Review: replace range_neighbor_query by sphere_neighbor_query

This commit is contained in:
Simon Giraudot 2017-05-03 12:39:09 +02:00
parent b2c33492ad
commit a97cf7b70a
4 changed files with 10 additions and 10 deletions

View File

@ -11,7 +11,7 @@ namespace Classification
Concept describing a neighbor query used for classification. Concept describing a neighbor query used for classification.
\cgalHasModel `CGAL::Classification::Point_set_neighborhood::K_neighbor_query` \cgalHasModel `CGAL::Classification::Point_set_neighborhood::K_neighbor_query`
\cgalHasModel `CGAL::Classification::Point_set_neighborhood::Range_neighbor_query` \cgalHasModel `CGAL::Classification::Point_set_neighborhood::Sphere_neighbor_query`
*/ */
class NeighborQuery class NeighborQuery

View File

@ -164,7 +164,7 @@ int main (int argc, char** argv)
t.start(); t.start();
Classification::classify_with_local_smoothing<CGAL::Parallel_tag> Classification::classify_with_local_smoothing<CGAL::Parallel_tag>
(pts, Pmap(), labels, classifier, (pts, Pmap(), labels, classifier,
neighborhood.range_neighbor_query(radius_neighbors), neighborhood.sphere_neighbor_query(radius_neighbors),
label_indices); label_indices);
t.stop(); t.stop();
std::cerr << "Classification with local smoothing performed in " << t.time() << " second(s)" << std::endl; std::cerr << "Classification with local smoothing performed in " << t.time() << " second(s)" << std::endl;

View File

@ -136,7 +136,7 @@ public:
\cgalModels CGAL::Classification::NeighborQuery \cgalModels CGAL::Classification::NeighborQuery
*/ */
class Range_neighbor_query class Sphere_neighbor_query
{ {
public: public:
typedef typename Point_set_neighborhood::Point value_type; ///< typedef typename Point_set_neighborhood::Point value_type; ///<
@ -149,21 +149,21 @@ public:
\param neighborhood point set neighborhood object. \param neighborhood point set neighborhood object.
\param radius radius of the neighbor query sphere. \param radius radius of the neighbor query sphere.
*/ */
Range_neighbor_query (const Point_set_neighborhood& neighborhood, float radius) Sphere_neighbor_query (const Point_set_neighborhood& neighborhood, float radius)
: neighborhood (neighborhood), radius(radius) { } : neighborhood (neighborhood), radius(radius) { }
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
template <typename OutputIterator> template <typename OutputIterator>
OutputIterator operator() (const value_type& query, OutputIterator output) const OutputIterator operator() (const value_type& query, OutputIterator output) const
{ {
neighborhood.range_neighbors (query, radius, output); neighborhood.sphere_neighbors (query, radius, output);
return output; return output;
} }
/// \endcond /// \endcond
}; };
friend class K_neighbor_query; friend class K_neighbor_query;
friend class Range_neighbor_query; friend class Sphere_neighbor_query;
/// \cond SKIP_IN_MANUAL /// \cond SKIP_IN_MANUAL
Point_set_neighborhood () : m_tree (NULL) { } Point_set_neighborhood () : m_tree (NULL) { }
@ -239,15 +239,15 @@ public:
/*! /*!
\brief Returns a neighbor query object with fixed radius `radius`. \brief Returns a neighbor query object with fixed radius `radius`.
*/ */
Range_neighbor_query range_neighbor_query (const float radius) const Sphere_neighbor_query sphere_neighbor_query (const float radius) const
{ {
return Range_neighbor_query (*this, radius); return Sphere_neighbor_query (*this, radius);
} }
private: private:
template <typename OutputIterator> template <typename OutputIterator>
void range_neighbors (const Point& query, const FT radius_neighbors, OutputIterator output) const void sphere_neighbors (const Point& query, const FT radius_neighbors, OutputIterator output) const
{ {
CGAL_assertion (m_tree != NULL); CGAL_assertion (m_tree != NULL);
Sphere fs (query, radius_neighbors, 0, m_tree->traits()); Sphere fs (query, radius_neighbors, 0, m_tree->traits());

View File

@ -125,7 +125,7 @@ class Point_set_item_classification : public Item_classification_base
else if (method == 1) else if (method == 1)
CGAL::Classification::classify_with_local_smoothing<Concurrency_tag> CGAL::Classification::classify_with_local_smoothing<Concurrency_tag>
(*(m_points->point_set()), m_points->point_set()->point_map(), m_labels, classifier, (*(m_points->point_set()), m_points->point_set()->point_map(), m_labels, classifier,
m_generator->neighborhood().range_neighbor_query(m_generator->radius_neighbors()), m_generator->neighborhood().sphere_neighbor_query(m_generator->radius_neighbors()),
indices); indices);
else if (method == 2) else if (method == 2)
CGAL::Classification::classify_with_graphcut<Concurrency_tag> CGAL::Classification::classify_with_graphcut<Concurrency_tag>