vclip
Class Plane

java.lang.Object
  extended byvclip.Plane

public class Plane
extends java.lang.Object

A plane in space.

Author:
Brian Mirtich (C++ version), Eddy Boxerman (Java port)
See Also:
Copyright information

Constructor Summary
Plane()
          Constructs a Plane with zero normal and offset.
Plane(javax.vecmath.Vector3d normal, javax.vecmath.Point3d point)
          Constructs a Plane based on a normal vector and a point.
 
Method Summary
 double distance(javax.vecmath.Point3d point)
          Computes a signed distance from a point to this plane, by taking the dot product of the point and the normal, and adding the plane offset.
 javax.vecmath.Vector3d getNormal()
          Gets the normal of this plane.
 double getOffset()
          Gets the offset of this plane.
 void planeTransform(vclip.Matrix4dX P, javax.vecmath.Point3d origin)
          Returns a 4x4 matrix which maps points into a coordinate system with a specified origin and whose x-y plane is parallel to this plane.
 void projectionMatrix(javax.vecmath.Matrix4d P)
          Returns a 4x4 matrix which projects points onto this plane.
 void set(javax.vecmath.Vector3d normal, double offset)
          Sets this plane based on a normal vector and an offset.
 void set(javax.vecmath.Vector3d normal, javax.vecmath.Point3d point)
          Sets this plane based on a normal vector and a point.
 java.lang.String toString()
          Returns a string representation of this plane.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Plane

public Plane()
Constructs a Plane with zero normal and offset.


Plane

public Plane(javax.vecmath.Vector3d normal,
             javax.vecmath.Point3d point)
Constructs a Plane based on a normal vector and a point.

Parameters:
normal - normal to the plane. This should be of unit length if distance is to work properly
point - point on the plane
Method Detail

set

public final void set(javax.vecmath.Vector3d normal,
                      javax.vecmath.Point3d point)
Sets this plane based on a normal vector and a point.

Parameters:
normal - normal to the plane. This should be of unit length if distance is to work properly
point - point on the plane

set

public final void set(javax.vecmath.Vector3d normal,
                      double offset)
Sets this plane based on a normal vector and an offset. The offset is defined as the negative of the dot product of the plane normal with any point on the plane.

Parameters:
normal - normal to the plane. This should be of unit length if distance is to work properly
offset - offset for the plane

distance

public final double distance(javax.vecmath.Point3d point)
Computes a signed distance from a point to this plane, by taking the dot product of the point and the normal, and adding the plane offset. A unit length normal is assumed.

Parameters:
point - point to compute the distance from

toString

public final java.lang.String toString()
Returns a string representation of this plane.

Returns:
string representation

getNormal

public javax.vecmath.Vector3d getNormal()
Gets the normal of this plane.

Returns:
plane normal

getOffset

public double getOffset()
Gets the offset of this plane. The offset is defined as the negative of the dot product of the plane normal with any point on the plane.

Returns:
plane offset

projectionMatrix

public void projectionMatrix(javax.vecmath.Matrix4d P)
Returns a 4x4 matrix which projects points onto this plane.


planeTransform

public void planeTransform(vclip.Matrix4dX P,
                           javax.vecmath.Point3d origin)
Returns a 4x4 matrix which maps points into a coordinate system with a specified origin and whose x-y plane is parallel to this plane.