Get the inverse of polyshape?
10 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Steven Lord
2021 年 11 月 1 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Elementary Polygons についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!