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

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에 대해 자세히 알아보기

태그

질문:

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