8.14.2 PolyLine class: A class representing a series of straight line segments.

The PolyLine class has this constructor:

class PolyLine( coords=[],closed=False)
Initialize a PolyLine from a coordinate array.

coords is a (npts,3) shaped array of coordinates of the subsequent vertices of the polyline (or a compatible data object). If closed == True, the polyline is closed by connecting the last point to the first. This does not change the vertex data.

PolyLine objects have the following methods:

toFormex( )
Return the polyline as a Formex.

sub_points( t,j)
Return the points at values t in part j

sub_points2( t,j)
Return the points at value,part pairs (t,j)

vectors( )
Return the vectors of the points to the next one.

The vectors are returned as a Coords object. If not closed, this returns one less vectors than the number of points.

directions( )
Returns unit vectors in the direction of the next point.

avgDirections( normalized=True)
Returns average directions at the inner nodes.

If open, the number of directions returned is 2 less than the number of points.

lengths( )
Return the length of the parts of the curve.

atLength( div)
Returns the parameter values for relative curve lengths div.

'div' is a list of relative curve lengths (from 0.0 to 1.0). As a convenience, an single integer value may be specified, in which case the relative curve lengths are found by dividing the interval [0.0,1.0] in the specified number of subintervals.

The function returns a list with the parameter values for the points at the specified relative lengths.

reverse( )