Returns the disjoint segments of a polygon as a list of polygons without external seams.
Syntax |
Description |
---|---|
polypieces(V, {"tolerance": tol_value}) |
Returns the disjoint segments of a polygon as a list of polygons without external seams.
|
Example
The following script creates a single polygon object in the object tree. However, it is actually composed of two disjoint polygons due to the duplicate paths between (1,1) and (1,2).
V = [ [0, 0];
[2, 0];
[1, 1];
[1, 2];
[2, 3];
[0, 3];
[1, 2];
[1, 1] ];
addpoly({"name": "originalWithSeam",
"vertices": V*1e-6});
Applying the polypieces command removes the seams from the vertices and makes it easier to turn the disjoint segments into separate objects.
delete;
W = polypieces(V); #< cell array with two polygons
for(idx=1:length(W)) {
addpoly({"name": "piece_"+num2str(idx), "vertices": W{idx}*1e-6});
}
See Also
List of commands , addpoly, polyclean , polyarea , centroid , polyintersect , inpoly , polyand , polyor , polydiff , polyxor, polygrow