IsoSurface Rendering of an AR Representation

rlaramee
Class TriangleVertex

java.lang.Object
  |
  +--rlaramee.Vertex
        |
        +--rlaramee.TriangleVertex
Direct Known Subclasses:
IsoXvertex, IsoYvertex, IsoZvertex

public class TriangleVertex
extends Vertex

Description: A Cube is made up of 8 vertices. Including a vertex class in the design allows flexibility in implementation.

start date Tue 27 April 1999

Version:
1.0
Author:
Robert S Laramee
See Also:
Cube.java

Field Summary
protected  float error
          This data member stores the error associated with the vertex.
protected  short resolution
          This is used so that coarser resolution vertices do not update finer resolution vertices by accident.
 
Constructor Summary
TriangleVertex(float[] coordinates, byte nativeEdge)
          Use this constructor when deriving a new cube.
 
Method Summary
 float fromBlockSpaceToVisAD(float coordinate, int dimension)
          Transform this vertex coordininates to NDC space We divide the x,y,z coordinates to normalize them.
 float getError()
           
 byte getNativeEdge(Cube cube)
          This method is called from: OctreeInternalNode.findCommonEdge() TriangleVertex.onFace() IsoXvertex.toString() IsoYvertex.toString() IsoZvertex.toString() OctreeNode.getEdgeVerticesOfCoarserNeighbor() It's used to resolve inconsistent interpolation and identify triangle vertices on the same face.
