예제 #1
0
        public void TrafoDecomposeTest()
        {
            var rnd = new RandomSystem();

            for (int i = 0; i < 100000; i++)
            {
                var rot   = rnd.UniformV3dFull() * Constant.PiTimesFour - Constant.PiTimesTwo;
                var trans = rnd.UniformV3dFull() * 10 - 5;
                var scale = rnd.UniformV3dFull() * 4 - 2;

                TestDecompose(scale, rot, trans);
            }
        }
예제 #2
0
        public static Trafo3d GetRandomTrafo(RandomSystem rnd, bool withPerspective)
        {
            var rot   = rnd.UniformV3dFull() * Constant.PiTimesFour - Constant.PiTimesTwo;
            var trans = rnd.UniformV3dFull() * 10 - 5;
            var scale = rnd.UniformV3dFull() * 4 - 2;

            var trafo = Trafo3d.FromComponents(scale, rot, trans);

            if (withPerspective)
            {
                trafo *= Trafo3d.PerspectiveProjectionRH(-1, 1, -1, 1, rnd.UniformDouble(), rnd.UniformDouble() * 100);
            }

            return(trafo);
        }