DISTANCEPOINTPOLYLINE Compute shortest distance between a point and a polyline. DIST = distancePointPolyline(POINT, POLYLINE) Returns the shortest distance between a point given as a 1-by-2 row vector, and a polyline given as a NV-by-2 array of coordinates. If POINT is a NP-by-2 array, the result DIST is a NP-by-1 array, containig the distance of each point to the polyline. [DIST, POS] = distancePointPolyline(POINT, POLYLINE) Also returns the relative position of the point projected on the polyline, between 0 and NV, the number of polyline vertices. ... = distancePointPolyline(POINT, POLYLINE, CLOSED) Specifies if the polyline is closed or not. CLOSED can be one of: * 'closed' -> the polyline is closed * 'open' -> the polyline is open a column vector of logical with the same number of elements as the number of points -> specify individually if each polyline is closed (true=closed). Example: pt1 = [30 20]; pt2 = [30 5]; poly = [10 10;50 10;50 50;10 50]; distancePointPolyline([pt1;pt2], poly) ans = 10 5 See also polygons2d, points2d distancePointEdge, distancePointPolygon, projPointOnPolyline
Package: matgeom