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 日

0 投票

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 件のコメント

Steven Lord
Steven Lord 2023 年 12 月 12 日
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 ExchangePolygonal Shapes についてさらに検索

タグ

質問済み:

2023 年 12 月 12 日

コメント済み:

2023 年 12 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by