/** * Initialize this plane using the three points of the given triangle. * * @param t * the triangle */ public void setPlanePoints(AbstractTriangle t) { setPlanePoints(t.get1(), t.get2(), t.get3()); }
public int collideWith(Collidable other, CollisionResults results) { if (other instanceof BoundingVolume) { BoundingVolume bv = (BoundingVolume) other; return bv.collideWith(this, results); } else if (other instanceof AbstractTriangle) { AbstractTriangle tri = (AbstractTriangle) other; float d = intersects(tri.get1(), tri.get2(), tri.get3()); if (Float.isInfinite(d) || Float.isNaN(d)) { return 0; } Vector3f point = new Vector3f(direction).multLocal(d).addLocal(origin); results.addCollision(new CollisionResult(point, d)); return 1; } else { throw new UnsupportedCollisionException(); } }
private CollisionResult collideWithTriangle(AbstractTriangle tri){ scaledTri.get1().set(tri.get1()).multLocal(invDim); scaledTri.get2().set(tri.get2()).multLocal(invDim); scaledTri.get3().set(tri.get3()).multLocal(invDim);
/** * Initialize this plane using the three points of the given triangle. * * @param t * the triangle */ public void setPlanePoints(AbstractTriangle t) { setPlanePoints(t.get1(), t.get2(), t.get3()); }
/** * Initialize this plane using the three points of the given triangle. * * @param t * the triangle */ public void setPlanePoints(AbstractTriangle t) { setPlanePoints(t.get1(), t.get2(), t.get3()); }
public int collideWith(Collidable other, CollisionResults results) { if (other instanceof BoundingVolume) { BoundingVolume bv = (BoundingVolume) other; return bv.collideWith(this, results); } else if (other instanceof AbstractTriangle) { AbstractTriangle tri = (AbstractTriangle) other; float d = intersects(tri.get1(), tri.get2(), tri.get3()); if (Float.isInfinite(d) || Float.isNaN(d)) { return 0; } Vector3f point = new Vector3f(direction).multLocal(d).addLocal(origin); results.addCollision(new CollisionResult(point, d)); return 1; } else { throw new UnsupportedCollisionException(); } }
public int collideWith(Collidable other, CollisionResults results) { if (other instanceof BoundingVolume) { BoundingVolume bv = (BoundingVolume) other; return bv.collideWith(this, results); } else if (other instanceof AbstractTriangle) { AbstractTriangle tri = (AbstractTriangle) other; float d = intersects(tri.get1(), tri.get2(), tri.get3()); if (Float.isInfinite(d) || Float.isNaN(d)) { return 0; } Vector3f point = new Vector3f(direction).multLocal(d).addLocal(origin); results.addCollision(new CollisionResult(point, d)); return 1; } else { throw new UnsupportedCollisionException(); } }
private CollisionResult collideWithTriangle(AbstractTriangle tri){ scaledTri.get1().set(tri.get1()).multLocal(invDim); scaledTri.get2().set(tri.get2()).multLocal(invDim); scaledTri.get3().set(tri.get3()).multLocal(invDim);
private CollisionResult collideWithTriangle(AbstractTriangle tri){ scaledTri.get1().set(tri.get1()).multLocal(invDim); scaledTri.get2().set(tri.get2()).multLocal(invDim); scaledTri.get3().set(tri.get3()).multLocal(invDim);