Beispiel #1
0
        public static Matrix Convert(BEPUutilities.Matrix3x3 matrix)
        {
            Matrix toReturn;

            Convert(ref matrix, out toReturn);
            return(toReturn);
        }
Beispiel #2
0
            public TextureMissile(GameModel model, Vector3 target, GameTexture carriedTex, Player p, GameModel targetModel, bool followPlayer = true)
            {
                FollowPlayer     = followPlayer;
                player           = p;
                this.targetModel = targetModel;

                Model      = model;
                Target     = target;
                CarriedTex = carriedTex;

                Vector3 up      = Vector3.UnitZ;
                Vector3 forward = Target - MathConverter.Convert(model.Entity.Position);

                forward.Normalize();
                Vector3 left = Vector3.Cross(up, forward);

                BEPUutilities.Matrix3x3 m = new BEPUutilities.Matrix3x3();
                m.Left    = left;
                m.Forward = forward;
                m.Up      = up;
                Model.Entity.OrientationMatrix = m;

                linearMotor = new SingleEntityLinearMotor(model.Entity, model.Entity.Position);
                linearMotor.Settings.Mode       = BEPUphysics.Constraints.TwoEntity.Motors.MotorMode.Servomechanism;
                linearMotor.Settings.Servo.Goal = Target;
                linearMotor.IsActive            = true;
            }
Beispiel #3
0
        public static void Convert(ref Matrix matrix, out BEPUutilities.Matrix3x3 bepuMatrix)
        {
            bepuMatrix.M11 = matrix.M11;
            bepuMatrix.M12 = matrix.M12;
            bepuMatrix.M13 = matrix.M13;

            bepuMatrix.M21 = matrix.M21;
            bepuMatrix.M22 = matrix.M22;
            bepuMatrix.M23 = matrix.M23;

            bepuMatrix.M31 = matrix.M31;
            bepuMatrix.M32 = matrix.M32;
            bepuMatrix.M33 = matrix.M33;
        }
Beispiel #4
0
            private void update()
            {
                if (FollowPlayer)
                {
                    Target = linearMotor.Settings.Servo.Goal = player.character.CharacterController.Body.Position;
                }

                Vector3 up      = Vector3.UnitZ;
                Vector3 forward = Target - MathConverter.Convert(Model.Entity.Position);

                forward.Normalize();
                Vector3 left = Vector3.Cross(up, forward);

                BEPUutilities.Matrix3x3 m = new BEPUutilities.Matrix3x3();
                m.Left    = left;
                m.Forward = forward;
                m.Up      = up;
                Model.Entity.OrientationMatrix = m;
            }
Beispiel #5
0
        private void off()
        {
            if (joint != null && this.Locked)
            {
                BEPUphysics.Constraints.JointBasis2D basis = joint.Motor.Basis;
                basis.RotationMatrix = joint.Motor.ConnectionA.OrientationMatrix;

                Vector3 localTestAxis = joint.Motor.LocalTestAxis;
                Vector3 worldTestAxis;
                BEPUutilities.Matrix3x3 orientationMatrix = joint.Motor.ConnectionB.OrientationMatrix;
                BEPUutilities.Matrix3x3.Transform(ref localTestAxis, ref orientationMatrix, out worldTestAxis);

                float   y, x;
                Vector3 yAxis = Vector3.Cross(basis.PrimaryAxis, basis.XAxis);
                Vector3.Dot(ref worldTestAxis, ref yAxis, out y);
                x = Vector3.Dot(worldTestAxis, basis.XAxis);
                this.Goal.Value  = (float)Math.Atan2(y, x);
                this.Servo.Value = true;
            }
        }
