コード例 #1
0
        public void SquadByRefTest()
        {
            Quaternion value1         = Utilities.GenerateQuaternion();
            Quaternion value1Expected = value1;
            Quaternion value2         = Utilities.GenerateQuaternion();
            Quaternion value2Expected = value2;
            Quaternion value3         = Utilities.GenerateQuaternion();
            Quaternion value3Expected = value3;
            Quaternion value4         = Utilities.GenerateQuaternion();
            Quaternion value4Expected = value4;
            float      amount         = Utilities.GenerateFloat();
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.Squad(
                                                                  Utilities.ConvertToMdx(value1),
                                                                  Utilities.ConvertToMdx(value2),
                                                                  Utilities.ConvertToMdx(value3),
                                                                  Utilities.ConvertToMdx(value4),
                                                                  amount));

            Quaternion.Squad(ref value1, ref value2, ref value3, ref value4, amount, out result);
            Utilities.AreEqual(value1Expected, value1);
            Utilities.AreEqual(value2Expected, value2);
            Utilities.AreEqual(value3Expected, value3);
            Utilities.AreEqual(value4Expected, value4);
            Utilities.AreEqual(resultExpected, result);
        }
コード例 #2
0
        public void SquadSetupTest()
        {
            Quaternion value1 = Utilities.GenerateQuaternion();
            Quaternion value2 = Utilities.GenerateQuaternion();
            Quaternion value3 = Utilities.GenerateQuaternion();
            Quaternion value4 = Utilities.GenerateQuaternion();

            Quaternion[] expected             = new Quaternion[3];
            Microsoft.DirectX.Quaternion outa = new Microsoft.DirectX.Quaternion();
            Microsoft.DirectX.Quaternion outb = new Microsoft.DirectX.Quaternion();
            Microsoft.DirectX.Quaternion outc = new Microsoft.DirectX.Quaternion();
            Microsoft.DirectX.Quaternion.SquadSetup(
                ref outa,
                ref outb,
                ref outc,
                Utilities.ConvertToMdx(value1),
                Utilities.ConvertToMdx(value2),
                Utilities.ConvertToMdx(value3),
                Utilities.ConvertToMdx(value4));
            expected[0] = Utilities.ConvertFrom(outa);
            expected[1] = Utilities.ConvertFrom(outb);
            expected[2] = Utilities.ConvertFrom(outc);

            Quaternion[] actual;
            actual = Quaternion.SquadSetup(value1, value2, value3, value4);

            Assert.IsNotNull(actual);
            Assert.IsTrue(expected.Length == actual.Length);

            for (int i = 0; i < expected.Length; ++i)
            {
                Utilities.AreEqual(expected[i], actual[i]);
            }
        }
コード例 #3
0
        public void BarycentricByRefTest()
        {
            Quaternion value1         = Utilities.GenerateQuaternion();
            Quaternion value1Expected = value1;
            Quaternion value2         = Utilities.GenerateQuaternion();
            Quaternion value2Expected = value2;
            Quaternion value3         = Utilities.GenerateQuaternion();
            Quaternion value3Expected = value3;
            float      amount1        = Utilities.GenerateFloat();
            float      amount2        = Utilities.GenerateFloat();
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.BaryCentric(
                                                                  Utilities.ConvertToMdx(value1),
                                                                  Utilities.ConvertToMdx(value2),
                                                                  Utilities.ConvertToMdx(value3),
                                                                  amount1,
                                                                  amount2));

            Quaternion.Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
            Utilities.AreEqual(value1Expected, value1);
            Utilities.AreEqual(value2Expected, value2);
            Utilities.AreEqual(value3Expected, value3);
            Utilities.AreEqual(resultExpected, result);
        }
コード例 #4
0
        public void LogarithmTest()
        {
            Quaternion value = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.Ln(
                                                            Utilities.ConvertToMdx(value)));

            Quaternion actual;

            actual = Quaternion.Logarithm(value);
            Utilities.AreEqual(expected, actual);
        }
コード例 #5
0
        public void LengthSquaredTest()
        {
            Quaternion target = Utilities.GenerateQuaternion();

            float expected = Microsoft.DirectX.Quaternion.LengthSq(
                Utilities.ConvertToMdx(target));

            float actual;

            actual = target.LengthSquared;
            Utilities.AreEqual(expected, actual);
        }
