unbboolean.bool
Class Face

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

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

Representation of a 3D face (triangle).

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 INSIDE
          face status if it is inside a solid
static int OPPOSITE
          face status if it is coincident with a solid face with opposite orientation
static int OUTSIDE
          face status if it is outside a solid
static int SAME
          face status if it is coincident with a solid face
static int UNKNOWN
          face status if it is still unknown
 Vertex v1
          first vertex
 Vertex v2
          second vertex
 Vertex v3
          third vertex
 
Constructor Summary
Face(Vertex v1, Vertex v2, Vertex v3)
          Constructs a face with unknown status.
 
Method Summary
 java.lang.Object clone()
          Clones the face object
 boolean equals(java.lang.Object anObject)
          Checks if a face is equal to another.
 double getArea()
          Gets the face area
 Bound getBound()
          Gets the face bound
 javax.vecmath.Vector3d getNormal()
          Gets the face normal
 int getStatus()
          Gets the face status
 void invert()
          Invert face direction (normal direction)
 void rayTraceClassify(Object3D object)
          Classifies the face based on the ray trace technique
 boolean simpleClassify()
          Classifies the face if one of its vertices are classified as INSIDE or OUTSIDE
 java.lang.String toString()
          Makes a string definition for the Face object
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

v1

public Vertex v1
first vertex


v2

public Vertex v2
second vertex


v3

public Vertex v3
third vertex


UNKNOWN

public static final int UNKNOWN
face status if it is still unknown

See Also:
Constant Field Values

INSIDE

public static final int INSIDE
face status if it is inside a solid

See Also:
Constant Field Values

OUTSIDE

public static final int OUTSIDE
face status if it is outside a solid

See Also:
Constant Field Values

SAME

public static final int SAME
face status if it is coincident with a solid face

See Also:
Constant Field Values

OPPOSITE

public static final int OPPOSITE
face status if it is coincident with a solid face with opposite orientation

See Also:
Constant Field Values
Constructor Detail

Face

public Face(Vertex v1,
            Vertex v2,
            Vertex v3)
Constructs a face with unknown status.

Parameters:
v1 - a face vertex
v2 - a face vertex
v3 - a face vertex
Method Detail

clone

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

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

toString

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

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

equals

public boolean equals(java.lang.Object anObject)
Checks if a face is equal to another. To be equal, they have to have equal vertices in the same order

Overrides:
equals in class java.lang.Object
Parameters:
anObject - the other face to be tested
Returns:
true if they are equal, false otherwise.

getBound

public Bound getBound()
Gets the face bound

Returns:
face bound

getNormal

public javax.vecmath.Vector3d getNormal()
Gets the face normal

Returns:
face normal

getStatus

public int getStatus()
Gets the face status

Returns:
face status - UNKNOWN, INSIDE, OUTSIDE, SAME OR OPPOSITE

getArea

public double getArea()
Gets the face area

Returns:
face area

invert

public void invert()
Invert face direction (normal direction)


simpleClassify

public boolean simpleClassify()
Classifies the face if one of its vertices are classified as INSIDE or OUTSIDE

Returns:
true if the face could be classified, false otherwise

rayTraceClassify

public void rayTraceClassify(Object3D object)
Classifies the face based on the ray trace technique

Parameters:
object - object3d used to compute the face status