Beispiel #6
0
        public static void Convert(ref BEPUutilities.Matrix3x3 matrix, out Matrix xnaMatrix)
        {
            xnaMatrix.M11 = matrix.M11;
            xnaMatrix.M12 = matrix.M12;
            xnaMatrix.M13 = matrix.M13;
            xnaMatrix.M14 = 0;

            xnaMatrix.M21 = matrix.M21;
            xnaMatrix.M22 = matrix.M22;
            xnaMatrix.M23 = matrix.M23;
            xnaMatrix.M24 = 0;

            xnaMatrix.M31 = matrix.M31;
            xnaMatrix.M32 = matrix.M32;
            xnaMatrix.M33 = matrix.M33;
            xnaMatrix.M34 = 0;

            xnaMatrix.M41 = 0;
            xnaMatrix.M42 = 0;
            xnaMatrix.M43 = 0;
            xnaMatrix.M44 = 1;
        }
Beispiel #7
0
        public static float TestScalarInvert(int iterationCount)
        {
            bMatrix3x3 m           = bMatrix3x3.Identity;
            float      accumulator = 0;

            for (int i = 0; i < iterationCount; ++i)
            {
                bMatrix3x3 r0, r1;
                bMatrix3x3.Invert(ref m, out r0);
                bMatrix3x3.Invert(ref r0, out r1);
                bMatrix3x3.Invert(ref r1, out r0);
                bMatrix3x3.Invert(ref r0, out r1);
                bMatrix3x3.Invert(ref r1, out r0);
                bMatrix3x3.Invert(ref r0, out r1);
                bMatrix3x3.Invert(ref r1, out r0);
                bMatrix3x3.Invert(ref r0, out r1);
                bMatrix3x3.Invert(ref r1, out r0);
                bMatrix3x3.Invert(ref r0, out r1);
                accumulator += r1.M11;
            }
            return(accumulator);
        }
Beispiel #8
0
        public static float TestScalarMultiply(int iterationCount)
        {
            bMatrix3x3 m1          = bMatrix3x3.Identity;
            bMatrix3x3 m2          = bMatrix3x3.Identity;
            float      accumulator = 0;

            for (int i = 0; i < iterationCount; ++i)
            {
                bMatrix3x3 r0, r1;
                bMatrix3x3.Multiply(ref m1, ref m2, out r0);
                bMatrix3x3.Multiply(ref r0, ref m2, out r1);
                bMatrix3x3.Multiply(ref r1, ref m2, out r0);
                bMatrix3x3.Multiply(ref r0, ref m2, out r1);
                bMatrix3x3.Multiply(ref r1, ref m2, out r0);
                bMatrix3x3.Multiply(ref r0, ref m2, out r1);
                bMatrix3x3.Multiply(ref r1, ref m2, out r0);
                bMatrix3x3.Multiply(ref r0, ref m2, out r1);
                bMatrix3x3.Multiply(ref r1, ref m2, out r0);
                bMatrix3x3.Multiply(ref r0, ref m2, out r1);
                accumulator += 0.000001f * r1.M11;
            }
            return(accumulator);
        }
Beispiel #9
0
        public static float TestTransformScalar(int iterationCount)
        {
            bVector3   v           = new bVector3(1, 2, 3);
            bMatrix3x3 m           = bMatrix3x3.Identity;
            float      accumulator = 0;

            for (int i = 0; i < iterationCount; ++i)
            {
                bVector3 r0, r1;
                bMatrix3x3.Transform(ref v, ref m, out r0);
                bMatrix3x3.Transform(ref r0, ref m, out r1);
                bMatrix3x3.Transform(ref r1, ref m, out r0);
                bMatrix3x3.Transform(ref r0, ref m, out r1);
                bMatrix3x3.Transform(ref r1, ref m, out r0);
                bMatrix3x3.Transform(ref r0, ref m, out r1);
                bMatrix3x3.Transform(ref r1, ref m, out r0);
                bMatrix3x3.Transform(ref r0, ref m, out r1);
                bMatrix3x3.Transform(ref r1, ref m, out r0);
                bMatrix3x3.Transform(ref r0, ref m, out r1);
                accumulator += 0.000001f * r1.X;
            }
            return(accumulator);
        }
