-
Hello, I was wondering if it was possible to conduct a 2D spatial search using projected 3D points? Tried to work my way around with k-d tree using Search_traits_2 and Projection_traits_xy_3 but I couldn't do it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Some types are missing in Something like the following for the map: template<class K>
struct Projection_xy_property_map
{
typedef typename K::Point_3 key_type;
typedef typename K::Point_2 value_type;
typedef value_type reference;
typedef boost::readable_property_map_tag category;
friend value_type get(Projection_xy_property_map<K>, const key_type& k)
{
return value_type(k.x(), k.y());
}
}; and the following typedefs: typedef CGAL::Search_traits_2<Kernel>Traits_base;
typedef CGAL::Search_traits_adapter<Kernel::Point_3,Projection_xy_property_map<Kernel>,Traits_base> Traits; Then you can adapt this example with the aforementioned types. |
Beta Was this translation helpful? Give feedback.
-
@sloriot shall we nevertheless make it a feature request issue to enrich the projection traits class, or is there a fundamental problem? |
Beta Was this translation helpful? Give feedback.
Some types are missing in
Projection_traits_xy_3
so it's not a model ofSearchGeomTraits_2
. I think an easy option is to use theSearch_traits_adaptor
with a property map doing the projection on the fly.Something like the following for the map:
and the following typedefs: