docs: public static Point3D getClosestPointTo(PathIterator3f pathIterator, double x, double y, double z) {
  		Point3D closest = null;
  		double bestDist = Double.POSITIVE_INFINITY;
  		Point3D candidate;
  		AbstractPathElement3F pe = pathIterator.next();
  		Path3f subPath;
  
  		if (pe.type != PathElementType.MOVE_TO) {
  			throw new IllegalArgumentException("missing initial moveto in path definition"); 
  		}
  
  		candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
  
  		while (pathIterator.hasNext()) {
  			pe = pathIterator.next();
  
  			candidate = null;
  
  			switch(pe.type) {
  			case MOVE_TO:
  				candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
  				break;
  			case LINE_TO:
  
  				candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
  
  				break;
  			case CLOSE:
  				if (!pe.isEmpty()) {
  					candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
  				}
  				break;
  			case QUAD_TO:
  				subPath = new Path3f();
  				subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
  				subPath.quadTo(
  						pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
  						pe.getToX(), pe.getToY(), pe.getToZ());
  
  				candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
  				break;
  			case CURVE_TO:
  				subPath = new Path3f();
  				subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
  				subPath.curveTo(
  						pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
  						pe.getCtrlX2(), pe.getCtrlY2(), pe.getCtrlZ2(),
  						pe.getToX(), pe.getToY(), pe.getToZ());
  
  				candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
  				break;
  			default:
  				throw new IllegalStateException(
  						pe.type==null ? null : pe.type.toString());
  			}
  
  			if (candidate!=null) {
  				double d = candidate.getDistanceSquared(new Point3f(x,y,z));
  				if (d<bestDist) {
  					bestDist = d;
  					closest = candidate;
  				}
  			}
  		}
  
  		return closest;
  	}