com.sun.j3d.utils.geometry
Class Stripifier

java.lang.Object
  extended by com.sun.j3d.utils.geometry.Stripifier

public class Stripifier
extends java.lang.Object

The Stripifier utility will change the primitive of the GeometryInfo object to Triangle Strips. The strips are made by analyzing the triangles in the original data and connecting them together.

Normal Generation should be performed on the GeometryInfo object before Stripification, for best results. Example:

   GeometryInfo gi = new GeometryInfo(TRIANGLE_ARRAY);
   gi.setCoordinates(coordinateData);

   NormalGenerator ng = new NormalGenerator();
   ng.generateNormals(gi);

   Stripifier st = new Stripifier()
   st.stripify(gi);

   Shape3D part = new Shape3D();
   part.setAppearance(appearance);
   part.setGeometry(gi.getGeometryArray());
   


Nested Class Summary
(package private)  class Stripifier.Edge
          Stores the information about an edge of a triangle
(package private)  class Stripifier.Face
          Stores the information about the face of a triangle
(package private)  class Stripifier.Istream
           
(package private)  class Stripifier.Node
          stores the information for a face node
(package private)  class Stripifier.SortedList
          sorts the Nodes by depth
(package private)  class Stripifier.Vertex
          Stores the infomration about a vertex
 
Field Summary
(package private)  boolean CHECK_ORIENT
           
static int COLLECT_STATS
          Indicates to the stripifier to collect statistics on the data
(package private)  boolean colorStrips
           
(package private)  boolean DEBUG
           
(package private) static int EMPTY
           
(package private)  boolean hasColors
           
(package private)  boolean hasNormals
           
(package private)  boolean hasTextures
           
(package private)  int[] numNhbrs
           
(package private)  StripifierStats stats
           
(package private)  int texSetCount
           
 
Constructor Summary
Stripifier()
          Creates the Stripifier object.
Stripifier(int flags)
          Creates the Stripifier object.
 
Method Summary
(package private)  void buildAdjacencies(Stripifier.Edge[] edges, Stripifier.Face[] faces)
          Builds the adjacency graph by finding the neighbors of the edges
(package private)  boolean checkOrientCCWSeq(Stripifier.Vertex last, Stripifier.Vertex prev, Stripifier.Face face)
           
(package private)  boolean checkOrientCWSeq(Stripifier.Vertex last, Stripifier.Vertex prev, Stripifier.Face face)
           
(package private)  void concatenate(java.util.ArrayList strips, Stripifier.Face[] faces)
          joins tristrips if their end triangles neighbor each other.
(package private)  Stripifier.Edge[] createEdgeArray(Stripifier.Face[] faces)
          Creates an array of edges from the Face array.
(package private)  Stripifier.Face[] createFaceArray(GeometryInfo gi)
          Creates an array of faces from the geometry in the GeometryInfo object.
(package private)  Stripifier.Node[] dfSearch(Stripifier.Face[] faces, Stripifier.Node[] faceNodes)
           
(package private)  int findNext(Stripifier.Node node, Stripifier.Node[] faceNodes, Stripifier.Face[] faces)
           
(package private)  void freeNhbrTable()
           
(package private)  Stripifier.Face getNextFace(java.util.ArrayList currStrip, int index)
           
 StripifierStats getStripifierStats()
          Returns the stripifier stats object.
(package private)  java.util.ArrayList hamilton(Stripifier.Node[] sTree, int[] numStrips, int[] numPatches)
          generates hamiltonian strips from the derived binary spanning tree using the path peeling algorithm to peel off any node wiht double children in a bottom up fashion.
(package private)  Stripifier.Node[] hybridSearch(Stripifier.Face[] faces, Stripifier.Node[] faceNodes)
          Takes a list of faces as input and performs a hybrid search, a variated depth first search that returns to the highest level node not yet fully explored.
(package private)  boolean orientSeq(boolean ccw, Stripifier.Istream stream, Stripifier.Face face)
           
(package private)  boolean orientZAT(boolean ccw, Stripifier.Istream stream, Stripifier.Face face)
           
(package private)  void putBackData(GeometryInfo gi, java.util.ArrayList strips)
          puts the stripified data back into the GeometryInfo object
(package private)  void quickSortEdges(Stripifier.Edge[] edges, int l, int r)
          uses quicksort to sort the edges
(package private)  void reduceCostByOne(java.util.ArrayList strips, Stripifier.Face[] faces, int[] faceTable)
          find all links that reduce cost by 1
(package private)  void reduceCostByTwo(java.util.ArrayList strips, Stripifier.Face[] faces, int[] faceTable)
          find all the links that reduce the cost by 2
(package private)  void reduceCostByZero(java.util.ArrayList strips, Stripifier.Face[] faces, int[] faceTable)
          find all the links that reduce the cost by 0
(package private)  int resetNhbr(int y, Stripifier.Face[] faces, Stripifier.Node[] faceNodes)
           
(package private)  boolean seq(Stripifier.Istream stream, Stripifier.Face face, int share)
           
(package private)  void setNumNhbrs(Stripifier.Face[] faces)
           
(package private)  void sortEdges(Stripifier.Edge[] edges)
          Sorts the edges using BubbleSort
(package private)  boolean stripDone(java.util.ArrayList strip, int count)
           
(package private)  java.util.ArrayList stripe(java.util.ArrayList strips)
          creates the triangle strips
 void stripify(GeometryInfo gi)
          Converts the geometry contained in the GeometryInfo object into an array of triangle strips.
