maliput
KDTree3D< Coordinate, Distance, NodeCmp > Class Template Reference

Detailed Description

template<typename Coordinate, typename Distance = details::SquaredDistance<Coordinate, 3>, typename NodeCmp = details::NodeCmp<3>>
class maliput::math::KDTree3D< Coordinate, Distance, NodeCmp >

3-Dimensional KDTree.

In addition it provides a RangeSearch method for range queries in the 3D-space.

KDTree<Vector3> tree{points};
tree.RangeSearch(region_1);
tree.RangeSearch(region_2);
...
tree.nearest_point(point_1); // NearestNeighbour (NN).
Template Parameters
CoordinateData type being used, must have:
  • operator[] for accessing the value in each dimension.
DimensionDimension of the KD-tree.
DistanceA functor used for getting the distance between two coordinates. By default, details::SquaredDistance is used.
NodeCmpA functor used for comparing two nodes at certain index/dimension. By default, details::NodeCmp is used.

#include <include/maliput/math/kd_tree.h>

Inheritance diagram for KDTree3D< Coordinate, Distance, NodeCmp >:
[legend]

Public Member Functions

template<typename Iterator >
 KDTree3D (Iterator begin, Iterator end)
 
template<typename Collection >
 KDTree3D (Collection &&points)
 Constructs a KDTreeBase taking a vector of points. More...
 
std::deque< const Coordinate * > RangeSearch (const AxisAlignedBox &region) const
 Range search in the 3D-space. More...
 
- Public Member Functions inherited from KDTreeBase< KDTree3D< Coordinate, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >, Coordinate, 3, AxisAlignedBox, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >
 KDTreeBase (Iterator begin, Iterator end)
 Constructs a KDTreeBase taking a pair of iterators. More...
 
 KDTreeBase (Collection &&points)
 Constructs a KDTreeBase taking a vector of points. More...
 
const Coordinate & nearest_point (const Coordinate &point) const
 Finds the nearest point in the tree to the given point. More...
 
const Coordinate & nearest_point (const Coordinate &point, double tolerance) const
 Finds the nearest point in the tree to the given point. More...
 

Additional Inherited Members

- Protected Types inherited from KDTreeBase< KDTree3D< Coordinate, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >, Coordinate, 3, AxisAlignedBox, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >
using Node = details::Node< Coordinate, AxisAlignedBox >
 
- Protected Member Functions inherited from KDTreeBase< KDTree3D< Coordinate, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >, Coordinate, 3, AxisAlignedBox, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >
void nearest_point (const Node *node, const Coordinate &point, std::size_t index, double tolerance, Node *&nearest_neighbour_node, double *nearest_neighbour_distance) const
 
- Protected Attributes inherited from KDTreeBase< KDTree3D< Coordinate, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >, Coordinate, 3, AxisAlignedBox, details::SquaredDistance< Coordinate, 3 >, details::NodeCmp< 3 > >
Noderoot_
 
std::deque< Nodenodes_
 

Constructor & Destructor Documentation

◆ KDTree3D() [1/2]

KDTree3D ( Iterator  begin,
Iterator  end 
)

◆ KDTree3D() [2/2]

KDTree3D ( Collection &&  points)

Constructs a KDTreeBase taking a vector of points.

Parameters
pointsVector of points
Template Parameters
Collectiontype of the collection.
Exceptions
maliput::common::assertion_errorWhen the range is empty.

Member Function Documentation

◆ RangeSearch()

std::deque<const Coordinate*> RangeSearch ( const AxisAlignedBox region) const

Range search in the 3D-space.

Parameters
regionThe region to be searched Coordinates on.
Returns
A vector of Coordinates located in the region. For further info on Range Search algorithm see http://www.cs.utah.edu/~lifeifei/cis5930/kdtree.pdf

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