From 1f369bbf096ae9f87a2924a908ea44094b4962a8 Mon Sep 17 00:00:00 2001 From: giorgiomarcias Date: Fri, 7 Nov 2014 15:38:00 +0000 Subject: [PATCH] Added the option for selecting polychord loops only. --- .../algorithms/polygon_polychord_collapse.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/vcg/complex/algorithms/polygon_polychord_collapse.h b/vcg/complex/algorithms/polygon_polychord_collapse.h index 46558e1f..88175e9c 100644 --- a/vcg/complex/algorithms/polygon_polychord_collapse.h +++ b/vcg/complex/algorithms/polygon_polychord_collapse.h @@ -859,8 +859,9 @@ public: * @brief FindPolychords lists all the valid polychords starting position of a mesh. * @param mesh The input mesh. * @param polychords The container of results. + * @param loopsOnly true if closed polychords only must be listed, false for all polychords. */ - static void FindPolychords(PolyMeshType &mesh, std::deque< vcg::face::Pos > &polychords) { + static void FindPolychords(PolyMeshType &mesh, std::deque< vcg::face::Pos > &polychords, const bool loopsOnly = false) { polychords.clear(); if (mesh.IsEmpty()) @@ -883,12 +884,16 @@ public: // check and find start pos resultCode = CheckPolychordFindStartPosition(pos, startPos, false); // visit the polychord - if (resultCode == PC_SUCCESS) + if (resultCode == PC_SUCCESS) { VisitPolychord(mesh, startPos, chords, mark, PC_OTHER); - else + // store a new polychord + if (!loopsOnly) + polychords.push_back(startPos); + else if (!startPos.IsBorder()) + polychords.push_back(startPos); + } else { VisitPolychord(mesh, startPos, chords, mark, resultCode); - // store a new polychord - polychords.push_back(startPos); + } // go to the next coord chords.Next();