unbboolean.bool
Class Vertex

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

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

Represents of a 3d face vertex.

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 BOUNDARY
          vertex status if it on the boundary of a solid
static int INSIDE
          vertex status if it is inside a solid
static int OUTSIDE
          vertex status if it is outside a solid
static int UNKNOWN
          vertex status if it is still unknown
 double x
          vertex coordinate in X
 double y
          vertex coordinate in Y
 double z
          vertex coordinate in Z
 
Constructor Summary
Vertex(double x, double y, double z, javax.vecmath.Color3f color)
          Constructs a vertex with unknown status
Vertex(double x, double y, double z, javax.vecmath.Color3f color, int status)
          Constructs a vertex with a definite status
Vertex(javax.vecmath.Point3d position, javax.vecmath.Color3f color)
          Constructs a vertex with unknown status
Vertex(javax.vecmath.Point3d position, javax.vecmath.Color3f color, int status)
          Constructs a vertex with definite status
 
Method Summary
 void addAdjacentVertex(Vertex adjacentVertex)
          Sets a vertex as being adjacent to it
 java.lang.Object clone()
          Clones the vertex object
 boolean equals(java.lang.Object anObject)
          Checks if an vertex is equal to another.
 Vertex[] getAdjacentVertices()
          Gets an array with the adjacent vertices
 javax.vecmath.Color3f getColor()
          Gets the vertex color
 javax.vecmath.Point3d getPosition()
          Gets the vertex position
 int getStatus()
          Gets the vertex status
 void mark(int status)
          Sets the vertex status, setting equally the adjacent ones
 void setStatus(int status)
          Sets the vertex status
 java.lang.String toString()
          Makes a string definition for the Vertex object
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x
vertex coordinate in X


y

public double y
vertex coordinate in Y


z

public double z
vertex coordinate in Z


UNKNOWN

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

See Also:
Constant Field Values

INSIDE

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

See Also:
Constant Field Values

OUTSIDE

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

See Also:
Constant Field Values

BOUNDARY

public static final int BOUNDARY
vertex status if it on the boundary of a solid

See Also:
Constant Field Values
Constructor Detail

Vertex

public Vertex(javax.vecmath.Point3d position,
              javax.vecmath.Color3f color)
Constructs a vertex with unknown status

Parameters:
position - vertex position
color - vertex color

Vertex

public Vertex(double x,
              double y,
              double z,
              javax.vecmath.Color3f color)
Constructs a vertex with unknown status

Parameters:
x - coordinate on the x axis
y - coordinate on the y axis
z - coordinate on the z axis
color - vertex color

Vertex

public Vertex(javax.vecmath.Point3d position,
              javax.vecmath.Color3f color,
              int status)
Constructs a vertex with definite status

Parameters:
position - vertex position
color - vertex color
status - vertex status - UNKNOWN, BOUNDARY, INSIDE or OUTSIDE

Vertex

public Vertex(double x,
              double y,
              double z,
              javax.vecmath.Color3f color,
              int status)
Constructs a vertex with a definite status

Parameters:
x - coordinate on the x axis
y - coordinate on the y axis
z - coordinate on the z axis
color - vertex color
status - vertex status - UNKNOWN, BOUNDARY, INSIDE or OUTSIDE
Method Detail

clone

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

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

toString

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

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

equals

public boolean equals(java.lang.Object anObject)
Checks if an vertex is equal to another. To be equal, they have to have the same coordinates(with some tolerance) and color

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

setStatus

public void setStatus(int status)
Sets the vertex status

Parameters:
status - vertex status - UNKNOWN, BOUNDARY, INSIDE or OUTSIDE

getPosition

public javax.vecmath.Point3d getPosition()
Gets the vertex position

Returns:
vertex position

getAdjacentVertices

public Vertex[] getAdjacentVertices()
Gets an array with the adjacent vertices

Returns:
array of the adjacent vertices

getStatus

public int getStatus()
Gets the vertex status

Returns:
vertex status - UNKNOWN, BOUNDARY, INSIDE or OUTSIDE

getColor

public javax.vecmath.Color3f getColor()
Gets the vertex color

Returns:
vertex color

addAdjacentVertex

public void addAdjacentVertex(Vertex adjacentVertex)
Sets a vertex as being adjacent to it

Parameters:
adjacentVertex - an adjacent vertex

mark

public void mark(int status)
Sets the vertex status, setting equally the adjacent ones

Parameters:
status - new status to be set