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); }
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]); } }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }