Class ArcLengthTable

java.lang.Object
com.ardor3d.spline.ArcLengthTable

public class ArcLengthTable extends Object
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

    Constructors
    Constructor
    Description
    Creates a new instance of ArcLengthTable.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    double
    getDelta(int index, double distance)
     
    double
    getLength(int index)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArcLengthTable

      public ArcLengthTable(Curve curve)
      Creates a new instance of ArcLengthTable.
      Parameters:
      curve - The curve to create the table for, can not be null.
  • 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 the cycle repeat type.