src/main/java/de/javagl/geom/CatmullRomSpline.java
/**
     * Update the positions of the interpolated points based on the
     * four control points starting at the given index
     *  
     * @param index The index in the list of control points
     * @param stepsInCurrentSegment The number of steps in the current
     * segment
     * @param lastStepInSegment The last step in the current segment.
     */
Update the positions of the interpolated points based on the
four control points starting at the given index

@param index The index in the list of control points
@param stepsInCurrentSegment The number of steps in the current
segment
@param lastStepInSegment The last step in the current segment.
Update the positions of the interpolated points based on the four control points starting at the given index @param index The index in the list of control points @param stepsInCurrentSegment The number of steps in the current segment @param lastStepInSegment The last step in the current segment .
private void updateInterpolatedPoints(int index, 
        int stepsInCurrentSegment, int lastStepInSegment)
    {
        Point2D p0 = controlPoints.get(index + 0);
        Point2D p1 = controlPoints.get(index + 1);
        Point2D p2 = controlPoints.get(index + 2);
        Point2D p3 = controlPoints.get(index + 3);
        double t0 = 0;
        double t1 = 1;
        double t2 = 2;
        double t3 = 3;
        if (alpha != 0.0)
        {
            double exponent = alpha * 0.5;
            double dx01 = p1.getX() - p0.getX();
            double dy01 = p1.getY() - p0.getY();
            double d01 = dx01 * dx01 + dy01 * dy01;
            t1 = t0 + Math.pow(d01, exponent);
            double dx12 = p2.getX() - p1.getX();
            double dy12 = p2.getY() - p1.getY();
            double d12 = dx12 * dx12 + dy12 * dy12;
            t2 = t1 + Math.pow(d12, exponent);
            double dx23 = p3.getX() - p2.getX();
            double dy23 = p3.getY() - p2.getY();
            double d23 = dx23 * dx23 + dy23 * dy23;
            t3 = t2 + Math.pow(d23, exponent);
        }
        double invStep = 1.0 / lastStepInSegment;
        for (int i = 0; i < stepsInCurrentSegment; i++)
        {
            double t = i * invStep;
            int interpolatedPointIndex = index * stepsPerSegment + i;
            Point2D interpolatedPoint =
                interpolatedPoints.get(interpolatedPointIndex);
            interpolate(p0, p1, p2, p3, t0, t1, t2, t3, t1 + t * (t2 - t1),
                interpolatedPoint);
        }
    }
private void updateInterpolatedPoints ( int index , int stepsInCurrentSegment , int lastStepInSegment ) { Point2D p0 = controlPoints . get ( index + 0 ) ; Point2D p1 = controlPoints . get ( index + 1 ) ; Point2D p2 = controlPoints . get ( index + 2 ) ; Point2D p3 = controlPoints . get ( index + 3 ) ; double t0 = 0 ; double t1 = 1 ; double t2 = 2 ; double t3 = 3 ; if ( alpha != 0.0 ) { double exponent = alpha * 0.5 ; double dx01 = p1 . getX ( ) - p0 . getX ( ) ; double dy01 = p1 . getY ( ) - p0 . getY ( ) ; double d01 = dx01 * dx01 + dy01 * dy01 ; t1 = t0 + Math . pow ( d01 , exponent ) ; double dx12 = p2 . getX ( ) - p1 . getX ( ) ; double dy12 = p2 . getY ( ) - p1 . getY ( ) ; double d12 = dx12 * dx12 + dy12 * dy12 ; t2 = t1 + Math . pow ( d12 , exponent ) ; double dx23 = p3 . getX ( ) - p2 . getX ( ) ; double dy23 = p3 . getY ( ) - p2 . getY ( ) ; double d23 = dx23 * dx23 + dy23 * dy23 ; t3 = t2 + Math . pow ( d23 , exponent ) ; } double invStep = 1.0 / lastStepInSegment ; for ( int i = 0 ; i < stepsInCurrentSegment ; i ++ ) { double t = i * invStep ; int interpolatedPointIndex = index * stepsPerSegment + i ; Point2D interpolatedPoint = interpolatedPoints . get ( interpolatedPointIndex ) ; interpolate ( p0 , p1 , p2 , p3 , t0 , t1 , t2 , t3 , t1 + t * ( t2 - t1 ) , interpolatedPoint ) ; } }
Update the positions of the interpolated points based on the
 four control points starting at the given index
Update the positions of the interpolated points based on the four control points starting at the given index
// System.out.println("Times "+t0+" "+t1+" "+t2+" "+t3);
