Esempio n. 1
0
 /**
  * <code>pseudoDistance</code> calculates the distance from this plane to a provided point. If the
  * point is on the negative side of the plane the distance returned is negative, otherwise it is
  * positive. If the point is on the plane, it is zero.
  *
  * @param point the point to check.
  * @return the signed distance from the plane to a point.
  */
 public float pseudoDistance(Vector3f point) {
   return normal.dot(point) - constant;
 }
Esempio n. 2
0
 /**
  * Initialize the Plane using the given 3 points as coplanar.
  *
  * @param v1 the first point
  * @param v2 the second point
  * @param v3 the third point
  */
 public void setPlanePoints(Vector3f v1, Vector3f v2, Vector3f v3) {
   normal.set(v2).subtractLocal(v1);
   normal.crossLocal(v3.x - v1.x, v3.y - v1.y, v3.z - v1.z).normalizeLocal();
   constant = normal.dot(v1);
 }
Esempio n. 3
0
 public Vector3f getClosestPoint(Vector3f point, Vector3f store) {
   //        float t = constant - normal.dot(point);
   //        return store.set(normal).multLocal(t).addLocal(point);
   float t = (constant - normal.dot(point)) / normal.dot(normal);
   return store.set(normal).multLocal(t).addLocal(point);
 }