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?

Respuestas (1)

Matt J
Matt J el 12 de Dic. de 2023
Editada: Matt J el 12 de Dic. de 2023

0 votos

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 comentario

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?

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 12 de Dic. de 2023

Comentada:

el 12 de Dic. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by