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 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 NormalizeTest() { Quaternion target = Utilities.GenerateQuaternion(); Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.Normalize( Utilities.ConvertToXna(target))); target.Normalize(); Utilities.AreEqual(expected, target); }
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); }
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 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 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); }
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); }
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); }
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); }
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 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); }
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); }
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); }
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 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); }
public void RotationYawPitchRollByRefTest() { float yaw = Utilities.GenerateFloat(); float pitch = Utilities.GenerateFloat(); float roll = Utilities.GenerateFloat(); Quaternion result; Quaternion resultExpected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.CreateFromYawPitchRoll( yaw, pitch, roll)); Quaternion.RotationYawPitchRoll(yaw, pitch, roll, out result); Utilities.AreEqual(resultExpected, result); }
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); }
public void RotationYawPitchRollTest() { float yaw = Utilities.GenerateFloat(); float pitch = Utilities.GenerateFloat(); float roll = Utilities.GenerateFloat(); Quaternion expected = Utilities.ConvertFrom(Microsoft.Xna.Framework.Quaternion.CreateFromYawPitchRoll( yaw, pitch, roll)); Quaternion actual; actual = Quaternion.RotationYawPitchRoll(yaw, pitch, roll); Utilities.AreEqual(expected, actual); }
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); }
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 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); }
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); }