src/main/java/de/javagl/geom/CatmullRomSpline.java
/**
     * Perform the cubic Catmull-Rom-interpolation for the given control 
     * points and times
     * 
     * @param p0 The first point
     * @param p1 The second point
     * @param p2 The third point
     * @param p3 The fourth point
     * @param t0 The first time
     * @param t1 The second time
     * @param t2 The third time
     * @param t3 The fourth time
     * @param t The current time
     * @param result The point that will store the result
     */
Perform the cubic Catmull-Rom-interpolation for the given control
points and times


Perform the cubic Catmull - Rom - interpolation for the given control points and times
private static void interpolate(
        Point2D p0, Point2D p1, Point2D p2, Point2D p3, 
        double t0, double t1, double t2, double t3, 
        double t, Point2D result)
    {
        double x0 = p0.getX();
        double y0 = p0.getY();
        double x1 = p1.getX();
        double y1 = p1.getY();
        double x2 = p2.getX();
        double y2 = p2.getY();
        double x3 = p3.getX();
        double y3 = p3.getY();
        double invDt01 = 1.0 / (t1 - t0);
        double invDt12 = 1.0 / (t2 - t1);
        double invDt23 = 1.0 / (t3 - t2);
        double f01a = (t1 - t) * invDt01;
        double f01b = (t - t0) * invDt01;
        double f12a = (t2 - t) * invDt12;
        double f12b = (t - t1) * invDt12;
        double f23a = (t3 - t) * invDt23;
        double f23b = (t - t2) * invDt23;
        double x01 = f01a * x0 + f01b * x1;
        double y01 = f01a * y0 + f01b * y1;
        double x12 = f12a * x1 + f12b * x2;
        double y12 = f12a * y1 + f12b * y2;
        double x23 = f23a * x2 + f23b * x3;
        double y23 = f23a * y2 + f23b * y3;
        double invDt02 = 1.0 / (t2 - t0);
        double invDt13 = 1.0 / (t3 - t1);
        double f012a = (t2 - t) * invDt02;
        double f012b = (t - t0) * invDt02;
        double f123a = (t3 - t) * invDt13;
        double f123b = (t - t1) * invDt13;
        double x012 = f012a * x01 + f012b * x12;
        double y012 = f012a * y01 + f012b * y12;
        double x123 = f123a * x12 + f123b * x23;
        double y123 = f123a * y12 + f123b * y23;
        double resultX = f12a * x012 + f12b * x123;
        double resultY = f12a * y012 + f12b * y123;
        result.setLocation(resultX, resultY);
    }
private static void interpolate ( Point2D p0 , Point2D p1 , Point2D p2 , Point2D p3 , double t0 , double t1 , double t2 , double t3 , double t , Point2D result ) { double x0 = p0 . getX ( ) ; double y0 = p0 . getY ( ) ; double x1 = p1 . getX ( ) ; double y1 = p1 . getY ( ) ; double x2 = p2 . getX ( ) ; double y2 = p2 . getY ( ) ; double x3 = p3 . getX ( ) ; double y3 = p3 . getY ( ) ; double invDt01 = 1.0 / ( t1 - t0 ) ; double invDt12 = 1.0 / ( t2 - t1 ) ; double invDt23 = 1.0 / ( t3 - t2 ) ; double f01a = ( t1 - t ) * invDt01 ; double f01b = ( t - t0 ) * invDt01 ; double f12a = ( t2 - t ) * invDt12 ; double f12b = ( t - t1 ) * invDt12 ; double f23a = ( t3 - t ) * invDt23 ; double f23b = ( t - t2 ) * invDt23 ; double x01 = f01a * x0 + f01b * x1 ; double y01 = f01a * y0 + f01b * y1 ; double x12 = f12a * x1 + f12b * x2 ; double y12 = f12a * y1 + f12b * y2 ; double x23 = f23a * x2 + f23b * x3 ; double y23 = f23a * y2 + f23b * y3 ; double invDt02 = 1.0 / ( t2 - t0 ) ; double invDt13 = 1.0 / ( t3 - t1 ) ; double f012a = ( t2 - t ) * invDt02 ; double f012b = ( t - t0 ) * invDt02 ; double f123a = ( t3 - t ) * invDt13 ; double f123b = ( t - t1 ) * invDt13 ; double x012 = f012a * x01 + f012b * x12 ; double y012 = f012a * y01 + f012b * y12 ; double x123 = f123a * x12 + f123b * x23 ; double y123 = f123a * y12 + f123b * y23 ; double resultX = f12a * x012 + f12b * x123 ; double resultY = f12a * y012 + f12b * y123 ; result . setLocation ( resultX , resultY ) ; }
Perform the cubic Catmull-Rom-interpolation for the given control
 points and times
Perform the cubic Catmull - Rom - interpolation for the given control points and times
// (Problem? :-D)
