fix Matrix.Divide(ref Matrix matrix1, ref Matrix matrix2, out Matrix result)
fix MathHelpers.WrapAngle(float angle) add MatrixTest.Invert() Modified GamePaddPadTest
This commit is contained in:
parent
ceafc20244
commit
a201b8092e
@ -152,14 +152,11 @@ namespace ANX.Framework.TestCenter.Input
|
||||
ANXGamePadDPad anx = new ANXGamePadDPad(upValue, downValue, leftValue, rightValue);
|
||||
ANXGamePadDPad anx2 = new ANXGamePadDPad(upValue, downValue, leftValue, rightValue);
|
||||
|
||||
if (anx.Equals(anx2))
|
||||
{
|
||||
Assert.Pass("Pass Equal");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail("Fail Equal");
|
||||
}
|
||||
XNAGamePadDPad xna = new XNAGamePadDPad(upValue2, downValue2, leftValue2, rightValue2);
|
||||
XNAGamePadDPad xna2 = new XNAGamePadDPad(upValue2, downValue2, leftValue2, rightValue2);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2),"Equal");
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void Equal2()
|
||||
@ -182,14 +179,11 @@ namespace ANX.Framework.TestCenter.Input
|
||||
ANXGamePadDPad anx = new ANXGamePadDPad(upValue, downValue, leftValue, rightValue);
|
||||
ANXGamePadDPad anx2 = new ANXGamePadDPad(upValue, downValue, leftValue, rightValue);
|
||||
|
||||
if (!(anx != anx2))
|
||||
{
|
||||
Assert.Pass("Pass !=");
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail("Fail !=");
|
||||
}
|
||||
XNAGamePadDPad xna = new XNAGamePadDPad(upValue2, downValue2, leftValue2, rightValue2);
|
||||
XNAGamePadDPad xna2 = new XNAGamePadDPad(upValue2, downValue2, leftValue2, rightValue2);
|
||||
|
||||
AssertHelper.ConvertEquals(xna != xna2, anx != anx2, "OperatorNoEqual");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,17 @@ namespace ANX.Framework.TestCenter.Strukturen
|
||||
|
||||
AssertHelper.ConvertEquals(xnaM1 / xnaM2, anxM1 / anxM2, "DivideOperator");
|
||||
}
|
||||
[Test, TestCaseSource("sixteenfloats")]
|
||||
public void Invert(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
|
||||
{
|
||||
XNAMatrix xnaM1 = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||
XNAMatrix xnaM2 = new XNAMatrix();
|
||||
|
||||
ANXMatrix anxM1 = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
|
||||
ANXMatrix anxM2 = new ANXMatrix();
|
||||
|
||||
AssertHelper.ConvertEquals(xnaM2, anxM2, "DivideOperator");
|
||||
}
|
||||
[Test, TestCaseSource("sixteenfloats")]
|
||||
public void CreateRotationX(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
|
||||
{
|
||||
|
@ -177,15 +177,15 @@ namespace ANX.Framework
|
||||
public static float WrapAngle(float angle)
|
||||
{
|
||||
angle = (float)Math.IEEERemainder((double)angle, 6.2831854820251465); //2xPi precission is double
|
||||
if (angle <= -3.141593f)
|
||||
{
|
||||
angle += 6.283185f;
|
||||
return angle;
|
||||
}
|
||||
if (angle > 3.141593f)
|
||||
{
|
||||
angle -= 6.283185f;
|
||||
}
|
||||
//if (angle <= -3.141593f)
|
||||
//{
|
||||
// angle += 6.283185f;
|
||||
// return angle;
|
||||
//}
|
||||
//if (angle > 3.141593f)
|
||||
//{
|
||||
// angle -= 6.283185f;
|
||||
//}
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
@ -282,9 +282,25 @@ namespace ANX.Framework
|
||||
|
||||
public static void Divide(ref Matrix matrix1, ref Matrix matrix2, out Matrix result)
|
||||
{
|
||||
Matrix invMatrix2;
|
||||
Invert(ref matrix2, out invMatrix2);
|
||||
Multiply(ref matrix1, ref invMatrix2, out result);
|
||||
result.M11 = matrix1.M11 / matrix2.M11;
|
||||
result.M21 = matrix1.M21 / matrix2.M21;
|
||||
result.M31 = matrix1.M31 / matrix2.M31;
|
||||
result.M41 = matrix1.M41 / matrix2.M41;
|
||||
|
||||
result.M12 = matrix1.M12 / matrix2.M12;
|
||||
result.M22 = matrix1.M22 / matrix2.M22;
|
||||
result.M32 = matrix1.M32 / matrix2.M32;
|
||||
result.M42 = matrix1.M42 / matrix2.M42;
|
||||
|
||||
result.M13 = matrix1.M13 / matrix2.M13;
|
||||
result.M23 = matrix1.M23 / matrix2.M23;
|
||||
result.M33 = matrix1.M33 / matrix2.M33;
|
||||
result.M43 = matrix1.M43 / matrix2.M43;
|
||||
|
||||
result.M14 = matrix1.M14 / matrix2.M14;
|
||||
result.M24 = matrix1.M24 / matrix2.M24;
|
||||
result.M34 = matrix1.M34 / matrix2.M34;
|
||||
result.M44 = matrix1.M44 / matrix2.M44;
|
||||
}
|
||||
|
||||
public static Matrix Divide(Matrix matrix1, float divider)
|
||||
@ -366,10 +382,7 @@ namespace ANX.Framework
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void Lerp(ref Matrix matrix1,
|
||||
ref Matrix matrix2,
|
||||
float amount,
|
||||
out Matrix result)
|
||||
public static void Lerp(ref Matrix matrix1, ref Matrix matrix2, float amount,out Matrix result)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user