コード例 #6
0
        public void ExponentialTest()
        {
            Quaternion value = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.Exp(
                                                            Utilities.ConvertToMdx(value)));

            Quaternion actual;

            actual = Quaternion.Exponential(value);
            Utilities.AreEqual(expected, actual);
        }
コード例 #7
0
        public void LogarithmByRefTest()
        {
            Quaternion value         = Utilities.GenerateQuaternion();
            Quaternion valueExpected = value;
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.Ln(
                                                                  Utilities.ConvertToMdx(value)));

            Quaternion.Logarithm(ref value, out result);
            Utilities.AreEqual(valueExpected, value);
            Utilities.AreEqual(resultExpected, result);
        }
コード例 #8
0
        public void RotationAxisTest()
        {
            Vector3 axis  = Utilities.GenerateVector3();
            float   angle = Utilities.GenerateFloat();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.RotationAxis(
                                                            Utilities.ConvertToMdx(axis),
                                                            angle));

            Quaternion actual;

            actual = Quaternion.RotationAxis(axis, angle);
            Utilities.AreEqual(expected, actual);
        }
コード例 #9
0
        public void MultiplyTest()
        {
            Quaternion left  = Utilities.GenerateQuaternion();
            Quaternion right = Utilities.GenerateQuaternion();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.Multiply(
                                                            Utilities.ConvertToMdx(left),
                                                            Utilities.ConvertToMdx(right)));

            Quaternion actual;

            actual = Quaternion.Multiply(left, right);
            Utilities.AreEqual(expected, actual);
        }
コード例 #10
0
        public void RotationAxisByRefTest()
        {
            Vector3    axis         = Utilities.GenerateVector3();
            Vector3    axisExpected = axis;
            float      angle        = Utilities.GenerateFloat();
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.RotationAxis(
                                                                  Utilities.ConvertToMdx(axis),
                                                                  angle));

            Quaternion.RotationAxis(ref axis, angle, out result);
            Utilities.AreEqual(axisExpected, axis);
            Utilities.AreEqual(resultExpected, result);
        }
コード例 #11
0
        public void MultiplyByRefTest()
        {
            Quaternion left          = Utilities.GenerateQuaternion();
            Quaternion leftExpected  = left;
            Quaternion right         = Utilities.GenerateQuaternion();
            Quaternion rightExpected = right;
            Quaternion result;

            Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.Multiply(
                                                                  Utilities.ConvertToMdx(left),
                                                                  Utilities.ConvertToMdx(right)));

            Quaternion.Multiply(ref left, ref right, out result);
            Utilities.AreEqual(leftExpected, left);
            Utilities.AreEqual(rightExpected, right);
            Utilities.AreEqual(resultExpected, result);
        }
コード例 #12
0
        public void SquadTest()
        {
            Quaternion value1 = Utilities.GenerateQuaternion();
            Quaternion value2 = Utilities.GenerateQuaternion();
            Quaternion value3 = Utilities.GenerateQuaternion();
            Quaternion value4 = Utilities.GenerateQuaternion();
            float      amount = Utilities.GenerateFloat();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.Squad(
                                                            Utilities.ConvertToMdx(value1),
                                                            Utilities.ConvertToMdx(value2),
                                                            Utilities.ConvertToMdx(value3),
                                                            Utilities.ConvertToMdx(value4),
                                                            amount));

            Quaternion actual;

            actual = Quaternion.Squad(value1, value2, value3, value4, amount);
            Utilities.AreEqual(expected, actual);
        }
コード例 #13
0
        public void BarycentricTest()
        {
            Quaternion value1  = Utilities.GenerateQuaternion();
            Quaternion value2  = Utilities.GenerateQuaternion();
            Quaternion value3  = Utilities.GenerateQuaternion();
            float      amount1 = Utilities.GenerateFloat();
            float      amount2 = Utilities.GenerateFloat();

            Quaternion expected = Utilities.ConvertFrom(Microsoft.DirectX.Quaternion.BaryCentric(
                                                            Utilities.ConvertToMdx(value1),
                                                            Utilities.ConvertToMdx(value2),
                                                            Utilities.ConvertToMdx(value3),
                                                            amount1,
                                                            amount2));

            Quaternion actual;

            actual = Quaternion.Barycentric(value1, value2, value3, amount1, amount2);
            Utilities.AreEqual(expected, actual);
        }