98 TEST(turbotrig_test, atan_test)
100 for (
float i = -200.0;
i <= 200.0;
i += 0.001)
106 TEST(turbotrig_test, sin_cos_test)
108 for (
float i = -200.0;
i <= 200.0;
i += 0.001)
116 TEST(turbotrig_test, atan2_test)
118 for (
float i = -100.0;
i <= 100.0;
i += 0.1)
120 for (
float j = -1.0; j <= 1.0; j += 0.001)
122 if (
fabs(j) > 0.0001)
130 TEST(turbotrig_test, asin_test)
132 for (
float i = -1.0;
i <= 1.0;
i += 0.001)
141 TEST(turbotrig_test, fast_alt_test)
149 float trueResult = 0.0;
150 for (
int i = 69682;
i < 106597;
i++)
152 trueResult =
static_cast<float>((1.0 - pow(static_cast<float>(
i)/101325,
153 0.190284)) * 145366.45) *
static_cast<float>(0.3048);
161 TEST(turbovec_test, vector_test)
163 for (
int i = 0;
i < 24;
i++)
167 Eigen::Vector3f eig2, eig1;
168 eig1 << vec1.
x, vec1.
y, vec1.
z;
169 eig2 << vec2.
x, vec2.
y, vec2.
z;
180 Eigen::Vector3f eig3 = eig1;
213 TEST(turbovec_test, quaternion_test)
216 for (
int i = 0;
i < 24;
i++)
221 Eigen::Quaternionf eig1(quat1.
w, quat1.
x, quat1.
y, quat1.
z);
222 Eigen::Quaternionf eig2(quat2.
w, quat2.
x, quat2.
y, quat2.
z);
238 Eigen::Vector3f veig1;
239 veig1 << vec1.
x, vec1.y, vec1.z;
244 Eigen::Vector3f veig2 = veig1.transpose()*eig1.toRotationMatrix();
256 Eigen::Vector3f ihat(1, 0, 0);
257 Eigen::Vector3f jhat(0, 1, 0);
258 Eigen::Vector3f khat(0, 0, 1);
260 Eigen::Quaternionf eig3 = Eigen::AngleAxisf(s, khat) * Eigen::AngleAxisf(t, jhat) * Eigen::AngleAxisf(p, ihat);
270 TEST(turbovec_test, quat_from_two_vectors_test)
283 for (
int i = 0;
i < 25;
i++)
float dot(const Vector &v) const
#define ASSERT_SUPERCLOSE(x, y)
Vector cross(const Vector &v) const
float atan2(float y, float x)
TEST(turbotrig_test, atan_test)
#define EXPECT_SUPERCLOSE(x, y)
void get_RPY(float *roll, float *pitch, float *yaw) const
#define ASSERT_TURBOQUAT_SUPERCLOSE(q, q2)
#define ASSERT_QUAT_SUPERCLOSE(q, q_eig)
Vector normalized() const
Quaternion & from_two_unit_vectors(const Vector &u, const Vector &v)
turbomath::Quaternion random_quaternions[25]
#define EXPECT_VEC3_SUPERCLOSE(vec, eig)
turbomath::Vector random_vectors[25]
Quaternion inverse() const
#define EXPECT_QUAT_SUPERCLOSE(q, q_eig)
Vector rotate(const Vector &v) const