public void TestIdentity() { Matrix34 nativeMatrix = Matrix34.CreateIdentity(); Matrix3x4 managedMatrix = Matrix3x4.Identity; // Compare native to managed identity Assert.That(nativeMatrix.m00, Is.EqualTo(managedMatrix[0, 0])); Assert.That(nativeMatrix.m01, Is.EqualTo(managedMatrix[0, 1])); Assert.That(nativeMatrix.m02, Is.EqualTo(managedMatrix[0, 2])); Assert.That(nativeMatrix.m03, Is.EqualTo(managedMatrix[0, 3])); Assert.That(nativeMatrix.m10, Is.EqualTo(managedMatrix[1, 0])); Assert.That(nativeMatrix.m11, Is.EqualTo(managedMatrix[1, 1])); Assert.That(nativeMatrix.m12, Is.EqualTo(managedMatrix[1, 2])); Assert.That(nativeMatrix.m13, Is.EqualTo(managedMatrix[1, 3])); Assert.That(nativeMatrix.m20, Is.EqualTo(managedMatrix[2, 0])); Assert.That(nativeMatrix.m21, Is.EqualTo(managedMatrix[2, 1])); Assert.That(nativeMatrix.m22, Is.EqualTo(managedMatrix[2, 2])); Assert.That(nativeMatrix.m23, Is.EqualTo(managedMatrix[2, 3])); // Compare managed matrix to real values. Assert.That(managedMatrix[0, 0], Is.EqualTo(1)); Assert.That(managedMatrix[0, 1], Is.EqualTo(0)); Assert.That(managedMatrix[0, 2], Is.EqualTo(0)); Assert.That(managedMatrix[0, 3], Is.EqualTo(0)); Assert.That(managedMatrix[1, 0], Is.EqualTo(0)); Assert.That(managedMatrix[1, 1], Is.EqualTo(1)); Assert.That(managedMatrix[1, 2], Is.EqualTo(0)); Assert.That(managedMatrix[1, 3], Is.EqualTo(0)); Assert.That(managedMatrix[2, 0], Is.EqualTo(0)); Assert.That(managedMatrix[2, 1], Is.EqualTo(0)); Assert.That(managedMatrix[2, 2], Is.EqualTo(1)); Assert.That(managedMatrix[2, 3], Is.EqualTo(0)); }
public void TestTransformDirection() { //managed Vector3 vector3 = new Vector3(0.2f, 0.2f, 0.2f); Matrix3x4 matrix3x4 = Matrix3x4.Identity; Vector3 transVector3 = matrix3x4.TransformDirection(vector3); //native Vec3 vec3 = new Vec3(vector3.x, vector3.y, vector3.z); Matrix34 matrix34 = Matrix34.CreateIdentity(); Vec3 transVec3 = matrix34.TransformVector(vec3); Assert.IsTrue(transVector3.x == transVec3.x, "x is different"); Assert.IsTrue(transVector3.y == transVec3.y, "y is different"); Assert.IsTrue(transVector3.z == transVec3.z, "z is different"); Assert.IsTrue(transVector3 == transVec3, "vector is different"); }
public void TestIdentity() { Assert.That(true, Is.EqualTo(Matrix3x4.Identity == Matrix34.CreateIdentity())); Matrix3x4 managedmatrix = Matrix3x4.Identity; Assert.That(true, Is.EqualTo(managedmatrix == Matrix3x4.Identity)); Assert.That(managedmatrix.m00, Is.EqualTo(1)); Assert.That(managedmatrix.m01, Is.EqualTo(0)); Assert.That(managedmatrix.m02, Is.EqualTo(0)); Assert.That(managedmatrix.m03, Is.EqualTo(0)); Assert.That(managedmatrix.m10, Is.EqualTo(0)); Assert.That(managedmatrix.m11, Is.EqualTo(1)); Assert.That(managedmatrix.m12, Is.EqualTo(0)); Assert.That(managedmatrix.m13, Is.EqualTo(0)); Assert.That(managedmatrix.m20, Is.EqualTo(0)); Assert.That(managedmatrix.m21, Is.EqualTo(0)); Assert.That(managedmatrix.m22, Is.EqualTo(1)); Assert.That(managedmatrix.m23, Is.EqualTo(0)); }
public void TestTransformPoint() { //managed Vector3 point3 = new Vector3(0.2f, 0.2f, 0.2f); Matrix3x4 matrix3x4 = Matrix3x4.Identity; Vector3 transPoint3 = matrix3x4.TransformPoint(point3); //native Vec3 pt3 = new Vec3(point3.x, point3.y, point3.z); Matrix34 matrix34 = Matrix34.CreateIdentity(); Vec3 transPt3 = matrix34.TransformPoint(pt3); Assert.IsTrue(point3.x == pt3.x, "x is different"); Assert.IsTrue(point3.y == pt3.y, "y is different"); Assert.IsTrue(point3.z == pt3.z, "z is different"); Assert.IsTrue(point3 == pt3, "point is different"); Assert.IsTrue(transPoint3.x == transPt3.x, "x is different"); Assert.IsTrue(transPoint3.y == transPt3.y, "y is different"); Assert.IsTrue(transPoint3.z == transPt3.z, "z is different"); Assert.IsTrue(transPoint3 == transPt3, "point is different"); }