Get the inverse of polyshape?
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
When you have a polygon like:
pgon = polyshape([200 250 260 200],[230 180 250 230])
plot(pgon)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/785983/image.png)
how can you get back the corners of the polygon, i.e. what is the inverse function of polyshape?
0 comentarios
Respuestas (1)
Steven Lord
el 1 de Nov. de 2021
Do you want to get the vertices from the polyshape object or from the plotted Polygon object?
pgon = polyshape([0 0 1 1],[1 0 0 1])
V = pgon.Vertices
h = plot(pgon)
V2 = h.Shape.Vertices
Note that V and V2 may not necessarily be the same as the vectors you passed into polyshape if those original vectors specified polygonal regions with collinear points, intersections, or improper nesting. See the "Area of Bow Tie" example on the documentation page for polyshape.
B = polyshape([0 0; 1 1; 1 0; 0 1; 0 0]);
V3 = B.Vertices
0 comentarios
Ver también
Categorías
Más información sobre Elementary Polygons en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!