public static void testPositiveXYZLookAt() { Vector3d dir = new Vector3d(); Matrix4x3d m = new Matrix4x3d().lookAt(0, 0, 0, -1, 0, 0, 0, 1, 0); m.positiveX(dir); TestUtil.assertVector3dEquals(new Vector3d(0, 0, -1).normalize(), dir, 1E-7f); m.positiveY(dir); TestUtil.assertVector3dEquals(new Vector3d(0, 1, 0).normalize(), dir, 1E-7f); m.positiveZ(dir); TestUtil.assertVector3dEquals(new Vector3d(1, 0, 0).normalize(), dir, 1E-7f); }
public static void testPositiveXYZSameAsInvert() { Vector3d dir = new Vector3d(); Vector3d dir2 = new Vector3d(); Matrix4x3d m = new Matrix4x3d().rotateXYZ(0.12f, 1.25f, -2.56f); Matrix4x3d inv = new Matrix4x3d(m).invert(); m.positiveX(dir); inv.transformDirection(dir2.set(1, 0, 0)); TestUtil.assertVector3dEquals(dir2, dir, 1E-6f); m.positiveY(dir); inv.transformDirection(dir2.set(0, 1, 0)); TestUtil.assertVector3dEquals(dir2, dir, 1E-6f); m.positiveZ(dir); inv.transformDirection(dir2.set(0, 0, 1)); TestUtil.assertVector3dEquals(dir2, dir, 1E-6f); }
public static void testPositiveZRotateX() { Vector3d dir = new Vector3d(); Matrix4x3d m = new Matrix4x3d().rotateX((float) Math.toRadians(90)); m.positiveZ(dir); TestUtil.assertVector3dEquals(new Vector3d(0, 1, 0), dir, 1E-7f); }