org.jcae.viewer3d.fd
Class PL02BranchGroup.EdgeLine

java.lang.Object
  extended by org.jcae.viewer3d.fd.PL02BranchGroup.EdgeLine
Enclosing class:
PL02BranchGroup

protected static class PL02BranchGroup.EdgeLine
extends java.lang.Object

Each EdgeLine object reports all edges along a particular infinite line This line is parallel to one of the axis, thus defined by: - Its direction: X, Y, or Z - The constant values in the other 2 directions Ex: X line defined by Y=5, Z=2 The values for the constants are indices in the grid array, thus integers Alongside each line, a certain number of edges can be defined. All overlapping edges are merged to form unique lines, thus reducing the geometry => Optimum solution in the end : no edge is duplicated, minimum geometrical description => easy to find back the grid indices in picking operations


Constructor Summary
PL02BranchGroup.EdgeLine(int c1, int c2, int direction)
           
 
Method Summary
 void add(int e1, int e2)
          Add an edge along this line.
 boolean equals(java.lang.Object obj)
          Equals is a bit special : test for direction and constant equality, but the edges need not be the same along this line.
 double[] getCoords(float[][] grid)
           
 int getNumberOfEdges()
           
 int hashCode()
          Hashcode the direction and constants.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PL02BranchGroup.EdgeLine

public PL02BranchGroup.EdgeLine(int c1,
                                int c2,
                                int direction)
Parameters:
c1 - The first constant of one couple : (Y,Z) or (X,Z) or (X,Y)
c2 - The second constant of one couple : (Y,Z) or (X,Z) or (X,Y)
direction - 0,1,2 for X,Y,Z
Method Detail

getCoords

public double[] getCoords(float[][] grid)
Parameters:
grid -
Returns:
an array of vertex coordinates, one vertex per edge end, 3 coords per vertex

getNumberOfEdges

public int getNumberOfEdges()
Returns:

add

public void add(int e1,
                int e2)
Add an edge along this line. Overlapping edges are merged.

Parameters:
e1 - The first edge end
e2 - The second edge end

equals

public boolean equals(java.lang.Object obj)
Equals is a bit special : test for direction and constant equality, but the edges need not be the same along this line. Only the infinite line is guaranteed to be the same.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object), hashCode()

hashCode

public int hashCode()
Hashcode the direction and constants. Thus, an hashMap of edges can be used to simply add new adges to a given direction without worrying if another EdgeLine exists (@see equals(java.lang.Object) too)

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()