Package com.ardor3d.spline
Class ArcLengthTable
java.lang.Object
com.ardor3d.spline.ArcLengthTable
ArcLengthTable class contains methods for generating and storing arc lengths of a curve. Arc Lengths are used to get
constant speed interpolation over a curve.
This class does not automatically generate the look up tables, you must manually call generate(int, boolean)
to generate the table.
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
ArcLengthTable
Creates a new instance ofArcLengthTable
.- Parameters:
curve
- The curve to create the table for, can not benull
.
-
-
Method Details
-
getLength
public double getLength(int index) - Parameters:
index
- The index of the control point you want the length for.- Returns:
- The total approximate length of the segment starting at the given index.
-
getDelta
public double getDelta(int index, double distance) - Parameters:
index
- The index of the first control point you are interpolating from.distance
- The distance you want the spatial to travel.- Returns:
- The delta you should use to travel the specified distance from the control point given, will not be negative but may be greater than 1.0 if the distance is greater than the length of the segment.
-
generate
public void generate(int step, boolean reverse) Actually generates the arc length table, this needs to be called before this class can actually perform any useful functions.- Parameters:
step
- The larger the step value used the more accurate the resulting table will be and thus the smoother the motion will be, must be greater than zero.reverse
-true
to generate the table while stepping from the end of the curve to the beginning,false
to generate the table from the beginning of the curve. You only need to generate a reverse table if you are using thecycle
repeat type.
-