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 14:14:52 +0300
Hi,
On 29 April 2013 16:22, Sebastien Loriot (GeometryFactory) <> wrote:
The simplest but probably not the faster is to use Search_traits_adapter
with Search_traits_2 and a property map that creates 2D points on the
fly from 3D points.
The Search_traits_adapter<> approach didn't really work. The application dumps a core while the tree is build
terminate called after throwing an instance of 'CGAL::Assertion_exception'or
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
terminate called after throwing an instance of 'CGAL::Assertion_exception'
what(): CGAL ERROR: assertion violation!
Expr: max_span_upper <= c0.max_span_upper()
File: /usr/include/CGAL/Splitters.h
Line: 197
depending, which version of function get() is used.
// Tree - 3D points used like 2D points
struct Property_map_xy_2
{
typedef Point_2 value_type;
typedef const value_type & reference;
typedef const Multi_Classified_Point & key_type;
typedef boost::readable_property_map_tag category;
};
Property_map_xy_2::reference
get
(
Property_map_xy_2,
Property_map_xy_2::key_type p
)
{
static Point_2 tmp;
return tmp = Point_2( p.x(), p.y() );
///return Point_2( p.x(), p.y() ); /// with a GCC warning
}
struct Property_map_xy_2
{
typedef Point_2 value_type;
typedef const value_type & reference;
typedef const Multi_Classified_Point & key_type;
typedef boost::readable_property_map_tag category;
};
Property_map_xy_2::reference
get
(
Property_map_xy_2,
Property_map_xy_2::key_type p
)
{
static Point_2 tmp;
return tmp = Point_2( p.x(), p.y() );
///return Point_2( p.x(), p.y() ); /// with a GCC warning
}
Sho
The approach, where a 3D [storage] tree is used with custom [2D] distance with only Distance_adapter<> won't compile, so the only approaches are
a) store points as tuples or
a) store points as tuples or
b)
You are right that [1] is longer to write but will be faster.
Matti L
--
Life is complex. It has real and imaginary parts.
Life is complex. It has real and imaginary parts.
- [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Matti Lehtonen, 04/29/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Sebastien Loriot (GeometryFactory), 04/29/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Matti Lehtonen, 04/30/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Sebastien Loriot (GeometryFactory), 04/30/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Matti Lehtonen, 04/30/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Sebastien Loriot (GeometryFactory), 04/30/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Matti Lehtonen, 04/30/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Sebastien Loriot (GeometryFactory), 04/30/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Matti Lehtonen, 04/30/2013
- Re: [cgal-discuss] Suggestions for how to do 2D nearest neighbour search from 3D points?, Sebastien Loriot (GeometryFactory), 04/29/2013
Archive powered by MHonArc 2.6.18.