Ejemplo n.º 1
0
  public static float distance(GVRTransform obj1, float[] obj2) {

    Vector3d v1 = new Vector3d(obj1.getPositionX(), obj1.getPositionY(), obj1.getPositionZ());

    Vector3d v2 = new Vector3d(obj2[0], obj2[1], obj2[2]);

    return (float) v1.distance(v2);
  }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
  public static float distance(GVRSceneObject obj1, GVRSceneObject obj2) {

    Vector3d v1 =
        new Vector3d(
            obj1.getTransform().getPositionX(),
            obj1.getTransform().getPositionY(),
            obj1.getTransform().getPositionZ());

    Vector3d v2 =
        new Vector3d(
            obj2.getTransform().getPositionX(),
            obj2.getTransform().getPositionY(),
            obj2.getTransform().getPositionZ());

    return (float) v1.distance(v2);
  }