|
|||||||||
| Home >> All >> com >> trapezium >> [ attractor overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.trapezium.attractor
Class AttractorPolygonReduction

java.lang.Objectcom.trapezium.chisel.Optimizer
com.trapezium.attractor.AttractorPolygonReduction
- All Implemented Interfaces:
- java.util.EventListener, com.trapezium.space.IFS, com.trapezium.chisel.NodeLocatorListener, com.trapezium.chisel.OptionHolder, com.trapezium.space.SpaceCorrespondenceConstants
- Direct Known Subclasses:
- GeodesicAttractor, LODAttractor
- public abstract class AttractorPolygonReduction
- extends com.trapezium.chisel.Optimizer
- implements com.trapezium.space.IFS, com.trapezium.space.SpaceCorrespondenceConstants
- extends com.trapezium.chisel.Optimizer
Abstract base class for all attractor reduction chisels. Attractor polygon reduction chisels use one IFS (the attractor) to reduce a second IFS (the floater). It does this by warping the first IFS onto the second. The result has the same basic polygon count as the first IFS, but the same shape as the second IFS. Actually, the resulting polygon count is the same as triangulating all faces of the attractor IFS by placing a vertex in the center of the face and connecting it to the surrounding vertices. The reduction takes place in two phases. First, the floater IFS is partitioned into sets of coordinates. Each coordinate in a set is closest to a particular attractor coordinate than to any other attractor coordinate. Within each of these sets, the coordinate nearest to the attractor is marked for preservation. Next, the dual of the attractor is created, and the coordinate sets calculated again. Within each of these sets, the coordinate farthest from the attractor is marked for preservation. The set of floater coordinates to be preserved are then merged into a single triangulated structure, with (V+F) vertices and 2*E triangle faces, where V,E,F are the number of vertices, edges, and faces in the attractor. Subclasses select specific attractors. Options: minimum number of vertices required in the floater preserve color boundaries preserve edge boundaries
- Since:
- 1.0
- Version:
- 1.0, 7 Oct 1998
| Nested Class Summary | |
(package private) class |
AttractorPolygonReduction.AttractorParam
The actual parameter passed to the optimize method, uses the ReducerState above to track whether or not the reduction algorithm has occurred since it has to happen at optimize time due to DEF/USE of coordinate nodes. |
(package private) class |
AttractorPolygonReduction.ReducerState
ReducerState is an internal class, tracks whether or not the reduction algorithm has taken place, since it can't actually occur until optimize time (due to DEF/USE of Coordinate nodes) |
| Field Summary | |
static int |
MIN_FLOATER_VERTICES
|
(package private) int |
minFloaterVertices
|
static int |
PRESERVE_COLOR_BOUNDARIES
|
static int |
PRESERVE_EDGE_BOUNDARIES
|
(package private) boolean |
preserveColorBoundaries
|
(package private) boolean |
preserveEdgeBoundaries
|
protected com.trapezium.vrmlspace.SpaceStructureLoader |
spaceStructureLoader
|
| Fields inherited from class com.trapezium.chisel.Optimizer |
baseFileName, baseFilePath, dataSource |
| Fields inherited from interface com.trapezium.space.IFS |
Color, ColorIndex, Coord, CoordIndex, Normal, NormalIndex, OnePerCoord, OnePerCoordIndex, OnePerFace, TexCoord, TexCoordIndex |
| Fields inherited from interface com.trapezium.space.SpaceCorrespondenceConstants |
ControlledByIndex, CorrespondsToF, CorrespondsToSpaceEntitySet, CorrespondsToV, StandAlone |
| Constructor Summary | |
AttractorPolygonReduction(java.lang.String reductionDescription)
Class constructor |
|
| Method Summary | |
void |
attemptOptimization(com.trapezium.vrml.node.Node n)
Attempt optimization by creating a SpaceStructure for the node, then if optimization is possible, register the node for optimization. |
abstract com.trapezium.space.SpaceStructure |
generateAttractor()
subclasses override this to provide specific attractors |
int |
getNumberOptions()
subclasses override this if they have additional options |
java.lang.Class |
getOptionClass(int optionOffset)
Get the class for an option |
java.lang.Object |
getOptionConstraints(int offset)
Get current option value |
java.lang.String |
getOptionLabel(int offset)
Get a specific control option label |
java.lang.Object |
getOptionValue(int offset)
Get current option value |
boolean |
optimizationOK(com.trapezium.space.SpaceStructure nSpace,
com.trapezium.vrml.node.Node n)
Check if optimization is allowed according to the user configurable guidelines. |
void |
optimize(com.trapezium.chisel.TokenPrinter tp,
java.lang.Object param,
int startTokenOffset,
int endTokenOffset)
Optimize a node. |
(package private) void |
printTexCoordIndex(com.trapezium.chisel.TokenPrinter tp,
int[] face,
com.trapezium.space.SpaceStructure original,
int[] newToOldMapping)
Print the texCoordIndex values for a regenerated face. |
(package private) void |
registerOptimization(com.trapezium.space.SpaceStructure nSpace,
com.trapezium.vrml.node.Node n)
Register the "coord" and "coordIndex" section of the Node for replacement by this chisel. |
(package private) void |
replaceCoord(com.trapezium.chisel.TokenPrinter tp,
com.trapezium.space.SpaceEntitySet vertices)
Regenerate the text for the coordinates, based on the locations provided by the SpaceEntitySet, which has by this time been modified by the reduction algorithm. |
(package private) void |
replaceCoordIndex(com.trapezium.chisel.TokenPrinter tp,
java.util.Enumeration faces)
Regenerate the text for the faces. |
(package private) void |
replaceTexCoord(com.trapezium.chisel.TokenPrinter tp,
int numberNewCoords,
int[] newToOldMapping,
com.trapezium.space.SpaceStructure original,
int startTokenOffset,
int endTokenOffset)
Regenerate the text for the "texCoord" field, this is always one-to-one with original coords. |
(package private) void |
replaceTexCoordIndex(com.trapezium.chisel.TokenPrinter tp,
java.util.Enumeration faces,
com.trapezium.space.SpaceStructure originalSpaceStructure,
int[] newToOldMapping)
Regenerate the text for the texCoordIndex field. |
(package private) void |
replaceUsingF(com.trapezium.chisel.TokenPrinter tp,
int[] newToOldMapping,
com.trapezium.space.SpaceEntitySet faces,
com.trapezium.space.SpaceEntitySet colors,
int startTokenOffset,
int endTokenOffset)
Replace values that originally corresponded to faces. |
(package private) void |
replaceUsingV(com.trapezium.chisel.TokenPrinter tp,
int numberNewCoords,
int[] newToOldMapping,
com.trapezium.space.SpaceEntitySet original,
int startTokenOffset,
int endTokenOffset)
This version replaces a "color" field where each entry corresponds to a coordinate |
void |
reset()
reset the Chisel |
(package private) void |
setDataSource(com.trapezium.vrml.node.Node n)
|
void |
setOptionValue(int offset,
java.lang.Object value)
Set option value |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
MIN_FLOATER_VERTICES
public static final int MIN_FLOATER_VERTICES
- See Also:
- Constant Field Values
PRESERVE_COLOR_BOUNDARIES
public static final int PRESERVE_COLOR_BOUNDARIES
- See Also:
- Constant Field Values
PRESERVE_EDGE_BOUNDARIES
public static final int PRESERVE_EDGE_BOUNDARIES
- See Also:
- Constant Field Values
minFloaterVertices
int minFloaterVertices
preserveColorBoundaries
boolean preserveColorBoundaries
preserveEdgeBoundaries
boolean preserveEdgeBoundaries
spaceStructureLoader
protected com.trapezium.vrmlspace.SpaceStructureLoader spaceStructureLoader
| Constructor Detail |
AttractorPolygonReduction
public AttractorPolygonReduction(java.lang.String reductionDescription)
- Class constructor
| Method Detail |
generateAttractor
public abstract com.trapezium.space.SpaceStructure generateAttractor()
- subclasses override this to provide specific attractors
getNumberOptions
public int getNumberOptions()
- subclasses override this if they have additional options
- Specified by:
getNumberOptionsin interfacecom.trapezium.chisel.OptionHolder
getOptionClass
public java.lang.Class getOptionClass(int optionOffset)
- Get the class for an option
- Specified by:
getOptionClassin interfacecom.trapezium.chisel.OptionHolder
getOptionLabel
public java.lang.String getOptionLabel(int offset)
- Description copied from class:
com.trapezium.chisel.Optimizer - Get a specific control option label
- Specified by:
getOptionLabelin interfacecom.trapezium.chisel.OptionHolder
getOptionValue
public java.lang.Object getOptionValue(int offset)
- Description copied from class:
com.trapezium.chisel.Optimizer - Get current option value
- Specified by:
getOptionValuein interfacecom.trapezium.chisel.OptionHolder
setOptionValue
public void setOptionValue(int offset,
java.lang.Object value)
- Description copied from class:
com.trapezium.chisel.Optimizer - Set option value
- Specified by:
setOptionValuein interfacecom.trapezium.chisel.OptionHolder
getOptionConstraints
public java.lang.Object getOptionConstraints(int offset)
- Description copied from class:
com.trapezium.chisel.Optimizer - Get current option value
- Specified by:
getOptionConstraintsin interfacecom.trapezium.chisel.OptionHolder
reset
public void reset()
- reset the Chisel
attemptOptimization
public void attemptOptimization(com.trapezium.vrml.node.Node n)
- Attempt optimization by creating a SpaceStructure for the node,
then if optimization is possible, register the node for optimization.
optimize
public void optimize(com.trapezium.chisel.TokenPrinter tp, java.lang.Object param, int startTokenOffset, int endTokenOffset)
- Optimize a node.
setDataSource
void setDataSource(com.trapezium.vrml.node.Node n)
optimizationOK
public boolean optimizationOK(com.trapezium.space.SpaceStructure nSpace, com.trapezium.vrml.node.Node n)
- Check if optimization is allowed according to the user configurable
guidelines. The return value is based on whether the SpaceStructure
exists and meets the minimum number of vertices requirement set by
the user.
registerOptimization
void registerOptimization(com.trapezium.space.SpaceStructure nSpace, com.trapezium.vrml.node.Node n)
- Register the "coord" and "coordIndex" section of the Node for
replacement by this chisel. This is only done if those fields exist
and the chisel successfully created an attractor SpaceStructure.
replaceCoord
void replaceCoord(com.trapezium.chisel.TokenPrinter tp, com.trapezium.space.SpaceEntitySet vertices)
- Regenerate the text for the coordinates, based on the locations
provided by the SpaceEntitySet, which has by this time been modified
by the reduction algorithm.
replaceCoordIndex
void replaceCoordIndex(com.trapezium.chisel.TokenPrinter tp, java.util.Enumeration faces)
- Regenerate the text for the faces.
replaceTexCoordIndex
void replaceTexCoordIndex(com.trapezium.chisel.TokenPrinter tp, java.util.Enumeration faces, com.trapezium.space.SpaceStructure originalSpaceStructure, int[] newToOldMapping)
- Regenerate the text for the texCoordIndex field.
printTexCoordIndex
void printTexCoordIndex(com.trapezium.chisel.TokenPrinter tp, int[] face, com.trapezium.space.SpaceStructure original, int[] newToOldMapping)
- Print the texCoordIndex values for a regenerated face.
In this case, the texCoord field has not changed, so the
new face coordIndex values have to be mapped into old face
texCoordIndex values.
replaceTexCoord
void replaceTexCoord(com.trapezium.chisel.TokenPrinter tp, int numberNewCoords, int[] newToOldMapping, com.trapezium.space.SpaceStructure original, int startTokenOffset, int endTokenOffset)
- Regenerate the text for the "texCoord" field, this is always
one-to-one with original coords.
replaceUsingV
void replaceUsingV(com.trapezium.chisel.TokenPrinter tp, int numberNewCoords, int[] newToOldMapping, com.trapezium.space.SpaceEntitySet original, int startTokenOffset, int endTokenOffset)
- This version replaces a "color" field where each entry corresponds to a coordinate
replaceUsingF
void replaceUsingF(com.trapezium.chisel.TokenPrinter tp, int[] newToOldMapping, com.trapezium.space.SpaceEntitySet faces, com.trapezium.space.SpaceEntitySet colors, int startTokenOffset, int endTokenOffset)
- Replace values that originally corresponded to faces.
|
|||||||||
| Home >> All >> com >> trapezium >> [ attractor overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC