Sort Coplanar 3D Points Clockwise
2 ビュー (過去 30 日間)
古いコメントを表示
I have a set of 3D points that form a polygon. The points are coplanar, due to the fact they are obtained by means of a Voronoi tessellation. I need to compute the area of such polygon. Computing the convex hull is not an option, since the points are coplanar. I thought about computing the centroid and calculating angles but I am struggling to make it work. MWE:
A = [263 274 14.1; 271 276 14.1; 251 296 14.1; 271 300 14.1];
C = mean(A);
and I need the triangulated convex hull or the ID of the points ordered counterclockwise. In this case the answer I need is:
ans = [1 2 4 3 1]
in order to construct a triangulated polygon, of which the calculation of the area is trivial.
0 件のコメント
回答 (1 件)
Greg Dionne
2017 年 5 月 2 日
I'd probably just project to 2D first and just take the X/Y from there. I'm not sure if the indices need to be sorted first either, but this might get you closer: polyarea.
Failing that, your idea of computing the centroid will work: use atan2(Y-Yc,X-Xc) to get the angle and then sort.
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!