Skip to content

Commit

Permalink
Changed KDTree convenience typedefs to template aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
kzampog committed May 8, 2020
1 parent 8dd77c4 commit c11cc8d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/kd_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ int main(int argc, char ** argv) {
points.emplace_back(1, 1, 0);
points.emplace_back(1, 1, 1);

cilantro::KDTree3f tree(points);
cilantro::KDTree3f<> tree(points);

cilantro::NeighborSet<float> nn = tree.kNNInRadiusSearch(Eigen::Vector3f(0.1, 0.1, 0.4), 2, 1.001);

Expand Down
2 changes: 1 addition & 1 deletion examples/normal_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int main(int argc, char ** argv) {

cilantro::Timer tree_timer;
tree_timer.start();
cilantro::KDTree3f tree(cloud.points);
cilantro::KDTree3f<> tree(cloud.points);
// cilantro::NormalEstimation3f ne(tree);
// cilantro::NormalEstimation3f ne(cloud.points);
tree_timer.stop();
Expand Down
2 changes: 1 addition & 1 deletion examples/robust_normal_estimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int main(int argc, char ** argv) {

cilantro::Timer tree_timer;
tree_timer.start();
cilantro::KDTree3f tree(cloud.points);
cilantro::KDTree3f<> tree(cloud.points);
tree_timer.stop();

cilantro::Timer ne_timer;
Expand Down
2 changes: 1 addition & 1 deletion examples/spectral_clustering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void generate_input_data(cilantro::VectorSet3f &points, Eigen::SparseMatrix<floa

// Build neighborhood graph
// 30 neighbors
cilantro::NeighborhoodSet<float> nn = cilantro::KDTree3f(points).search(points, cilantro::KNNNeighborhoodSpecification<>(30));
cilantro::NeighborhoodSet<float> nn = cilantro::KDTree3f<>(points).search(points, cilantro::KNNNeighborhoodSpecification<>(30));
affinities = cilantro::getNNGraphFunctionValueSparseMatrix(nn, cilantro::RBFKernelWeightEvaluator<float>(), true);
}

Expand Down
23 changes: 17 additions & 6 deletions include/cilantro/core/kd_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,21 @@ namespace cilantro {
nanoflann::SearchParams params_;
};

typedef KDTree<float,2,KDTreeDistanceAdaptors::L2> KDTree2f;
typedef KDTree<double,2,KDTreeDistanceAdaptors::L2> KDTree2d;
typedef KDTree<float,3,KDTreeDistanceAdaptors::L2> KDTree3f;
typedef KDTree<double,3,KDTreeDistanceAdaptors::L2> KDTree3d;
typedef KDTree<float,Eigen::Dynamic,KDTreeDistanceAdaptors::L2> KDTreeXf;
typedef KDTree<double,Eigen::Dynamic,KDTreeDistanceAdaptors::L2> KDTreeXd;
template <template <class> class DistAdaptor = KDTreeDistanceAdaptors::L2, typename IndexT = size_t>
using KDTree2f = KDTree<float,2,DistAdaptor,IndexT>;

template <template <class> class DistAdaptor = KDTreeDistanceAdaptors::L2, typename IndexT = size_t>
using KDTree2d = KDTree<double,2,DistAdaptor,IndexT>;

template <template <class> class DistAdaptor = KDTreeDistanceAdaptors::L2, typename IndexT = size_t>
using KDTree3f = KDTree<float,3,DistAdaptor,IndexT>;

template <template <class> class DistAdaptor = KDTreeDistanceAdaptors::L2, typename IndexT = size_t>
using KDTree3d = KDTree<double,3,DistAdaptor,IndexT>;

template <template <class> class DistAdaptor = KDTreeDistanceAdaptors::L2, typename IndexT = size_t>
using KDTreeXf = KDTree<float,Eigen::Dynamic,DistAdaptor,IndexT>;

template <template <class> class DistAdaptor = KDTreeDistanceAdaptors::L2, typename IndexT = size_t>
using KDTreeXd = KDTree<double,Eigen::Dynamic,DistAdaptor,IndexT>;
}

0 comments on commit c11cc8d

Please sign in to comment.