Beispiel #1
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);
        });
Beispiel #2
0
        public static void ConsistentWithMatrixRotationShiftAndScaleTest()
        => TrafoTesting.GenericTest(rnd =>
        {
            var trans = rnd.UniformV3d() * 10;

            var axis  = rnd.UniformV3dDirection();
            var angle = rnd.UniformDouble() * Constant.PiTimesTwo;

            var scale = rnd.UniformDouble() * 5;

            var m = M44d.Translation(trans) * M44d.Rotation(axis, angle) * M44d.Scale(scale, scale, scale);
            var e = new Similarity3d(scale, Rot3d.Rotation(axis, angle), trans);

            var p    = rnd.UniformV3d() * rnd.UniformInt(1000);
            var res  = m.TransformPos(p);
            var res2 = e.TransformPos(p);

            TrafoTesting.AreEqual(res, res2);
        });
Beispiel #3
0
 public void Write(Similarity3d t)
 {
     Write(t.Scale); Write(t.Euclidean);
 }
 public void Write(Similarity3d t)
 {
     Write(t.Scale); Write(t.EuclideanTransformation);
 }
Beispiel #5
0
 public static void FromTrafo3d()
 => TrafoTesting.GenericConversionTest(TrafoTesting.GetRandomSimilarity, a => (Trafo3d)a, b => Similarity3d.FromTrafo3d(b));
 public static void FromSimilarity3d()
 => TrafoTesting.GenericConversionTest(rnd => new Scale3d(rnd.UniformDouble() * 10), a => Similarity3d.FromScale3d(a), b => Scale3d.FromSimilarity3d(b));