Package com.ardor3d.spline
Class CatmullRomSpline
java.lang.Object
com.ardor3d.spline.CatmullRomSpline
- All Implemented Interfaces:
Spline
CatmullRomSpline class is an implementation of spline that uses the Catmull-Rom equation:
q(t) = 0.5 * ((2 * P1) + (-P0 + P2) * t + (2 * P0 - 5 * P1 + 4 * P2 - P3) * t2 + (-P0 + 3 * P1 - 3 * P2 + P3) * t3)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioninterpolate
(ReadOnlyVector3 p0, ReadOnlyVector3 p1, ReadOnlyVector3 p2, ReadOnlyVector3 p3, double t) Will return an interpolated vector between parametersp1
andp2
usingt
.interpolate
(ReadOnlyVector3 p0, ReadOnlyVector3 p1, ReadOnlyVector3 p2, ReadOnlyVector3 p3, double t, Vector3 result) If any vector isnull
then the result is just returned unchanged.
-
Constructor Details
-
CatmullRomSpline
public CatmullRomSpline()
-
-
Method Details
-
interpolate
public Vector3 interpolate(ReadOnlyVector3 p0, ReadOnlyVector3 p1, ReadOnlyVector3 p2, ReadOnlyVector3 p3, double t) Description copied from interface:Spline
Will return an interpolated vector between parametersp1
andp2
usingt
.- Specified by:
interpolate
in interfaceSpline
- Parameters:
p0
- The starting control point.p1
- The second control point.p2
- The third control point.p3
- The final control point.t
- Should be between zero and one. Zero will return pointp1
while one will returnp2
, a value in between will return an interpolated vector between the two.- Returns:
- The interpolated vector.
- See Also:
-
interpolate
public Vector3 interpolate(ReadOnlyVector3 p0, ReadOnlyVector3 p1, ReadOnlyVector3 p2, ReadOnlyVector3 p3, double t, Vector3 result) If any vector isnull
then the result is just returned unchanged.- Specified by:
interpolate
in interfaceSpline
- Parameters:
p0
- The start control point.p1
- Result will be between this and p2.p2
- result will be between this and p1.p3
- The end control point.t
-0.0 <= t <= 1.0
, if t <= 0.0 then result will be contain exact same values as p1 and if its >= 1.0 it will contain the exact same values as p2.result
- The results from the interpolation will be stored in this vector.- Returns:
- The result vector as a convenience.
-