Class ReparametrisingInterpolation

java.lang.Object
com.sk89q.worldedit.math.interpolation.ReparametrisingInterpolation
All Implemented Interfaces:
Interpolation

public class ReparametrisingInterpolation extends Object implements Interpolation
Reparametrises another interpolation function by arc length.

This is done so entities travel at roughly the same speed across the whole route.

  • Constructor Details

    • ReparametrisingInterpolation

      public ReparametrisingInterpolation(Interpolation baseInterpolation)
  • Method Details

    • setNodes

      public void setNodes(List<Node> nodes)
      Description copied from interface: Interpolation
      Sets nodes to be used by subsequent calls to Interpolation.getPosition(double) and the other methods.
      Specified by:
      setNodes in interface Interpolation
      Parameters:
      nodes - the nodes
    • getBaseInterpolation

      public Interpolation getBaseInterpolation()
    • getPosition

      public Vector3 getPosition(double position)
      Description copied from interface: Interpolation
      Gets the result of f(position).
      Specified by:
      getPosition in interface Interpolation
      Parameters:
      position - the position to interpolate
      Returns:
      the result
    • get1stDerivative

      public Vector3 get1stDerivative(double position)
      Description copied from interface: Interpolation
      Gets the result of f'(position).
      Specified by:
      get1stDerivative in interface Interpolation
      Parameters:
      position - the position to interpolate
      Returns:
      the result
    • arcLength

      public double arcLength(double positionA, double positionB)
      Description copied from interface: Interpolation
      Gets the result of ∫ab|f'(t)| dt.
      That means it calculates the arc length (in meters) between positionA and positionB.
      Specified by:
      arcLength in interface Interpolation
      Parameters:
      positionA - lower limit
      positionB - upper limit
      Returns:
      the arc length
    • getSegment

      public int getSegment(double position)
      Description copied from interface: Interpolation
      Get the segment position.
      Specified by:
      getSegment in interface Interpolation
      Parameters:
      position - the position
      Returns:
      the segment position