bool
Class Segment

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

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

Represents a line segment resulting from a intersection of a face and a plane.

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)

Field Summary
static int EDGE
          define as edge one of the segment ends
static int FACE
          define as face one of the segment ends
static int VERTEX
          define as vertex one of the segment ends
 
Constructor Summary
Segment(bool.Line line, bool.Face face, int sign1, int sign2, int sign3)
          Constructs a Segment based on elements obtained from the two planes relations
 
Method Summary
 java.lang.Object clone()
          Clones the Segment object
 double getEndDistance()
          Gets the distance from the origin until ending point
 javax.vecmath.Point3d getEndPosition()
          Gets the ending position
 int getEndType()
          Gets the type of the ending point
 bool.Vertex getEndVertex()
          Gets the end vertex
 int getIntermediateType()
          Gets the type of the segment between the starting and ending points
 int getNumEndsSet()
          Gets the number of ends already set
 double getStartDistance()
          Gets the distance from the origin until the starting point
 javax.vecmath.Point3d getStartPosition()
          Gets the starting position
 int getStartType()
          Gets the type of the starting point
 bool.Vertex getStartVertex()
          Gets the start vertex
 boolean intersect(bool.Segment segment)
          Checks if two segments intersect
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERTEX

public static final int VERTEX
define as vertex one of the segment ends

See Also:
Constant Field Values

FACE

public static final int FACE
define as face one of the segment ends

See Also:
Constant Field Values

EDGE

public static final int EDGE
define as edge one of the segment ends

See Also:
Constant Field Values
Constructor Detail

Segment

public Segment(bool.Line line,
               bool.Face face,
               int sign1,
               int sign2,
               int sign3)
Constructs a Segment based on elements obtained from the two planes relations

Parameters:
line - resulting from the two planes intersection
face - face that intersects with the plane
sign1 - position of the face vertex1 relative to the plane (-1 behind, 1 front, 0 on)
sign2 - position of the face vertex2 relative to the plane (-1 behind, 1 front, 0 on)
sign3 - position of the face vertex3 relative to the plane (-1 behind, 1 front, 0 on)
Method Detail

clone

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

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

getStartVertex

public bool.Vertex getStartVertex()
Gets the start vertex

Returns:
start vertex

getEndVertex

public bool.Vertex getEndVertex()
Gets the end vertex

Returns:
end vertex

getStartDistance

public double getStartDistance()
Gets the distance from the origin until the starting point

Returns:
distance from the origin until the starting point

getEndDistance

public double getEndDistance()
Gets the distance from the origin until ending point

Returns:
distance from the origin until the ending point

getStartType

public int getStartType()
Gets the type of the starting point

Returns:
type of the starting point

getIntermediateType

public int getIntermediateType()
Gets the type of the segment between the starting and ending points

Returns:
type of the segment between the starting and ending points

getEndType

public int getEndType()
Gets the type of the ending point

Returns:
type of the ending point

getNumEndsSet

public int getNumEndsSet()
Gets the number of ends already set

Returns:
number of ends already set

getStartPosition

public javax.vecmath.Point3d getStartPosition()
Gets the starting position

Returns:
start position

getEndPosition

public javax.vecmath.Point3d getEndPosition()
Gets the ending position

Returns:
ending position

intersect

public boolean intersect(bool.Segment segment)
Checks if two segments intersect

Parameters:
segment - the other segment to check the intesection
Returns:
true if the segments intersect, false otherwise