POLYLINESELFINTERSECTIONS Find self-intersection points of a polyline. Computes self-intersections of a polyline, eventually specifying if polyline is closed or open, and eventually returning position of intersection points on polyline. For common use cases, the intersectPolylines function may return the desired result in a faster way. PTS = polylineSelfIntersections(POLY); Returns the position of self intersections of the given polyline. PTS = polylineSelfIntersections(POLY, CLOSED); Adds an options to specify if the polyline is closed (i.e., is a polygon), or open (the default). CLOSED can be a boolean, or one of 'closed' or 'open'. [PTS, POS1, POS2] = polylineSelfIntersections(POLY); Also return the 2 positions of each intersection point (the position when meeting point for first time, then position when meeting point for the second time). [...] = polylineSelfIntersections(POLY, 'tolerance', TOL) Specifies an additional parameter to decide whether two intersection points should be considered the same, based on their Euclidean distance. Example % use a gamma-shaped polyline poly = [0 0;0 10;20 10;20 20;10 20;10 0]; polylineSelfIntersections(poly) ans = 10 10 % use a 'S'-shaped polyline poly = [10 0;0 0;0 10;20 10;20 20;10 20]; polylineSelfIntersections(poly) ans = Empty matrix: 0-by-2 polylineSelfIntersections(poly, 'closed') ans = 10 10 See also polygons2d, intersectPolylines, polygonSelfIntersections
Package: matgeom