Class Lineard<T extends Vectord<T>>

java.lang.Object
gaiasky.util.math.Lineard<T>
All Implemented Interfaces:
Pathd<T>

public class Lineard<T extends Vectord<T>>
extends java.lang.Object
implements Pathd<T>
  • Field Summary

    Fields
    Modifier and Type Field Description
    T[] controlPoints  
  • Constructor Summary

    Constructors
    Constructor Description
    Lineard​(T[] controlPoints)  
  • Method Summary

    Modifier and Type Method Description
    double approximate​(T v)  
    double approxLength​(int samples)  
    T derivativeAt​(T out, double t)  
    double locate​(T v)  
    Lineard set​(T[] controlPoints)  
    T valueAt​(T out, double t)  

    Methods inherited from class java.lang.Object

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

    • controlPoints

      public T extends Vectord<T>[] controlPoints
  • Constructor Details

    • Lineard

      public Lineard​(T[] controlPoints)
  • Method Details

    • set

      public Lineard set​(T[] controlPoints)
    • derivativeAt

      public T derivativeAt​(T out, double t)
      Specified by:
      derivativeAt in interface Pathd<T extends Vectord<T>>
    • valueAt

      public T valueAt​(T out, double t)
      Specified by:
      valueAt in interface Pathd<T extends Vectord<T>>
      Returns:
      The value of the path at t where 0<=t<=1
    • approximate

      public double approximate​(T v)
      Specified by:
      approximate in interface Pathd<T extends Vectord<T>>
      Returns:
      The approximated value (between 0 and 1) on the path which is closest to the specified value. Note that the implementation of this method might be optimized for speed against precision, see Pathd.locate(Object) for a more precise (but more intensive) method.
    • locate

      public double locate​(T v)
      Specified by:
      locate in interface Pathd<T extends Vectord<T>>
      Returns:
      The precise location (between 0 and 1) on the path which is closest to the specified value. Note that the implementation of this method might be CPU intensive, see Pathd.approximate(Object) for a faster (but less precise) method.
    • approxLength

      public double approxLength​(int samples)
      Specified by:
      approxLength in interface Pathd<T extends Vectord<T>>
      Parameters:
      samples - The amount of divisions used to approximate length. Higher values will produce more precise results, but will be more CPU intensive.
      Returns:
      An approximated length of the spline through sampling the curve and accumulating the euclidean distances between the sample points.