Sort Coplanar 3D Points Clockwise
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Greg Dionne
le 2 Mai 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.
0 commentaires
Voir également
Catégories
En savoir plus sur Computational Geometry dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!