LineSegmentImpl seg = new LineSegmentImpl(p1, p2, 0);
//(LineSegmentImpl)cf.createLineSegment(cf.createPosition(this.forParam(actualParam)),cf.createPosition(this.forParam(actualParam+newSpacing)));
/* Search maximum of all distances */
CurveImpl curve = new CurveImpl(seg);
maxDistance = curve.distance( new PointImpl(segments.get(firstSegment).getStartPoint()) );
//maxDistance = seg.distance(segments.get(firstSegment).getStartPoint());
double actDistance = 0;
for (i=firstSegment; i<lastSegment; i++) {
actDistance = curve.distance( new PointImpl(segments.get(i).getEndPoint()) );
//actDistance = seg.distance(segments.get(i).getEndPoint());
if (actDistance > maxDistance) {
maxDistance = actDistance;
}
}