From 5722144cd268c3c030c80b5955c1cb0fd7ab8788 Mon Sep 17 00:00:00 2001
From: Jean-Yves TINEVEZ <tinevez@pasteur.fr>
Date: Sun, 26 Jul 2020 14:12:51 +0200
Subject: [PATCH] sort_polygon also returns the sorting indices.

---
 src/@deproj/deproj.m       | 3 ++-
 src/@deproj/sort_polygon.m | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/@deproj/deproj.m b/src/@deproj/deproj.m
index 13c595f..36c371c 100644
--- a/src/@deproj/deproj.m
+++ b/src/@deproj/deproj.m
@@ -90,6 +90,7 @@ classdef deproj
         
         % Add the tissue plot colored with the error on cell perimeter caused by the projection.
         hts = add_plot_distorsion_perimeter( obj, ax )
+
                 
     end
     
@@ -123,7 +124,7 @@ classdef deproj
         [ curvMean, curvGauss, curvK1, curvK2 ] = compute_curvatures( H, object_scale, pixel_size, voxel_depth, invert_z )
         
         % Sort the points of a polygon in clockwise manner.
-        P2 = sort_polygon( P )
+        [ P2, I ] = sort_polygon( P )
         
         % Sort x,y coordinates along a continuous contour.
         P2 = find_countour( P )
diff --git a/src/@deproj/sort_polygon.m b/src/@deproj/sort_polygon.m
index 58c5ef5..d8979b2 100644
--- a/src/@deproj/sort_polygon.m
+++ b/src/@deproj/sort_polygon.m
@@ -1,4 +1,4 @@
-function P2 = sort_polygon( P )
+function [ P2, sort_indexes ] = sort_polygon( P )
 %SORT_POLYGON Sort the points of a polygon in clockwise manner.
     
     center = mean( P );
-- 
GitLab