Modifier and Type | Class and Description |
---|---|
static class |
Spline.SplineType |
Constructor and Description |
---|
Spline() |
Spline(java.util.List<Vector4f> controlPoints,
java.util.List<java.lang.Float> nurbKnots)
Create a NURBS spline.
|
Spline(Spline.SplineType splineType,
java.util.List<Vector3f> controlPoints,
float curveTension,
boolean cycle)
Create a spline
|
Spline(Spline.SplineType splineType,
Vector3f[] controlPoints,
float curveTension,
boolean cycle)
Create a spline
|
Modifier and Type | Method and Description |
---|---|
void |
addControlPoint(Vector3f controlPoint)
Adds a controlPoint to the spline
|
void |
clearControlPoints() |
int |
getBasisFunctionDegree()
This method returns NURBS' spline basis function degree.
|
java.util.List<Vector3f> |
getControlPoints()
returns this spline control points
|
float |
getCurveTension()
returns the curve tension
|
java.util.List<java.lang.Float> |
getKnots()
This method returns NURBS' spline knots.
|
float |
getMaxNurbKnot()
This method returns the maximum nurb curve knot value.
|
float |
getMinNurbKnot()
This method returns the minimum nurb curve knot value.
|
java.util.List<java.lang.Float> |
getSegmentsLength()
returns a list of float representing the segments length
|
float |
getTotalLength() |
Spline.SplineType |
getType()
return the type of the spline
|
float[] |
getWeights()
This method returns NURBS' spline weights.
|
Vector3f |
interpolate(float value,
int currentControlPoint,
Vector3f store)
Interpolate a position on the spline
|
boolean |
isCycle() |
void |
read(JmeImporter im)
De-serialize this spline from the specified importer, for example
when loading from a J3O file.
|
void |
removeControlPoint(Vector3f controlPoint)
remove the controlPoint from the spline
|
void |
setCurveTension(float curveTension)
sets the curve tension
|
void |
setCycle(boolean cycle)
set to true to make the spline cycle
|
void |
setType(Spline.SplineType type)
Sets the type of the spline
|
void |
write(JmeExporter ex)
Serialize this spline to the specified exporter, for example when
saving to a J3O file.
|
public Spline()
public Spline(Spline.SplineType splineType, Vector3f[] controlPoints, float curveTension, boolean cycle)
splineType
- the type of the spline @see {SplineType}controlPoints
- an array of vector to use as control points of the spline
If the type of the curve is Bezier curve the control points should be provided
in the appropriate way. Each point 'p' describing control position in the scene
should be surrounded by two handler points. This applies to every point except
for the border points of the curve, who should have only one handle point.
The pattern should be as follows:
P0 - H0 : H1 - P1 - H1 : ... : Hn - Pn
n is the amount of 'P' - points.curveTension
- the tension of the splinecycle
- true if the spline cycle.public Spline(Spline.SplineType splineType, java.util.List<Vector3f> controlPoints, float curveTension, boolean cycle)
splineType
- the type of the spline @see {SplineType}controlPoints
- a list of vector to use as control points of the spline
If the type of the curve is Bezier curve the control points should be provided
in the appropriate way. Each point 'p' describing control position in the scene
should be surrounded by two handler points. This applies to every point except
for the border points of the curve, who should have only one handle point.
The pattern should be as follows:
P0 - H0 : H1 - P1 - H1 : ... : Hn - Pn
n is the amount of 'P' - points.curveTension
- the tension of the splinecycle
- true if the spline cycle.public Spline(java.util.List<Vector4f> controlPoints, java.util.List<java.lang.Float> nurbKnots)
controlPoints
- a list of vector to use as control points of the splinenurbKnots
- the nurb's spline knotspublic void addControlPoint(Vector3f controlPoint)
controlPoint
- a position in world spacepublic void removeControlPoint(Vector3f controlPoint)
controlPoint
- the controlPoint to removepublic void clearControlPoints()
public Vector3f interpolate(float value, int currentControlPoint, Vector3f store)
value
- a value from 0 to 1 that represent the position between the
current control point and the next onecurrentControlPoint
- the current control pointstore
- a vector to store the result (use null to create a new one
that will be returned by the method)public float getCurveTension()
public void setCurveTension(float curveTension)
curveTension
- the tensionpublic boolean isCycle()
public void setCycle(boolean cycle)
cycle
- true for cyclic, false for acyclicpublic float getTotalLength()
public Spline.SplineType getType()
public void setType(Spline.SplineType type)
type
- Linear/CatmullRom/Bezier/Nurbpublic java.util.List<Vector3f> getControlPoints()
public java.util.List<java.lang.Float> getSegmentsLength()
public float getMinNurbKnot()
public float getMaxNurbKnot()
public java.util.List<java.lang.Float> getKnots()
public float[] getWeights()
public int getBasisFunctionDegree()
public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException