|
j3d.org Code | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.j3d.geom.GeometryGenerator
org.j3d.geom.spline.BSplineGenerator
public class BSplineGenerator
Geometry generator for generating a single B-Splinecurve.
BSpline curves of all orders are permitted.
The implementation of the algorithm is based on Paul Bourke's C code found at http://astronomy.swin.edu.au/~pbourke/curves/spline/.
| Field Summary | |
|---|---|
protected float[] |
controlPointWeights
The control point weightings on the patch. |
protected boolean |
useControlPointWeights
Should we use control point weights. |
| Constructor Summary | |
|---|---|
BSplineGenerator()
Construct a new generator of degree 3 with default number of segments. |
|
BSplineGenerator(int t)
Construct a new generator with the given degree but fixed number of segments. |
|
BSplineGenerator(int t,
int facets)
Construct a new generator with the specified number of tessellations over the length of the curve, regardless of extents. |
|
| 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. |
void |
generateSmoothKnots()
Convenience method to set knots that give a better looking curve shape using the existing curve degree. |
void |
generateSmoothKnots(int t)
Convenience method to set knots that give a better looking curve shape and set a new degree for the curve directly. |
int |
getDegree()
Get the degree of the curve being generated. |
float[] |
getKnots()
Return a copy of the knot values. |
int |
getVertexCount(GeometryData data)
Get the number of vertices that this generator will create for the curve. |
boolean |
hasControlPointWeights()
Get the current setting of the control point weight usage flag. |
void |
setControlPoints(double[] controlPoints)
Set the curve controlPoints. |
void |
setControlPoints(double[] controlPoints,
double[] weights)
Set the curve controlPoints. |
void |
setControlPoints(double[] controlPoints,
int numValid)
Set the curve controlPoints from a subset of the given array. |
void |
setControlPoints(double[] controlPoints,
int numValid,
double[] weights)
Set the curve controlPoints from a subset of the given array. |
void |
setControlPoints(float[] controlPoints)
Set the curve controlPoints. |
void |
setControlPoints(float[] controlPoints,
float[] weights)
Set the curve controlPoints. |
void |
setControlPoints(float[] controlPoints,
int numValid)
Set the curve controlPoints from a subset of the given array. |
void |
setControlPoints(float[] controlPoints,
int numValid,
float[] weights)
Set the curve controlPoints from a subset of the given array. |
void |
setFacetCount(int facets)
Change the number of facets used to create this cone. |
void |
setKnots(int n,
double[] knts)
Set the curve degree and knots. |
void |
setKnots(int n,
float[] knts)
Set the curve degree and knots. |
void |
setWeights(double[] weights)
Set the control point weights to use with the existing control points. |
void |
setWeights(double[] weights,
int numValid)
Set the control point weights to use with the existing control points. |
void |
setWeights(float[] weights)
Set the control point weights to use with the existing control points. |
void |
setWeights(float[] weights,
int numValid)
Set the control point weights to use with the existing control points. |
double |
splineBlend(int i,
int k,
double t)
Calculate the blending value, this is done recursively. |
| 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[] controlPointWeights
protected boolean useControlPointWeights
| Constructor Detail |
|---|
public BSplineGenerator()
public BSplineGenerator(int t)
t - The degree of the curve > 1
java.lang.IllegalArgumentException - The degree < 2
public BSplineGenerator(int t,
int facets)
t - The degree of the curve > 1facets - The number of facets on the side of the curve
java.lang.IllegalArgumentException - The number of facets is less than 3 or
degree < 2| Method Detail |
|---|
public void enableControlPointWeights(boolean state)
state - true if the weights should be usedpublic boolean hasControlPointWeights()
public void setFacetCount(int facets)
facets - The number of facets on the side of the cone
java.lang.IllegalArgumentException - The number of facets is less than 3public void setWeights(float[] weights)
weights - Weight values to go with the pointspublic void setWeights(double[] weights)
weights - Weight values to go with the points
public void setWeights(float[] weights,
int numValid)
weights - Weight values to go with the pointsnumValid - The number of valid points in the array
public void setWeights(double[] weights,
int numValid)
weights - Weight values to go with the pointsnumValid - The number of valid points in the arraypublic void setControlPoints(float[] controlPoints)
controlPoints - The controlPoint coordinate valuespublic void setControlPoints(double[] controlPoints)
controlPoints - The controlPoint coordinate values
public void setControlPoints(float[] controlPoints,
float[] weights)
Will automatically turn on the use of control point weight calculations (rational form).
controlPoints - The controlPoint coordinate valuesweights - Weight values to go with the points
public void setControlPoints(double[] controlPoints,
double[] weights)
Will automatically turn on the use of control point weight calculations (rational form).
controlPoints - The controlPoint coordinate valuesweights - Weight values to go with the points
public void setControlPoints(float[] controlPoints,
int numValid)
controlPoints - The controlPoint coordinate valuesnumValid - The number of valid points in the array
public void setControlPoints(double[] controlPoints,
int numValid)
controlPoints - The controlPoint coordinate valuesnumValid - The number of valid points in the array
public void setControlPoints(float[] controlPoints,
int numValid,
float[] weights)
Will automatically turn on the use of control point weight calculations (rational form).
controlPoints - The controlPoint coordinate valuesnumValid - The number of valid points in the arrayweights - Weight values to go with the points
public void setControlPoints(double[] controlPoints,
int numValid,
double[] weights)
Will automatically turn on the use of control point weight calculations (rational form).
controlPoints - The controlPoint coordinate valuesnumValid - The number of valid points in the arrayweights - Weight values to go with the points
public void setKnots(int n,
float[] knts)
n - The degree of the curveknts - The knot values to control the curve
public void setKnots(int n,
double[] knts)
n - The degree of the curveknts - The knot values to control the curvepublic int getDegree()
public float[] getKnots()
public void generateSmoothKnots(int t)
t - The degree of the curvepublic void generateSmoothKnots()
public int getVertexCount(GeometryData data)
throws UnsupportedTypeException
getVertexCount in class GeometryGeneratordata - The data to base 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 GeometryGeneratordata - 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 requested
public double splineBlend(int i,
int k,
double t)
i - The basis function to checkk - The order of the curvet - The position along the curve to check ie N(t)
|
j3d.org Code | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||