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!