com.threed.jpct
Class Plane

java.lang.Object
  extended bycom.threed.jpct.Plane

public class Plane
extends java.lang.Object

A simple class to represent a plane. jPCT is using this for collision detection. It can also be used to add additional clipping planes when using a hardware renderer.


Constructor Summary
Plane()
          Creates a undefined plane.
Plane(SimpleVector point, SimpleVector normal)
          Constructs a plane from a point on the plane and a normal
Plane(SimpleVector p0, SimpleVector p1, SimpleVector p2)
          Constructs a plane from three points that lie within the plane.
 
Method Summary
 float distanceTo(SimpleVector point)
          Calculates the shortest (signed) distance from a point to the plane.
 boolean isFrontFacingTo(SimpleVector point)
          Tests is the plane is facing the point or if the point is located "behind" the plane.
 void setTo(SimpleVector point, SimpleVector normal)
          Sets the plane's attributes to new ones.
 void setTo(SimpleVector p0, SimpleVector p1, SimpleVector p2)
          Sets the plane's attributes to new ones.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Plane

public Plane()
Creates a undefined plane. This has to be filled by calling setTo() to be useful.


Plane

public Plane(SimpleVector point,
             SimpleVector normal)
Constructs a plane from a point on the plane and a normal

Parameters:
point - the point on the plane
normal - the plane's normal

Plane

public Plane(SimpleVector p0,
             SimpleVector p1,
             SimpleVector p2)
Constructs a plane from three points that lie within the plane.

Parameters:
p0 - first point
p1 - second point
p2 - third point
Method Detail

setTo

public void setTo(SimpleVector point,
                  SimpleVector normal)
Sets the plane's attributes to new ones.

Parameters:
point - the point on the plane
normal - the plane's normal

setTo

public void setTo(SimpleVector p0,
                  SimpleVector p1,
                  SimpleVector p2)
Sets the plane's attributes to new ones.

Parameters:
p0 - first point
p1 - second point
p2 - third point

isFrontFacingTo

public boolean isFrontFacingTo(SimpleVector point)
Tests is the plane is facing the point or if the point is located "behind" the plane.

Parameters:
point - the point
Returns:
true if the point lies in front of the plane, otherwise false

distanceTo

public float distanceTo(SimpleVector point)
Calculates the shortest (signed) distance from a point to the plane.

Parameters:
point - the point
Returns:
the distance