Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.trapezium.vrml.node.space
Class SpaceStructure  view SpaceStructure download SpaceStructure.java

java.lang.Object
  extended bycom.trapezium.vrml.node.space.SpaceStructure

public class SpaceStructure
extends java.lang.Object

The SpaceStructure keeps track of vertices, edges, and faces in a somewhat fluid manner. There are three sets of objects, corresponding to vertices, edges, and faces, but these sets can be mixed, and relationships created between these sets. This is done to allow transformations of one type into another. A SpaceEntitySet represents a set of SpacePrimitive objects used by a particular space structure. The Strategy field "primitiveHandler" indicates the current visualization of a space entity and its surrounding entities. Relationships between the sets are created as needed, only r1 is known at the time the SpaceStructure is first created. The possible relationships are: r1. F ---* V The set of vertices surrounding each face, created when an IndexedFaceSet is loaded r2. V ---* F V,r2: requires r3() The set of faces surrounding each vertex, derived from r3 r3. F ---* E F,r3: requires r1() The set of edges surrounding each face, derived from r1 r4. E ---2 F E,r4: The set of faces (usually 2) surrounding each edge r5. V ---* E V,r5 The set of edges surrounding each vertex r6. E ---2 V E,r6: E() creates this relationship The set of vertices (always 2) making up each edge The methods r1(), r2(), r3(), r4(), r5(), r6() create these relationships. A SpaceStructure is made up of three SpaceEntitySet objects, each of which is a set of SpacePrimitive objects. The type (vertex, edge, face) is kept as an attribute of the SpaceEntitySet to simplify the transformation of one type into another, and to simplify merging separate sets.


Field Summary
(package private)  SpaceEntitySet appendedV1
           
(package private)  SpaceEntitySet appendedV2
           
(package private)  SpaceEntitySet appendedV3
           
(package private)  java.util.Vector connectivityList
          Connectivity sections
(package private)  boolean createColorObject
           
(package private)  boolean createNormalObject
           
(package private)  boolean createTexObject
           
(package private)  float[] dxes
          Check all edges from a vertex, if two are parallel, mark vertex as a candidate
(package private)  float[] dyes
           
(package private)  float[] dzes
           
(package private)  int faceBitCount
          The number of bits in the "removedFaceSet" above
(package private)  java.util.BitSet faceRemovalCandidateSet
          The set of faces removed by "edgeRemovalPolygonReduction" or "coplanarTriToQuad"
(package private)  int[] faceToMergeWith
           
(package private)  int id
           
(package private) static int idCounter
           
(package private)  float max1
           
(package private)  float max2
           
(package private)  float max3
           
(package private)  int maxToCheck
           
(package private)  int mergeCount
           
(package private)  java.lang.String name
           
(package private)  SpacePrimitive newlyAddedFace
          Add a face that has been collected on coord at a time
(package private)  int nextToCheckIdx
           
(package private)  int[] nextToCheckList
           
(package private)  java.util.BitSet normalMergeSet
          The set of edges that are removed
(package private)  int preAppendCount
           
(package private)  SpaceEntitySet prevV1
           
(package private)  SpaceEntitySet prevV2
           
(package private)  SpaceEntitySet prevV3
           
(package private)  int[] singleColorCoords
           
(package private)  int singleFaceCoordIdx
           
(package private)  int[] singleFaceCoords
           
(package private)  int[] singleNormalCoords
           
(package private)  int[] singleTexCoords
           
(package private)  SpaceEntitySet v1
           
(package private)  SpaceEntitySet v2
           
(package private)  SpaceEntitySet v3
           
(package private)  int[] vno
           
 
Constructor Summary
SpaceStructure()
          Class constructor
SpaceStructure(SpaceStructure original)
          Copy constructor
 
Method Summary
 void addColorCoord(int value)
           
(package private)  void addEfaces()
           
 void addFace()
           
 void addFaceCoord(int value)
          Add another coord to the face being built one coord at a time
 void addNormalCoord(int value)
           
 void addTexCoord(int value)
           
 void addVertex(float x, float y, float z)
          Add a vertex to the SpaceEntitySet for vertices.
