jglcore
Class JGL_3DPlane

java.lang.Object
  extended by jglcore.JGL_3DPlane

public final class JGL_3DPlane
extends java.lang.Object

Representation of a plane in a 3D space.

Author:
Nicolas Devere

Field Summary
 float constant
          Position constant
 JGL_3DVector normal
          Normal vector
 
Constructor Summary
JGL_3DPlane(float a, float b, float c, float d)
          Constructs a plane given its 4 values : a 3D normal vector and a position constant.
JGL_3DPlane(JGL_3DVector p1, JGL_3DVector p2, JGL_3DVector p3)
          Constructs a plane given 3 points.
 
Method Summary
 void assign(JGL_3DPlane arg)
          Assigns values of the specified plane to this plane.
 void assign(JGL_3DVector p1, JGL_3DVector p2, JGL_3DVector p3)
          Assigns a new plane defined by the specified 3 points.
 boolean before(JGL_3DVector point)
          Returns if the specified point is before the plane.
 boolean behind(JGL_3DVector point)
          Returns if the specified point is behind the plane.
 float distance(JGL_3DVector point)
          Returns the distance between the specified point and the plane.
 boolean inside(JGL_3DVector point)
          Returns if the specified point is inside the plane.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

normal

public JGL_3DVector normal
Normal vector


constant

public float constant
Position constant

Constructor Detail

JGL_3DPlane

public JGL_3DPlane(JGL_3DVector p1,
                   JGL_3DVector p2,
                   JGL_3DVector p3)
Constructs a plane given 3 points. The plane's front side is the one where the points are disposed in the counter clockwise order.

Parameters:
p1 - : the first point
p2 - : the second point
p3 - : the third point

JGL_3DPlane

public JGL_3DPlane(float a,
                   float b,
                   float c,
                   float d)
Constructs a plane given its 4 values : a 3D normal vector and a position constant.

Parameters:
a - : the normal vector's X value
b - : the normal vector's Y value
c - : the normal vector's Z value
d - : the position constant
Method Detail

assign

public void assign(JGL_3DVector p1,
                   JGL_3DVector p2,
                   JGL_3DVector p3)
Assigns a new plane defined by the specified 3 points.

Parameters:
p1 - : the first point
p2 - : the second point
p3 - : the third point

assign

public void assign(JGL_3DPlane arg)
Assigns values of the specified plane to this plane.

Parameters:
arg - : the plane to assign

distance

public float distance(JGL_3DVector point)
Returns the distance between the specified point and the plane.

Parameters:
point - : the point
Returns:
the distance between the specified point and the plane

before

public boolean before(JGL_3DVector point)
Returns if the specified point is before the plane.

Parameters:
point - : the point
Returns:
true if the point is before the plane (distance GT JGL_Math.EPSILON), false otherwise

inside

public boolean inside(JGL_3DVector point)
Returns if the specified point is inside the plane.

Parameters:
point - : the point
Returns:
true if the point is inside the plane (absolute value of the distance LT -JGL_Math.EPSILON), false otherwise

behind

public boolean behind(JGL_3DVector point)
Returns if the specified point is behind the plane.

Parameters:
point - : the point
Returns:
true if the point is before the plane (distance LT -JGL_Math.EPSILON), false otherwise