Lines Matching defs:quaternion
62 // double quaternion[4];
63 // EXPECT_THAT(quaternion, IsNormalizedQuaternion());
66 *result_listener << "Null quaternion";
86 *result_listener << "Null quaternion";
197 // Transforms a zero axis/angle to a quaternion.
200 double quaternion[4];
202 AngleAxisToQuaternion(axis_angle, quaternion);
203 EXPECT_THAT(quaternion, IsNormalizedQuaternion());
204 EXPECT_THAT(quaternion, IsNearQuaternion(expected));
212 double quaternion[4];
214 AngleAxisToQuaternion(axis_angle, quaternion);
215 EXPECT_THAT(quaternion, IsNormalizedQuaternion());
216 EXPECT_THAT(quaternion, IsNearQuaternion(expected));
224 double quaternion[4];
226 AngleAxisToQuaternion(axis_angle, quaternion);
227 EXPECT_THAT(quaternion, IsNormalizedQuaternion());
228 EXPECT_THAT(quaternion, IsNearQuaternion(expected));
231 // Transforms a rotation by pi/2 around X to a quaternion.
234 double quaternion[4];
236 AngleAxisToQuaternion(axis_angle, quaternion);
237 EXPECT_THAT(quaternion, IsNormalizedQuaternion());
238 EXPECT_THAT(quaternion, IsNearQuaternion(expected));
241 // Transforms a unit quaternion to an axis angle.
243 double quaternion[4] = { 1, 0, 0, 0 };
246 QuaternionToAngleAxis(quaternion, axis_angle);
250 // Transforms a quaternion that rotates by pi about the Y axis to an axis angle.
252 double quaternion[4] = { 0, 0, 1, 0 };
255 QuaternionToAngleAxis(quaternion, axis_angle);
259 // Transforms a quaternion that rotates by pi/3 about the Z axis to an axis
262 double quaternion[4] = { sqrt(3) / 2, 0, 0, 0.5 };
265 QuaternionToAngleAxis(quaternion, axis_angle);
273 double quaternion[4] = { cos(theta/2), sin(theta/2.0), 0, 0 };
276 QuaternionToAngleAxis(quaternion, axis_angle);
284 double quaternion[4] = { cos(theta/2), sin(theta/2.0), 0, 0 };
287 QuaternionToAngleAxis(quaternion, axis_angle);
292 double quaternion[4];
297 quaternion[0] = cos(half_theta);
298 quaternion[1] = 1.0 * sin(half_theta);
299 quaternion[2] = 0.0;
300 quaternion[3] = 0.0;
301 QuaternionToAngleAxis(quaternion, angle_axis);
331 double quaternion[4];
336 AngleAxisToQuaternion(axis_angle, quaternion);
337 ASSERT_THAT(quaternion, IsNormalizedQuaternion());
338 QuaternionToAngleAxis(quaternion, round_trip);
348 double quaternion[4];
352 quaternion[i] = RandDouble() * 2 - 1;
353 norm += quaternion[i] * quaternion[i];
358 quaternion[i] = quaternion[i] / norm;
363 QuaternionToAngleAxis(quaternion, axis_angle);
366 ASSERT_THAT(round_trip, IsNearQuaternion(quaternion));
732 J3 quaternion[4];
739 AngleAxisToQuaternion(axis_angle, quaternion);
740 ExpectJetArraysClose<4, 3>(quaternion, expected);
752 J3 quaternion[4];
762 AngleAxisToQuaternion(axis_angle, quaternion);
763 ExpectJetArraysClose<4, 3>(quaternion, expected);
770 J3 quaternion[4];
777 AngleAxisToQuaternion(axis_angle, quaternion);
778 ExpectJetArraysClose<4, 3>(quaternion, expected);
789 J4 quaternion[4] = { J4(c, 0), J4(s, 1), J4(0, 2), J4(0, 3) };
796 QuaternionToAngleAxis(quaternion, axis_angle);
809 J4 quaternion[4] = { J4(c, 0), J4(s, 1), J4(0, 2), J4(0, 3) };
819 QuaternionToAngleAxis(quaternion, axis_angle);
826 J4 quaternion[4] = { J4(1, 0), J4(0, 1), J4(0, 2), J4(0, 3) };
833 QuaternionToAngleAxis(quaternion, axis_angle);
837 TEST(Quaternion, RotatePointGivesSameAnswerAsRotationByMatrixCanned) {
867 TEST(Quaternion, RotatePointGivesSameAnswerAsRotationByMatrix) {
868 // Rotation defined by a unit quaternion.
894 TEST(Quaternion, MultiplicationIsAssociative) {