Easy3D 2.5.3
KdTreeSearch_ETH Class Reference

KdTree implementation based on Richard Keiser's KdTree code. More...

#include <easy3d/kdtree/kdtree_search_eth.h>

Inheritance diagram for KdTreeSearch_ETH:
KdTreeSearch

Public Member Functions

 KdTreeSearch_ETH (const PointCloud *cloud)
 Constructor. More...
 
 KdTreeSearch_ETH (const std::vector< vec3 > &points)
 Constructor. More...
 
Closest point query
int find_closest_point (const vec3 &p, float &squared_distance) const override
 Queries the closest point for a given point. More...
 
int find_closest_point (const vec3 &p) const override
 Queries the closest point for a given point. More...
 
K nearest neighbors search
void find_closest_k_points (const vec3 &p, int k, std::vector< int > &neighbors, std::vector< float > &squared_distances) const override
 Queries the K nearest neighbors for a given point. More...
 
void find_closest_k_points (const vec3 &p, int k, std::vector< int > &neighbors) const override
 Queries the K nearest neighbors for a given point. More...
 
Fixed radius search
void find_points_in_range (const vec3 &p, float squared_radius, std::vector< int > &neighbors, std::vector< float > &squared_distances) const override
 Queries the nearest neighbors within a fixed range. More...
 
void find_points_in_range (const vec3 &p, float squared_radius, std::vector< int > &neighbors) const override
 Queries the nearest neighbors within a fixed range. More...
 
Cylinder range search
int find_points_in_cylinder (const vec3 &p1, const vec3 &p2, float radius, std::vector< int > &neighbors, std::vector< float > &squared_distances, bool bToLine=true) const
 Queries the nearest neighbors within a cylinder range. More...
 
int find_points_in_cylinder (const vec3 &p1, const vec3 &p2, float radius, std::vector< int > &neighbors, bool bToLine=true) const
 Queries the nearest neighbors within a cylinder range. More...
 
Cone range search
int find_points_in_cone (const vec3 &eye, const vec3 &p1, const vec3 &p2, float angle_range, std::vector< int > &neighbors, std::vector< float > &squared_distances, bool bToLine=true) const
 Queries the nearest neighbors within a cone. More...
 
int find_points_in_cone (const vec3 &eye, const vec3 &p1, const vec3 &p2, float angle_range, std::vector< int > &neighbors, bool bToLine=true) const
 Queries the nearest neighbors within a cone. More...
 

Detailed Description

KdTree implementation based on Richard Keiser's KdTree code.

See also
KdTreeSearch_ANN, KdTreeSearch_FLANN, and KdTreeSearch_NanoFLANN.

Constructor & Destructor Documentation

◆ KdTreeSearch_ETH() [1/2]

KdTreeSearch_ETH ( const PointCloud cloud)
explicit

Constructor.

Parameters
cloudThe point cloud for which a KdTree will be constructed.

◆ KdTreeSearch_ETH() [2/2]

KdTreeSearch_ETH ( const std::vector< vec3 > &  points)
explicit

Constructor.

Parameters
pointsThe points for which a KdTree will be constructed.

Member Function Documentation

◆ find_closest_k_points() [1/2]

void find_closest_k_points ( const vec3 p,
int  k,
std::vector< int > &  neighbors 
) const
overridevirtual

Queries the K nearest neighbors for a given point.

Parameters
pThe query point.
kThe number of required neighbors.
neighborsThe indices of the neighbors found.

Implements KdTreeSearch.

◆ find_closest_k_points() [2/2]

void find_closest_k_points ( const vec3 p,
int  k,
std::vector< int > &  neighbors,
std::vector< float > &  squared_distances 
) const
overridevirtual

Queries the K nearest neighbors for a given point.

Parameters
pThe query point.
kThe number of required neighbors.
neighborsThe indices of the neighbors found.
squared_distancesThe squared distances between the query point and its K nearest neighbors. The values are stored in accordance with their indices.
Note
The squared distances are returned by the argument squared_distances.

Implements KdTreeSearch.

◆ find_closest_point() [1/2]

int find_closest_point ( const vec3 p) const
overridevirtual

Queries the closest point for a given point.

Parameters
pThe query point.
Returns
The index of the nearest neighbor found.

Implements KdTreeSearch.

◆ find_closest_point() [2/2]

int find_closest_point ( const vec3 p,
float &  squared_distance 
) const
overridevirtual

Queries the closest point for a given point.

