KrisLibrary  1.0.0
Public Member Functions | Public Attributes | List of all members
KDTreePointLocation Class Reference

An accelerated point location algorithm that uses a K-D tree. More...

#include <PointLocation.h>

Inheritance diagram for KDTreePointLocation:
PointLocationBase

Public Member Functions

 KDTreePointLocation (std::vector< Vector > &points)
 
 KDTreePointLocation (std::vector< Vector > &points, Real norm, const Vector &weights)
 
virtual void OnBuild ()
 Call this when the point list is completely changed.
 
virtual void OnAppend ()
 Call this when something is appended to the point list.
 
virtual bool OnClear ()
 Call this when the point list is cleared.
 
virtual bool NN (const Vector &p, int &nn, Real &distance)
 
virtual bool KNN (const Vector &p, int k, std::vector< int > &nn, std::vector< Real > &distances)
 
virtual bool Close (const Vector &p, Real r, std::vector< int > &nn, std::vector< Real > &distances)
 
virtual void GetStats (PropertyMap &stats)
 Returns any potentially interesting statistics.
 
- Public Member Functions inherited from PointLocationBase
 PointLocationBase (std::vector< Vector > &_points)
 
virtual bool OnDelete (int id)
 
virtual bool Exact ()
 Subclass returns true if this is exact nearest neighbors.
 
virtual bool FilteredNN (const Vector &p, bool(*filter)(int), int &nn, Real &distance)
 Same as NN, but with a filter.
 
virtual bool FilteredKNN (const Vector &p, int k, bool(*filter)(int), std::vector< int > &nn, std::vector< Real > &distances)
 Same as KNN, but with a filter.
 
virtual bool FilteredClose (const Vector &p, Real r, bool(*filter)(int), std::vector< int > &neighbors, std::vector< Real > &distances)
 Same as close, but with a filter.
 

Public Attributes

Real norm
 
Vector weights
 
std::unique_ptr< Geometry::KDTreetree
 
- Public Attributes inherited from PointLocationBase
std::vector< Vector > & points
 

Detailed Description

An accelerated point location algorithm that uses a K-D tree.

Uses an L-n norm, optionally with weights.

Does not support deletion.

Member Function Documentation

bool KDTreePointLocation::Close ( const Vector p,
Real  r,
std::vector< int > &  neighbors,
std::vector< Real > &  distances 
)
virtual

Call this to retrieve the index of the points within distance r, and their distances. Subclasses should return false if close-neighbor queries are not supported.

Reimplemented from PointLocationBase.

bool KDTreePointLocation::KNN ( const Vector p,
int  k,
std::vector< int > &  nn,
std::vector< Real > &  distances 
)
virtual

Call this to retrieve the indices of the k-nearest neighbors and their distances. Subclasses should return false if KNN queries are not supported.

Reimplemented from PointLocationBase.

bool KDTreePointLocation::NN ( const Vector p,
int &  nn,
Real &  distance 
)
virtual

Call this to retrieve the index of the nearest neighbor and its distance. Subclasses should return false if NN queries are not supported.

Reimplemented from PointLocationBase.


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