Skip to content

Commit f1ad81a

Browse files
committed
Use std::partition and std::sort instead of just sort
1 parent 41193b3 commit f1ad81a

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

surface/include/pcl/surface/gp3.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -473,19 +473,6 @@ namespace pcl
473473
part_[v] = part_[s];
474474
fringe_queue_.push_back(v);
475475
}
476-
477-
/** \brief Function for ascending sort of nnAngle, taking visibility into account
478-
* (angles to visible neighbors will be first, to the invisible ones after).
479-
* \param[in] a1 the first angle
480-
* \param[in] a2 the second angle
481-
*/
482-
static inline bool
483-
nnAngleSortAsc (const nnAngle& a1, const nnAngle& a2)
484-
{
485-
if (a1.visible == a2.visible)
486-
return (a1.angle < a2.angle);
487-
return a1.visible;
488-
}
489476
};
490477

491478
} // namespace pcl

surface/include/pcl/surface/impl/gp3.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040

4141
#include <pcl/surface/gp3.h>
4242

43+
#include <algorithm>
44+
4345
/////////////////////////////////////////////////////////////////////////////////////////////
4446
template <typename PointInT> void
4547
pcl::GreedyProjectionTriangulation<PointInT>::performReconstruction (pcl::PolygonMesh &output)
@@ -479,7 +481,8 @@ pcl::GreedyProjectionTriangulation<PointInT>::reconstructPolygons (std::vector<p
479481
}
480482

481483
// Sorting angles
482-
std::sort (angles_.begin (), angles_.end (), GreedyProjectionTriangulation<PointInT>::nnAngleSortAsc);
484+
const auto visible_end = std::partition(angles_.begin(), angles_.end(), [](const nnAngle& a){ return a.visible; });
485+
std::sort(angles_.begin(), visible_end, [](const nnAngle& a, const nnAngle& b){ return a.angle < b.angle; });
483486

484487
// Triangulating
485488
if (angles_[2].visible == false)

0 commit comments

Comments
 (0)