CLIPPOLYLINE Clip an open polyline with a rectangular box.
POLY2 = clipPolyline(POLY, BOX);
POLY is N-by-2 array of vertex coordinates.
BOX has the form: [XMIN XMAX YMIN YMAX].
Returns the set of polylines created by the intersection of the
polyline POLY and the bounding box BOX. The result is a cell array with
as many cells as the number of curve clips.
Example
circle = [5 5 6];
poly = circleToPolygon(circle, 200);
box = [0 10 0 10];
res = clipPolyline(poly, box);
figure;
hold on; axis equal; axis([-2 12 -2 12]);
drawCircle(circle, 'b:')
drawBox(box, 'k')
drawPolyline(res, 'linewidth', 2, 'color', 'b')
See also:
polygons2d, boxes2d, clipPolygon, clipEdge
Package: matgeom