add a naive way to intersect two AABB-trees

This commit is contained in:
Sébastien Loriot 2018-07-17 14:08:30 +02:00
parent d2f4e19e36
commit f5ef4b0034
1 changed files with 17 additions and 0 deletions

View File

@ -176,6 +176,10 @@ struct AABB_traits_base_2<GeomTraits,true>{
/// \addtogroup PkgAABB_tree /// \addtogroup PkgAABB_tree
/// @{ /// @{
// forward declaration
template< typename AABBTraits>
class AABB_tree;
/// This traits class handles any type of 3D geometric /// This traits class handles any type of 3D geometric
/// primitives provided that the proper intersection tests and /// primitives provided that the proper intersection tests and
/// constructions are implemented. It handles points, rays, lines and /// constructions are implemented. It handles points, rays, lines and
@ -369,6 +373,19 @@ public:
{ {
return GeomTraits().do_intersect_3_object()(q, internal::Primitive_helper<AT>::get_datum(pr,m_traits)); return GeomTraits().do_intersect_3_object()(q, internal::Primitive_helper<AT>::get_datum(pr,m_traits));
} }
// intersection with AABB-tree
template<typename AABBTraits>
bool operator()(const CGAL::AABB_tree<AABBTraits>& other_tree, const Primitive& pr) const
{
return other_tree.do_intersect( internal::Primitive_helper<AT>::get_datum(pr,m_traits) );
}
template<typename AABBTraits>
bool operator()(const CGAL::AABB_tree<AABBTraits>& other_tree, const Bounding_box& bbox) const
{
return other_tree.do_intersect(bbox);
}
}; };
Do_intersect do_intersect_object() const {return Do_intersect(*this);} Do_intersect do_intersect_object() const {return Do_intersect(*this);}