path.getSegment(index)

Return the path segment at index.

Negative indices are accepted; they instruct the algorithm to start looking from the end of the segments array.

Throws an error if the path has no segments. Also throws an error if the index is out of range.