<Line|User's Guide|Ray>

Plane

See Javadoc

Definition

A plane is defined by the equation N . (X - X0) = 0 where N = (a, b, c) and passes through the point X0 = (x0, y0, z0). X defines another point on this plane (x, y, z).

N . (X - X0) = 0 can be described as (N . X) + (N . -X0) = 0

or

(ax + by + cz) + (-ax0-by0-cz0) = 0

where (-ax0-by0-cz0) = d

Where d is the negative value of a point in the plane times the unit vector describing the orientation of the plane.

This gives us the general equation: (ax + by + cz + d = 0)

Usage in jME

jME defines the Plane as ax + by + cz = -d. Therefore, during creation of the plane, the normal of the plane (a,b,c) and the constant d is supplied.

The most common usage of Plane is Camera frustum planes. Therefore, the primary purpose of Plane is to determine if a point is on the positive side, negative side, or intersecting a plane.

Plane defines the constants:

  • NEGATIVE_SIDE - represents a point on the opposite side to which the normal points.
  • NO_SIDE - represents a point that lays on the plane itself.
  • POSITIVE_SIDE - represents a point on the side to which the normal points.

These values are returned on a call to whichSide.

Example 1 - Determining if a Point is On the Positive Side of a Plane

Vector3f normal = new Vector3f(0,1,0);
float constant = new Vector3f(1,1,1).dot(normal);
Plane testPlane = new Plane(normal, constant);
 
int side = testPlane.whichSide(new Vector3f(2,1,0);
 
if(side == Plane.NO_SIDE) {
   System.out.println("This point lies on the plane");
}

<Line|User's Guide|Ray>


/var/www/wiki/data/pages/plane.txt · Last modified: 2009/07/28 18:44 (external edit)  
Recent changes · Show pagesource · Login

Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

subscribe to jME latest jme headlines


site design by bleedcrimson designs © 2008