public void TestStaticFn_TransformMatix44_i ()
{
Double pi; Maths.Pi (out pi);
Double piOver2 = pi / (Double) 2;
Double minusPi = -pi;
Vector2 v1 = new Vector2 (8, 70);
Matrix44 rotmati = Matrix44.Identity;
Matrix44 rotmat1; Matrix44.CreateRotationX(ref pi, out rotmat1);
Matrix44 rotmat2; Matrix44.CreateRotationY(ref piOver2, out rotmat2);
Matrix44 rotmat3; Matrix44.CreateRotationZ(ref minusPi, out rotmat3);
Matrix44 rotmat4 = rotmat1 * rotmat2 * rotmat3;
var tests = new Tuple<Vector2, Matrix44, Vector2>[]
{
//vector -> transform -> expected
new Tuple<Vector2, Matrix44, Vector2>(
v1, rotmati, v1),
new Tuple<Vector2, Matrix44, Vector2>(
v1, rotmat1, new Vector2 (8, -70)),
new Tuple<Vector2, Matrix44, Vector2>(
v1, rotmat2, new Vector2 (0, 70)),
new Tuple<Vector2, Matrix44, Vector2>(
v1, rotmat3, new Vector2 (-8, -70)),
new Tuple<Vector2, Matrix44, Vector2>(
v1, rotmat4, new Vector2 (0, 70)),
};
foreach (var test in tests)
{
Vector2 vec = test.Item1;
Matrix44 trans = test.Item2;
Vector2 expected = test.Item3;
Vector2 result;
Vector2.Transform (ref vec, ref trans, out result);
AssertEqualWithinReason (result, expected);
}
}