Sort Coplanar 3D Points Clockwise

7 visualizzazioni (ultimi 30 giorni)
Alessandro
Alessandro il 2 Mag 2017
Risposto: Greg Dionne il 2 Mag 2017
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.

Risposte (1)

Greg Dionne
Greg Dionne il 2 Mag 2017
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.

Categorie

Scopri di più su Bounding Regions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by