Identifying elements of an array in clockwise order
古いコメントを表示
If I have an array A such that it contains vertex coordinates of polygons where
A=[ 1 1;
2 0;
4 0;
10 1;
0 0;
1 5;
11 2;
0 2;
2 2;
.
.
.
x y ]
and C such that it contains the collection of vertex locations in A of a polygon where C is something like:
C = {[ 2, 5, 8, 9]
.
.
.
[x,y locations in A]}
C{1} contains the coordinates (2,0), (0,0), (0,2), and (2,2) from A. I want to take say, the first elements of C{1}, and sort C such that the remaining element order in C{1} moves clockwise (or counter-clockwise) in terms of element location with respect to polygon generation. So C{1}(1)=2 (2,0), and the remaining elements would follow as such:
C{1}(2)=9 (2,2)
C{1}(3)=8 (0,2)
C{1}(4)=5 (0,0)
6 件のコメント
Sara
2014 年 7 月 7 日
Do you have the mapping toolbox?
Sean
2014 年 7 月 7 日
Sean
2014 年 7 月 7 日
Sara
2014 年 7 月 7 日
I was thinking at poly2cw actually. it will order the vertexes in the clock wise order, then you can reorganize it so you have first the vertex of your choice
Sean
2014 年 7 月 7 日
Sean
2014 年 7 月 8 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Creating and Concatenating Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!