src/main/java/de/javagl/geom/CatmullRomSpline.java
/**
     * Update the first and the last control point, based on the positions
     * of the succeeding or preceding points
     */
Update the first and the last control point, based on the positions
of the succeeding or preceding points
Update the first and the last control point based on the positions of the succeeding or preceding points
private void updateAdditionalControlPoints()
    {
        if (closed)
        {
            Point2D py = controlPoints.get(controlPoints.size()-3);
            Point2D cp0 = controlPoints.get(0);
            cp0.setLocation(py);
            Point2D p1 = controlPoints.get(2);
            Point2D cpz = controlPoints.get(controlPoints.size()-1);
            cpz.setLocation(p1);
        }
        else
        {
            Point2D p0 = controlPoints.get(1);
            Point2D p1 = controlPoints.get(2);
            Point2D cp0 = controlPoints.get(0);
            sub(p1, p0, cp0);
            sub(p0, cp0, cp0);
            Point2D py = controlPoints.get(controlPoints.size()-3);
            Point2D pz = controlPoints.get(controlPoints.size()-2);
            Point2D cpz = controlPoints.get(controlPoints.size()-1);
            sub(pz, py, cpz);
            add(pz, cpz, cpz);
        }
    }
private void updateAdditionalControlPoints ( ) { if ( closed ) { Point2D py = controlPoints . get ( controlPoints . size ( ) - 3 ) ; Point2D cp0 = controlPoints . get ( 0 ) ; cp0 . setLocation ( py ) ; Point2D p1 = controlPoints . get ( 2 ) ; Point2D cpz = controlPoints . get ( controlPoints . size ( ) - 1 ) ; cpz . setLocation ( p1 ) ; } else { Point2D p0 = controlPoints . get ( 1 ) ; Point2D p1 = controlPoints . get ( 2 ) ; Point2D cp0 = controlPoints . get ( 0 ) ; sub ( p1 , p0 , cp0 ) ; sub ( p0 , cp0 , cp0 ) ; Point2D py = controlPoints . get ( controlPoints . size ( ) - 3 ) ; Point2D pz = controlPoints . get ( controlPoints . size ( ) - 2 ) ; Point2D cpz = controlPoints . get ( controlPoints . size ( ) - 1 ) ; sub ( pz , py , cpz ) ; add ( pz , cpz , cpz ) ; } }
Update the first and the last control point, based on the positions
 of the succeeding or preceding points
Update the first and the last control point based on the positions of the succeeding or preceding points