public static void FromM33d() { TrafoTesting.GenericTest(rnd => { var rot = rnd.UniformV3dFull() * Constant.PiTimesFour - Constant.PiTimesTwo; var mat = M44d.RotationEuler(rot); var mat2 = (M44d)Rot3d.FromM33d((M33d)mat); Assert.IsFalse(mat.Elements.Any(x => x.IsNaN()), "NaN"); if (!Fun.ApproximateEquals(mat, mat2, 1e-9)) { Assert.Fail("FAIL"); } }); }
public static void YawPitchRoll() { TrafoTesting.GenericTest(rnd => { var yaw = rnd.UniformDouble() * Constant.PiTimesFour - Constant.PiTimesTwo; var pitch = rnd.UniformDouble() * Constant.PiTimesFour - Constant.PiTimesTwo; var roll = rnd.UniformDouble() * Constant.PiTimesFour - Constant.PiTimesTwo; // Aardvark euler angles: roll (X), pitch (Y), yaw (Z). Ther are applied in reversed order. var mat = (M33d)(M44d.RotationZ(yaw) * M44d.RotationY(pitch) * M44d.RotationX(roll)); var mat2 = (M33d)M44d.RotationEuler(roll, pitch, yaw); var mat3 = (M33d)(Rot3d.RotationZ(yaw) * Rot3d.RotationY(pitch) * Rot3d.RotationX(roll)); var mat4 = (M33d)Rot3d.RotationEuler(roll, pitch, yaw); Assert.IsTrue(Fun.ApproximateEquals(mat, mat2, 1e-7)); Assert.IsTrue(Fun.ApproximateEquals(mat, mat3, 1e-7)); Assert.IsTrue(Fun.ApproximateEquals(mat, mat4, 1e-7)); }); }