(package private)  void addVfaces()
           
 void appendSet(int type, SpaceEntitySet newSet)
           
(package private)  boolean checkVertex(int candidate, SpaceEntitySet edges, SpaceEntitySet vertices, java.util.BitSet verticesRuledOut, java.util.BitSet vertexCandidates, float threshold, java.util.Hashtable joinTo)
           
 boolean coplanar(SpacePrimitive v1, SpacePrimitive v2, SpacePrimitive v3, SpacePrimitive v4, double limit)
           
 int coplanarTriToQuad(double limit, int ifsNumber)
          Merge coplanar polygons.
 int coplanarTriToQuad(int ifsNumber)
           
(package private)  void createFtoE(SpaceEntitySet edges, SpaceEntitySet faces, int numberFaces)
          Create F-*E relationship, must not exist when this is called.
 void createSet(SpaceEntitySet obsoleteSet, int type)
           
 void diagonalize()
           
(package private)  float distanceBetween(SpacePrimitive v1, SpacePrimitive v2)
           
(package private)  void E()
           
 void edgeRemovalPolygonReduction(boolean preserveColorBoundaries, int xFactor, int yFactor, int zFactor, int percent, int minEdgeCount, BoundingBox b, java.util.Hashtable boundingBoxOverlap, boolean useBoundingBoxLimit, int ifsNumber)
          Edge removal polygon reduction algorithm.
 void expand(float factor)
          Multiply each vertex by a factor
(package private)  void F()
           
(package private)  void fillNextToCheckList(java.util.BitSet edgesToCheck, int numberEdges)
           
(package private)  void generateEdges()
          Generate edges from the faces, assume F exists and r1 holds.
 SpaceEntitySet getAppendedSet(int type)
           
 int getConnectivity(int faceNo)
          Get the connectivity section number for a particular face
 SpaceEntitySet getEntitySet(int type)
          Get the SpaceEntitySet for the vertices, edges, or faces.
 int getFaceBitCount()
           
 java.util.BitSet getFaceBits()
           
 int getMergeCount()
           
 int getMergeFace(int faceIdx)
          Get the index of the face merged with a particular face.
(package private)  float getMiddleValue(int firstIdx, int lastIdx, int[] list, float[] edgeLengths)
           
