Subject: CGAL users discussion list
List archive
- From: Philipp Moeller <>
- To: Samaras <>
- Cc:
- Subject: Re: [cgal-discuss] NN, change the splitting rule of the tree
- Date: Wed, 20 Nov 2013 16:11:41 +0100
- Organization: GeometryFactory
Samaras
<>
writes:
> Dear all,
>
> cgal provides a number of splitting rule (
> http://doc.cgal.org/latest/Spatial_searching/index.html#title3 ). I would
> like, since I am a beginner, to not only read them in the manual, but try
> them out too! :) If my understanding is correct, the tree is built before we
> search for NNs., i.e. not a lazy built. As a result I am posting the code
> until the tree is built. The default splitting rule is Sliding_midpoint.
>
>
> #include <CGAL/Cartesian_d.h>
> typedef CGAL::Cartesian_d<double> Kernel;
> typedef Kernel::Point_d Point;
>
> #include <CGAL/Manhattan_distance_iso_box_point.h>
> #include <CGAL/K_neighbor_search.h>
> #include <CGAL/Search_traits_2.h>
>
> // from documentation
> //CGAL::K_neighbor_search< Traits, GeneralDistance, Splitter, SpatialTree
>>::K_neighbor_search
>
> typedef Kernel TreeTraits;
> typedef CGAL::Manhattan_distance_iso_box_point<TreeTraits> Distance;
> //typedef CGAL::Midpoint_of_max_spread<TreeTraits> SplitRule; // This
> can be
> compiled, but how do I apply it to the tree?
> typedef CGAL::K_neighbor_search<TreeTraits> Neighbor_search;
> typedef Neighbor_search::Tree Tree;
> ...
> Tree tree;
> for(int i = 0; i < N; ++i)
> tree.insert(v[i]); // v is an std::vector of points
>
> I have also found two examples related to this question, but didn't
> help me.
If you have a look at the documentation of Orthogonal_k_neighbor_search
[1] you can see that the Splitter is the third template argument, which
defaults to Sliding_midpoint<Traits>. In your case:
typedef CGAL::K_neighbor_search<TreeTraits, Distance, SplitRule>
Neighbor_search;
should make it the tree use your Distance and SplitRule.
Footnotes:
[1]
http://doc.cgal.org/latest/Spatial_searching/classCGAL_1_1Orthogonal__k__neighbor__search.html
- [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Philipp Moeller, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Philipp Moeller, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Philipp Moeller, 11/21/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/21/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Philipp Moeller, 11/21/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/21/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/21/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/21/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Philipp Moeller, 11/21/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Philipp Moeller, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Samaras, 11/20/2013
- Re: [cgal-discuss] NN, change the splitting rule of the tree, Philipp Moeller, 11/20/2013
Archive powered by MHonArc 2.6.18.