Function File: [Xo, Yo] = polycut (Xi, Yi)
Function File: [Xo, Yo, Zo] = polycut (Xi, Yi, Zi)
Function File: [XY_o] = polycut (XY_i)

Reorder nested multipart polygons in such a way that branch cuts aren’t drawn when using the patch command.

Normally when drawing multipart nested polygons (with holes and other polygons inside the holes; polygon parts separated by NaNs) holes will be filled. Connecting the polygon parts by deleting the NaNs leads to edges of some polygon parts to be drawn across neighboring polygon parts. polycut reorders the polygon parts such that the last vertices of polygon parts have minimum distance to the first vertices of the next parts, avoiding the connecting lines ("branch cuts") to show up in the drawing.

Input consists of separate X, Y, and -optionally- Z vectors, or an Nx2 or Nx3 matrix of vertex coordinates (X, Y) or (X, Y, Z). If individual X and Y vectors were input, the output consists of the same number of vectors. If an Nx 2 or Nx3 array was input, the output will be an Nx2 or Nx3 matrix as well.

polycut is a mere wrapper around the function polygon2patch in the OF geometry package.

Package: mapping