Sort Coplanar 3D Points Clockwise

조회 수: 7 (최근 30일)
Alessandro
Alessandro 2017년 5월 2일
답변: Greg Dionne 2017년 5월 2일
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.

답변 (1개)

Greg Dionne
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.

카테고리

Help CenterFile Exchange에서 Computational Geometry에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by