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
Spatial
s 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.UpdateField
Nested 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
Decrements the index by 1.void
generateArcLengths
(int step) Generates the arc lengths, generates the reverse table if therepeat type
is set tocycle
void
generateArcLengths
(int step, boolean reverse) Generates arc lengths which are required if you wish to haveconstant speed
interpolation.protected ReadOnlyVector3
protected ReadOnlyVector3
getCurve()
protected int
Since splines require at least 4 points to interpolate correctly the default maximum value is overridden to 1 less than normal.protected int
Since splines require at least 4 points to interpolate correctly the default minimum value is overridden to 1 more than normal.protected double
incrementDelta
(double by) protected int
Increments the index by 1.protected Vector3
interpolateVectors
(ReadOnlyVector3 from, ReadOnlyVector3 to, double delta, Vector3 target) Implemented by sub classes to perform the actual interpolation.void
reset()
Resets the internal state, namely the cycle direction, delta and index variables.void
setConstantSpeed
(boolean constantSpeed) void
Setting a new curve will automatically update the control points.Methods inherited from class com.ardor3d.scenegraph.controller.interpolation.Vector3InterpolationController
getUpdateField, interpolate, isConstantSpeed, setUpdateField
Methods 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, updateDeltaAndIndex
Methods 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:
incrementDelta
in 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:InterpolationController
Decrements the index by 1.- Overrides:
decrementIndex
in classInterpolationController<ReadOnlyVector3,
Spatial> - Returns:
- The new index value as a convenience.
-
incrementIndex
protected int incrementIndex()Description copied from class:InterpolationController
Increments the index by 1.- Overrides:
incrementIndex
in 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:Vector3InterpolationController
Implemented by sub classes to perform the actual interpolation.- Specified by:
interpolateVectors
in classVector3InterpolationController
- Parameters:
from
- The vector to interpolate from.to
- The vector to interpolate to.delta
- The distance betweenfrom
andto
, will be between0.0
and1.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:
setConstantSpeed
in classVector3InterpolationController
- Parameters:
constantSpeed
-true
to interpolate between vectors at a constant speed,false
to interpolate at a constant time.- See Also:
-
generateArcLengths
public void generateArcLengths(int step) Generates the arc lengths, generates the reverse table if therepeat type
is 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 speed
interpolation.- Parameters:
step
- 'See Also:' method for more info.reverse
-true
to also generate a reverse look up table. This is only required if you plan to use theComplexSpatialController.RepeatType.CYCLE
repeat 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:
getMaximumIndex
in classInterpolationController<ReadOnlyVector3,
Spatial> - Returns:
- The maximum allowed index. By default it returns the last index in the
control
list.
-
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:
getMinimumIndex
in classInterpolationController<ReadOnlyVector3,
Spatial> - Returns:
- The minimum allowed index. By default it returns 0.
-
reset
public void reset()Description copied from class:InterpolationController
Resets the internal state, namely the cycle direction, delta and index variables.- Overrides:
reset
in classInterpolationController<ReadOnlyVector3,
Spatial>
-