diff --git a/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h b/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h index 4c2c98c12bf..7514f945bae 100644 --- a/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Side_of_triangle_mesh.h @@ -164,7 +164,7 @@ public: * @param tree a \cgal `AABB_tree` with `AABB_face_graph_triangle_primitive` as `Primitive` type * @param gt an instance of the geometric traits class * - * @pre `CGAL::is_closed(tmesh) && CGAL::is_triangle_mesh(tmesh)` + * @pre `tree` contains a set of triangle faces representing a closed surface mesh */ Side_of_triangle_mesh(const AABB_tree& tree, const GeomTraits& gt = GeomTraits()) @@ -181,6 +181,34 @@ public: box = tree.bbox(); } + /** + * Constructor that takes a pre-built \cgal `AABB_tree` + * of the triangulated surface mesh primitives, and moves it. + * + * @param tree a \cgal `AABB_tree` with `AABB_face_graph_triangle_primitive` as `Primitive` type + * @param gt an instance of the geometric traits class + * + * @pre `tree` contains a set of triangle faces representing a closed surface mesh + */ + Side_of_triangle_mesh(AABB_tree&& tree, + const GeomTraits& gt = GeomTraits()) + : ray_functor(gt.construct_ray_3_object()) + , vector_functor(gt.construct_vector_3_object()) + , tm_ptr(nullptr) + , own_tree(true) +#ifdef CGAL_HAS_THREADS + , atomic_tree_ptr(new AABB_tree(std::forward(tree))) +#else + , tree_ptr(new AABB_tree(std::forward(tree))) +#endif + { +#ifdef CGAL_HAS_THREADS + box = atomic_tree_ptr.load()->bbox(); +#else + box = tree_ptr->bbox(); +#endif + } + /** * Constructor moving an instance of `Side_of_triangle_mesh` to a new memory * location with minimal memory copy.