private  int getNumSharedPolygons()
           
 int[] getPolygonList()
          polygonList is a list of polygon indices (indices into the list of polygons e.g.
protected  short getResolution()
           
 float getXcoord()
          This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.
 float getYcoord()
          This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.
 float getZcoord()
          This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.
 boolean isValid()
          An error check methed, there is no check on a triangles' scalar value because the scalar value of a triangle is associated with an isosurface.
 void oldSetPolygonList(int polygonNumber)
          Deprecated. -use the setPolygonList() method
 boolean onFace(Cube cube, byte face)
           
 void setError(float newError)
           
protected  void setNativeEdge(byte edge)
          Deprecated. the native edge is computed now, not stored
private  boolean setNumSharedPolygons()
           
 void setPolygonList(int polygonNumber)
          The 8th index of the polygonList for each vertex hold the total number of polygons sharing the vertex.
protected  void setResolution(short newRes)
           
 void setXcoord(float newX)
          This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.
 void setYcoord(float newX)
          This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.
 void setZcoord(float newX)
          This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.
 boolean sharedXaxis(CubeVertex cubeVertex)
          Called from OctreeARnode.onCoarseEdge()
 boolean sharedYaxis(CubeVertex cubeVertex)
          Called from OctreeARnode.onCoarseEdge()
 boolean sharedZaxis(CubeVertex cubeVertex)
          Called from OctreeARnode.onCoarseEdge()
 java.lang.String toString(Cube cube)
           
 boolean updateWith(TriangleVertex newVertex)
          This is called from OctreeInternalNode.processEdgeList() .
 
Methods inherited from class rlaramee.Vertex
isEqual
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

error

protected float error
This data member stores the error associated with the vertex.

resolution

protected short resolution
This is used so that coarser resolution vertices do not update finer resolution vertices by accident.
Constructor Detail

TriangleVertex

public TriangleVertex(float[] coordinates,
                      byte nativeEdge)
Use this constructor when deriving a new cube. The vertices do not need to be transformed since they are interpolated from cube vertices that have already been transformed.
Parameters:
coordinates - the x, y, and z coordinates of this TriangleVertex The 4th coordinate is the error value of the vertex
nativeEdge - the native cube edge that this vertex lies on
Method Detail

setError

public void setError(float newError)
Parameters:
the - error value for this triangle vertex.

getError

public float getError()
Returns:
the error value for this triangle vertex.

getXcoord

public float getXcoord()
This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.

Overrides:
getXcoord in class Vertex
Returns:
the x coordinate of this TriangleVertex

getYcoord

public float getYcoord()
This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.

Overrides:
getYcoord in class Vertex
Returns:
the y coordinate of this TriangleVertex

getZcoord

public float getZcoord()
This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.

Overrides:
getZcoord in class Vertex
Returns:
the z coordinate of this TriangleVertex

setXcoord

public void setXcoord(float newX)
This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.

Overrides:
setXcoord in class Vertex
Parameters:
newX - the x coordinate of this TriangleVertex

setYcoord

public void setYcoord(float newX)
This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.

Overrides:
setYcoord in class Vertex
Parameters:
newY - the Y coordinate of this TriangleVertex

setZcoord

public void setZcoord(float newX)
This method must be over-ridden by IsoXvertex, IsoYvertex, and IsoZvertex.

Overrides:
setZcoord in class Vertex
Parameters:
newZ - the Z coordinate of this TriangleVertex

getNumSharedPolygons

private int getNumSharedPolygons()
Returns:
the number of polygons that share this TriangleVertex object

setNumSharedPolygons

private boolean setNumSharedPolygons()
Parameters:
the - number of polygons that share this TriangleVertex object

getNativeEdge

public byte getNativeEdge(Cube cube)
This method is called from: OctreeInternalNode.findCommonEdge() TriangleVertex.onFace() IsoXvertex.toString() IsoYvertex.toString() IsoZvertex.toString() OctreeNode.getEdgeVerticesOfCoarserNeighbor() It's used to resolve inconsistent interpolation and identify triangle vertices on the same face.

This is actually a tricky procedure because triangle vertices are shared between triangles. When a new triangle vertex is computed, the TriangleVertexList object is searched to see if that vertex is already on the list (since 1 vertex may belong to more than 1 triangle). However, the triangles that share the vertex do not have to be in the same cube. Therefore, in order to return the proper native edge we have to examine the cube that is making the query (calling this method). Because the native edge that the triangle vertex is on depends on the cube (the same vertex is on more than one cube edge!).

Native refers to the cube that originally generated the triangle vertex. It is only important in the AR algorithm not the MR algorithm.

Parameters:
cube - the octree node/cube that is querying to find out which native edge this triangle vertex is on
Returns:
the native cube edge that this vertex lies on

setNativeEdge

protected void setNativeEdge(byte edge)
Deprecated. the native edge is computed now, not stored

Parameters:
the - native cube edge that this vertex lies on

getResolution

protected short getResolution()
Returns:
the resolution of this triangle vertex

setResolution

protected void setResolution(short newRes)
Parameters:
the - resolution of this triangle vertex

onFace

public boolean onFace(Cube cube,
                      byte face)
Parameters:
cube - the cube/octree node that would like to know which on what face this vertex is on
face - 1 of 6 cube/octree node faces
Returns:
TRUE if this triangle vertex lies on the given face

sharedXaxis

public boolean sharedXaxis(CubeVertex cubeVertex)
Called from OctreeARnode.onCoarseEdge()

Parameters:
cubeVertex - a cube vertex
Returns:
TRUE if the this vertex and the given vertex lie on the same X axis

sharedYaxis

public boolean sharedYaxis(CubeVertex cubeVertex)
Called from OctreeARnode.onCoarseEdge()

Parameters:
cubeVertex - a cube vertex
Returns:
TRUE if the this and the given vertex lie on the same Y axis

sharedZaxis

public boolean sharedZaxis(CubeVertex cubeVertex)
Called from OctreeARnode.onCoarseEdge()

Parameters:
cubeVertex - a cube vertex
Returns:
TRUE if this vertex and the given vertex lie on the same Z axis

getPolygonList

public int[] getPolygonList()
polygonList is a list of polygon indices (indices into the list of polygons e.g. the isosurface) that share this vertex. This method was added in order to populate the int[] polygonFromVertex array used in Gridded3DSet.make_poly_stripe() method.

Returns:
polygonList -the list of polygons sharing this vertex

public int[] getPolygonList() { return polygonList; }


setPolygonList

public void setPolygonList(int polygonNumber)
The 8th index of the polygonList for each vertex hold the total number of polygons sharing the vertex.

Parameters:
polygonNumber - the number of the polygon that this TriangleVertex belongs too

oldSetPolygonList

public void oldSetPolygonList(int polygonNumber)
Deprecated. -use the setPolygonList() method

This method was removed in order to save space. The 8th index of the polygonList for each vertex hold the total number of polygons sharing the vertex.

Parameters:
polygonNumber - the number of the polygon that this TriangleVertex belongs too

updateWith

public boolean updateWith(TriangleVertex newVertex)
This is called from OctreeInternalNode.processEdgeList() .

We make sure not to update a finer resolution vertex with a coarser resolution vertex.

Parameters:
newVertex - a new vertex whose values are replacing this
Returns:
TRUE if the update was successful

fromBlockSpaceToVisAD

public float fromBlockSpaceToVisAD(float coordinate,
                                   int dimension)
Transform this vertex coordininates to NDC space We divide the x,y,z coordinates to normalize them. Cube space has a range of 0-XROWS. Each group of 3 coordinates values defines the XAxis, YAxis and ZAxis spatial coordinates of a vertex. Spatial coordinates vary from -1.0f to +1.0f in the VisAD display "box".

In general, the coordinates of shapes should be centered around the origin (0.0f, 0.0f, 0.0f) and scaled appropriately relative to the "box" dimensions.

Parameters:
coordinate - the coordinate to transform
dimension - the dimension, either x, y, or z along which to transform the coordinate
Returns:
the transformed coordinate

isValid

public boolean isValid()
An error check methed, there is no check on a triangles' scalar value because the scalar value of a triangle is associated with an isosurface.

Returns:
TRUE if this is a valid TriangleVertex

toString

public java.lang.String toString(Cube cube)
Parameters:
cube - the cube that this triangle vertex belongs to
Returns:
the string representation of this TriangleVertex

IsoSurface Rendering of an AR Representation