Class CurveInterpolationController
java.lang.Object
com.ardor3d.scenegraph.controller.ComplexSpatialController<Spatial>
com.ardor3d.scenegraph.controller.interpolation.InterpolationController<ReadOnlyVector3,Spatial>
com.ardor3d.scenegraph.controller.interpolation.Vector3InterpolationController
com.ardor3d.scenegraph.controller.interpolation.CurveInterpolationController
- All Implemented Interfaces:
SpatialController<Spatial>,Savable,Serializable
CurveInterpolationController class interpolates a
Spatials vectors using a Curve.
This class is stateful and can not be used by more than one controller at a time.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ardor3d.scenegraph.controller.interpolation.Vector3InterpolationController
Vector3InterpolationController.UpdateFieldNested classes/interfaces inherited from class com.ardor3d.scenegraph.controller.ComplexSpatialController
ComplexSpatialController.RepeatType -
Field Summary
Fields inherited from class com.ardor3d.scenegraph.controller.interpolation.InterpolationController
DELTA_MAX, DELTA_MIN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intDecrements the index by 1.voidgenerateArcLengths(int step) Generates the arc lengths, generates the reverse table if therepeat typeis set tocyclevoidgenerateArcLengths(int step, boolean reverse) Generates arc lengths which are required if you wish to haveconstant speedinterpolation.protected ReadOnlyVector3protected ReadOnlyVector3getCurve()protected intSince splines require at least 4 points to interpolate correctly the default maximum value is overridden to 1 less than normal.protected intSince splines require at least 4 points to interpolate correctly the default minimum value is overridden to 1 more than normal.protected doubleincrementDelta(double by) protected intIncrements the index by 1.protected Vector3interpolateVectors(ReadOnlyVector3 from, ReadOnlyVector3 to, double delta, Vector3 target) Implemented by sub classes to perform the actual interpolation.voidreset()Resets the internal state, namely the cycle direction, delta and index variables.voidsetConstantSpeed(boolean constantSpeed) voidSetting a new curve will automatically update the control points.Methods inherited from class com.ardor3d.scenegraph.controller.interpolation.Vector3InterpolationController
getUpdateField, interpolate, isConstantSpeed, setUpdateFieldMethods inherited from class com.ardor3d.scenegraph.controller.interpolation.InterpolationController
clampIndex, decrementDelta, getControlFrom, getControls, getControlTo, getDelta, getIndex, isClamped, isCycleForward, setControls, setControls, setCycleForward, setDelta, setIndex, setRepeatType, update, updateDeltaAndIndexMethods inherited from class com.ardor3d.scenegraph.controller.ComplexSpatialController
getClassTag, getControllerValues, getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, isRepeatTypeClamp, isRepeatTypeCycle, isRepeatTypeWrap, read, setActive, setControllerValues, setMaxTime, setMinTime, setSpeed, write
-
Constructor Details
-
CurveInterpolationController
public CurveInterpolationController()
-
-
Method Details
-
incrementDelta
protected double incrementDelta(double by) - Overrides:
incrementDeltain classInterpolationController<ReadOnlyVector3,Spatial> - Parameters:
by- The amount to increment by, if this is negative it will actually decrement the delta.- Returns:
- The new delta value as a convenience.
- See Also:
-
decrementIndex
protected int decrementIndex()Description copied from class:InterpolationControllerDecrements the index by 1.- Overrides:
decrementIndexin classInterpolationController<ReadOnlyVector3,Spatial> - Returns:
- The new index value as a convenience.
-
incrementIndex
protected int incrementIndex()Description copied from class:InterpolationControllerIncrements the index by 1.- Overrides:
incrementIndexin classInterpolationController<ReadOnlyVector3,Spatial> - Returns:
- The new index value as a convenience.
-
interpolateVectors
protected Vector3 interpolateVectors(ReadOnlyVector3 from, ReadOnlyVector3 to, double delta, Vector3 target) Description copied from class:Vector3InterpolationControllerImplemented by sub classes to perform the actual interpolation.- Specified by:
interpolateVectorsin classVector3InterpolationController- Parameters:
from- The vector to interpolate from.to- The vector to interpolate to.delta- The distance betweenfromandto, will be between0.0and1.0(inclusive).target- The vector to actually interpolate.- Returns:
- The interpolated vector, should not be
null.
-
getControlPointStart
- Returns:
- The initial control point, will not be
null.
-
getCotnrolPointEnd
- Returns:
- The final control point, will not be
null.
-
setCurve
Setting a new curve will automatically update the control points.- Parameters:
curve- The new curve to follow, can not benull.- See Also:
-
getCurve
- Returns:
- The curve being followed, will not
null. - See Also:
-
setConstantSpeed
public void setConstantSpeed(boolean constantSpeed) - Overrides:
setConstantSpeedin classVector3InterpolationController- Parameters:
constantSpeed-trueto interpolate between vectors at a constant speed,falseto interpolate at a constant time.- See Also:
-
generateArcLengths
public void generateArcLengths(int step) Generates the arc lengths, generates the reverse table if therepeat typeis set tocycle- Parameters:
step- 'See Also:' method for more info.- See Also:
-
generateArcLengths
public void generateArcLengths(int step, boolean reverse) Generates arc lengths which are required if you wish to haveconstant speedinterpolation.- Parameters:
step- 'See Also:' method for more info.reverse-trueto also generate a reverse look up table. This is only required if you plan to use theComplexSpatialController.RepeatType.CYCLErepeat type.- See Also:
-
getMaximumIndex
protected int getMaximumIndex()Since splines require at least 4 points to interpolate correctly the default maximum value is overridden to 1 less than normal.- Overrides:
getMaximumIndexin classInterpolationController<ReadOnlyVector3,Spatial> - Returns:
- The maximum allowed index. By default it returns the last index in the
controllist.
-
getMinimumIndex
protected int getMinimumIndex()Since splines require at least 4 points to interpolate correctly the default minimum value is overridden to 1 more than normal.- Overrides:
getMinimumIndexin classInterpolationController<ReadOnlyVector3,Spatial> - Returns:
- The minimum allowed index. By default it returns 0.
-
reset
public void reset()Description copied from class:InterpolationControllerResets the internal state, namely the cycle direction, delta and index variables.- Overrides:
resetin classInterpolationController<ReadOnlyVector3,Spatial>
-