code: public void createPath (Array<T> waypoints) {
  		if (waypoints == null || waypoints.size < 2)
  			throw new IllegalArgumentException("waypoints cannot be null and must contain at least two (2) waypoints");
  
  		segments = new Array<Segment<T>>(waypoints.size);
  		pathLength = 0;
  		T curr = waypoints.first();
  		T prev = null;
  		for (int i = 1; i <= waypoints.size; i++) {
  			prev = curr;
  			if (i < waypoints.size)
  				curr = waypoints.get(i);
  			else if (isOpen)
  				break; // keep the path open
  			else
  				curr = waypoints.first(); // close the path
  			Segment<T> segment = new Segment<T>(prev, curr);
  			pathLength += segment.length;
  			segment.cumulativeLength = pathLength;
  			segments.add(segment);
  		}
  	}
docs: Sets up this {@link Path} using the given way points.
  @param waypoints The way points of this path.
  @throws IllegalArgumentException if {@code waypoints} is {@code null} or empty.