1 #ifndef GEOMETRY_KDTREE_H 2 #define GEOMETRY_KDTREE_H 4 #include <KrisLibrary/math/vector.h> 42 static KDTree* Create(
const std::vector<Vector>& p,
int k,
int maxDepth);
45 KDTree(
const std::vector<Point>& pts,
int k,
int depth=0,
int maxDepth=100);
52 inline bool IsLeaf()
const {
return splitDim==-1; }
57 int MaxLeafSize()
const;
58 int MinLeafSize()
const;
64 KDTree* Insert(
const Vector& p,
int id,
int maxLeafPoints=2);
70 bool Split(
int dimension=-1);
79 int ClosestPoint(
const Vector& pt,Real n,
const Vector& w,Real& dist)
const;
84 int PointWithin(
const Vector& pt,Real& dist)
const;
86 void ClosePoints(
const Vector& pt,Real radius,std::vector<Real>& distances,std::vector<int>& ids)
const;
88 void ClosePoints(
const Vector& pt,Real radius,Real n,
const Vector& w,std::vector<Real>& distances,std::vector<int>& ids)
const;
92 void KClosestPoints(
const Vector& pt,
int k,Real* dist,
int* idx)
const;
94 void KClosestPoints(
const Vector& pt,
int k,Real n,
const Vector& w,Real* dist,
int* idx)
const;
97 static Real Select(
const std::vector<Point>& S,
int d,
int k);
100 void _ClosestPoint(
const Vector& pt,Real& dist,
int& idx)
const;
101 void _KClosestPoints(
const Vector& pt,
int k,Real* dist,
int* idx,
int& maxdist)
const;
102 void _ClosestPoint2(
const Vector& pt,Real& dist,
int& idx,Real norm,
const Vector& weights)
const;
103 void _KClosestPoints2(
const Vector& pt,
int k,Real* dist,
int* idx,
int& maxdist,Real norm,
const Vector& weights)
const;
109 std::vector<Point> pts;
A kd-tree or a node of one.
Definition: KDTree.h:30
int ClosestPoint(const CollisionMesh &mesh, const Vector3 &p, Vector3 &cp, Real bound)
Definition: CollisionMesh.cpp:1309
Contains all definitions in the Math package.
Definition: WorkspaceBound.h:12
Contains all definitions in the Geometry package.
Definition: AnyGeometry.cpp:26