Return the length of the path.

The path length is a sum of the lengths of visible path segments; invisible segments (e.g. Moveto segments) have a length of 0. If the path has no segments at all, 0 is returned.

Although calculating the length of linear segments (e.g. Lineto and Closepath segments) is straightforward, determining the length of curved segments is complex. Refer to curve.length() documentation for more information.

The opt argument is optional. Two properties may be specified, opt.precision and opt.segmentSubdivisions, which determine maximum error allowed for the length calculation (default precision is 3; this corresponds to maximum observed error of 0.1%). The opt.segmentSubdivisions property is an array of individual segments' subdivision arrays. The path.getSegmentSubdivisions() function may be used to obtain the segmentSubdivisions array.