Class SplineInterpolator

java.lang.Object
me.wobblyyyy.pathfinder.trajectory.SplineInterpolator

public class SplineInterpolator
extends java.lang.Object
Interpolate splines by using the Fritsch-Carlson computational method for determining control points for a spline. This class isn't really all that useful on its own - rather, you should go check out the much more usable Spline class - that'll get what you need done.
Since:
0.3.0
Author:
Colin Robertson
  • Field Summary

    Fields
    Modifier and Type Field Description
    private double[] mValues  
    private java.util.List<java.lang.Double> xValues  
    private java.util.List<java.lang.Double> yValues  
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected SplineInterpolator​(java.util.List<java.lang.Double> x, java.util.List<java.lang.Double> y, double[] m)  
  • Method Summary

    Modifier and Type Method Description
    double interpolateFromX​(double x)  
    double interpolateFromY​(double y)  
    static SplineInterpolator invertedMonotoneCubic​(java.util.List<java.lang.Double> xList, java.util.List<java.lang.Double> yList)
    Create a new inverted monotone cubic spline.
    static SplineInterpolator monotoneCubic​(java.util.List<java.lang.Double> x, java.util.List<java.lang.Double> y)
    Create a new monotone cubic spline.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • xValues

      private final java.util.List<java.lang.Double> xValues
    • yValues

      private final java.util.List<java.lang.Double> yValues
    • mValues

      private final double[] mValues
  • Constructor Details

    • SplineInterpolator

      protected SplineInterpolator​(java.util.List<java.lang.Double> x, java.util.List<java.lang.Double> y, double[] m)
  • Method Details

    • invertedMonotoneCubic

      public static SplineInterpolator invertedMonotoneCubic​(java.util.List<java.lang.Double> xList, java.util.List<java.lang.Double> yList)
      Create a new inverted monotone cubic spline.
      Parameters:
      xList - the X components of the spline.
      yList - the Y components of the spline.
      Returns:
      a newly-created inverted spline that passes through each of the provided points.
    • monotoneCubic

      public static SplineInterpolator monotoneCubic​(java.util.List<java.lang.Double> x, java.util.List<java.lang.Double> y)
      Create a new monotone cubic spline.
      Parameters:
      x - the X components of the spline.
      y - the Y components of the spline.
      Returns:
      a newly-created spline that passes through each of the provided X/Y control points - very cool, I know.
    • interpolateFromX

      public double interpolateFromX​(double x)
    • interpolateFromY

      public double interpolateFromY​(double y)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object