Esempio n. 1
0
        public void NormalizeTest()
        {
            Quaternion target = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Normalize(
                                                            Utilities.ConvertToXna(target)));

            target.Normalize();
            Utilities.AreEqual(expected, target);
        }
Esempio n. 2
0
        public void RotationMatrixTest()
        {
            Matrix matrix = Utilities.GenerateMatrix();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.CreateFromRotationMatrix(
                                                            Utilities.ConvertToXna(matrix)));

            Quaternion actual;

            actual = Quaternion.RotationMatrix(matrix);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void NormalizeTest1()
        {
            Quaternion value = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Normalize(
                                                            Utilities.ConvertToXna(value)));

            Quaternion actual;

            actual = Quaternion.Normalize(value);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void op_UnaryNegationTest()
        {
            Quaternion value = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Negate(
                                                            Utilities.ConvertToXna(value)));

            Quaternion actual;

            actual = -(value);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 5
0
        public void RotationMatrixByRefTest()
        {
            Matrix     matrix         = Utilities.GenerateMatrix();
            Matrix     matrixExpected = matrix;
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.CreateFromRotationMatrix(
                                                                  Utilities.ConvertToXna(matrix)));

            Quaternion.RotationMatrix(ref matrix, out result);
            Utilities.AreEqual(matrixExpected, matrix);
            Utilities.AreEqual(resultExpected, result);
        }
Esempio n. 6
0
        public void NormalizeByRefTest()
        {
            Quaternion value         = Utilities.GenerateQuaternion();
            Quaternion valueExpected = value;
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Normalize(
                                                                  Utilities.ConvertToXna(value)));

            Quaternion.Normalize(ref value, out result);
            Utilities.AreEqual(valueExpected, value);
            Utilities.AreEqual(resultExpected, result);
        }
Esempio n. 7
0
        public void op_MultiplyTest()
        {
            float      scale = Utilities.GenerateFloat();
            Quaternion value = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Multiply(
                                                            Utilities.ConvertToXna(value),
                                                            scale));

            Quaternion actual;

            actual = (scale * value);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 8
0
        public void op_AdditionTest()
        {
            Quaternion left  = Utilities.GenerateQuaternion();
            Quaternion right = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Add(
                                                            Utilities.ConvertToXna(left),
                                                            Utilities.ConvertToXna(right)));

            Quaternion actual;

            actual = (left + right);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 9
0
        public void SubtractTest()
        {
            Quaternion left  = Utilities.GenerateQuaternion();
            Quaternion right = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Subtract(
                                                            Utilities.ConvertToXna(left),
                                                            Utilities.ConvertToXna(right)));

            Quaternion actual;

            actual = Quaternion.Subtract(left, right);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 10
0
        public void DotTest()
        {
            Quaternion left  = Utilities.GenerateQuaternion();
            Quaternion right = Utilities.GenerateQuaternion();

            float expected = Microsoft.Xna.Framework.Quaternion.Dot(
                Utilities.ConvertToXna(left),
                Utilities.ConvertToXna(right));

            float actual;

            actual = Quaternion.Dot(left, right);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 11
0
        public void MultiplyScaleByRefTest()
        {
            Quaternion value         = Utilities.GenerateQuaternion();
            Quaternion valueExpected = value;
            float      scale         = Utilities.GenerateFloat();
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Multiply(
                                                                  Utilities.ConvertToXna(value),
                                                                  scale));

            Quaternion.Multiply(ref value, scale, out result);
            Utilities.AreEqual(valueExpected, value);
            Utilities.AreEqual(resultExpected, result);
        }
Esempio n. 12
0
        public void SlerpTest()
        {
            Quaternion start  = Utilities.GenerateQuaternion();
            Quaternion end    = Utilities.GenerateQuaternion();
            float      amount = Utilities.GenerateFloat();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Slerp(
                                                            Utilities.ConvertToXna(start),
                                                            Utilities.ConvertToXna(end),
                                                            amount));

            Quaternion actual;

            actual = Quaternion.Slerp(start, end, amount);
            Utilities.AreEqual(expected, actual);
        }
Esempio n. 13
0
        public void SubtractByRefTest()
        {
            Quaternion left          = Utilities.GenerateQuaternion();
            Quaternion leftExpected  = left;
            Quaternion right         = Utilities.GenerateQuaternion();
            Quaternion rightExpected = right;
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Subtract(
                                                                  Utilities.ConvertToXna(left),
                                                                  Utilities.ConvertToXna(right)));

            Quaternion.Subtract(ref left, ref right, out result);
            Utilities.AreEqual(leftExpected, left);
            Utilities.AreEqual(rightExpected, right);
            Utilities.AreEqual(resultExpected, result);
        }
Esempio n. 14
0
        public void SlerpByRefTest()
        {
            Quaternion start         = Utilities.GenerateQuaternion();
            Quaternion startExpected = start;
            Quaternion end           = Utilities.GenerateQuaternion();
            Quaternion endExpected   = end;
            float      amount        = Utilities.GenerateFloat();
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Slerp(
                                                                  Utilities.ConvertToXna(start),
                                                                  Utilities.ConvertToXna(end),
                                                                  amount));

            Quaternion.Slerp(ref start, ref end, amount, out result);
            Utilities.AreEqual(startExpected, start);
            Utilities.AreEqual(endExpected, end);
            Utilities.AreEqual(resultExpected, result);
        }