Parameters
pThe query point.
squared_distanceThe squared distance between the query point and its closest neighbor.
Note
A squared distance is returned by the second argument squared_distance.
Returns
The index of the nearest neighbor found.

Implements KdTreeSearch.

◆ find_points_in_cone() [1/2]

int find_points_in_cone ( const vec3 eye,
const vec3 p1,
const vec3 p2,
float  angle_range,
std::vector< int > &  neighbors,
bool  bToLine = true 
) const

Queries the nearest neighbors within a cone.

Searches for the nearest points with a cone from p1 to p2.

Parameters
eyeThe view point.
p1One end point of a line segment.
p2The other end point of a line segment.
angle_rangeThe maximal angle in radian allowed between p1 - p and p1 - p2, where p is a candidate point.
neighborsThe indices of the neighbors found.
bToLineSpecifies how the points found are ordered. If bToLine=true, the points found are ordered by their distances to the line. Otherwise, they are ordered by their distances to the view point eye.
Note
The angle is specified in radian and squared distances are returned.

◆ find_points_in_cone() [2/2]

int find_points_in_cone ( const vec3 eye,
const vec3 p1,
const vec3 p2,
float  angle_range,
std::vector< int > &  neighbors,
std::vector< float > &  squared_distances,
bool  bToLine = true 
) const

Queries the nearest neighbors within a cone.

Searches for the nearest points with a cone from p1 to p2.

Parameters
eyeThe view point.
p1One end point of a line segment.
p2The other end point of a line segment.
angle_rangeThe maximal angle in radian allowed between p1 - p and p1 - p2, where p is a candidate point.
neighborsThe indices of the neighbors found.
squared_distancesThe squared distances between the found neighbors to the query line segment. The values are stored in accordance with their indices.
bToLineSpecifies how the points found are ordered. If \bToLine=true, the points found are ordered by their distances to the line. Otherwise, they are ordered by their distances to the view point eye.
Note
The angle is specified in radian and squared distances are returned.

◆ find_points_in_cylinder() [1/2]

int find_points_in_cylinder ( const vec3 p1,
const vec3 p2,
float  radius,
std::vector< int > &  neighbors,
bool  bToLine = true 
) const

Queries the nearest neighbors within a cylinder range.

Searches for the nearest points whose distances to line segment p1 - p2 are smaller than radius (not squared).

Parameters
p1One end point of the query line segment.
p2The other end point of the query line segment.
radiusThe search range (which is not squared).
neighborsThe indices of the neighbors found.
bToLineSpecifies how the points found are ordered. If \bToLine=true, the points found are ordered by their distances to the line. Otherwise, they are ordered by their distances to p1.
Note
The range is specified by radius (not squared) but squared distances are returned.

◆ find_points_in_cylinder() [2/2]

int find_points_in_cylinder ( const vec3 p1,
const vec3 p2,
float  radius,
std::vector< int > &  neighbors,
std::vector< float > &  squared_distances,
bool  bToLine = true 
) const

Queries the nearest neighbors within a cylinder range.

Searches for the nearest points whose distances to line segment p1 - p2 are smaller than radius (not squared).

Parameters
p1One end point of the query line segment.
p2The other end point of the query line segment.
radiusThe search range (which is not squared).
neighborsThe indices of the neighbors found.
squared_distancesThe squared distances between the found neighbors to the query line. The values are stored in accordance with their indices.
bToLineSpecifies how the points found are ordered. If \bToLine=true, the points found are ordered by their distances to the line. Otherwise, they are ordered by their distances to p1.
Note
The range is specified by radius (not squared) but squared distances are returned.

◆ find_points_in_range() [1/2]

void find_points_in_range ( const vec3 p,
float  squared_radius,
std::vector< int > &  neighbors 
) const
overridevirtual

Queries the nearest neighbors within a fixed range.

Parameters
pThe query point.
squared_radiusThe search range (which is required to be squared).
neighborsThe indices of the neighbors found.

Implements KdTreeSearch.

◆ find_points_in_range() [2/2]

void find_points_in_range ( const vec3 p,
float  squared_radius,
std::vector< int > &  neighbors,
std::vector< float > &  squared_distances 
) const
overridevirtual

Queries the nearest neighbors within a fixed range.

Parameters
pThe query point.
squared_radiusThe search range (which is required to be squared).
neighborsThe indices of the neighbors found.
squared_distancesThe squared distances between the query point and the neighbors found. The values are stored in accordance with their indices.
Note
The squared distances are returned by the argument squared_distances.

Implements KdTreeSearch.


The documentation for this class was generated from the following files: