- Vector2, Vector3, Vector4 no more NUitn issues (except of GetHashCode)
- Vector2, Vector3, Vector4 optimised (not yet finished) - fixed/extended some unit tests
This commit is contained in:
parent
c005180b0e
commit
f1e561b2cd
@ -130,6 +130,9 @@ using ANXShort2 = ANX.Framework.Graphics.PackedVector.Short2;
|
|||||||
using XNAShort4 = Microsoft.Xna.Framework.Graphics.PackedVector.Short4;
|
using XNAShort4 = Microsoft.Xna.Framework.Graphics.PackedVector.Short4;
|
||||||
using ANXShort4 = ANX.Framework.Graphics.PackedVector.Short4;
|
using ANXShort4 = ANX.Framework.Graphics.PackedVector.Short4;
|
||||||
|
|
||||||
|
using XNAMatrix = Microsoft.Xna.Framework.Matrix;
|
||||||
|
using ANXMatrix = ANX.Framework.Matrix;
|
||||||
|
|
||||||
using XNAQuaternion = Microsoft.Xna.Framework.Quaternion;
|
using XNAQuaternion = Microsoft.Xna.Framework.Quaternion;
|
||||||
using ANXQuaternion = ANX.Framework.Quaternion;
|
using ANXQuaternion = ANX.Framework.Quaternion;
|
||||||
|
|
||||||
@ -144,6 +147,18 @@ namespace ANX.Framework.TestCenter
|
|||||||
return (float)Math.Abs((double)(a - b)) < epsilon;
|
return (float)Math.Abs((double)(a - b)) < epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ConvertEquals(bool xna, bool anx, String test)
|
||||||
|
{
|
||||||
|
if (xna == anx)
|
||||||
|
{
|
||||||
|
Assert.Pass(test + " passed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.Fail(String.Format("{0] failed: xna: ({1}) anx: ({2})", test, xna.ToString(), anx.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ConvertEquals(XNABgr565 lhs, ANXBgr565 rhs, String test)
|
public static void ConvertEquals(XNABgr565 lhs, ANXBgr565 rhs, String test)
|
||||||
{
|
{
|
||||||
if (lhs.PackedValue == rhs.PackedValue)
|
if (lhs.PackedValue == rhs.PackedValue)
|
||||||
@ -378,7 +393,10 @@ namespace ANX.Framework.TestCenter
|
|||||||
public static void ConvertEquals(XNAVector2 xna, ANXVector2 anx, String test)
|
public static void ConvertEquals(XNAVector2 xna, ANXVector2 anx, String test)
|
||||||
{
|
{
|
||||||
//comparing string to catch "not defined" and "infinity" (which seems not to be equal)
|
//comparing string to catch "not defined" and "infinity" (which seems not to be equal)
|
||||||
if (xna.X.ToString().Equals(anx.X.ToString()) && xna.Y.ToString().Equals(anx.Y.ToString()))
|
float epsilon = 0.000001f;
|
||||||
|
if (anx.X.ToString().Equals(xna.X.ToString()) && anx.Y.ToString().Equals(xna.Y.ToString()) ||
|
||||||
|
(CompareFloats(xna.X, anx.X, epsilon) &&
|
||||||
|
CompareFloats(xna.Y, anx.Y, epsilon)))
|
||||||
{
|
{
|
||||||
Assert.Pass(test + " passed");
|
Assert.Pass(test + " passed");
|
||||||
}
|
}
|
||||||
@ -404,7 +422,11 @@ namespace ANX.Framework.TestCenter
|
|||||||
public static void ConvertEquals(XNAVector3 xna, ANXVector3 anx, String test)
|
public static void ConvertEquals(XNAVector3 xna, ANXVector3 anx, String test)
|
||||||
{
|
{
|
||||||
//comparing string to catch "not defined" and "infinity" (which seems not to be equal)
|
//comparing string to catch "not defined" and "infinity" (which seems not to be equal)
|
||||||
if ((xna.X == anx.X) && (xna.Y == anx.Y) && (xna.Z == anx.Z))
|
float epsilon = 0.000001f;
|
||||||
|
if (anx.X.ToString().Equals(xna.X.ToString()) && anx.Y.ToString().Equals(xna.Y.ToString()) && anx.Z.ToString().Equals(xna.Z.ToString()) ||
|
||||||
|
(CompareFloats(xna.X, anx.X, epsilon) &&
|
||||||
|
CompareFloats(xna.Y, anx.Y, epsilon) &&
|
||||||
|
CompareFloats(xna.Z, anx.Z, epsilon)))
|
||||||
{
|
{
|
||||||
Assert.Pass(test + " passed");
|
Assert.Pass(test + " passed");
|
||||||
}
|
}
|
||||||
@ -417,7 +439,12 @@ namespace ANX.Framework.TestCenter
|
|||||||
public static void ConvertEquals(XNAVector4 xna, ANXVector4 anx, String test)
|
public static void ConvertEquals(XNAVector4 xna, ANXVector4 anx, String test)
|
||||||
{
|
{
|
||||||
//comparing string to catch "not defined" and "infinity" (which seems not to be equal)
|
//comparing string to catch "not defined" and "infinity" (which seems not to be equal)
|
||||||
if ((xna.X == anx.X) && (xna.Y == anx.Y) && (xna.Z == anx.Z) && (xna.W == anx.W))
|
float epsilon = 0.000001f;
|
||||||
|
if (anx.X.ToString().Equals(xna.X.ToString()) && anx.Y.ToString().Equals(xna.Y.ToString()) && anx.Z.ToString().Equals(xna.Z.ToString()) && anx.W.ToString().Equals(xna.W.ToString()) ||
|
||||||
|
(CompareFloats(xna.X, anx.X, epsilon) &&
|
||||||
|
CompareFloats(xna.Y, anx.Y, epsilon) &&
|
||||||
|
CompareFloats(xna.Z, anx.Z, epsilon) &&
|
||||||
|
CompareFloats(xna.W, anx.W, epsilon)))
|
||||||
{
|
{
|
||||||
Assert.Pass(test + " passed");
|
Assert.Pass(test + " passed");
|
||||||
}
|
}
|
||||||
@ -514,6 +541,33 @@ namespace ANX.Framework.TestCenter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ConvertEquals(XNAMatrix xna, ANXMatrix anx, String test)
|
||||||
|
{
|
||||||
|
if (xna.M11.Equals(anx.M11) &&
|
||||||
|
xna.M12.Equals(anx.M12) &&
|
||||||
|
xna.M13.Equals(anx.M13) &&
|
||||||
|
xna.M14.Equals(anx.M14) &&
|
||||||
|
xna.M21.Equals(anx.M21) &&
|
||||||
|
xna.M22.Equals(anx.M22) &&
|
||||||
|
xna.M23.Equals(anx.M23) &&
|
||||||
|
xna.M24.Equals(anx.M24) &&
|
||||||
|
xna.M31.Equals(anx.M31) &&
|
||||||
|
xna.M32.Equals(anx.M32) &&
|
||||||
|
xna.M33.Equals(anx.M33) &&
|
||||||
|
xna.M34.Equals(anx.M34) &&
|
||||||
|
xna.M41.Equals(anx.M41) &&
|
||||||
|
xna.M42.Equals(anx.M42) &&
|
||||||
|
xna.M43.Equals(anx.M43) &&
|
||||||
|
xna.M44.Equals(anx.M44))
|
||||||
|
{
|
||||||
|
Assert.Pass(test + " passed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ConvertEquals(XNAQuaternion xna, ANXQuaternion anx, String test)
|
public static void ConvertEquals(XNAQuaternion xna, ANXQuaternion anx, String test)
|
||||||
{
|
{
|
||||||
float epsilon = 0.0000001f;
|
float epsilon = 0.0000001f;
|
||||||
|
@ -63,44 +63,14 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
class MatrixTest
|
class MatrixTest
|
||||||
{
|
{
|
||||||
#region Helper
|
|
||||||
public void ConvertEquals(XNAMatrix xna, ANXMatrix anx, String test)
|
|
||||||
{
|
|
||||||
if (xna.M11.Equals(anx.M11) &&
|
|
||||||
xna.M12.Equals(anx.M12) &&
|
|
||||||
xna.M13.Equals(anx.M13) &&
|
|
||||||
xna.M14.Equals(anx.M14) &&
|
|
||||||
xna.M21.Equals(anx.M21) &&
|
|
||||||
xna.M22.Equals(anx.M22) &&
|
|
||||||
xna.M23.Equals(anx.M23) &&
|
|
||||||
xna.M24.Equals(anx.M24) &&
|
|
||||||
xna.M31.Equals(anx.M31) &&
|
|
||||||
xna.M32.Equals(anx.M32) &&
|
|
||||||
xna.M33.Equals(anx.M33) &&
|
|
||||||
xna.M34.Equals(anx.M34) &&
|
|
||||||
xna.M41.Equals(anx.M41) &&
|
|
||||||
xna.M42.Equals(anx.M42) &&
|
|
||||||
xna.M43.Equals(anx.M43) &&
|
|
||||||
xna.M44.Equals(anx.M44))
|
|
||||||
{
|
|
||||||
Assert.Pass(test + " passed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Fail(String.Format("{0} failed: xna({1}) anx({2})", test, xna.ToString(), anx.ToString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Testdata
|
#region Testdata
|
||||||
static object[] sixteenfloats =
|
static object[] sixteenfloats =
|
||||||
{
|
{
|
||||||
new object[] { DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat },
|
new object[] { DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000) },
|
||||||
new object[] { DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat },
|
new object[] { DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000) },
|
||||||
new object[] { DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat },
|
new object[] { DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000) },
|
||||||
new object[] { DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat },
|
new object[] { DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000) },
|
||||||
new object[] { DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat, DataFactory.RandomFloat },
|
new object[] { DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000), DataFactory.RandomValueMinMax(float.Epsilon, 1000) },
|
||||||
};
|
};
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -108,7 +78,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
[Test]
|
[Test]
|
||||||
public void Identity()
|
public void Identity()
|
||||||
{
|
{
|
||||||
ConvertEquals(XNAMatrix.Identity, ANXMatrix.Identity, "Identity");
|
AssertHelper.ConvertEquals(XNAMatrix.Identity, ANXMatrix.Identity, "Identity");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion // Properties
|
#endregion // Properties
|
||||||
@ -121,7 +91,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix xnaM = new XNAMatrix();
|
XNAMatrix xnaM = new XNAMatrix();
|
||||||
ANXMatrix anxM = new ANXMatrix();
|
ANXMatrix anxM = new ANXMatrix();
|
||||||
|
|
||||||
ConvertEquals(xnaM, anxM, "Constructor0");
|
AssertHelper.ConvertEquals(xnaM, anxM, "Constructor0");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -130,7 +100,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix xnaM = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
XNAMatrix xnaM = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
ANXMatrix anxM = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
|
|
||||||
ConvertEquals(xnaM, anxM, "Constructor1");
|
AssertHelper.ConvertEquals(xnaM, anxM, "Constructor1");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion // Constructors
|
#endregion // Constructors
|
||||||
@ -145,7 +115,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
|
|
||||||
ConvertEquals(xnaM1 * xnaM2, anxM1 * anxM2, "MultiplyOperator");
|
AssertHelper.ConvertEquals(xnaM1 * xnaM2, anxM1 * anxM2, "MultiplyOperator");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -157,7 +127,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
|
|
||||||
ConvertEquals(XNAMatrix.Multiply(xnaM1, xnaM2), ANXMatrix.Multiply(anxM1, anxM2), "Multiply");
|
AssertHelper.ConvertEquals(XNAMatrix.Multiply(xnaM1, xnaM2), ANXMatrix.Multiply(anxM1, anxM2), "Multiply");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -174,7 +144,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix.Multiply(ref xnaM1, ref xnaM2, out xnaResult);
|
XNAMatrix.Multiply(ref xnaM1, ref xnaM2, out xnaResult);
|
||||||
ANXMatrix.Multiply(ref anxM1, ref anxM2, out anxResult);
|
ANXMatrix.Multiply(ref anxM1, ref anxM2, out anxResult);
|
||||||
|
|
||||||
ConvertEquals(xnaResult, anxResult, "Multiply2");
|
AssertHelper.ConvertEquals(xnaResult, anxResult, "Multiply2");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -184,7 +154,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
|
|
||||||
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
|
|
||||||
ConvertEquals(XNAMatrix.Multiply(xnaM1, m11), ANXMatrix.Multiply(anxM1, m11), "Multiply3");
|
AssertHelper.ConvertEquals(XNAMatrix.Multiply(xnaM1, m11), ANXMatrix.Multiply(anxM1, m11), "Multiply3");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -199,7 +169,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix.Multiply(ref xnaM1, m11, out xnaResult);
|
XNAMatrix.Multiply(ref xnaM1, m11, out xnaResult);
|
||||||
ANXMatrix.Multiply(ref anxM1, m11, out anxResult);
|
ANXMatrix.Multiply(ref anxM1, m11, out anxResult);
|
||||||
|
|
||||||
ConvertEquals(xnaResult, anxResult, "Multiply4");
|
AssertHelper.ConvertEquals(xnaResult, anxResult, "Multiply4");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -211,7 +181,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
|
|
||||||
ConvertEquals(xnaM1 + xnaM2, anxM1 + anxM2, "AddOperator");
|
AssertHelper.ConvertEquals(xnaM1 + xnaM2, anxM1 + anxM2, "AddOperator");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -223,7 +193,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
|
|
||||||
ConvertEquals(xnaM1 - xnaM2, anxM1 - anxM2, "SubtractOperator");
|
AssertHelper.ConvertEquals(xnaM1 - xnaM2, anxM1 - anxM2, "SubtractOperator");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -235,7 +205,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
ANXMatrix anxM2 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||||
|
|
||||||
ConvertEquals(xnaM1 / xnaM2, anxM1 / anxM2, "DivideOperator");
|
AssertHelper.ConvertEquals(xnaM1 / xnaM2, anxM1 / anxM2, "DivideOperator");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -244,7 +214,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix xnaMatrix = XNAMatrix.CreateRotationX(m11);
|
XNAMatrix xnaMatrix = XNAMatrix.CreateRotationX(m11);
|
||||||
ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(m11);
|
ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(m11);
|
||||||
|
|
||||||
ConvertEquals(xnaMatrix, anxMatrix, "CreateRotationX");
|
AssertHelper.ConvertEquals(xnaMatrix, anxMatrix, "CreateRotationX");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -253,7 +223,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix xnaMatrix = XNAMatrix.CreateRotationY(m11);
|
XNAMatrix xnaMatrix = XNAMatrix.CreateRotationY(m11);
|
||||||
ANXMatrix anxMatrix = ANXMatrix.CreateRotationY(m11);
|
ANXMatrix anxMatrix = ANXMatrix.CreateRotationY(m11);
|
||||||
|
|
||||||
ConvertEquals(xnaMatrix, anxMatrix, "CreateRotationY");
|
AssertHelper.ConvertEquals(xnaMatrix, anxMatrix, "CreateRotationY");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,7 +233,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix xnaMatrix = XNAMatrix.CreateRotationZ(m11);
|
XNAMatrix xnaMatrix = XNAMatrix.CreateRotationZ(m11);
|
||||||
ANXMatrix anxMatrix = ANXMatrix.CreateRotationZ(m11);
|
ANXMatrix anxMatrix = ANXMatrix.CreateRotationZ(m11);
|
||||||
|
|
||||||
ConvertEquals(xnaMatrix, anxMatrix, "CreateRotationZ");
|
AssertHelper.ConvertEquals(xnaMatrix, anxMatrix, "CreateRotationZ");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("sixteenfloats")]
|
[Test, TestCaseSource("sixteenfloats")]
|
||||||
@ -272,7 +242,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAMatrix xnaMatrix = XNAMatrix.CreateTranslation(m11, m12, m13);
|
XNAMatrix xnaMatrix = XNAMatrix.CreateTranslation(m11, m12, m13);
|
||||||
ANXMatrix anxMatrix = ANXMatrix.CreateTranslation(m11, m12, m13);
|
ANXMatrix anxMatrix = ANXMatrix.CreateTranslation(m11, m12, m13);
|
||||||
|
|
||||||
ConvertEquals(xnaMatrix, anxMatrix, "CreateTranslation");
|
AssertHelper.ConvertEquals(xnaMatrix, anxMatrix, "CreateTranslation");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -593,6 +593,124 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Operators
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void AddOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
XNAVector2 xna2 = new XNAVector2(x2, y2);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
ANXVector2 anx2 = new ANXVector2(x2, y2);
|
||||||
|
|
||||||
|
XNAVector2 xnaR = xna1 + xna2;
|
||||||
|
ANXVector2 anxR = anx1 + anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "AddOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void SubtractOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
XNAVector2 xna2 = new XNAVector2(x2, y2);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
ANXVector2 anx2 = new ANXVector2(x2, y2);
|
||||||
|
|
||||||
|
XNAVector2 xnaR = xna1 - xna2;
|
||||||
|
ANXVector2 anxR = anx1 - anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "SubtractOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void EqualsOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
XNAVector2 xna2 = new XNAVector2(x2, y2);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
ANXVector2 anx2 = new ANXVector2(x2, y2);
|
||||||
|
|
||||||
|
bool xnaR = xna1 == xna2;
|
||||||
|
bool anxR = anx1 == anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "EqualsOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void UnequalsOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
XNAVector2 xna2 = new XNAVector2(x2, y2);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
ANXVector2 anx2 = new ANXVector2(x2, y2);
|
||||||
|
|
||||||
|
bool xnaR = xna1 != xna2;
|
||||||
|
bool anxR = anx1 != anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "UnequalsOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void MultiplyOperatorFloat(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float value)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
|
||||||
|
XNAVector2 xnaR = xna1 * value;
|
||||||
|
ANXVector2 anxR = anx1 * value;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyOperatorFloat");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void MultiplyOperatorVector2(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
XNAVector2 xna2 = new XNAVector2(x2, y2);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
ANXVector2 anx2 = new ANXVector2(x2, y2);
|
||||||
|
|
||||||
|
XNAVector2 xnaR = xna1 * xna2;
|
||||||
|
ANXVector2 anxR = anx1 * anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyOperatorVector2");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void DivideOperatorFloat(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float value)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
|
||||||
|
XNAVector2 xnaR = xna1 / value;
|
||||||
|
ANXVector2 anxR = anx1 / value;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideOperatorFloat");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("ninefloats")]
|
||||||
|
public void DivideOperatorVector2(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1)
|
||||||
|
{
|
||||||
|
XNAVector2 xna1 = new XNAVector2(x1, y1);
|
||||||
|
XNAVector2 xna2 = new XNAVector2(x2, y2);
|
||||||
|
|
||||||
|
ANXVector2 anx1 = new ANXVector2(x1, y1);
|
||||||
|
ANXVector2 anx2 = new ANXVector2(x2, y2);
|
||||||
|
|
||||||
|
XNAVector2 xnaR = xna1 / xna2;
|
||||||
|
ANXVector2 anxR = anx1 / anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideOperatorVector2");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//TODO: transform, transform normal operations
|
//TODO: transform, transform normal operations
|
||||||
|
@ -286,7 +286,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
||||||
|
|
||||||
XNAVector3 xnaR = XNAVector3.Cross(xna1, xna2);
|
XNAVector3 xnaR = XNAVector3.Cross(xna1, xna2);
|
||||||
ANXVector3 anxR = ANXVector3.Cross(anx2, anx2);
|
ANXVector3 anxR = ANXVector3.Cross(anx1, anx2);
|
||||||
|
|
||||||
AssertHelper.ConvertEquals(xnaR, anxR, "Cross");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Cross");
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirteenFloats")]
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
public void SmoothStep(float x1, float y1, float z1, float x2, float y2, float z2, float amount, float nop1, float nop2, float nop3, float nop4, float nop5)
|
public void SmoothStep(float x1, float y1, float z1, float x2, float y2, float z2, float amount, float nop0, float nop1, float nop2, float nop3, float nop4, float nop5)
|
||||||
{
|
{
|
||||||
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
||||||
@ -588,6 +588,124 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Operators
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void AddOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
XNAVector3 xnaR = xna1 + xna2;
|
||||||
|
ANXVector3 anxR = anx1 + anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "AddOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void SubtractOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
XNAVector3 xnaR = xna1 - xna2;
|
||||||
|
ANXVector3 anxR = anx1 - anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "SubtractOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void EqualsOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
bool xnaR = xna1 == xna2;
|
||||||
|
bool anxR = anx1 == anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "EqualsOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void UnequalsOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
bool xnaR = xna1 != xna2;
|
||||||
|
bool anxR = anx1 != anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "UnequalsOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void MultiplyOperatorFloat(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float value, float nop1, float nop2, float nop3, float nop4)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
|
||||||
|
XNAVector3 xnaR = xna1 * value;
|
||||||
|
ANXVector3 anxR = anx1 * value;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyOperatorFloat");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void MultiplyOperatorVector3(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
XNAVector3 xnaR = xna1 * xna2;
|
||||||
|
ANXVector3 anxR = anx1 * anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyOperatorVector3");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void DivideOperatorFloat(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float value, float nop1, float nop2, float nop3, float nop4)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
|
||||||
|
XNAVector3 xnaR = xna1 / value;
|
||||||
|
ANXVector3 anxR = anx1 / value;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideOperatorFloat");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("thirteenFloats")]
|
||||||
|
public void DivideOperatorVector3(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5)
|
||||||
|
{
|
||||||
|
XNAVector3 xna1 = new XNAVector3(x1, y1, z1);
|
||||||
|
XNAVector3 xna2 = new XNAVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
ANXVector3 anx1 = new ANXVector3(x1, y1, z1);
|
||||||
|
ANXVector3 anx2 = new ANXVector3(x2, y2, z2);
|
||||||
|
|
||||||
|
XNAVector3 xnaR = xna1 / xna2;
|
||||||
|
ANXVector3 anxR = anx1 / anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideOperatorVector3");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//TODO: transform, transform normal operations
|
//TODO: transform, transform normal operations
|
||||||
|
@ -68,23 +68,6 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
class Vector4Test
|
class Vector4Test
|
||||||
{
|
{
|
||||||
#region Helper
|
|
||||||
|
|
||||||
public void ConvertEquals(XNAVector4 xna, ANXVector4 anx, String test)
|
|
||||||
{
|
|
||||||
//comparing string to catch "not defined" and "infinity" (which seems not to be equal)
|
|
||||||
if ((xna.X == anx.X) && (xna.Y == anx.Y) && (xna.Z == anx.Z) && (xna.W == anx.W))
|
|
||||||
{
|
|
||||||
Assert.Pass(test + " passed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Fail(string.Format("{0} failed: xna({1}{2}{3}{4}) anx({5}{6}{7}{8})", test, xna.X, xna.Y, xna.Z, xna.W, anx.X, anx.Y, anx.Z, anx.W));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Testdata
|
#region Testdata
|
||||||
|
|
||||||
static object[] fourFloats =
|
static object[] fourFloats =
|
||||||
@ -114,37 +97,37 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
[Test]
|
[Test]
|
||||||
public void One()
|
public void One()
|
||||||
{
|
{
|
||||||
ConvertEquals(XNAVector4.One, ANXVector4.One, "One");
|
AssertHelper.ConvertEquals(XNAVector4.One, ANXVector4.One, "One");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Zero()
|
public void Zero()
|
||||||
{
|
{
|
||||||
ConvertEquals(XNAVector4.Zero, ANXVector4.Zero, "Zero");
|
AssertHelper.ConvertEquals(XNAVector4.Zero, ANXVector4.Zero, "Zero");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UnitX()
|
public void UnitX()
|
||||||
{
|
{
|
||||||
ConvertEquals(XNAVector4.UnitX, ANXVector4.UnitX, "UnitX");
|
AssertHelper.ConvertEquals(XNAVector4.UnitX, ANXVector4.UnitX, "UnitX");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UnitY()
|
public void UnitY()
|
||||||
{
|
{
|
||||||
ConvertEquals(XNAVector4.UnitY, ANXVector4.UnitY, "UnitY");
|
AssertHelper.ConvertEquals(XNAVector4.UnitY, ANXVector4.UnitY, "UnitY");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UnitZ()
|
public void UnitZ()
|
||||||
{
|
{
|
||||||
ConvertEquals(XNAVector4.UnitZ, ANXVector4.UnitZ, "UnitZ");
|
AssertHelper.ConvertEquals(XNAVector4.UnitZ, ANXVector4.UnitZ, "UnitZ");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UnitW()
|
public void UnitW()
|
||||||
{
|
{
|
||||||
ConvertEquals(XNAVector4.UnitW, ANXVector4.UnitW, "UnitW");
|
AssertHelper.ConvertEquals(XNAVector4.UnitW, ANXVector4.UnitW, "UnitW");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -158,7 +141,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
|
|
||||||
ANXVector4 anxR = new ANXVector4();
|
ANXVector4 anxR = new ANXVector4();
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Constructor1");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Constructor1");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("fourFloats")]
|
[Test, TestCaseSource("fourFloats")]
|
||||||
@ -168,7 +151,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
|
|
||||||
ANXVector4 anxR = new ANXVector4(x);
|
ANXVector4 anxR = new ANXVector4(x);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Constructor2");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Constructor2");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("fourFloats")]
|
[Test, TestCaseSource("fourFloats")]
|
||||||
@ -180,7 +163,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXVector3 anxV3 = new ANXVector3(x, y, z);
|
ANXVector3 anxV3 = new ANXVector3(x, y, z);
|
||||||
ANXVector4 anxR = new ANXVector4(anxV3, w);
|
ANXVector4 anxR = new ANXVector4(anxV3, w);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Constructor3");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Constructor3");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("fourFloats")]
|
[Test, TestCaseSource("fourFloats")]
|
||||||
@ -192,7 +175,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
ANXVector2 anxV2 = new ANXVector2(x, y);
|
ANXVector2 anxV2 = new ANXVector2(x, y);
|
||||||
ANXVector4 anxR = new ANXVector4(anxV2, z, w);
|
ANXVector4 anxR = new ANXVector4(anxV2, z, w);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Constructor4");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Constructor4");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("fourFloats")]
|
[Test, TestCaseSource("fourFloats")]
|
||||||
@ -202,7 +185,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
|
|
||||||
ANXVector4 anxR = new ANXVector4(x, y, z, w);
|
ANXVector4 anxR = new ANXVector4(x, y, z, w);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Constructor5");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Constructor5");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -221,7 +204,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Add(xna1, xna2);
|
XNAVector4 xnaR = XNAVector4.Add(xna1, xna2);
|
||||||
ANXVector4 anxR = ANXVector4.Add(anx1, anx2);
|
ANXVector4 anxR = ANXVector4.Add(anx1, anx2);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Add");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Add");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -241,7 +224,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Barycentric(xna1, xna2, xna3, amount1, amount2);
|
XNAVector4 xnaR = XNAVector4.Barycentric(xna1, xna2, xna3, amount1, amount2);
|
||||||
ANXVector4 anxR = ANXVector4.Barycentric(anx1, anx2, anx3, amount1, amount2);
|
ANXVector4 anxR = ANXVector4.Barycentric(anx1, anx2, anx3, amount1, amount2);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Barycentric");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Barycentric");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +244,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.CatmullRom(xna1, xna2, xna3, xna4, amount);
|
XNAVector4 xnaR = XNAVector4.CatmullRom(xna1, xna2, xna3, xna4, amount);
|
||||||
ANXVector4 anxR = ANXVector4.CatmullRom(anx1, anx2, anx3, anx4, amount);
|
ANXVector4 anxR = ANXVector4.CatmullRom(anx1, anx2, anx3, anx4, amount);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "CatmullRom");
|
AssertHelper.ConvertEquals(xnaR, anxR, "CatmullRom");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +262,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Clamp(xna1, xna2, xna3);
|
XNAVector4 xnaR = XNAVector4.Clamp(xna1, xna2, xna3);
|
||||||
ANXVector4 anxR = ANXVector4.Clamp(anx1, anx2, anx3);
|
ANXVector4 anxR = ANXVector4.Clamp(anx1, anx2, anx3);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Clamp");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Clamp");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +278,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
float xnaR = XNAVector4.Distance(xna1, xna2);
|
float xnaR = XNAVector4.Distance(xna1, xna2);
|
||||||
float anxR = ANXVector4.Distance(anx1, anx2);
|
float anxR = ANXVector4.Distance(anx1, anx2);
|
||||||
|
|
||||||
Assert.AreEqual(xnaR, anxR);
|
AssertHelper.ConvertEquals(xnaR, anxR, "Distance");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -310,7 +293,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
float xnaR = XNAVector4.DistanceSquared(xna1, xna2);
|
float xnaR = XNAVector4.DistanceSquared(xna1, xna2);
|
||||||
float anxR = ANXVector4.DistanceSquared(anx1, anx2);
|
float anxR = ANXVector4.DistanceSquared(anx1, anx2);
|
||||||
|
|
||||||
Assert.AreEqual(xnaR, anxR);
|
AssertHelper.ConvertEquals(xnaR, anxR, "DistanceSquared");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -323,7 +306,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Divide(xna1, divider);
|
XNAVector4 xnaR = XNAVector4.Divide(xna1, divider);
|
||||||
ANXVector4 anxR = ANXVector4.Divide(anx1, divider);
|
ANXVector4 anxR = ANXVector4.Divide(anx1, divider);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "DivideVectorDivider");
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideVectorDivider");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -338,7 +321,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Divide(xna1, xna2);
|
XNAVector4 xnaR = XNAVector4.Divide(xna1, xna2);
|
||||||
ANXVector4 anxR = ANXVector4.Divide(anx1, anx2);
|
ANXVector4 anxR = ANXVector4.Divide(anx1, anx2);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "DivideVectorVector");
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideVectorVector");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -353,7 +336,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
float xnaR = XNAVector4.Dot(xna1, xna2);
|
float xnaR = XNAVector4.Dot(xna1, xna2);
|
||||||
float anxR = ANXVector4.Dot(anx1, anx2);
|
float anxR = ANXVector4.Dot(anx1, anx2);
|
||||||
|
|
||||||
Assert.AreEqual(xnaR, anxR);
|
AssertHelper.ConvertEquals(xnaR, anxR, "Dot");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -366,7 +349,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
float xnaR = xna1.GetHashCode();
|
float xnaR = xna1.GetHashCode();
|
||||||
float anxR = anx1.GetHashCode();
|
float anxR = anx1.GetHashCode();
|
||||||
|
|
||||||
Assert.AreEqual(xnaR, anxR);
|
AssertHelper.ConvertEquals(xnaR, anxR, "GetHashCode");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +369,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Hermite(xna1, xna2, xna3, xna4, amount);
|
XNAVector4 xnaR = XNAVector4.Hermite(xna1, xna2, xna3, xna4, amount);
|
||||||
ANXVector4 anxR = ANXVector4.Hermite(anx1, anx2, anx3, anx4, amount);
|
ANXVector4 anxR = ANXVector4.Hermite(anx1, anx2, anx3, anx4, amount);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Hermite");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Hermite");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -394,7 +377,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
{
|
{
|
||||||
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
Assert.AreEqual(anx1.Length(), xna1.Length());
|
AssertHelper.ConvertEquals(anx1.Length(), xna1.Length(), "Length");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -402,7 +385,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
{
|
{
|
||||||
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
Assert.AreEqual(anx1.LengthSquared(), xna1.LengthSquared());
|
AssertHelper.ConvertEquals(anx1.LengthSquared(), xna1.LengthSquared(), "LengthSquared");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -417,7 +400,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Lerp(xna1, xna2, amount);
|
XNAVector4 xnaR = XNAVector4.Lerp(xna1, xna2, amount);
|
||||||
ANXVector4 anxR = ANXVector4.Lerp(anx1, anx2, amount);
|
ANXVector4 anxR = ANXVector4.Lerp(anx1, anx2, amount);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Lerp");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Lerp");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -432,7 +415,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Max(xna1, xna2);
|
XNAVector4 xnaR = XNAVector4.Max(xna1, xna2);
|
||||||
ANXVector4 anxR = ANXVector4.Max(anx1, anx2);
|
ANXVector4 anxR = ANXVector4.Max(anx1, anx2);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Max");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Max");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -448,7 +431,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Min(xna1, xna2);
|
XNAVector4 xnaR = XNAVector4.Min(xna1, xna2);
|
||||||
ANXVector4 anxR = ANXVector4.Min(anx1, anx2);
|
ANXVector4 anxR = ANXVector4.Min(anx1, anx2);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Min");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Min");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -461,7 +444,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Multiply(xna1, scale);
|
XNAVector4 xnaR = XNAVector4.Multiply(xna1, scale);
|
||||||
ANXVector4 anxR = ANXVector4.Multiply(anx1, scale);
|
ANXVector4 anxR = ANXVector4.Multiply(anx1, scale);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "MultiplyVectorFloat");
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyVectorFloat");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -476,7 +459,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Multiply(xna1, xna2);
|
XNAVector4 xnaR = XNAVector4.Multiply(xna1, xna2);
|
||||||
ANXVector4 anxR = ANXVector4.Multiply(anx1, anx2);
|
ANXVector4 anxR = ANXVector4.Multiply(anx1, anx2);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "MultiplyVectorVector");
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyVectorVector");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -489,7 +472,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Negate(xna1);
|
XNAVector4 xnaR = XNAVector4.Negate(xna1);
|
||||||
ANXVector4 anxR = ANXVector4.Negate(anx1);
|
ANXVector4 anxR = ANXVector4.Negate(anx1);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Negate");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Negate");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -502,7 +485,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
xnaR.Normalize();
|
xnaR.Normalize();
|
||||||
anxR.Normalize();
|
anxR.Normalize();
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "NormalizeInstanz");
|
AssertHelper.ConvertEquals(xnaR, anxR, "NormalizeInstanz");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -515,7 +498,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Normalize(xna1);
|
XNAVector4 xnaR = XNAVector4.Normalize(xna1);
|
||||||
ANXVector4 anxR = ANXVector4.Normalize(anx1);
|
ANXVector4 anxR = ANXVector4.Normalize(anx1);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "NormalizeStatic");
|
AssertHelper.ConvertEquals(xnaR, anxR, "NormalizeStatic");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -530,7 +513,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.SmoothStep(xna1, xna2, amount);
|
XNAVector4 xnaR = XNAVector4.SmoothStep(xna1, xna2, amount);
|
||||||
ANXVector4 anxR = ANXVector4.SmoothStep(anx1, anx2, amount);
|
ANXVector4 anxR = ANXVector4.SmoothStep(anx1, anx2, amount);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "SmoothStep");
|
AssertHelper.ConvertEquals(xnaR, anxR, "SmoothStep");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -545,7 +528,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector4 xnaR = XNAVector4.Subtract(xna1, xna2);
|
XNAVector4 xnaR = XNAVector4.Subtract(xna1, xna2);
|
||||||
ANXVector4 anxR = ANXVector4.Subtract(anx1, anx2);
|
ANXVector4 anxR = ANXVector4.Subtract(anx1, anx2);
|
||||||
|
|
||||||
ConvertEquals(xnaR, anxR, "Subtract");
|
AssertHelper.ConvertEquals(xnaR, anxR, "Subtract");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("seventeenFloats")]
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
@ -563,6 +546,124 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Operators
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void AddOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
XNAVector4 xna2 = new XNAVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
ANXVector4 anx2 = new ANXVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
XNAVector4 xnaR = xna1 + xna2;
|
||||||
|
ANXVector4 anxR = anx1 + anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "AddOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void SubtractOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
XNAVector4 xna2 = new XNAVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
ANXVector4 anx2 = new ANXVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
XNAVector4 xnaR = xna1 - xna2;
|
||||||
|
ANXVector4 anxR = anx1 - anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "SubtractOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void EqualsOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
XNAVector4 xna2 = new XNAVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
ANXVector4 anx2 = new ANXVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
bool xnaR = xna1 == xna2;
|
||||||
|
bool anxR = anx1 == anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "EqualsOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void UnequalsOperator(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
XNAVector4 xna2 = new XNAVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
ANXVector4 anx2 = new ANXVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
bool xnaR = xna1 != xna2;
|
||||||
|
bool anxR = anx1 != anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "UnequalsOperator");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void MultiplyOperatorFloat(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float value, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
|
||||||
|
XNAVector4 xnaR = xna1 * value;
|
||||||
|
ANXVector4 anxR = anx1 * value;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyOperatorFloat");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void MultiplyOperatorVector4(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
XNAVector4 xna2 = new XNAVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
ANXVector4 anx2 = new ANXVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
XNAVector4 xnaR = xna1 * xna2;
|
||||||
|
ANXVector4 anxR = anx1 * anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "MultiplyOperatorVector4");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void DivideOperatorFloat(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float value, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
|
||||||
|
XNAVector4 xnaR = xna1 / value;
|
||||||
|
ANXVector4 anxR = anx1 / value;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideOperatorFloat");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test, TestCaseSource("seventeenFloats")]
|
||||||
|
public void DivideOperatorVector4(float x1, float y1, float z1, float w1, float x2, float y2, float z2, float w2, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9)
|
||||||
|
{
|
||||||
|
XNAVector4 xna1 = new XNAVector4(x1, y1, z1, w1);
|
||||||
|
XNAVector4 xna2 = new XNAVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
ANXVector4 anx1 = new ANXVector4(x1, y1, z1, w1);
|
||||||
|
ANXVector4 anx2 = new ANXVector4(x2, y2, z2, w2);
|
||||||
|
|
||||||
|
XNAVector4 xnaR = xna1 / xna2;
|
||||||
|
ANXVector4 anxR = anx1 / anx2;
|
||||||
|
|
||||||
|
AssertHelper.ConvertEquals(xnaR, anxR, "DivideOperatorVector4");
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
//TODO: transform operations
|
//TODO: transform operations
|
||||||
|
@ -61,74 +61,74 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
|
|
||||||
#region properties
|
#region properties
|
||||||
#region One
|
#region One
|
||||||
private static readonly Vector2 privateOne;
|
private static readonly Vector2 privateOne;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="Vector2"/> with both of its components set to one.
|
/// Returns a <see cref="Vector2"/> with both of its components set to one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Vector2 One
|
public static Vector2 One
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return privateOne;
|
return privateOne;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Zero
|
#region Zero
|
||||||
private static readonly Vector2 privateZero;
|
private static readonly Vector2 privateZero;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a <see cref="Vector2"/> with both of its components set to zero.
|
/// Returns a <see cref="Vector2"/> with both of its components set to zero.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Vector2 Zero
|
public static Vector2 Zero
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return privateZero;
|
return privateZero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UnitX
|
#region UnitX
|
||||||
private static readonly Vector2 privateUnitX;
|
private static readonly Vector2 privateUnitX;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the unit vector for the x-axis.
|
/// Returns the unit vector for the x-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Vector2 UnitX
|
public static Vector2 UnitX
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return privateUnitX;
|
return privateUnitX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UnitY
|
#region UnitY
|
||||||
private static readonly Vector2 privateUnitY;
|
private static readonly Vector2 privateUnitY;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the unit vector for the y-axis.
|
/// Returns the unit vector for the y-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Vector2 UnitY
|
public static Vector2 UnitY
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return privateUnitY;
|
return privateUnitY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region constructors
|
#region constructors
|
||||||
static Vector2()
|
static Vector2()
|
||||||
{
|
{
|
||||||
privateOne = new Vector2(1.0f, 1.0f);
|
privateOne = new Vector2(1.0f, 1.0f);
|
||||||
privateUnitX = new Vector2(1.0f, 0.0f);
|
privateUnitX = new Vector2(1.0f, 0.0f);
|
||||||
privateUnitY = new Vector2(0.0f, 1.0f);
|
privateUnitY = new Vector2(0.0f, 1.0f);
|
||||||
privateZero = new Vector2(0.0f, 0.0f);
|
privateZero = new Vector2(0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2(float value)
|
public Vector2(float value)
|
||||||
{
|
{
|
||||||
this.X = value;
|
this.X = value;
|
||||||
this.Y = value;
|
this.Y = value;
|
||||||
@ -149,14 +149,12 @@ namespace ANX.Framework
|
|||||||
Vector2 result;
|
Vector2 result;
|
||||||
Vector2.Add(ref value1, ref value2, out result);
|
Vector2.Add(ref value1, ref value2, out result);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Add(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
|
public static void Add(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
|
||||||
{
|
{
|
||||||
result.X = value1.X + value2.X;
|
result.X = value1.X + value2.X;
|
||||||
result.Y = value1.Y + value2.Y;
|
result.Y = value1.Y + value2.Y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)
|
public static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)
|
||||||
@ -164,7 +162,6 @@ namespace ANX.Framework
|
|||||||
Vector2 result;
|
Vector2 result;
|
||||||
Vector2.Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
|
Vector2.Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void Barycentric(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, float amount1, float amount2, out Vector2 result)
|
public static void Barycentric(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, float amount1, float amount2, out Vector2 result)
|
||||||
{
|
{
|
||||||
@ -183,7 +180,7 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void CatmullRom(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, ref Vector2 value4, float amount, out Vector2 result)
|
public static void CatmullRom(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, ref Vector2 value4, float amount, out Vector2 result)
|
||||||
{
|
{
|
||||||
result.X=MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
|
result.X = MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
|
||||||
result.Y = MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
|
result.Y = MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +204,9 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void Distance(ref Vector2 value1, ref Vector2 value2, out float result)
|
public static void Distance(ref Vector2 value1, ref Vector2 value2, out float result)
|
||||||
{
|
{
|
||||||
result = (value2 - value1).Length();
|
Vector2 tmp;
|
||||||
|
Vector2.Subtract(ref value1, ref value2, out tmp);
|
||||||
|
result = tmp.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float DistanceSquared(Vector2 value1, Vector2 value2)
|
public static float DistanceSquared(Vector2 value1, Vector2 value2)
|
||||||
@ -218,7 +217,9 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void DistanceSquared(ref Vector2 value1, ref Vector2 value2, out float result)
|
public static void DistanceSquared(ref Vector2 value1, ref Vector2 value2, out float result)
|
||||||
{
|
{
|
||||||
result = (value2-value1).LengthSquared();
|
Vector2 tmp;
|
||||||
|
Vector2.Subtract(ref value1, ref value2, out tmp);
|
||||||
|
result = tmp.LengthSquared();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2 Divide(Vector2 value1, float divider)
|
public static Vector2 Divide(Vector2 value1, float divider)
|
||||||
@ -229,7 +230,9 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void Divide(ref Vector2 value1, float divider, out Vector2 result)
|
public static void Divide(ref Vector2 value1, float divider, out Vector2 result)
|
||||||
{
|
{
|
||||||
result = value1 / divider;
|
divider = 1f / divider;
|
||||||
|
result.X = value1.X * divider;
|
||||||
|
result.Y = value1.Y * divider;
|
||||||
}
|
}
|
||||||
public static Vector2 Divide(Vector2 value1, Vector2 value2)
|
public static Vector2 Divide(Vector2 value1, Vector2 value2)
|
||||||
{
|
{
|
||||||
@ -239,7 +242,8 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void Divide(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
|
public static void Divide(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
|
||||||
{
|
{
|
||||||
result = value1 / value2;
|
result.X = value1.X / value2.X;
|
||||||
|
result.Y = value1.Y / value2.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float Dot(Vector2 value1, Vector2 value2)
|
public static float Dot(Vector2 value1, Vector2 value2)
|
||||||
@ -272,7 +276,7 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public float Length()
|
public float Length()
|
||||||
{
|
{
|
||||||
return (float)Math.Sqrt((this.X*this.X)+(this.Y*this.Y));
|
return (float)Math.Sqrt((this.X * this.X) + (this.Y * this.Y));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float LengthSquared()
|
public float LengthSquared()
|
||||||
@ -288,7 +292,7 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void Lerp(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
|
public static void Lerp(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
|
||||||
{
|
{
|
||||||
result.X=MathHelper.Lerp(value1.X, value2.X, amount);
|
result.X = MathHelper.Lerp(value1.X, value2.X, amount);
|
||||||
result.Y = MathHelper.Lerp(value1.Y, value2.Y, amount);
|
result.Y = MathHelper.Lerp(value1.Y, value2.Y, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,7 +329,8 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void Multiply(ref Vector2 value1, float scaleFactor, out Vector2 result)
|
public static void Multiply(ref Vector2 value1, float scaleFactor, out Vector2 result)
|
||||||
{
|
{
|
||||||
result = value1*scaleFactor;
|
result.X = value1.X * scaleFactor;
|
||||||
|
result.Y = value1.Y * scaleFactor;
|
||||||
}
|
}
|
||||||
public static Vector2 Multiply(Vector2 value1, Vector2 value2)
|
public static Vector2 Multiply(Vector2 value1, Vector2 value2)
|
||||||
{
|
{
|
||||||
@ -335,7 +340,8 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void Multiply(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
|
public static void Multiply(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
|
||||||
{
|
{
|
||||||
result =value1*value2;
|
result.X = value1.X * value2.X;
|
||||||
|
result.Y = value1.Y * value2.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2 Negate(Vector2 value)
|
public static Vector2 Negate(Vector2 value)
|
||||||
@ -358,13 +364,13 @@ namespace ANX.Framework
|
|||||||
public static Vector2 Normalize(Vector2 value)
|
public static Vector2 Normalize(Vector2 value)
|
||||||
{
|
{
|
||||||
float divider = 1f / value.Length();
|
float divider = 1f / value.Length();
|
||||||
return new Vector2(value.X*divider,value.Y*divider);
|
return new Vector2(value.X * divider, value.Y * divider);
|
||||||
}
|
}
|
||||||
public static void Normalize(ref Vector2 value, out Vector2 result)
|
public static void Normalize(ref Vector2 value, out Vector2 result)
|
||||||
{
|
{
|
||||||
float divider = 1f / value.Length();
|
float divider = 1f / value.Length();
|
||||||
result.X=value.X * divider;
|
result.X = value.X * divider;
|
||||||
result.Y=value.Y * divider;
|
result.Y = value.Y * divider;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Vect2 = Vect1 - 2 * WallN * (WallN DOT Vect1)
|
Vect2 = Vect1 - 2 * WallN * (WallN DOT Vect1)
|
||||||
@ -393,9 +399,8 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void SmoothStep(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
|
public static void SmoothStep(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
|
||||||
{
|
{
|
||||||
result.X=MathHelper.SmoothStep(value1.X, value2.X, amount);
|
result.X = MathHelper.SmoothStep(value1.X, value2.X, amount);
|
||||||
result.Y=MathHelper.SmoothStep(value1.Y, value2.Y, amount);
|
result.Y = MathHelper.SmoothStep(value1.Y, value2.Y, amount);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2 Subtract(Vector2 value1, Vector2 value2)
|
public static Vector2 Subtract(Vector2 value1, Vector2 value2)
|
||||||
@ -413,7 +418,7 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "{X:"+this.X+" Y:"+this.Y+"}";
|
return "{X:" + this.X + " Y:" + this.Y + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector2 Transform(Vector2 position, Matrix matrix)
|
public static Vector2 Transform(Vector2 position, Matrix matrix)
|
||||||
@ -464,8 +469,8 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void TransformNormal(
|
public static void TransformNormal(
|
||||||
Vector2[] sourceArray,
|
Vector2[] sourceArray,
|
||||||
int sourceIndex,
|
int sourceIndex,
|
||||||
ref Matrix matrix,
|
ref Matrix matrix,
|
||||||
Vector2[] destinationArray,
|
Vector2[] destinationArray,
|
||||||
int destinationIndex,
|
int destinationIndex,
|
||||||
@ -498,7 +503,7 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
#region operator overloading
|
#region operator overloading
|
||||||
public static Vector2 operator +(Vector2 value1, Vector2 value2)
|
public static Vector2 operator +(Vector2 value1, Vector2 value2)
|
||||||
{
|
{
|
||||||
return new Vector2(value1.X + value2.X, value1.Y + value2.Y);
|
return new Vector2(value1.X + value2.X, value1.Y + value2.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ namespace ANX.Framework
|
|||||||
private static Vector3 left = new Vector3(-1f, 0f, 0f);
|
private static Vector3 left = new Vector3(-1f, 0f, 0f);
|
||||||
private static Vector3 right = new Vector3(1f, 0f, 0f);
|
private static Vector3 right = new Vector3(1f, 0f, 0f);
|
||||||
private static Vector3 up = new Vector3(0f, 1f, 0f);
|
private static Vector3 up = new Vector3(0f, 1f, 0f);
|
||||||
private static Vector3 down = new Vector3(0f, -1f, 0f);
|
private static Vector3 down = new Vector3(0f, -1f, 0f);
|
||||||
private static Vector3 forward = new Vector3(0f, 0f, -1f);
|
private static Vector3 forward = new Vector3(0f, 0f, -1f);
|
||||||
private static Vector3 backward = new Vector3(0f, 0f, 1f);
|
private static Vector3 backward = new Vector3(0f, 0f, 1f);
|
||||||
private static Vector3 unitX = new Vector3(1f, 0f, 0f);
|
private static Vector3 unitX = new Vector3(1f, 0f, 0f);
|
||||||
@ -75,9 +75,9 @@ namespace ANX.Framework
|
|||||||
public float X;
|
public float X;
|
||||||
public float Y;
|
public float Y;
|
||||||
public float Z;
|
public float Z;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Static Properties
|
#region Public Static Properties
|
||||||
|
|
||||||
public static Vector3 Zero
|
public static Vector3 Zero
|
||||||
@ -265,7 +265,9 @@ namespace ANX.Framework
|
|||||||
public static void Divide(ref Vector3 value1, float value2, out Vector3 result)
|
public static void Divide(ref Vector3 value1, float value2, out Vector3 result)
|
||||||
{
|
{
|
||||||
float divFactor = 1f / value2;
|
float divFactor = 1f / value2;
|
||||||
Multiply(ref value1, divFactor, out result);
|
result.X = value1.X * divFactor;
|
||||||
|
result.Y = value1.Y * divFactor;
|
||||||
|
result.Z = value1.Z * divFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -283,7 +285,6 @@ namespace ANX.Framework
|
|||||||
result.Z = value1.Z / value2.Z;
|
result.Z = value1.Z / value2.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static float Dot(Vector3 vector1, Vector3 vector2)
|
public static float Dot(Vector3 vector1, Vector3 vector2)
|
||||||
{
|
{
|
||||||
float result;
|
float result;
|
||||||
@ -321,7 +322,10 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public static void Normalize(ref Vector3 value, out Vector3 result)
|
public static void Normalize(ref Vector3 value, out Vector3 result)
|
||||||
{
|
{
|
||||||
Divide(ref value, value.Length(), out result);
|
float divFactor = 1f / value.Length();
|
||||||
|
result.X = value.X * divFactor;
|
||||||
|
result.Y = value.Y * divFactor;
|
||||||
|
result.Z = value.Z * divFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -407,7 +411,7 @@ namespace ANX.Framework
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)
|
public static void Hermite(ref Vector3 value1, ref Vector3 tangent1, ref Vector3 value2, ref Vector3 tangent2, float amount, out Vector3 result)
|
||||||
{
|
{
|
||||||
result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
|
result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
|
||||||
result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
|
result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
|
||||||
@ -574,22 +578,29 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public static Vector3 operator +(Vector3 value1, Vector3 value2)
|
public static Vector3 operator +(Vector3 value1, Vector3 value2)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Add(ref value1, ref value2, out result);
|
result.X = value1.X + value2.X;
|
||||||
|
result.Y = value1.Y + value2.Y;
|
||||||
|
result.Z = value1.Z + value2.Z;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 operator /(Vector3 value1, float divider)
|
public static Vector3 operator /(Vector3 value1, float divider)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Divide(ref value1, divider, out result);
|
float divFactor = 1f / divider;
|
||||||
|
result.X = value1.X * divFactor;
|
||||||
|
result.Y = value1.Y * divFactor;
|
||||||
|
result.Z = value1.Z * divFactor;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 operator /(Vector3 value1, Vector3 value2)
|
public static Vector3 operator /(Vector3 value1, Vector3 value2)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Divide(ref value1, ref value2, out result);
|
result.X = value1.X / value2.X;
|
||||||
|
result.Y = value1.Y / value2.Y;
|
||||||
|
result.Z = value1.Z / value2.Z;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,60 +614,71 @@ namespace ANX.Framework
|
|||||||
return !value1.Equals(value2);
|
return !value1.Equals(value2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 operator *(float scaleFactor, Vector3 value)
|
public static Vector3 operator *(Vector3 value, float scaleFactor)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Multiply(ref value, scaleFactor, out result);
|
result.X = value.X * scaleFactor;
|
||||||
|
result.Y = value.Y * scaleFactor;
|
||||||
|
result.Z = value.Z * scaleFactor;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 operator *(Vector3 value, float scaleFactor)
|
public static Vector3 operator *(float scaleFactor, Vector3 value)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Multiply(ref value, scaleFactor, out result);
|
result.X = value.X * scaleFactor;
|
||||||
|
result.Y = value.Y * scaleFactor;
|
||||||
|
result.Z = value.Z * scaleFactor;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 operator *(Vector3 value1, Vector3 value2)
|
public static Vector3 operator *(Vector3 value1, Vector3 value2)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Multiply(ref value1, ref value2, out result);
|
result.X = value1.X * value2.X;
|
||||||
|
result.Y = value1.Y * value2.Y;
|
||||||
|
result.Z = value1.Z * value2.Z;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 operator -(Vector3 value1, Vector3 value2)
|
public static Vector3 operator -(Vector3 value1, Vector3 value2)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Subtract(ref value1, ref value2, out result);
|
result.X = value1.X - value2.X;
|
||||||
|
result.Y = value1.Y - value2.Y;
|
||||||
|
result.Z = value1.Z - value2.Z;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3 operator -(Vector3 value)
|
public static Vector3 operator -(Vector3 value)
|
||||||
{
|
{
|
||||||
Vector3 result;
|
Vector3 result = new Vector3();
|
||||||
Negate(ref value, out result);
|
result.X = value.X;
|
||||||
|
result.Y = value.Y;
|
||||||
|
result.Z = value.Z;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public Methods
|
#region Public Methods
|
||||||
|
|
||||||
public float Length()
|
public float Length()
|
||||||
{
|
{
|
||||||
return (float)Math.Sqrt(LengthSquared());
|
return (float)Math.Sqrt(this.X * this.X + this.Y * this.Y + this.Z * this.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float LengthSquared()
|
public float LengthSquared()
|
||||||
{
|
{
|
||||||
return (float)(Math.Pow(X, 2) + Math.Pow(Y, 2) + Math.Pow(Z, 2));
|
return this.X * this.X + this.Y * this.Y + this.Z * this.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Normalize()
|
public void Normalize()
|
||||||
{
|
{
|
||||||
Vector3 result;
|
float divFactor = 1f / this.Length();
|
||||||
Normalize(ref this, out result);
|
this.X = this.X * divFactor;
|
||||||
this = result;
|
this.Y = this.Y * divFactor;
|
||||||
|
this.Z = this.Z * divFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
@ -672,7 +694,7 @@ namespace ANX.Framework
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IEquatable implementation
|
#region IEquatable implementation
|
||||||
|
|
||||||
public override bool Equals(Object obj)
|
public override bool Equals(Object obj)
|
||||||
{
|
{
|
||||||
return (obj is Vector3) ? this.Equals((Vector3)obj) : false;
|
return (obj is Vector3) ? this.Equals((Vector3)obj) : false;
|
||||||
|
@ -240,20 +240,23 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result)
|
public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result)
|
||||||
{
|
{
|
||||||
result = (value1 - value2).Length();
|
Vector4 tmp;
|
||||||
|
Vector4.Subtract(ref value1, ref value2, out tmp);
|
||||||
|
result = tmp.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float DistanceSquared(Vector4 value1, Vector4 value2)
|
public static float DistanceSquared(Vector4 value1, Vector4 value2)
|
||||||
{
|
{
|
||||||
float result;
|
float result;
|
||||||
Vector4.Distance(ref value1, ref value2, out result);
|
Vector4.DistanceSquared(ref value1, ref value2, out result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result)
|
public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result)
|
||||||
{
|
{
|
||||||
result = (value1 - value2).LengthSquared();
|
Vector4 tmp;
|
||||||
|
Vector4.Subtract(ref value1, ref value2, out tmp);
|
||||||
|
result = tmp.LengthSquared();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector4 Divide(Vector4 value1, float divider)
|
public static Vector4 Divide(Vector4 value1, float divider)
|
||||||
@ -264,7 +267,10 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
public static void Divide(ref Vector4 value1, float divider, out Vector4 result)
|
public static void Divide(ref Vector4 value1, float divider, out Vector4 result)
|
||||||
{
|
{
|
||||||
result = value1 / divider;
|
result.X = value1.X / divider;
|
||||||
|
result.Y = value1.Y / divider;
|
||||||
|
result.Z = value1.Z / divider;
|
||||||
|
result.W = value1.W / divider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector4 Divide(Vector4 value1, Vector4 value2)
|
public static Vector4 Divide(Vector4 value1, Vector4 value2)
|
||||||
@ -276,7 +282,10 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public static void Divide(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
public static void Divide(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
||||||
{
|
{
|
||||||
result = value1 / value2;
|
result.X = value1.X / value2.X;
|
||||||
|
result.Y = value1.Y / value2.Y;
|
||||||
|
result.Z = value1.Z / value2.Z;
|
||||||
|
result.W = value1.W / value2.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float Dot(Vector4 vector1, Vector4 vector2)
|
public static float Dot(Vector4 vector1, Vector4 vector2)
|
||||||
@ -331,8 +340,8 @@ namespace ANX.Framework
|
|||||||
public static void Max(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
public static void Max(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
||||||
{
|
{
|
||||||
result.X = (value1.X > value2.X) ? value1.X : value2.X;
|
result.X = (value1.X > value2.X) ? value1.X : value2.X;
|
||||||
result.Y = (value1.Y > value2.Z) ? value1.Y : value2.Y;
|
result.Y = (value1.Y > value2.Y) ? value1.Y : value2.Y;
|
||||||
result.Z = (value1.Z > value2.Y) ? value1.Z : value2.Z;
|
result.Z = (value1.Z > value2.Z) ? value1.Z : value2.Z;
|
||||||
result.W = (value1.W > value2.W) ? value1.W : value2.W;
|
result.W = (value1.W > value2.W) ? value1.W : value2.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,8 +355,8 @@ namespace ANX.Framework
|
|||||||
public static void Min(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
public static void Min(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
||||||
{
|
{
|
||||||
result.X = (value1.X < value2.X) ? value1.X : value2.X;
|
result.X = (value1.X < value2.X) ? value1.X : value2.X;
|
||||||
result.Y = (value1.Y < value2.Z) ? value1.Y : value2.Y;
|
result.Y = (value1.Y < value2.Y) ? value1.Y : value2.Y;
|
||||||
result.Z = (value1.Z < value2.Y) ? value1.Z : value2.Z;
|
result.Z = (value1.Z < value2.Z) ? value1.Z : value2.Z;
|
||||||
result.W = (value1.W < value2.W) ? value1.W : value2.W;
|
result.W = (value1.W < value2.W) ? value1.W : value2.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,19 +369,25 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result)
|
public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result)
|
||||||
{
|
{
|
||||||
result = value1 * scaleFactor;
|
result.X = value1.X * scaleFactor;
|
||||||
|
result.Y = value1.Y * scaleFactor;
|
||||||
|
result.Z = value1.Z * scaleFactor;
|
||||||
|
result.W = value1.W * scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector4 Multiply(Vector4 value1, Vector4 value2)
|
public static Vector4 Multiply(Vector4 value1, Vector4 value2)
|
||||||
{
|
{
|
||||||
Vector4 result;
|
Vector4 result;
|
||||||
Vector4.Max(ref value1, ref value2, out result);
|
Vector4.Multiply(ref value1, ref value2, out result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Multiply(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
public static void Multiply(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
||||||
{
|
{
|
||||||
result = value1 * value2;
|
result.X = value1.X * value2.X;
|
||||||
|
result.Y = value1.Y * value2.Y;
|
||||||
|
result.Z = value1.Z * value2.Z;
|
||||||
|
result.W = value1.W * value2.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector4 Negate(Vector4 value)
|
public static Vector4 Negate(Vector4 value)
|
||||||
@ -384,7 +399,10 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public static void Negate(ref Vector4 value, out Vector4 result)
|
public static void Negate(ref Vector4 value, out Vector4 result)
|
||||||
{
|
{
|
||||||
result = -value;
|
result.X = -value.X;
|
||||||
|
result.Y = -value.Y;
|
||||||
|
result.Z = -value.Z;
|
||||||
|
result.W = -value.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector4 Normalize(Vector4 vector)
|
public static Vector4 Normalize(Vector4 vector)
|
||||||
@ -397,7 +415,10 @@ namespace ANX.Framework
|
|||||||
public static void Normalize(ref Vector4 vector, out Vector4 result)
|
public static void Normalize(ref Vector4 vector, out Vector4 result)
|
||||||
{
|
{
|
||||||
float divider = 1f / vector.Length();
|
float divider = 1f / vector.Length();
|
||||||
result = vector * divider;
|
result.X = vector.X * divider;
|
||||||
|
result.Y = vector.Y * divider;
|
||||||
|
result.Z = vector.Z * divider;
|
||||||
|
result.W = vector.W * divider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount)
|
public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount)
|
||||||
@ -424,7 +445,10 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
|
||||||
{
|
{
|
||||||
result = value1 - value2;
|
result.X = value1.X - value2.X;
|
||||||
|
result.Y = value1.Y - value2.Y;
|
||||||
|
result.Z = value1.Z - value2.Z;
|
||||||
|
result.W = value1.W - value2.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector4 Transform(Vector2 position, Matrix matrix)
|
public static Vector4 Transform(Vector2 position, Matrix matrix)
|
||||||
@ -513,7 +537,11 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public void Normalize()
|
public void Normalize()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
float divider = 1f / this.Length();
|
||||||
|
this.X *= divider;
|
||||||
|
this.Y *= divider;
|
||||||
|
this.Z *= divider;
|
||||||
|
this.W *= divider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
@ -533,13 +561,13 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public float LengthSquared()
|
public float LengthSquared()
|
||||||
{
|
{
|
||||||
return (this.X * this.X + this.Y * this.Y + this.Z * this.Z + this.W * this.W);
|
return this.X * this.X + this.Y * this.Y + this.Z * this.Z + this.W * this.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IEquatable implementation
|
#region IEquatable implementation
|
||||||
|
|
||||||
public override bool Equals(Object obj)
|
public override bool Equals(Object obj)
|
||||||
{
|
{
|
||||||
return (obj is Vector4) ? this.Equals((Vector4)obj) : false;
|
return (obj is Vector4) ? this.Equals((Vector4)obj) : false;
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.Research.Kinect, Version=1.0.0.45, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Research.Kinect, Version=1.0.0.45, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\lib\KinectSDK\Microsoft.Research.Kinect.dll</HintPath>
|
<HintPath>..\..\lib\KinectSDK\Microsoft.Research.Kinect.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user