unbboolean.bool
Class Line

java.lang.Object
  |
  +--unbboolean.bool.Line
All Implemented Interfaces:
java.lang.Cloneable

public class Line
extends java.lang.Object
implements java.lang.Cloneable

Representation of a 3d line or a ray (represented by a direction and a point).

See: D. H. Laidlaw, W. B. Trumbore, and J. F. Hughes. "Constructive Solid Geometry for Polyhedral Objects" SIGGRAPH Proceedings, 1986, p.161.

Author:
Danilo Balby Silva Castanheira (danbalby@yahoo.com)

Constructor Summary
Line(Face face1, Face face2)
          Constructor for a line.
Line(javax.vecmath.Vector3d direction, javax.vecmath.Point3d point)
          Constructor for a ray
 
Method Summary
 java.lang.Object clone()
          Clones the Line object
 javax.vecmath.Point3d computeLineIntersection(Line otherLine)
          Computes the point resulting from the intersection with another line
 javax.vecmath.Point3d computePlaneIntersection(javax.vecmath.Vector3d normal, javax.vecmath.Point3d planePoint)
          Compute the point resulting from the intersection with a plane
 double computePointToPointDistance(javax.vecmath.Point3d otherPoint)
          Computes the distance from the line point to another point
 javax.vecmath.Vector3d getDirection()
          Gets the line direction
 javax.vecmath.Point3d getPoint()
          Gets the point used to represent the line
 void perturbDirection()
          Changes slightly the line direction
 void setDirection(javax.vecmath.Vector3d direction)
          Sets a new direction
 void setPoint(javax.vecmath.Point3d point)
          Sets a new point
 java.lang.String toString()
          Makes a string definition for the Line object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Line

public Line(Face face1,
            Face face2)
Constructor for a line. The line created is the intersection between two planes

Parameters:
face1 - face representing one of the planes
face2 - face representing one of the planes

Line

public Line(javax.vecmath.Vector3d direction,
            javax.vecmath.Point3d point)
Constructor for a ray

Parameters:
direction - direction ray
point - beginning of the ray
Method Detail

clone

public java.lang.Object clone()
Clones the Line object

Overrides:
clone in class java.lang.Object
Returns:
cloned Line object

toString

public java.lang.String toString()
Makes a string definition for the Line object

Overrides:
toString in class java.lang.Object
Returns:
the string definition

getPoint

public javax.vecmath.Point3d getPoint()
Gets the point used to represent the line

Returns:
point used to represent the line

getDirection

public javax.vecmath.Vector3d getDirection()
Gets the line direction

Returns:
line direction

setPoint

public void setPoint(javax.vecmath.Point3d point)
Sets a new point

Parameters:
point - new point

setDirection

public void setDirection(javax.vecmath.Vector3d direction)
Sets a new direction

Parameters:
direction - new direction

computePointToPointDistance

public double computePointToPointDistance(javax.vecmath.Point3d otherPoint)
Computes the distance from the line point to another point

Parameters:
otherPoint - the point to compute the distance from the line point. The point is supposed to be on the same line.
Returns:
points distance. If the point submitted is behind the direction, the distance is negative

computeLineIntersection

public javax.vecmath.Point3d computeLineIntersection(Line otherLine)
Computes the point resulting from the intersection with another line

Parameters:
otherLine - the other line to apply the intersection. The lines are supposed to intersect
Returns:
point resulting from the intersection. If the point coundn't be obtained, return null

computePlaneIntersection

public javax.vecmath.Point3d computePlaneIntersection(javax.vecmath.Vector3d normal,
                                                      javax.vecmath.Point3d planePoint)
Compute the point resulting from the intersection with a plane

Parameters:
normal - the plane normal
planePoint - a plane point.
Returns:
intersection point. If they don't intersect, return null

perturbDirection

public void perturbDirection()
Changes slightly the line direction