Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?


Chronological Thread 
  • From: Matti Lehtonen <>
  • To:
  • Subject: Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?
  • Date: Tue, 30 Apr 2013 17:31:45 +0300

Hi,

On 30 April 2013 14:58, Sebastien Loriot (GeometryFactory) <> wrote:
I think you should simply use:


struct Property_map_xy_2
{
     typedef Point_2  value_type;
     typedef value_type reference;

     typedef const Multi_Classified_Point &        key_type;
     typedef boost::readable_property_map_tag    category;
};


with


Property_map_xy_2::reference
get
(
     Property_map_xy_2,
     Property_map_xy_2::key_type        p
)
{
     return Point_2( p.x(), p.y() );
}

Without reference at "typedef value_type reference", but still with const keyword, a core dump is created, while building the tree.
terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: b = (b && (bbox.min_coord(i) <= tbox.min_coord(i)))
File: /usr/include/CGAL/Point_container.h
Line: 325

 

otherwise, you might use tmp while it was changed.

I used a const reference, so changing should not be possible.



It seems that a tuple version works - inefficiently and with ugly code, but it works.


To the wish list:
* e.g. CGAL::Distance_xy_3 could be used similarly like CGAL::Triangulation_euclidean_traits_xy_3, which allows use of 3D points for 2D triangulation


Matti L
--
Life is complex. It has real and imaginary parts.



Archive powered by MHonArc 2.6.18.

Top of Page