From 7032b35789c05d9eca78d2c45d43d97bae529e04 Mon Sep 17 00:00:00 2001 From: Pierre Alliez Date: Sat, 26 Jul 2008 20:15:38 +0000 Subject: [PATCH] AABB tree now linked to oracle --- .../demo/Polyhedron/MainWindow_remeshing.cpp | 10 +++++---- .../include/CGAL/Collisions/AABB_node.h | 3 +++ .../CGAL/Collisions/AABB_polyhedral_oracle.h | 21 ++++++++++++++++++- .../include/CGAL/Collisions/AABB_tree.h | 4 ++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp b/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp index 80fe8b4a108..c00137e6181 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow_remeshing.cpp @@ -38,7 +38,7 @@ void MainWindow::on_actionRemeshing_triggered() // AABB tree std::cout << "Build AABB tree..."; - typedef AABB_tree Tree; + typedef CGAL::AABB_tree Tree; Tree tree; tree.build_faces(*pMesh); std::cout << "done" << std::endl; @@ -46,11 +46,13 @@ void MainWindow::on_actionRemeshing_triggered() // input surface typedef CGAL::AABB_polyhedral_oracle Input_surface; + // instantiate surface (linked to the AABB tree) + Input_surface input(&tree); + // remesh - Input_surface input; - //std::cout << "Remesh..."; + std::cout << "Remesh..."; CGAL::make_surface_mesh(c2t3, input, facets_criteria, CGAL::Manifold_tag()); - //std::cout << "done (" << tr.number_of_vertices() << " vertices)" << std::endl; + std::cout << "done (" << tr.number_of_vertices() << " vertices)" << std::endl; // add remesh as new polyhedron Polyhedron *pRemesh = new Polyhedron; diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_node.h b/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_node.h index caa88d5b3d3..067c577defd 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_node.h +++ b/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_node.h @@ -13,6 +13,7 @@ #include "Plucker_ray_3_Bbox_3_do_intersect.h" #include "Sphere_3_Bbox_do_intersect.h" +CGAL_BEGIN_NAMESPACE template class AABB_node @@ -1512,5 +1513,7 @@ public: } }; +CGAL_END_NAMESPACE + #endif // _AABB_NODE_ diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_polyhedral_oracle.h b/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_polyhedral_oracle.h index 95b1c74862d..3d9fe6bd439 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_polyhedral_oracle.h +++ b/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_polyhedral_oracle.h @@ -5,6 +5,8 @@ #include #include +#include "AABB_tree.h" + namespace CGAL { template @@ -17,16 +19,33 @@ public: typedef typename Kernel::Line_3 Line_3; typedef typename Kernel::Point_3 Point_3; typedef typename Kernel::Segment_3 Segment_3; + typedef typename AABB_polyhedral_oracle Self; typedef typename Self Surface_mesher_traits_3; typedef typename Point_3 Intersection_point; -public: + // AABB tree + typedef AABB_tree Tree; + Tree *m_pTree; +public: + Tree* tree() { return m_pTree; } + +public: // Surface constructor AABB_polyhedral_oracle() { + m_pTree = NULL; } + AABB_polyhedral_oracle(Tree *pTree) + { + m_pTree = pTree; + } + AABB_polyhedral_oracle(const AABB_polyhedral_oracle& oracle) + { + m_pTree = oracle.tree(); + } + class Intersect_3; diff --git a/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_tree.h b/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_tree.h index 786b0742d54..e9ddf6a40eb 100644 --- a/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_tree.h +++ b/Polyhedron/demo/Polyhedron/include/CGAL/Collisions/AABB_tree.h @@ -8,6 +8,8 @@ #include "AABB_node.h" #include "knn.h" +CGAL_BEGIN_NAMESPACE + template class AABB_tree { @@ -481,4 +483,6 @@ public: } }; +CGAL_END_NAMESPACE + #endif // _AABB_TREE_