/** * Returns the pseudo distance from the given position to the near * plane of the camera. This is used for render queue sorting. * @param pos The position to compute a distance to. * @return Distance from the near plane to the point. */ public float distanceToNearPlane(Vector3f pos) { return worldPlane[NEAR_PLANE].pseudoDistance(pos); }
public boolean isOnPlane(Vector3f point){ float dist = pseudoDistance(point); if (dist < FastMath.FLT_EPSILON && dist > -FastMath.FLT_EPSILON) return true; else return false; }
/** * <code>whichSide</code> takes a plane (typically provided by a view * frustum) to determine which side this bound is on. * * @param plane * the plane to check against. * @return side */ public Plane.Side whichSide(Plane plane) { float distance = plane.pseudoDistance(center); if (distance <= -radius) { return Plane.Side.Negative; } else if (distance >= radius) { return Plane.Side.Positive; } else { return Plane.Side.None; } }
/** * <code>whichSide</code> returns the side at which a point lies on the * plane. The positive values returned are: NEGATIVE_SIDE, POSITIVE_SIDE and * NO_SIDE. * * @param point * the point to check. * @return the side at which the point lies. */ public Side whichSide(Vector3f point) { float dis = pseudoDistance(point); if (dis < 0) { return Side.Negative; } else if (dis > 0) { return Side.Positive; } else { return Side.None; } }
public static boolean intersect(Camera camera, Vector3f center,float radius){ for (int i = 5; i >= 0; i--) { if (camera.getWorldPlane(i).pseudoDistance(center) <= -radius) { return false; } } return true; }
public Vector3f reflect(Vector3f point, Vector3f store){ if (store == null) store = new Vector3f(); float d = pseudoDistance(point); store.set(normal).negateLocal().multLocal(d * 2f); store.addLocal(point); return store; }
float dot = plane.pseudoDistance(position); if(dot < 0){ dot = plane.pseudoDistance(farPoint); if(dot < 0){ dot = plane.pseudoDistance(projectedPoint); if(dot < 0){
private boolean insidePlane(Plane p, Vector3f axis1, Vector3f axis2, Vector3f axis3, Vector3f tn) { // transform the plane normal in the box local space. tn.set(axis1.dot(p.getNormal()), axis2.dot(p.getNormal()), axis3.dot(p.getNormal())); // distance check float radius = FastMath.abs(tn.x) + FastMath.abs(tn.y) + FastMath.abs(tn.z); float distance = p.pseudoDistance(transform.getTranslation()); if (distance < -radius) { return false; } return true; }
/** * <code>whichSide</code> takes a plane (typically provided by a view * frustum) to determine which side this bound is on. * * @param plane * the plane to check against. */ public Plane.Side whichSide(Plane plane) { float radius = FastMath.abs(xExtent * plane.getNormal().getX()) + FastMath.abs(yExtent * plane.getNormal().getY()) + FastMath.abs(zExtent * plane.getNormal().getZ()); float distance = plane.pseudoDistance(center); //changed to < and > to prevent floating point precision problems if (distance < -radius) { return Plane.Side.Negative; } else if (distance > radius) { return Plane.Side.Positive; } else { return Plane.Side.None; } }
boolean embedded = false; float signedDistanceToPlane = triPlane.pseudoDistance(sCenter); if (normalDotVelocity == 0.0f){
public boolean isOnPlane(Vector3f point){ float dist = pseudoDistance(point); if (dist < FastMath.FLT_EPSILON && dist > -FastMath.FLT_EPSILON) return true; else return false; }
/** * Returns the pseudo distance from the given position to the near * plane of the camera. This is used for render queue sorting. * @param pos The position to compute a distance to. * @return Distance from the near plane to the point. */ public float distanceToNearPlane(Vector3f pos) { return worldPlane[NEAR_PLANE].pseudoDistance(pos); }
public boolean isOnPlane(Vector3f point){ float dist = pseudoDistance(point); if (dist < FastMath.FLT_EPSILON && dist > -FastMath.FLT_EPSILON) return true; else return false; }
/** * Returns the pseudo distance from the given position to the near * plane of the camera. This is used for render queue sorting. * @param pos The position to compute a distance to. * @return Distance from the far plane to the point. */ public float distanceToNearPlane(Vector3f pos) { return worldPlane[NEAR_PLANE].pseudoDistance(pos); }
/** * <code>whichSide</code> takes a plane (typically provided by a view * frustum) to determine which side this bound is on. * * @param plane * the plane to check against. * @return side */ public Plane.Side whichSide(Plane plane) { float distance = plane.pseudoDistance(center); if (distance <= -radius) { return Plane.Side.Negative; } else if (distance >= radius) { return Plane.Side.Positive; } else { return Plane.Side.None; } }
/** * <code>whichSide</code> takes a plane (typically provided by a view * frustum) to determine which side this bound is on. * * @param plane * the plane to check against. * @return side */ public Plane.Side whichSide(Plane plane) { float distance = plane.pseudoDistance(center); if (distance <= -radius) { return Plane.Side.Negative; } else if (distance >= radius) { return Plane.Side.Positive; } else { return Plane.Side.None; } }
@Override public boolean intersectsFrustum(Camera camera, TempVars vars) { if (this.radius == 0) { return true; } else { for (int i = 5; i >= 0; i--) { if (camera.getWorldPlane(i).pseudoDistance(position) <= -radius) { return false; } } return true; } }
public Vector3f reflect(Vector3f point, Vector3f store){ if (store == null) store = new Vector3f(); float d = pseudoDistance(point); store.set(normal).negateLocal().multLocal(d * 2f); store.addLocal(point); return store; }
public Vector3f reflect(Vector3f point, Vector3f store){ if (store == null) store = new Vector3f(); float d = pseudoDistance(point); store.set(normal).negateLocal().multLocal(d * 2f); store.addLocal(point); return store; }
/** * <code>whichSide</code> takes a plane (typically provided by a view * frustum) to determine which side this bound is on. * * @param plane * the plane to check against. */ public Plane.Side whichSide(Plane plane) { float radius = FastMath.abs(xExtent * plane.getNormal().getX()) + FastMath.abs(yExtent * plane.getNormal().getY()) + FastMath.abs(zExtent * plane.getNormal().getZ()); float distance = plane.pseudoDistance(center); //changed to < and > to prevent floating point precision problems if (distance < -radius) { return Plane.Side.Negative; } else if (distance > radius) { return Plane.Side.Positive; } else { return Plane.Side.None; } }