Input multiple region for polyshape

Hi community,
I want to read XYZ coordinates from a txt file that contains points that represent the bounday of more that one polygon and make it available as an input for the polyshape function.
In other words I want to detect how many closed polygons are inside that txt file and add a NaN line when a polygon is closed. In that case I will have the coordinates of the regions delimited by a NaN row that is suitable to input for polyshape function.
Can please anyone help me?

回答(1 个)

Matt J
Matt J 2023-12-12
编辑:Matt J 2023-12-12
There is no unique way to divide a series of points into closed polygons. If you haven't inserted the NaNs already, the intended result is ambiguous.

1 个评论

To illustrate Matt J's point, consider the following five points.
x = [-1 0 1 1 -1];
y = [-1 0 -1 1 1];
plot(x, y, 'o')
axis square
axis([-1.5 1.5 -1.5 1.5])
Should that region be split into four triangles, a kind of claw shape and a triangle (and if so, which three of the four triangles should be used to draw the claw?), or two hourglasses?

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Polygonal Shapes 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by