com.jme.curve
Class BezierCurve
java.lang.Object
com.jme.scene.Spatial
com.jme.scene.Geometry
com.jme.curve.Curve
com.jme.curve.BezierCurve
- All Implemented Interfaces:
- java.io.Serializable
- public class BezierCurve
- extends Curve
BezierCurve uses an ordered-list of three-dimensional points
and the equation: x(t) = Sum(n, i=0) Bn,i(t)Pi
t [0,1]
Bn,i(t) = C(n;i)t^i(1-t)^(n-i)
The input (t) provides the current point of the curve at a interval [0,1]
where 0 is the first control point and 1 is the second control point.
- Version:
- $Id: BezierCurve.java,v 1.15 2004/10/14 01:23:13 mojomonkey Exp $
- Author:
- Mark Powell
- See Also:
- Serialized Form
| Fields inherited from class com.jme.curve.Curve |
steps |
| Fields inherited from class com.jme.scene.Spatial |
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder |
|
Constructor Summary |
BezierCurve(java.lang.String name)
Constructor instantiates a new BezierCurve object. |
BezierCurve(java.lang.String name,
Vector3f[] controlPoints)
Constructor instantiates a new BezierCurve object. |
|
Method Summary |
void |
findCollisions(Spatial scene,
CollisionResults results)
checks this spatial against a second spatial, any collisions are stored
in the results object. |
void |
findPick(Ray toTest,
PickResults results)
|
Matrix3f |
getOrientation(float time,
float precision)
getOrientation calculates the rotation matrix for any
given point along to the line to still be facing in the direction of the
line. |
Matrix3f |
getOrientation(float time,
float precision,
Vector3f up)
getOrientation calculates the rotation matrix for any
given point along to the line to still be facing in the direction of the
line. |
Vector3f |
getPoint(float time)
getPoint calculates a point on the curve based on
the time, where time is [0, 1]. |
Vector3f |
getPoint(float time,
Vector3f point)
getPoint calculates a point on a Bezier curve from a given
time value within the interval [0, 1]. |
boolean |
hasCollision(Spatial scene,
boolean checkTriangles)
|
| Methods inherited from class com.jme.scene.Geometry |
applyRenderState, applyStates, clearBuffers, copyTextureCoords, getAllTextures, getCloneID, getColorAsFloatBuffer, getColors, getModelBound, getNormalAsFloatBuffer, getNormals, getNumberOfUnits, getTextureAsFloatBuffer, getTextureAsFloatBuffer, getTextures, getTextures, getVBOColorID, getVBONormalID, getVBOTextureID, getVBOVertexID, getVerticeAsFloatBuffer, getVertices, getVertQuantity, isVBOColorEnabled, isVBONormalEnabled, isVBOTextureEnabled, isVBOVertexEnabled, putClone, randomVertice, reconstruct, setAllTextures, setColor, setColors, setFloatBuffer, setForceView, setModelBound, setNormal, setNormalBuffer, setNormals, setRandomColors, setSolidColor, setTexture, setTexture, setTextureBuffer, setTextureCoord, setTextures, setTextures, setVBOColorEnabled, setVBOColorID, setVBONormalEnabled, setVBONormalID, setVBOTextureEnabled, setVBOTextureID, setVBOVertexEnabled, setVBOVertexID, setVertex, setVertexBuffer, setVertices, updateColorBuffer, updateColorBuffer, updateModelBound, updateNormalBuffer, updateNormalBuffer, updateTextureBuffer, updateTextureBuffer, updateTextureBuffer, updateVertexBuffer, updateVertexBuffer, updateWorldBound |
| Methods inherited from class com.jme.scene.Spatial |
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, setZOrder, toString, updateCollisionTree, updateGeometricState, updateRenderState, updateRenderState, updateWorldData |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
BezierCurve
public BezierCurve(java.lang.String name)
- Constructor instantiates a new
BezierCurve object.
- Parameters:
name - the name of the scene element. This is required for
identification and comparision purposes.
BezierCurve
public BezierCurve(java.lang.String name,
Vector3f[] controlPoints)
- Constructor instantiates a new
BezierCurve object. The
control points that define the curve are supplied.
- Parameters:
name - the name of the scene element. This is required for
identification and comparision purposes.controlPoints - the points that define the curve.
getPoint
public Vector3f getPoint(float time,
Vector3f point)
getPoint calculates a point on a Bezier curve from a given
time value within the interval [0, 1]. If the value is zero or less, the
first control point is returned. If the value is one or more, the last
control point is returned. Using the equation of a Bezier Curve, the
point at the interval is calculated and returned.
- Specified by:
getPoint in class Curve
- Parameters:
time - the time frame on the curve: [0, 1].point - the vector3f object to store the point in.
- Returns:
- store, after receiving the result.
- See Also:
Curve.getPoint(float)
getPoint
public Vector3f getPoint(float time)
- Description copied from class:
Curve
getPoint calculates a point on the curve based on
the time, where time is [0, 1]. How the point is calculated is
defined by the subclass.
- Specified by:
getPoint in class Curve
- Parameters:
time - the time frame on the curve, [0, 1].
- Returns:
- the point on the curve at a specified time.
getOrientation
public Matrix3f getOrientation(float time,
float precision)
getOrientation calculates the rotation matrix for any
given point along to the line to still be facing in the direction of the
line.
- Specified by:
getOrientation in class Curve
- Parameters:
time - the current time (between 0 and 1)precision - how accurate to (i.e. the next time) to check against.
- Returns:
- the rotation matrix.
- See Also:
Curve.getOrientation(float, float)
getOrientation
public Matrix3f getOrientation(float time,
float precision,
Vector3f up)
getOrientation calculates the rotation matrix for any
given point along to the line to still be facing in the direction of the
line. A up vector is supplied, this keep the rotation matrix following
the line, but insures the object's up vector is not drastically changed.
- Specified by:
getOrientation in class Curve
- Parameters:
time - the current time (between 0 and 1)precision - how accurate to (i.e. the next time) to check against.up - the up vector to lock.
- Returns:
- the rotation matrix.
- See Also:
Curve.getOrientation(float, float)
findCollisions
public void findCollisions(Spatial scene,
CollisionResults results)
- Description copied from class:
Spatial
- checks this spatial against a second spatial, any collisions are stored
in the results object.
- Specified by:
findCollisions in class Spatial
- Parameters:
scene - the scene to test against.results - the results of the collisions.
hasCollision
public boolean hasCollision(Spatial scene,
boolean checkTriangles)
- Specified by:
hasCollision in class Spatial
findPick
public void findPick(Ray toTest,
PickResults results)
- Overrides:
findPick in class Geometry