docs: @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
  	@Pure
  	public final void toPath2D(Path2d path, double startPosition, double endPosition) {
  		final double length = getLength();
  		// For performance purpose
  		if ((Double.isNaN(startPosition) || startPosition < 0f)
  				&&
  				(Double.isNaN(endPosition) || endPosition >= length)) {
  			toPath2D(path);
  			return;
  		}
  
  		final double p1;
  		final double p2;
  		if (Double.isNaN(startPosition) || startPosition <= 0f) {
  			p1 = 0.;
  		} else {
  			p1 = startPosition;
  		}
  		if (Double.isNaN(endPosition) || endPosition >= length) {
  			p2 = length;
  		} else {
  			p2 = endPosition;
  		}
  		if (p2 <= p1) {
  			return;
  		}
  
  		boolean firstDrawn;
  		double curvilinePosition = 0.;
  		double previousCurvilinePosition = 0.;
  
  		for (final PointGroup grp : groups()) {
  			firstDrawn = true;
  			Point2d previous = null;
  			for (final Point2d pts : grp) {
  				if (p2 <= previousCurvilinePosition) {
  					return;
  				}
  
  				if (previous != null) {
  					curvilinePosition += previous.getDistance(pts);
  				}
  
  				if (curvilinePosition >= p1) {
  					final Point2d f;
  					double curvilineDiff;
  					if (previous == null || previousCurvilinePosition >= p1) {
  						f = pts;
  					} else {
  						curvilineDiff = curvilinePosition - previousCurvilinePosition;
  						if (curvilineDiff <= 0.) {
  							f = pts;
  						} else {
  							f = new Point2d();
  							Segment2afp.interpolates(previous.getX(), previous.getY(), pts.getX(), pts.getY(),
  									(p1 - previousCurvilinePosition) / curvilineDiff, f);
  						}
  					}
  					final Point2d l;
  					if (p2 < curvilinePosition) {
  						assert previous != null && p2 >= previousCurvilinePosition && p2 <= curvilinePosition;
  						curvilineDiff = curvilinePosition - previousCurvilinePosition;
  						if (curvilineDiff <= 0.) {
  							l = null;
  						} else {
  							l = new Point2d();
  							Segment2afp.interpolates(previous.getX(), previous.getY(), pts.getX(), pts.getY(),
  									(p2 - previousCurvilinePosition) / curvilineDiff, l);
  						}
  					} else {
  						l = null;
  					}
  
  					if (l == null) {
  						if (firstDrawn) {
  							firstDrawn = false;
  							path.moveTo(f.getX(), f.getY());
  						} else {
  							path.lineTo(f.getX(), f.getY());
  						}
  						if (f != pts) {
  							path.lineTo(pts.getX(), pts.getY());
  						}
  					} else {
  						if (firstDrawn) {
  							firstDrawn = false;
  							path.moveTo(l.getX(), l.getY());
  						} else {
  							path.lineTo(l.getX(), l.getY());
  						}
  					}
  				}
  
  				previous = pts;
  				previousCurvilinePosition = curvilinePosition;
  			}
  		}
  	}