From f5ef4b00346cce2bdafd2bf08c49303a18723dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 17 Jul 2018 14:08:30 +0200 Subject: [PATCH] add a naive way to intersect two AABB-trees --- AABB_tree/include/CGAL/AABB_traits.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 42540c0a764..827fdd23afd 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -176,6 +176,10 @@ struct AABB_traits_base_2{ /// \addtogroup PkgAABB_tree /// @{ +// forward declaration +template< typename AABBTraits> +class AABB_tree; + /// This traits class handles any type of 3D geometric /// primitives provided that the proper intersection tests 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::get_datum(pr,m_traits)); } + + // intersection with AABB-tree + template + bool operator()(const CGAL::AABB_tree& other_tree, const Primitive& pr) const + { + return other_tree.do_intersect( internal::Primitive_helper::get_datum(pr,m_traits) ); + } + + template + bool operator()(const CGAL::AABB_tree& other_tree, const Bounding_box& bbox) const + { + return other_tree.do_intersect(bbox); + } }; Do_intersect do_intersect_object() const {return Do_intersect(*this);}