Skip to content

polylineLength

David Legland edited this page Feb 28, 2022 · 1 revision

Return the length of a polyline given as a list of points.

Usage

L = polylineLength(POLY);

POLY should be a N-by-D array, where N is the number of points and D is the dimension of the points.

L = polylineLength(..., TYPE);

Specifies if the last point is connected to the first one. TYPE can be either 'closed' or 'open'.

L = polylineLength(POLY, POS);

Compute the length of the polyline between its origin and the position given by POS. POS should be between 0 and N-1, where N is the number of points of the polyline.

Example

% Compute the perimeter of a circle with radius 1
polylineLength(circleAsPolygon([0 0 1], 500), 'closed')
ans = 
    6.2831

See also:

polygons2d, polylineCentroid, polygonLength

Clone this wiki locally