org.openmali.spatial.bodies
Class Plane

java.lang.Object
  extended by org.openmali.spatial.bodies.Plane
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public final class Plane
extends java.lang.Object
implements java.io.Externalizable

A Plane.

See Also:
Serialized Form

Constructor Summary
Plane()
          Useless Plane constructor.
Plane(float a, float b, float c, float d)
          Plane constructor comment.
Plane(Plane plane)
          Plane constructor comment.
Plane(Vector3f normal, float d)
          Plane constructor comment.
 
Method Summary
 float distanceTo(float x, float y, float z)
          Classifies a point with respect to the plane.
 float distanceTo(Tuple3f v)
          Classifies a point with respect to the plane.
static Plane fromPool()
           
 float getA()
           
 float getB()
           
 float getC()
           
 float getD()
           
 Vector3f getNormal()
           
 float getNX()
           
 float getNY()
           
 float getNZ()
           
 boolean intersects(Plane rkPlane1)
           
 boolean intersects(Plane rkPlane1, Line rkLine)
          Computes the intersection line between this plane and incoming plane rkPlane1.
 boolean intersects(Point3f rayOrigin, Vector3f rayDirection)
          Does a ray intersection test with this.
 boolean intersects(Point3f rayOrigin, Vector3f rayDirection, Tuple3f intersection)
          Does a ray intersection test with this.
 boolean intersects(Ray3f ray)
          Does a ray intersection test with this.
 boolean intersects(Ray3f ray, Tuple3f intersection)
          Does a ray intersection test with this.
 float intersectsSegment(Tuple3f va, Tuple3f vb, Tuple3f intersection)
           
 Plane normalize()
          Normalizes this plane (i.e. the vector (a,b,c) becomes unit length) This also scales d to compensate.
 float rayIntersectionParametric(Point3f rayOrigin, Vector3f dir, Tuple3f intersection)
           
 float rayIntersectionParametric(Ray3f ray, Tuple3f intersection)
           
 void readExternal(java.io.ObjectInput in)
          readExternal method comment.
 boolean segmentIntersection(Point3f from, Point3f to, Tuple3f intersect)
           
 void set(float a, float b, float c, float d)
          Insert the method's description here.
 void set(Plane plane)
          Insert the method's description here.
 void setA(float a)
           
 void setB(float b)
           
 void setC(float c)
           
 void setD(float d)
           
 void setNormal(Vector3f normal)
           
static void toPool(Plane plane)
          Pushes a Plane-instance to the pool.
 java.lang.String toString()
          
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Plane

public Plane(float a,
             float b,
             float c,
             float d)
Plane constructor comment.

Parameters:
a -
b -
c -
d -

Plane

public Plane(Vector3f normal,
             float d)
Plane constructor comment.

Parameters:
normal -
d -

Plane

public Plane(Plane plane)
Plane constructor comment.

Parameters:
plane -

Plane

public Plane()
Useless Plane constructor.

Method Detail

setNormal

public void setNormal(Vector3f normal)

getNormal

public final Vector3f getNormal()
Returns:
the normal to this Plane.

setA

public void setA(float a)

getA

public final float getA()

getNX

public final float getNX()

setB

public void setB(float b)

getB

public final float getB()

getNY

public final float getNY()

setC

public void setC(float c)

getC

public final float getC()

getNZ

public final float getNZ()

setD

public void setD(float d)

getD

public final float getD()

distanceTo

public final float distanceTo(float x,
                              float y,
                              float z)
Classifies a point with respect to the plane. Classifying a point with respect to a plane is done by passing the (x, y, z) values of the point into the plane equation, Ax + By + Cz + D = 0. The result of this operation is the distance from the plane to the point along the plane's normal Vec3f. It will be positive if the point is on the side of the plane pointed to by the normal Vec3f, negative otherwise. If the result is 0, the point is on the plane.


distanceTo

public final float distanceTo(Tuple3f v)
Classifies a point with respect to the plane. Classifying a point with respect to a plane is done by passing the (x, y, z) values of the point into the plane equation, Ax + By + Cz + D = 0. The result of this operation is the distance from the plane to the point along the plane's normal Vec3f. It will be positive if the point is on the side of the plane pointed to by the normal Vec3f, negative otherwise. If the result is 0, the point is on the plane.


intersects

public boolean intersects(Plane rkPlane1,
                          Line rkLine)
Computes the intersection line between this plane and incoming plane rkPlane1. The intersection is returned in rkLine unless the planes do not intersect, in which case the function returns false and no data is changed. Thanks to magic software for this one.


rayIntersectionParametric

public float rayIntersectionParametric(Point3f rayOrigin,
                                       Vector3f dir,
                                       Tuple3f intersection)
Parameters:
rayOrigin -
dir -
intersection -
Returns:
NaN if ray is parallel to plane, t which has to be multipled by dir to get intersection point

rayIntersectionParametric

public float rayIntersectionParametric(Ray3f ray,
                                       Tuple3f intersection)
Parameters:
ray -
intersection -
Returns:
NaN if ray is parallel to plane, t which has to be multipled by dir to get intersection point

intersects

public boolean intersects(Point3f rayOrigin,
                          Vector3f rayDirection,
                          Tuple3f intersection)
Does a ray intersection test with this.

Parameters:
rayOrigin -
rayDirection -
intersection -
Returns:
true for an intersection

intersects

public boolean intersects(Ray3f ray,
                          Tuple3f intersection)
Does a ray intersection test with this.

Parameters:
ray -
intersection -
Returns:
true for an intersection

intersects

public boolean intersects(Point3f rayOrigin,
                          Vector3f rayDirection)
Does a ray intersection test with this.

Parameters:
rayOrigin -
rayDirection -
Returns:
true for an intersection

intersects

public boolean intersects(Ray3f ray)
Does a ray intersection test with this.

Parameters:
ray -
Returns:
true for an intersection

segmentIntersection

public boolean segmentIntersection(Point3f from,
                                   Point3f to,
                                   Tuple3f intersect)

intersectsSegment

public float intersectsSegment(Tuple3f va,
                               Tuple3f vb,
                               Tuple3f intersection)

intersects

public boolean intersects(Plane rkPlane1)

normalize

public Plane normalize()
Normalizes this plane (i.e. the vector (a,b,c) becomes unit length) This also scales d to compensate. Creation date: (05/02/2001 22:45:55)


readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
readExternal method comment.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

set

public void set(float a,
                float b,
                float c,
                float d)
Insert the method's description here. Creation date: (04/02/2001 21:59:03)


set

public void set(Plane plane)
Insert the method's description here. Creation date: (04/02/2001 21:59:03)


fromPool

public static final Plane fromPool()
Returns:
a Plane-instance from the pool.

toPool

public static final void toPool(Plane plane)
Pushes a Plane-instance to the pool.

Parameters:
plane -