Package com.jme3.math

Class Plane

java.lang.Object
com.jme3.math.Plane
All Implemented Interfaces:
Serializable, Cloneable

public class Plane extends Object implements Cloneable, Serializable
Plane defines a plane where Normal dot (x,y,z) = Constant. This provides methods for calculating a "distance" of a point from this plane. The distance is pseudo due to the fact that it can be negative if the point is on the non-normal side of the plane.
See Also:
  • Field Details

    • normal

      protected Vector3f normal
      Vector normal to the plane.
    • constant

      protected float constant
      Constant of the plane. See formula in class definition.
  • Constructor Details

    • Plane

      public Plane(Vector3f normal, float constant)
      Constructor instantiates a new Plane object. The normal and constant values are set at creation.
      Parameters:
      normal - the normal of the plane.
      constant - the constant of the plane.
    • Plane

      public Plane(Vector3f normal, Vector3f displacement)
      Constructor instantiates a new Plane object.
      Parameters:
      normal - The normal of the plane.
      displacement - A vector representing a point on the plane.
  • Method Details

    • getNormal

      public Vector3f getNormal()
      getNormal retrieves the normal of the plane.
      Returns:
      the normal of the plane.
    • getConstant

      public float getConstant()
      getConstant returns the constant of the plane.
      Returns:
      the constant of the plane.
    • getClosestPoint

      public Vector3f getClosestPoint(Vector3f point, Vector3f store)
      Find the point in this plane that's nearest to the specified point.
      Parameters:
      point - the location of the input point (not null, unaffected)
      store - storage for the result (not null, modified)
      Returns:
      the location of the nearest point (store)
    • pseudoDistance

      public float pseudoDistance(Vector3f point)
      pseudoDistance 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.
      Parameters:
      point - the point to check.
      Returns:
      the signed distance from the plane to a point.
    • toString

      public String toString()
      toString returns a string representation of this plane. It represents the normal as a Vector3f, so the format is: Plane [Normal: (X.XXXX, Y.YYYY, Z.ZZZZ) - Constant: C.CCCC]
      Overrides:
      toString in class Object
      Returns:
      the string representation of this plane.
    • clone

      public Plane clone()
      Create a copy of this plane.
      Overrides:
      clone in class Object
      Returns:
      a new instance, equivalent to this one