예제 #1
0
 public static void Multiplication3x3Test()
 => TrafoTesting.GenericMatrixMultiplicationTest <Similarity3d, M33d, M34d>(
     rnd => TrafoTesting.GetRandomSimilarity(rnd, false),
     Similarity.TransformPos,
     Mat.Transform,
     Mat.TransformPos,
     (a, v) => (a * new V4d(v, 1)).XYZ,
     (m, v) => m * v,
     (m, v) => m * new V4d(v, 1));
예제 #2
0
        public static void FromM33dAndV3d()
        => TrafoTesting.GenericTest(rnd =>
        {
            var a   = TrafoTesting.GetRandomSimilarity(rnd);
            var tmp = (M34d)a;
            var m   = (M33d)tmp;
            var t   = tmp.C3;

            var restored = Similarity3d.FromM33dAndV3d(m, t);
            TrafoTesting.AreEqual(a, restored);
        });
예제 #3
0
        public static void InverseTest()
        => TrafoTesting.GenericTest(rnd =>
        {
            var s = TrafoTesting.GetRandomSimilarity(rnd);

            var p = rnd.UniformV3d() * rnd.UniformInt(1000);
            var q = s.TransformPos(p);

            // Inverse property
            var res = s.Inverse.TransformPos(q);

            // Invert method
            Similarity.Invert(ref s);
            var res2 = s.TransformPos(q);

            TrafoTesting.AreEqual(p, res);
            TrafoTesting.AreEqual(p, res2);
        });