public static void Rot3dTransformTest() { var rnd = new RandomSystem(1); for (int i = 0; i < 10000; i++) { var v = rnd.UniformV3d(); var axis = rnd.UniformV3dDirection(); var ang = rnd.UniformDouble(); var rot = Rot3d.Rotation(axis, ang); var test1 = TransformUsingM33d(rot, v); var test2 = rot.Transform(v); var test3 = TransformUsingQuaternion(rot, v); var test4 = TransformUsingQuaternionOpt1(rot, v); Assert.IsTrue(test1.ApproximateEquals(test2, 1e-5)); Assert.IsTrue(test1.ApproximateEquals(test3, 1e-5)); Assert.IsTrue(test1.ApproximateEquals(test4, 1e-5)); } }
public static Shift3d GetRandomShift3(RandomSystem rnd) => new Shift3d(rnd.UniformV3d() * 10);
public static Scale3d GetRandomScale3(RandomSystem rnd) => new Scale3d(rnd.UniformV3d() * 5);