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