path.toPolylines([opt])
Return an array of polylines that approximates the path at given precision. If there are no segments, null
is returned.
Every Moveto segment starts a new subpath within the path. Every subpath has a separate entry in the returned array. If there is only one subpath, an array with one element is returned.
The polyline points are found as endpoints of Lineto and Closepath segments and as endpoints of curve subdivisions whose flattened length is up to the specified precision level away from actual curved length. Refer to path.length()
documentation for more information about precision and curve flattening.
The opt
argument is optional. Two properties may be specified, opt.precision
and opt.segmentSubdivisions
, which determine maximum error allowed in the calculation (default precision is 3; this corresponds to maximum observed error of 0.1% in flattened curve length). The opt.segmentSubdivisions
property is an array of individual segments' subdivision arrays. The path.getSegmentSubdivisions()
function may be used to obtain the segmentSubdivisions
array.