CGAL 5.5.2 - Shape Detection
CGAL::Shape_detection::Point_set::Sphere_neighbor_query< GeomTraits, InputRange, PointMap > Class Template Reference

#include <CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h>

Definition

Fuzzy sphere neighbors search in a set of Kernel::Point_2 or Kernel::Point_3.

This class returns all neighbors of a query point, which fall in a sphere of the fixed radius centered at this point.

Template Parameters
GeomTraitsmust be a model of Kernel.
InputRangemust be a model of ConstRange whose iterator type is RandomAccessIterator.
PointMapmust be an LvaluePropertyMap whose key type is the value type of the input range and value type is Kernel::Point_2 or Kernel::Point_3.
Is Model Of:
NeighborQuery
Examples:
Shape_detection/region_growing_lines_on_point_set_2.cpp.

Types

typedef GeomTraits::FT FT
 Number type.
 

Initialization

 Sphere_neighbor_query (const InputRange &input_range, const FT sphere_radius=FT(1), const PointMap point_map=PointMap())
 initializes a Kd-tree with input points. More...
 

Access

void operator() (const std::size_t query_index, std::vector< std::size_t > &neighbors) const
 implements NeighborQuery::operator()(). More...
 

Constructor & Destructor Documentation

◆ Sphere_neighbor_query()

template<typename GeomTraits , typename InputRange , typename PointMap >
CGAL::Shape_detection::Point_set::Sphere_neighbor_query< GeomTraits, InputRange, PointMap >::Sphere_neighbor_query ( const InputRange &  input_range,
const FT  sphere_radius = FT(1),
const PointMap  point_map = PointMap() 
)

initializes a Kd-tree with input points.

Parameters
input_rangean instance of InputRange with 2D or 3D points
sphere_radiusthe fixed radius of the fuzzy sphere used for searching neighbors of a query point. Default is 1.
point_mapan instance of PointMap that maps an item from input_range to Kernel::Point_2 or to Kernel::Point_3
Precondition
input_range.size() > 0
sphere_radius > 0

Member Function Documentation

◆ operator()()

template<typename GeomTraits , typename InputRange , typename PointMap >
void CGAL::Shape_detection::Point_set::Sphere_neighbor_query< GeomTraits, InputRange, PointMap >::operator() ( const std::size_t  query_index,
std::vector< std::size_t > &  neighbors 
) const

implements NeighborQuery::operator()().

This operator finds indices of all points, which fall in a sphere of the fixed radius sphere_radius centered at the query point with the index query_index. These neighbors are returned in neighbors.

Parameters
query_indexindex of the query point
neighborsindices of points, which are neighbors of the query point
Precondition
query_index >= 0 && query_index < input_range.size()