Plot a polygon without intersection
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi everyone I have the matrix below and 1st row refers x-coordinates and 2nd row refers y-coordinates. When I plot it, I get the polygon that I do not want with several intersections due to array of the elements in the out matrix. You can see in the figure below. So, How can I arrange of the elements' array of this matrix to get smooth polygon. For example, the points should be in this aray (1,4) , (2,4) , (3,4) , (3,5) , (2,5) , (1,5). of course, the first point can be changed.
out = [ 1 1 2 2 3 3;
4 5 4 5 4 5]
pgon = polyshape([out(1,:)], [out(2,:)]);
plot(pgon)
grid on

댓글 수: 0
채택된 답변
Walter Roberson
2019년 5월 18일
k = boundary(out.');
plot(out(1,k), out(2,k))
... but it will just look like a square.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Computational Geometry에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!