ANGLESORT3D Sort 3D coplanar points according to their angles in plane.

   PTS2 = angleSort3d(PTS);
   Considers all points are located on the same plane, and sort them
   according to the angle on plane. PTS is a [Nx2] array. Note that the
   result depends on the plane orientation: points can be in reverse order
   compared to expected. The reference plane is computed based on the
   first three points.

   PTS2 = angleSort3d(PTS, PTS0);
   Computes angles between each point of PTS and PT0. By default, uses
   centroid of points.

   PTS2 = angleSort3d(PTS, PTS0, PTS1);
   Specifies the point which will be used as a start.

   [PTS2, I] = angleSort3d(...);
   Also return in I the indices of PTS, such that PTS2 = PTS(I, :);

   See also:
   points3d, angles3d, angleSort

 ------
 Author: David Legland
 e-mail: david.legland@grignon.inra.fr
 Created: 2005-11-24
 Copyright 2005 INRA - CEPIA Nantes - MIAJ (Jouy-en-Josas).

Package: matgeom