|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.geom.GeometryGenerator org.j3d.geom.spline.PatchGenerator
public abstract class PatchGenerator
Base geometry generator defintion for all forms of spline-based patches.
Patches of all orders are permitted. Order information is derived from the provided controlPoint coordinates. When generating a patch, the values for the coordinates are nominally provided in the X and Z plane although no explicit checking is performed to ensure that controlPoint coordinates do not self-intersect or do anything nasty. Normals are always generated as the average between the adjacent faces.
A user may optionally provide a weighting for each control point to make for rational patches. By default, all control points start with a weight of one. The implementation automatically resets the weights back to one each time the control points are changed, unless otherwise specified. If the patch coordinate size changes, then the weights will always be reset, otherwise if the size is the same as previously set, then the weights are left alone.
Field Summary | |
---|---|
protected float[][] |
controlPointCoordinates
ControlPoint values used to generate patches |
protected float[][] |
controlPointWeights
The control point weightings on the patch. |
protected int |
depthFacetCount
The number of sections used around the patch depth |
protected boolean |
normalsChanged
Flag indicating base values have changed |
protected int |
numDepthControlPoints
The number of control points in the depth |
protected int |
numNormalValues
The number of patch coordinates in depth |
protected int |
numPatchValues
The number of patch coordinates in depth |
protected int |
numTexcoordValues
The number of patch coordinates in depth |
protected int |
numWidthControlPoints
The number of control points in the width |
protected boolean |
patchChanged
Flag indicating base values have changed |
protected float[][] |
patchCoordinates
The points on the patch. |
protected float[][] |
patchNormals
The smoothed normal for each point on the patch. |
protected float[][] |
patchTexcoords
The texture coordinate for each point on the patch. |
protected boolean |
texCoordsChanged
Flag indicating base values have changed |
protected boolean |
useControlPointWeights
Should we use control point weights. |
protected int |
widthFacetCount
The number of sections used around the patch width |
Constructor Summary | |
---|---|
protected |
PatchGenerator()
Construct a new generator with no control points set. |
Method Summary | |
---|---|
void |
enableControlPointWeights(boolean state)
Set the flag to say that calculations should be using the control point weights. |
void |
generate(GeometryData data)
Generate a new set of geometry items patchd on the passed data. |
int |
getVertexCount(GeometryData data)
Get the number of vertices that this generator will create for the shape given in the definition. |
boolean |
hasControlPointWeights()
Get the current setting of the control point weight usage flag. |
protected void |
regenerateNormals()
Convenience method to regenerate the smoothed normals for the patch. |
protected abstract void |
regeneratePatch()
Regenerate the patch coordinate points in accordance with the derived classes algorithm type. |
protected void |
regenerateTexcoords()
Regenerate the texture coordinate points. |
void |
setFacetCount(int widthFacets,
int depthFacets)
Change the number of facets used to create this cone. |
void |
setPatchControlPoints(double[][] controlPoints)
Set the patch control points. |
void |
setPatchControlPoints(double[][] controlPoints,
double[][] weights)
Set the patch control points and weights at the same time. |
void |
setPatchControlPoints(double[] controlPoints,
int numWidth,
int numDepth)
Set the patch controlPoints. |
void |
setPatchControlPoints(double[] controlPoints,
int numWidth,
int numDepth,
double[] weights)
Set the patch controlPoints. |
void |
setPatchControlPoints(float[][] controlPoints)
Set the patch control points. |
void |
setPatchControlPoints(float[][] controlPoints,
float[][] weights)
Set the patch control points and weights at the same time. |
void |
setPatchControlPoints(float[] controlPoints,
int numWidth,
int numDepth)
Set the patch controlPoints. |
void |
setPatchControlPoints(float[] controlPoints,
int numWidth,
int numDepth,
float[] weights)
Set the patch controlPoints. |
void |
setPatchWeights(double[][] weights)
Set the patch control point weights. |
void |
setPatchWeights(double[] weights,
int numWidth,
int numDepth)
Set the patch controlPoints. |
void |
setPatchWeights(float[][] weights)
Set the patch control point weights. |
void |
setPatchWeights(float[] weights,
int numWidth,
int numDepth)
Set the patch controlPoints. |
Methods inherited from class org.j3d.geom.GeometryGenerator |
---|
createFaceNormal, createFaceNormal, createRadialNormal, createRadialNormal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected float[][] controlPointCoordinates
protected float[][] controlPointWeights
protected int numWidthControlPoints
protected int numDepthControlPoints
protected float[][] patchCoordinates
protected float[][] patchNormals
protected float[][] patchTexcoords
protected int numPatchValues
protected int numNormalValues
protected int numTexcoordValues
protected boolean patchChanged
protected boolean normalsChanged
protected boolean texCoordsChanged
protected int widthFacetCount
protected int depthFacetCount
protected boolean useControlPointWeights
Constructor Detail |
---|
protected PatchGenerator()
Method Detail |
---|
protected abstract void regeneratePatch()
public void setFacetCount(int widthFacets, int depthFacets)
widthFacets
- The number of facets on the width of the patchdepthFacets
- The number of facets on the width of the patch
java.lang.IllegalArgumentException
- The number of facets is less than 3public void enableControlPointWeights(boolean state)
state
- true if the weights should be usedpublic boolean hasControlPointWeights()
public void setPatchWeights(float[][] weights)
If the arrays are not of minimum length 3 and equal length an exception is generated.
weights
- The weight values to usepublic void setPatchWeights(double[][] weights)
If the arrays are not of minimum length 3 and equal length an exception is generated.
weights
- The weight values to usepublic void setPatchWeights(float[] weights, int numWidth, int numDepth)
weights
- The weight values to usenumWidth
- The number of points in the widthnumDepth
- The number of points in the depthpublic void setPatchWeights(double[] weights, int numWidth, int numDepth)
weights
- The weight values to usenumWidth
- The number of points in the widthnumDepth
- The number of points in the depthpublic void setPatchControlPoints(float[][] controlPoints)
controlPoints
- The controlPoint coordinate valuespublic void setPatchControlPoints(double[][] controlPoints)
controlPoints
- The controlPoint coordinate valuespublic void setPatchControlPoints(float[][] controlPoints, float[][] weights)
controlPoints
- The controlPoint coordinate valuesweights
- The weight values to usepublic void setPatchControlPoints(double[][] controlPoints, double[][] weights)
controlPoints
- The controlPoint coordinate valuesweights
- The weight values to usepublic void setPatchControlPoints(float[] controlPoints, int numWidth, int numDepth)
controlPoints
- The controlPoint coordinate valuesnumWidth
- The number of points in the widthnumDepth
- The number of points in the depthpublic void setPatchControlPoints(double[] controlPoints, int numWidth, int numDepth)
controlPoints
- The controlPoint coordinate valuesnumWidth
- The number of points in the widthnumDepth
- The number of points in the depthpublic void setPatchControlPoints(float[] controlPoints, int numWidth, int numDepth, float[] weights)
controlPoints
- The controlPoint coordinate valuesnumWidth
- The number of points in the widthnumDepth
- The number of points in the depthpublic void setPatchControlPoints(double[] controlPoints, int numWidth, int numDepth, double[] weights)
controlPoints
- The controlPoint coordinate valuesnumWidth
- The number of points in the widthnumDepth
- The number of points in the depthpublic int getVertexCount(GeometryData data) throws UnsupportedTypeException
getVertexCount
in class GeometryGenerator
data
- The data to patch the calculations on
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requested.public void generate(GeometryData data) throws UnsupportedTypeException, InvalidArraySizeException
generate
in class GeometryGenerator
data
- The data to patch the calculations on
InvalidArraySizeException
- The array is not big enough to contain
the requested geometry
UnsupportedTypeException
- The generator cannot handle the type
of geometry you have requestedprotected void regenerateNormals()
protected final void regenerateTexcoords()
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |