Get the inverse of polyshape?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Steven Lord
am 1 Nov. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Elementary Polygons finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!