com.jme.math
Class Plane

java.lang.Object
  extended bycom.jme.math.Plane

public class Plane
extends java.lang.Object

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.

Version:
$Id: Plane.java,v 1.6 2004/07/30 23:14:53 cep21 Exp $
Author:
Mark Powell

Field Summary
 float constant
          Constant of the plane.
static int NEGATIVE_SIDE
          NEGATIVE_SIDE represents a point on the opposite side the normal points.
static int NO_SIDE
          NO_SIDE represents the plane itself.
 Vector3f normal
          Vector normal to the plane.
static int POSITIVE_SIDE
          POSITIVE_SIDE represents a point on the side the normal points.
 
Constructor Summary
Plane()
          Constructor instantiates a new Plane object.
Plane(Vector3f normal, float constant)
          Constructor instantiates a new Plane object.
 
Method Summary
 float getConstant()
          getConstant returns the constant of the plane.
 Vector3f getNormal()
          getNormal retrieves the normal of the plane.
 float pseudoDistance(Vector3f point)
          pseudoDistance calculates the distance from this plane to a provided point.
 void setConstant(float constant)
          setConstant sets the constant value that helps define the plane.
 void setNormal(Vector3f normal)
          setNormal sets the normal of the plane.
 java.lang.String toString()
          toString returns a string thta represents the string representation of this plane.
 int whichSide(Vector3f point)
          whichSide returns the side at which a point lies on the plane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_SIDE

public static final int NO_SIDE
NO_SIDE represents the plane itself.

See Also:
Constant Field Values

POSITIVE_SIDE

public static final int POSITIVE_SIDE
POSITIVE_SIDE represents a point on the side the normal points.

See Also:
Constant Field Values

NEGATIVE_SIDE

public static final int NEGATIVE_SIDE
NEGATIVE_SIDE represents a point on the opposite side the normal points.

See Also:
Constant Field Values

normal

public Vector3f normal
Vector normal to the plane.


constant

public float constant
Constant of the plane. See formula in class definition.

Constructor Detail

Plane

public Plane()
Constructor instantiates a new Plane object. This is the default object and contains a normal of (0,0,0) and a constant of 0.


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.
Method Detail

setNormal

public void setNormal(Vector3f normal)
setNormal sets the normal of the plane.

Parameters:
normal - the new normal of the plane.

getNormal

public Vector3f getNormal()
getNormal retrieves the normal of the plane.

Returns:
the normal of the plane.

setConstant

public void setConstant(float constant)
setConstant sets the constant value that helps define the plane.

Parameters:
constant - the new constant value.

getConstant

public float getConstant()
getConstant returns the constant of the plane.

Returns:
the constant of the plane.

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.

whichSide

public int whichSide(Vector3f point)
whichSide returns the side at which a point lies on the plane. The positive values returned are: NEGATIVE_SIDE, POSITIVE_SIDE and NO_SIDE.

Parameters:
point - the point to check.
Returns:
the side at which the point lies.

toString

public java.lang.String toString()
toString returns a string thta represents the string representation of this plane. It represents the normal as a Vector3f object, so the format is the following: com.jme.math.Plane [Normal: org.jme.math.Vector3f [X=XX.XXXX, Y=YY.YYYY, Z=ZZ.ZZZZ] - Constant: CC.CCCCC]

Returns:
the string representation of this plane.