(package private)  void updateNumNhbrs(Stripifier.Node node)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

final boolean DEBUG
See Also:
Constant Field Values

CHECK_ORIENT

final boolean CHECK_ORIENT
See Also:
Constant Field Values

EMPTY

static final int EMPTY
See Also:
Constant Field Values

hasNormals

boolean hasNormals

hasTextures

boolean hasTextures

texSetCount

int texSetCount

hasColors

boolean hasColors

colorStrips

boolean colorStrips

stats

StripifierStats stats

numNhbrs

int[] numNhbrs

COLLECT_STATS

public static final int COLLECT_STATS
Indicates to the stripifier to collect statistics on the data

See Also:
Constant Field Values
Constructor Detail

Stripifier

public Stripifier()
Creates the Stripifier object.


Stripifier

public Stripifier(int flags)
Creates the Stripifier object.

Parameters:
flags - Flags
Since:
Java 3D 1.2.1
Method Detail

stripify

public void stripify(GeometryInfo gi)
Converts the geometry contained in the GeometryInfo object into an array of triangle strips.


getStripifierStats

public StripifierStats getStripifierStats()
Returns the stripifier stats object.

Throws:
java.lang.IllegalStateException - if the Stripfier has not been constructed with the COLLECT_STATS flag
Since:
Java 3D 1.2.1

createFaceArray

Stripifier.Face[] createFaceArray(GeometryInfo gi)
Creates an array of faces from the geometry in the GeometryInfo object.


createEdgeArray

Stripifier.Edge[] createEdgeArray(Stripifier.Face[] faces)
Creates an array of edges from the Face array.


buildAdjacencies

void buildAdjacencies(Stripifier.Edge[] edges,
                      Stripifier.Face[] faces)
Builds the adjacency graph by finding the neighbors of the edges


sortEdges

void sortEdges(Stripifier.Edge[] edges)
Sorts the edges using BubbleSort


quickSortEdges

void quickSortEdges(Stripifier.Edge[] edges,
                    int l,
                    int r)
uses quicksort to sort the edges


hybridSearch

Stripifier.Node[] hybridSearch(Stripifier.Face[] faces,
                               Stripifier.Node[] faceNodes)
Takes a list of faces as input and performs a hybrid search, a variated depth first search that returns to the highest level node not yet fully explored. Returns an array of pointers to the faces found in order from the search. The faceNodes parameter is an array of the Nodes created for the faces.


dfSearch

Stripifier.Node[] dfSearch(Stripifier.Face[] faces,
                           Stripifier.Node[] faceNodes)

findNext

int findNext(Stripifier.Node node,
             Stripifier.Node[] faceNodes,
             Stripifier.Face[] faces)

setNumNhbrs

void setNumNhbrs(Stripifier.Face[] faces)

freeNhbrTable

void freeNhbrTable()

updateNumNhbrs

void updateNumNhbrs(Stripifier.Node node)

resetNhbr

int resetNhbr(int y,
              Stripifier.Face[] faces,
              Stripifier.Node[] faceNodes)

hamilton

java.util.ArrayList hamilton(Stripifier.Node[] sTree,
                             int[] numStrips,
                             int[] numPatches)
generates hamiltonian strips from the derived binary spanning tree using the path peeling algorithm to peel off any node wiht double children in a bottom up fashion. Returns a Vector of strips. Also return the number of strips and patches in the numStrips and numPatches "pointers"


stripe

java.util.ArrayList stripe(java.util.ArrayList strips)
creates the triangle strips


stripDone

boolean stripDone(java.util.ArrayList strip,
                  int count)

seq

boolean seq(Stripifier.Istream stream,
            Stripifier.Face face,
            int share)

orientSeq

boolean orientSeq(boolean ccw,
                  Stripifier.Istream stream,
                  Stripifier.Face face)

orientZAT

boolean orientZAT(boolean ccw,
                  Stripifier.Istream stream,
                  Stripifier.Face face)

checkOrientCWSeq

boolean checkOrientCWSeq(Stripifier.Vertex last,
                         Stripifier.Vertex prev,
                         Stripifier.Face face)

checkOrientCCWSeq

boolean checkOrientCCWSeq(Stripifier.Vertex last,
                          Stripifier.Vertex prev,
                          Stripifier.Face face)

getNextFace

Stripifier.Face getNextFace(java.util.ArrayList currStrip,
                            int index)

concatenate

void concatenate(java.util.ArrayList strips,
                 Stripifier.Face[] faces)
joins tristrips if their end triangles neighbor each other. The priority is performed in three stages: strips are concatenated to save 2, 1, or no vertices


reduceCostByTwo

void reduceCostByTwo(java.util.ArrayList strips,
                     Stripifier.Face[] faces,
                     int[] faceTable)
find all the links that reduce the cost by 2


reduceCostByOne

void reduceCostByOne(java.util.ArrayList strips,
                     Stripifier.Face[] faces,
                     int[] faceTable)
find all links that reduce cost by 1


reduceCostByZero

void reduceCostByZero(java.util.ArrayList strips,
                      Stripifier.Face[] faces,
                      int[] faceTable)
find all the links that reduce the cost by 0


putBackData

void putBackData(GeometryInfo gi,
                 java.util.ArrayList strips)
puts the stripified data back into the GeometryInfo object



Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.