Class CatmullRomSpline

java.lang.Object
org.episteme.core.mathematics.geometry.curves.CatmullRomSpline

public class CatmullRomSpline extends Object
Catmull-Rom spline curve.

A Catmull-Rom spline is a smooth curve that passes through all control points. It uses cubic interpolation with automatic tangent calculation based on neighboring points.

The curve is defined by a set of control points P₀, P₁, ..., Pₙ and uses the formula: P(t) = 0.5 * [(2P₁) + (-P₀ + P₂)t + (2P₀ - 5P₁ + 4P₂ - P₃)t² + (-P₀ + 3P₁ - 3P₂ + P₃)t³]

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • CatmullRomSpline

      public CatmullRomSpline(List<Vector<Real>> controlPoints)
      Creates a Catmull-Rom spline with standard tension (0.0).
      Parameters:
      controlPoints - the control points (minimum 4 required)
    • CatmullRomSpline

      public CatmullRomSpline(List<Vector<Real>> controlPoints, Real tension)
      Creates a Catmull-Rom spline with custom tension.
      Parameters:
      controlPoints - the control points (minimum 4 required)
      tension - the tension parameter (0 = standard, 0.5 = cardinal)
  • Method Details

    • evaluate

      public Vector<Real> evaluate(Real t)
    • tangent

      public Vector<Real> tangent(Real t)
    • getNumControlPoints

      public int getNumControlPoints()
      Returns the number of control points.
      Returns:
      the number of control points
    • getNumSegments

      public int getNumSegments()
      Returns the number of segments.
      Returns:
      the number of segments
    • getControlPoints

      public List<Vector<Real>> getControlPoints()
      Returns the control points.
      Returns:
      the control points
    • getTension

      public Real getTension()
      Returns the tension parameter.
      Returns:
      the tension
    • toString

      public String toString()
      Overrides:
      toString in class Object