Beispiel #10
0
        public static void Test()
        {
            Vector3 v1 = new Vector3(0, 0, 1);
            Vector3 v2 = new Vector3(0, 0, 2);
            Vector3 v3 = new Vector3(0, 0, 3);
            Vector3 v4 = new Vector3(0, 0, 4);
            Vector3 v5 = new Vector3(0, 0, 5);
            Vector3 v6 = new Vector3(0, 0, 6);
            Vector3 v7 = new Vector3(0, 0, 7);
            Vector3 v8 = new Vector3(0, 0, 8);
            Matrix3x3 m = new Matrix3x3 { X = new Vector3(1, 0, 0), Y = new Vector3(0, 1, 0), Z = new Vector3(0, 0, 1) };
            Matrix4x4 m4 = new Matrix4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
            Vector3 t = Matrix3x3.Transform(v1, m);
            Matrix3x3.Transform(ref t, ref m, out t);
            Console.WriteLine($"t to preload: {t}");
            double time, endTime;

            const int testIterations = 10000000;

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 refAccumulator = new Vector3();
            for (int i = 0; i < testIterations; ++i)
            {
                Vector3 t1, t2, t3, t4, t5, t6, t7, t8;
                Matrix3x3.Transform(ref v1, ref m, out t1);
                Matrix3x3.Transform(ref v2, ref m, out t2);
                Matrix3x3.Transform(ref v3, ref m, out t3);
                Matrix3x3.Transform(ref v4, ref m, out t4);
                Matrix3x3.Transform(ref v5, ref m, out t5);
                Matrix3x3.Transform(ref v6, ref m, out t6);
                Matrix3x3.Transform(ref v7, ref m, out t7);
                Matrix3x3.Transform(ref v8, ref m, out t8);
                refAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"ref time: {endTime - time}, acc: {refAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 nonrefAccumulator = new Vector3();
            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Matrix3x3.Transform(v1, m);
                var t2 = Matrix3x3.Transform(v2, m);
                var t3 = Matrix3x3.Transform(v3, m);
                var t4 = Matrix3x3.Transform(v4, m);
                var t5 = Matrix3x3.Transform(v5, m);
                var t6 = Matrix3x3.Transform(v6, m);
                var t7 = Matrix3x3.Transform(v7, m);
                var t8 = Matrix3x3.Transform(v8, m);
                nonrefAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"nonref time: {endTime - time}, acc: {nonrefAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 ref2Accumulator = new Vector3();
            for (int i = 0; i < testIterations; ++i)
            {
                Vector3 t1, t2, t3, t4, t5, t6, t7, t8;
                Matrix3x3.Transform2(ref v1, ref m, out t1);
                Matrix3x3.Transform2(ref v2, ref m, out t2);
                Matrix3x3.Transform2(ref v3, ref m, out t3);
                Matrix3x3.Transform2(ref v4, ref m, out t4);
                Matrix3x3.Transform2(ref v5, ref m, out t5);
                Matrix3x3.Transform2(ref v6, ref m, out t6);
                Matrix3x3.Transform2(ref v7, ref m, out t7);
                Matrix3x3.Transform2(ref v8, ref m, out t8);
                ref2Accumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"ref2 time: {endTime - time}, acc: {ref2Accumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 nonref2Accumulator = new Vector3();
            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Matrix3x3.Transform2(v1, m);
                var t2 = Matrix3x3.Transform2(v2, m);
                var t3 = Matrix3x3.Transform2(v3, m);
                var t4 = Matrix3x3.Transform2(v4, m);
                var t5 = Matrix3x3.Transform2(v5, m);
                var t6 = Matrix3x3.Transform2(v6, m);
                var t7 = Matrix3x3.Transform2(v7, m);
                var t8 = Matrix3x3.Transform2(v8, m);
                nonref2Accumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"nonref2 time: {endTime - time}, acc: {nonref2Accumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 refTransposeAccumulator = new Vector3();
            for (int i = 0; i < testIterations; ++i)
            {
                Vector3 t1, t2, t3, t4, t5, t6, t7, t8;
                Matrix3x3.TransformTranspose(ref v1, ref m, out t1);
                Matrix3x3.TransformTranspose(ref v2, ref m, out t2);
                Matrix3x3.TransformTranspose(ref v3, ref m, out t3);
                Matrix3x3.TransformTranspose(ref v4, ref m, out t4);
                Matrix3x3.TransformTranspose(ref v5, ref m, out t5);
                Matrix3x3.TransformTranspose(ref v6, ref m, out t6);
                Matrix3x3.TransformTranspose(ref v7, ref m, out t7);
                Matrix3x3.TransformTranspose(ref v8, ref m, out t8);
                refTransposeAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"refTranspose time: {endTime - time}, acc: {refTransposeAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 nonrefTransposeAccumulator = new Vector3();
            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Matrix3x3.TransformTranspose(v1, m);
                var t2 = Matrix3x3.TransformTranspose(v2, m);
                var t3 = Matrix3x3.TransformTranspose(v3, m);
                var t4 = Matrix3x3.TransformTranspose(v4, m);
                var t5 = Matrix3x3.TransformTranspose(v5, m);
                var t6 = Matrix3x3.TransformTranspose(v6, m);
                var t7 = Matrix3x3.TransformTranspose(v7, m);
                var t8 = Matrix3x3.TransformTranspose(v8, m);
                nonrefTransposeAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"nonrefTranspose time: {endTime - time}, acc: {nonrefTransposeAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 netAccumulator = new Vector3();
            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Vector3.TransformNormal(v1, m4);
                var t2 = Vector3.TransformNormal(v2, m4);
                var t3 = Vector3.TransformNormal(v3, m4);
                var t4 = Vector3.TransformNormal(v4, m4);
                var t5 = Vector3.TransformNormal(v5, m4);
                var t6 = Vector3.TransformNormal(v6, m4);
                var t7 = Vector3.TransformNormal(v7, m4);
                var t8 = Vector3.TransformNormal(v8, m4);
                netAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"net time: {endTime - time}, acc: {netAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            var v1b = new BEPUVector3(0, 0, 1);
            var v2b = new BEPUVector3(0, 0, 2);
            var v3b = new BEPUVector3(0, 0, 3);
            var v4b = new BEPUVector3(0, 0, 4);
            var v5b = new BEPUVector3(0, 0, 5);
            var v6b = new BEPUVector3(0, 0, 6);
            var v7b = new BEPUVector3(0, 0, 7);
            var v8b = new BEPUVector3(0, 0, 8);
            BEPUMatrix3x3 mb = new BEPUMatrix3x3(1, 0, 0, 0, 1, 0, 0, 0, 1);
            BEPUVector3 bepuAccumulator = new BEPUVector3();
            for (int i = 0; i < testIterations; ++i)
            {
                BEPUVector3 t1, t2, t3, t4, t5, t6, t7, t8;
                BEPUMatrix3x3.Transform(ref v1b, ref mb, out t1);
                BEPUMatrix3x3.Transform(ref v2b, ref mb, out t2);
                BEPUMatrix3x3.Transform(ref v3b, ref mb, out t3);
                BEPUMatrix3x3.Transform(ref v4b, ref mb, out t4);
                BEPUMatrix3x3.Transform(ref v5b, ref mb, out t5);
                BEPUMatrix3x3.Transform(ref v6b, ref mb, out t6);
                BEPUMatrix3x3.Transform(ref v7b, ref mb, out t7);
                BEPUMatrix3x3.Transform(ref v8b, ref mb, out t8);
                BEPUVector3.Add(ref bepuAccumulator, ref t1, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t2, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t3, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t4, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t5, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t6, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t7, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t8, out bepuAccumulator);
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"bepu time: {endTime - time}, acc: {bepuAccumulator}");
        }
Beispiel #11
0
        public static void Test()
        {
            Vector3   v1 = new Vector3(0, 0, 1);
            Vector3   v2 = new Vector3(0, 0, 2);
            Vector3   v3 = new Vector3(0, 0, 3);
            Vector3   v4 = new Vector3(0, 0, 4);
            Vector3   v5 = new Vector3(0, 0, 5);
            Vector3   v6 = new Vector3(0, 0, 6);
            Vector3   v7 = new Vector3(0, 0, 7);
            Vector3   v8 = new Vector3(0, 0, 8);
            Matrix3x3 m  = new Matrix3x3 {
                X = new Vector3(1, 0, 0), Y = new Vector3(0, 1, 0), Z = new Vector3(0, 0, 1)
            };
            Matrix4x4 m4 = new Matrix4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
            Vector3   t  = Matrix3x3.Transform(v1, m);

            Matrix3x3.Transform(ref t, ref m, out t);
            Console.WriteLine($"t to preload: {t}");
            double time, endTime;

            const int testIterations = 10000000;

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 refAccumulator = new Vector3();

            for (int i = 0; i < testIterations; ++i)
            {
                Vector3 t1, t2, t3, t4, t5, t6, t7, t8;
                Matrix3x3.Transform(ref v1, ref m, out t1);
                Matrix3x3.Transform(ref v2, ref m, out t2);
                Matrix3x3.Transform(ref v3, ref m, out t3);
                Matrix3x3.Transform(ref v4, ref m, out t4);
                Matrix3x3.Transform(ref v5, ref m, out t5);
                Matrix3x3.Transform(ref v6, ref m, out t6);
                Matrix3x3.Transform(ref v7, ref m, out t7);
                Matrix3x3.Transform(ref v8, ref m, out t8);
                refAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;


            Console.WriteLine($"ref time: {endTime - time}, acc: {refAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 nonrefAccumulator = new Vector3();

            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Matrix3x3.Transform(v1, m);
                var t2 = Matrix3x3.Transform(v2, m);
                var t3 = Matrix3x3.Transform(v3, m);
                var t4 = Matrix3x3.Transform(v4, m);
                var t5 = Matrix3x3.Transform(v5, m);
                var t6 = Matrix3x3.Transform(v6, m);
                var t7 = Matrix3x3.Transform(v7, m);
                var t8 = Matrix3x3.Transform(v8, m);
                nonrefAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"nonref time: {endTime - time}, acc: {nonrefAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 ref2Accumulator = new Vector3();

            for (int i = 0; i < testIterations; ++i)
            {
                Vector3 t1, t2, t3, t4, t5, t6, t7, t8;
                Matrix3x3.Transform2(ref v1, ref m, out t1);
                Matrix3x3.Transform2(ref v2, ref m, out t2);
                Matrix3x3.Transform2(ref v3, ref m, out t3);
                Matrix3x3.Transform2(ref v4, ref m, out t4);
                Matrix3x3.Transform2(ref v5, ref m, out t5);
                Matrix3x3.Transform2(ref v6, ref m, out t6);
                Matrix3x3.Transform2(ref v7, ref m, out t7);
                Matrix3x3.Transform2(ref v8, ref m, out t8);
                ref2Accumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;


            Console.WriteLine($"ref2 time: {endTime - time}, acc: {ref2Accumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 nonref2Accumulator = new Vector3();

            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Matrix3x3.Transform2(v1, m);
                var t2 = Matrix3x3.Transform2(v2, m);
                var t3 = Matrix3x3.Transform2(v3, m);
                var t4 = Matrix3x3.Transform2(v4, m);
                var t5 = Matrix3x3.Transform2(v5, m);
                var t6 = Matrix3x3.Transform2(v6, m);
                var t7 = Matrix3x3.Transform2(v7, m);
                var t8 = Matrix3x3.Transform2(v8, m);
                nonref2Accumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"nonref2 time: {endTime - time}, acc: {nonref2Accumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 refTransposeAccumulator = new Vector3();

            for (int i = 0; i < testIterations; ++i)
            {
                Vector3 t1, t2, t3, t4, t5, t6, t7, t8;
                Matrix3x3.TransformTranspose(ref v1, ref m, out t1);
                Matrix3x3.TransformTranspose(ref v2, ref m, out t2);
                Matrix3x3.TransformTranspose(ref v3, ref m, out t3);
                Matrix3x3.TransformTranspose(ref v4, ref m, out t4);
                Matrix3x3.TransformTranspose(ref v5, ref m, out t5);
                Matrix3x3.TransformTranspose(ref v6, ref m, out t6);
                Matrix3x3.TransformTranspose(ref v7, ref m, out t7);
                Matrix3x3.TransformTranspose(ref v8, ref m, out t8);
                refTransposeAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;


            Console.WriteLine($"refTranspose time: {endTime - time}, acc: {refTransposeAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 nonrefTransposeAccumulator = new Vector3();

            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Matrix3x3.TransformTranspose(v1, m);
                var t2 = Matrix3x3.TransformTranspose(v2, m);
                var t3 = Matrix3x3.TransformTranspose(v3, m);
                var t4 = Matrix3x3.TransformTranspose(v4, m);
                var t5 = Matrix3x3.TransformTranspose(v5, m);
                var t6 = Matrix3x3.TransformTranspose(v6, m);
                var t7 = Matrix3x3.TransformTranspose(v7, m);
                var t8 = Matrix3x3.TransformTranspose(v8, m);
                nonrefTransposeAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"nonrefTranspose time: {endTime - time}, acc: {nonrefTransposeAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;
            Vector3 netAccumulator = new Vector3();

            for (int i = 0; i < testIterations; ++i)
            {
                var t1 = Vector3.TransformNormal(v1, m4);
                var t2 = Vector3.TransformNormal(v2, m4);
                var t3 = Vector3.TransformNormal(v3, m4);
                var t4 = Vector3.TransformNormal(v4, m4);
                var t5 = Vector3.TransformNormal(v5, m4);
                var t6 = Vector3.TransformNormal(v6, m4);
                var t7 = Vector3.TransformNormal(v7, m4);
                var t8 = Vector3.TransformNormal(v8, m4);
                netAccumulator += t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8;
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"net time: {endTime - time}, acc: {netAccumulator}");

            time = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            var           v1b             = new BEPUVector3(0, 0, 1);
            var           v2b             = new BEPUVector3(0, 0, 2);
            var           v3b             = new BEPUVector3(0, 0, 3);
            var           v4b             = new BEPUVector3(0, 0, 4);
            var           v5b             = new BEPUVector3(0, 0, 5);
            var           v6b             = new BEPUVector3(0, 0, 6);
            var           v7b             = new BEPUVector3(0, 0, 7);
            var           v8b             = new BEPUVector3(0, 0, 8);
            BEPUMatrix3x3 mb              = new BEPUMatrix3x3(1, 0, 0, 0, 1, 0, 0, 0, 1);
            BEPUVector3   bepuAccumulator = new BEPUVector3();

            for (int i = 0; i < testIterations; ++i)
            {
                BEPUVector3 t1, t2, t3, t4, t5, t6, t7, t8;
                BEPUMatrix3x3.Transform(ref v1b, ref mb, out t1);
                BEPUMatrix3x3.Transform(ref v2b, ref mb, out t2);
                BEPUMatrix3x3.Transform(ref v3b, ref mb, out t3);
                BEPUMatrix3x3.Transform(ref v4b, ref mb, out t4);
                BEPUMatrix3x3.Transform(ref v5b, ref mb, out t5);
                BEPUMatrix3x3.Transform(ref v6b, ref mb, out t6);
                BEPUMatrix3x3.Transform(ref v7b, ref mb, out t7);
                BEPUMatrix3x3.Transform(ref v8b, ref mb, out t8);
                BEPUVector3.Add(ref bepuAccumulator, ref t1, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t2, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t3, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t4, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t5, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t6, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t7, out bepuAccumulator);
                BEPUVector3.Add(ref bepuAccumulator, ref t8, out bepuAccumulator);
            }
            endTime = (double)Stopwatch.GetTimestamp() / Stopwatch.Frequency;

            Console.WriteLine($"bepu time: {endTime - time}, acc: {bepuAccumulator}");
        }