Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] NN, change the splitting rule of the tree

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] NN, change the splitting rule of the tree


Chronological Thread 
  • From: Philipp Moeller <>
  • To: Samaras <>
  • Cc:
  • Subject: Re: [cgal-discuss] NN, change the splitting rule of the tree
  • Date: Thu, 21 Nov 2013 11:30:41 +0100
  • Organization: GeometryFactory



Samaras
<>
writes:

> Thanks Philipp for the kind tips :)
>
> Here is the minimal example:
> #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;
> //typedef CGAL::K_neighbor_search<TreeTraits> Neighbor_search;
> typedef CGAL::K_neighbor_search<TreeTraits> Neighbor_search;
I assume you meant to say this:
typedef CGAL::K_neighbor_search<TreeTraits, Distance, SplitRule>
Neighbor_search;

otherwise I can't reproduce your problem.

> typedef Neighbor_search::Tree Tree;
>
> int main() {
> Tree tree;
> for(int i = 0; i < 5 ; ++i)
> tree.insert(Point (1, 1, 1, 1));
> for(int i = 0 ; i < 3 ; ++i)
> Neighbor_search N1(tree, (Point (2, 2, 2, 1)), 1, 0.2,
> false);
^^^^^
The problem is here. As I said before: the Query_item is determined by
the Distance type that is used. The default distance is
Euclidian_distance and its Query_item is a Point_d, the Query_item of
Manhattan_distance_iso_box_point is Iso_box_d, hence the error.

> return 0;
> }



Archive powered by MHonArc 2.6.18.

Top of Page