public void TestStaticFn_TransformMatix44_i ()
{
Double pi; Maths.Pi (out pi);
Double piOver2 = pi / (Double) 2;
Double minusPi = -pi;
Vector3 v1 = new Vector3 (10, 50, -20);
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<Vector3, Matrix44, Vector3>[]
{
//vector -> transform -> expected
new Tuple<Vector3, Matrix44, Vector3>(
v1, rotmati, v1),
new Tuple<Vector3, Matrix44, Vector3>(
v1, rotmat1, new Vector3 (10, -50, 20)),
new Tuple<Vector3, Matrix44, Vector3>(
v1, rotmat2, new Vector3 (-20, 50, -10)),
new Tuple<Vector3, Matrix44, Vector3>(
v1, rotmat3, new Vector3 (-10, -50, -20)),
new Tuple<Vector3, Matrix44, Vector3>(
v1, rotmat4, new Vector3 (-20, 50, -10))
};
for (Int32 i = 0; i < tests.Length; ++i)
{
var test = tests [i];
Vector3 vec = test.Item1;
Matrix44 trans = test.Item2;
Vector3 expected = test.Item3;
Vector3 result;
Vector3.Transform (ref vec, ref trans, out result);
AssertEqualWithinReason(result, expected);
}
}