(package private)  int getNextEdgeToCheck(java.util.BitSet edgesToCheck, int numberEdges)
           
 int getNumberEntities(int type)
          Copy entities from public void dump() { dump( "JJ" ); } public void dump( String s ) { System.out.println( s ); SpaceEntitySet.debug = true; SpaceEntitySet v = getEntitySet( SpacePrimitive.Vertex ); v.dump( "Vertices" ); SpaceEntitySet e = getEntitySet( SpacePrimitive.Edge ); e.dump( "Edges" ); SpaceEntitySet f = getEntitySet( SpacePrimitive.Face ); f.dump( "Faces" ); SpaceEntitySet.debug = false; } /** Get the number of entities in the set of the given type.
 SpaceEntitySet getPrevEntitySet(int type)
           
(package private)  int getStartEdge(java.util.BitSet edgeConnectivity, int numberEdges)
           
(package private)  void getTraceback()
           
(package private)  void initArrays()
          internal array and id initialization, used only by constructors
(package private)  void initMaxes()
           
 void invalidate(int type)
           
(package private)  void markCandidate(int candidate, int bro1, int bro2, java.util.BitSet verticesRuledOut, java.util.BitSet vertexCandidates)
           
 void markConnectivity()
          Create the connectivity sections for this structure
(package private)  void markConnectivity(java.util.BitSet edgeConnectivity, SpaceEntitySet edges, int startEdge, SpaceEntitySet faces, java.util.BitSet faceConnectivity)
          Mark connectivity for a set of faces linked to a single start edge
(package private)  void markEdge(java.util.BitSet edgeConnectivity, int startEdge, SpaceEntitySet edges, SpaceEntitySet faces, java.util.BitSet faceConnectivity, java.util.BitSet edgesToCheck)
          mark edges associated with a single edge.
(package private)  void markFace(int fidx, SpaceEntitySet faces, java.util.BitSet faceConnectivity, java.util.BitSet edgesToCheck, java.util.BitSet edgeConnectivity)
          mark the face in its connectivity set, add edges to check list
(package private)  void markMax(float d)
           
 void normalize()
           
 int numberConnectivity()
          Get the number of connectivity sections
 int parallelEdgePolygonReduction(float threshold)
          Parallel edge joining algorithm.
(package private)  void r1()
          Relationship #1: F --* V Exists when structure is first loaded.
(package private)  void r2()
          RelationShip #2: V --* F Can be derived from r1 This method however derivew from r3.
(package private)  void r3()
           
(package private)  void r4()
          Calculate relationship #4, faces around each edge r4.
(package private)  void r5()
           
(package private)  void r6()
           
 void replaceSet(int type, SpaceEntitySet newSet)
           
 void s1()
           
 void s12()
           
 void s123()
           
 void s13()
           
 void s2()
           
 void s23()
           
 void s3()
           
 void setFaceColor(int value)
          Hack, since I don't use face location, don't want to make SpacePrimitive too big...
 void setLocation(int baseType, int avgType)
          Set the center location for each SpacePrimitive by averaging location of surrounding entities.
(package private)  void setLocation(int baseType, int avgType, boolean setDistance, float cx, float cy, float cz, float distance)
           
 void setLocation(int baseType, int avgType, float cx, float cy, float cz, float distance)
           
 void setName(java.lang.String nm)
           
(package private)  void showNonRemoval(int numberEdges, java.util.BitSet edgeNonRemovalList)
           
(package private)  void shrinkFaces(float factor)
           
 boolean smallTrianglePolygonReduction(int minimumNumberFaces, int percentThreshold, boolean preserveColorBoundaries)
          Small triangle removal polygon reduction algorithm.
(package private)  void sort(int firstIdx, int lastIdx, int[] list, int[] tmpList, float[] edgeLengths)
           
 void summarize()
           
 void t1()
           
 void t12()
           
 void t123()
           
 void t13()
           
 void t2()
           
 void t23()
           
 void t3()
           
(package private)  void V()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v1

SpaceEntitySet v1

v2

SpaceEntitySet v2

v3

SpaceEntitySet v3

prevV1

SpaceEntitySet prevV1

prevV2

SpaceEntitySet prevV2

prevV3

SpaceEntitySet prevV3

appendedV1

SpaceEntitySet appendedV1

appendedV2

SpaceEntitySet appendedV2

appendedV3

SpaceEntitySet appendedV3

singleFaceCoords

int[] singleFaceCoords

singleTexCoords

int[] singleTexCoords

singleNormalCoords

int[] singleNormalCoords

singleColorCoords

int[] singleColorCoords

singleFaceCoordIdx

int singleFaceCoordIdx

idCounter

static int idCounter

id

int id

mergeCount

int mergeCount

faceToMergeWith

int[] faceToMergeWith

faceRemovalCandidateSet

java.util.BitSet faceRemovalCandidateSet
The set of faces removed by "edgeRemovalPolygonReduction" or "coplanarTriToQuad"


faceBitCount

int faceBitCount
The number of bits in the "removedFaceSet" above


connectivityList

java.util.Vector connectivityList
Connectivity sections


nextToCheckList

int[] nextToCheckList

nextToCheckIdx

int nextToCheckIdx

maxToCheck

int maxToCheck

normalMergeSet

java.util.BitSet normalMergeSet
The set of edges that are removed


preAppendCount

int preAppendCount

createTexObject

boolean createTexObject

createNormalObject

boolean createNormalObject

createColorObject

boolean createColorObject

newlyAddedFace

SpacePrimitive newlyAddedFace
Add a face that has been collected on coord at a time


max1

float max1

max2

float max2

max3

float max3

dxes

float[] dxes
Check all edges from a vertex, if two are parallel, mark vertex as a candidate


dyes

float[] dyes

dzes

float[] dzes

vno

int[] vno

name

java.lang.String name
Constructor Detail

SpaceStructure

public SpaceStructure()
Class constructor


SpaceStructure

public SpaceStructure(SpaceStructure original)
Copy constructor

Method Detail

initArrays

void initArrays()
internal array and id initialization, used only by constructors


getNumberEntities

public int getNumberEntities(int type)
Copy entities from public void dump() { dump( "JJ" ); } public void dump( String s ) { System.out.println( s ); SpaceEntitySet.debug = true; SpaceEntitySet v = getEntitySet( SpacePrimitive.Vertex ); v.dump( "Vertices" ); SpaceEntitySet e = getEntitySet( SpacePrimitive.Edge ); e.dump( "Edges" ); SpaceEntitySet f = getEntitySet( SpacePrimitive.Face ); f.dump( "Faces" ); SpaceEntitySet.debug = false; } /** Get the number of entities in the set of the given type.


summarize

public void summarize()

getMergeCount

public int getMergeCount()

coplanarTriToQuad

public int coplanarTriToQuad(int ifsNumber)

getFaceBits

public java.util.BitSet getFaceBits()

getFaceBitCount

public int getFaceBitCount()

markConnectivity

public void markConnectivity()
Create the connectivity sections for this structure


numberConnectivity

public int numberConnectivity()
Get the number of connectivity sections


getConnectivity

public int getConnectivity(int faceNo)
Get the connectivity section number for a particular face


getStartEdge

int getStartEdge(java.util.BitSet edgeConnectivity,
                 int numberEdges)

getNextEdgeToCheck

int getNextEdgeToCheck(java.util.BitSet edgesToCheck,
                       int numberEdges)

fillNextToCheckList

void fillNextToCheckList(java.util.BitSet edgesToCheck,
                         int numberEdges)

markConnectivity

void markConnectivity(java.util.BitSet edgeConnectivity,
                      SpaceEntitySet edges,
                      int startEdge,
                      SpaceEntitySet faces,
                      java.util.BitSet faceConnectivity)
Mark connectivity for a set of faces linked to a single start edge


markEdge

void markEdge(java.util.BitSet edgeConnectivity,
              int startEdge,
              SpaceEntitySet edges,
              SpaceEntitySet faces,
              java.util.BitSet faceConnectivity,
              java.util.BitSet edgesToCheck)
mark edges associated with a single edge.


markFace

void markFace(int fidx,
              SpaceEntitySet faces,
              java.util.BitSet faceConnectivity,
              java.util.BitSet edgesToCheck,
              java.util.BitSet edgeConnectivity)
mark the face in its connectivity set, add edges to check list


getMergeFace

public int getMergeFace(int faceIdx)
Get the index of the face merged with a particular face.


coplanarTriToQuad

public int coplanarTriToQuad(double limit,
                             int ifsNumber)
Merge coplanar polygons.


coplanar

public boolean coplanar(SpacePrimitive v1,
                        SpacePrimitive v2,
                        SpacePrimitive v3,
                        SpacePrimitive v4,
                        double limit)

expand

public void expand(float factor)
Multiply each vertex by a factor


createSet

public void createSet(SpaceEntitySet obsoleteSet,
                      int type)

appendSet

public void appendSet(int type,
                      SpaceEntitySet newSet)

replaceSet

public void replaceSet(int type,
                       SpaceEntitySet newSet)

invalidate

public void invalidate(int type)

getEntitySet

public SpaceEntitySet getEntitySet(int type)
Get the SpaceEntitySet for the vertices, edges, or faces.


getPrevEntitySet

public SpaceEntitySet getPrevEntitySet(int type)

getAppendedSet

public SpaceEntitySet getAppendedSet(int type)

setLocation

public void setLocation(int baseType,
                        int avgType)
Set the center location for each SpacePrimitive by averaging location of surrounding entities.


setLocation

public void setLocation(int baseType,
                        int avgType,
                        float cx,
                        float cy,
                        float cz,
                        float distance)

setLocation

void setLocation(int baseType,
                 int avgType,
                 boolean setDistance,
                 float cx,
                 float cy,
                 float cz,
                 float distance)

addVertex

public void addVertex(float x,
                      float y,
                      float z)
Add a vertex to the SpaceEntitySet for vertices. This is used to initially create the vertex set when an IndexedFaceSet is encountered.


addTexCoord

public void addTexCoord(int value)

addNormalCoord

public void addNormalCoord(int value)

addColorCoord

public void addColorCoord(int value)

addFaceCoord

public void addFaceCoord(int value)
Add another coord to the face being built one coord at a time


addFace

public void addFace()

setFaceColor

public void setFaceColor(int value)
Hack, since I don't use face location, don't want to make SpacePrimitive too big...


diagonalize

public void diagonalize()

initMaxes

void initMaxes()

markMax

void markMax(float d)

parallelEdgePolygonReduction

public int parallelEdgePolygonReduction(float threshold)
Parallel edge joining algorithm.


checkVertex

boolean checkVertex(int candidate,
                    SpaceEntitySet edges,
                    SpaceEntitySet vertices,
                    java.util.BitSet verticesRuledOut,
                    java.util.BitSet vertexCandidates,
                    float threshold,
                    java.util.Hashtable joinTo)

markCandidate

void markCandidate(int candidate,
                   int bro1,
                   int bro2,
                   java.util.BitSet verticesRuledOut,
                   java.util.BitSet vertexCandidates)

smallTrianglePolygonReduction

public boolean smallTrianglePolygonReduction(int minimumNumberFaces,
                                             int percentThreshold,
                                             boolean preserveColorBoundaries)
Small triangle removal polygon reduction algorithm.


normalize

public void normalize()

s1

public void s1()

t1

public void t1()

s2

public void s2()

t2

public void t2()

s3

public void s3()

t3

public void t3()

s12

public void s12()

t12

public void t12()

s13

public void s13()

t13

public void t13()

s23

public void s23()

t23

public void t23()

s123

public void s123()

t123

public void t123()

V

void V()

E

void E()

F

void F()

r1

void r1()
Relationship #1: F --* V Exists when structure is first loaded.


r2

void r2()
RelationShip #2: V --* F Can be derived from r1 This method however derivew from r3.


r3

void r3()

r4

void r4()
Calculate relationship #4, faces around each edge r4. E ---2 F E,r3


r5

void r5()

r6

void r6()

showNonRemoval

void showNonRemoval(int numberEdges,
                    java.util.BitSet edgeNonRemovalList)

setName

public void setName(java.lang.String nm)

createFtoE

void createFtoE(SpaceEntitySet edges,
                SpaceEntitySet faces,
                int numberFaces)
Create F-*E relationship, must not exist when this is called.


edgeRemovalPolygonReduction

public void edgeRemovalPolygonReduction(boolean preserveColorBoundaries,
                                        int xFactor,
                                        int yFactor,
                                        int zFactor,
                                        int percent,
                                        int minEdgeCount,
                                        BoundingBox b,
                                        java.util.Hashtable boundingBoxOverlap,
                                        boolean useBoundingBoxLimit,
                                        int ifsNumber)
Edge removal polygon reduction algorithm.


sort

void sort(int firstIdx,
          int lastIdx,
          int[] list,
          int[] tmpList,
          float[] edgeLengths)

getMiddleValue

float getMiddleValue(int firstIdx,
                     int lastIdx,
                     int[] list,
                     float[] edgeLengths)

generateEdges

void generateEdges()
Generate edges from the faces, assume F exists and r1 holds.


shrinkFaces

void shrinkFaces(float factor)

addVfaces

void addVfaces()

distanceBetween

float distanceBetween(SpacePrimitive v1,
                      SpacePrimitive v2)

addEfaces

void addEfaces()

getTraceback

void getTraceback()