diff --git a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h index e8393e20e55..5a386ef5d99 100644 --- a/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h +++ b/Mesh_3/include/CGAL/Compact_mesh_cell_base_3.h @@ -52,6 +52,7 @@ template class Compact_mesh_cell_base_3_base { typedef typename GT::Point_3 Point; + typedef typename GT::Weighted_point_3 Weighted_point; protected: Compact_mesh_cell_base_3_base() @@ -238,6 +239,8 @@ public: typedef GT Geom_traits; typedef typename GT::Point_3 Point; + typedef typename GT::Weighted_point_3 Weighted_point_3; + typedef Point* Point_container; typedef Point* Point_iterator; @@ -444,6 +447,7 @@ public: Point_iterator hidden_points_begin() const { return hidden_points_end(); } Point_iterator hidden_points_end() const { return NULL; } void hide_point (const Point &) const { } + void hide_point (const Weighted_point_3 &) const { } // We must override the functions that modify the vertices. diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index 6b3f73f86db..2fe59a9595f 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -638,6 +638,8 @@ class C3T3_helpers typedef typename Gt::FT FT; typedef typename Gt::Tetrahedron_3 Tetrahedron; + typedef typename Gt::Construct_point_3 Construct_point_3; + typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Cell Cell; @@ -711,7 +713,9 @@ public: : Base(lock_ds) , c3t3_(c3t3) , tr_(c3t3.triangulation()) - , domain_(domain) { } + , domain_(domain) + , wp2p_(tr_.geom_traits().construct_point_3_object()) + { } /** * @brief tries to move \c old_vertex to \c new_position in the mesh @@ -2393,6 +2397,7 @@ private: C3T3& c3t3_; Tr& tr_; const MeshDomain& domain_; + Construct_point_3 wp2p_; }; // class C3T3_helpers @@ -2449,7 +2454,6 @@ update_mesh_no_topo_change(const Point_3& new_position, // << new_position << ",\n" // << " " << (void*)(&*old_vertex) << "=" << old_vertex->point() // << ")\n"; - //backup metadata std::set cells_backup; fill_cells_backup(conflict_cells, cells_backup); @@ -2457,7 +2461,7 @@ update_mesh_no_topo_change(const Point_3& new_position, // Get old values criterion.before_move(c3t3_cells(conflict_cells)); // std::cerr << "old_sliver_value=" << old_sliver_value << std::endl; - Point_3 old_position = old_vertex->point(); + Point_3 old_position = wp2p_(old_vertex->point()); // Move point reset_circumcenter_cache(conflict_cells); @@ -2510,6 +2514,8 @@ update_mesh_topo_change(const Point_3& new_position, // << " " << (void*)(&*old_vertex) << "=" << old_vertex->point() // << ")\n"; // check_c3t3(c3t3_); + + Cell_set insertion_conflict_cells; Cell_set removal_conflict_cells; Facet_vector insertion_conflict_boundary; @@ -2539,7 +2545,7 @@ update_mesh_topo_change(const Point_3& new_position, criterion.before_move(c3t3_cells(conflict_cells)); // std::cerr << "old_sliver_value=" << old_sliver_value << std::endl; - Point_3 old_position = old_vertex->point(); + Point_3 old_position = wp2p_(old_vertex->point()); // Keep old boundary Vertex_set old_incident_surface_vertices; @@ -2740,6 +2746,8 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells, CGAL_HISTOGRAM_PROFILER("|vertex_to_proj|=", static_cast(vertex_to_proj.size())); + + // Project interior vertices // Note: ~0% of rebuild_restricted_delaunay time // TODO : iterate to be sure no interior vertice become on the surface @@ -2748,7 +2756,7 @@ rebuild_restricted_delaunay(OutdatedCells& outdated_cells, it != vertex_to_proj.end() ; ++it ) { - Point_3 new_pos = project_on_surface((*it)->point(),*it); + Point_3 new_pos = project_on_surface(wp2p_((*it)->point()),*it); if ( ! equal(new_pos, Point_3()) ) { @@ -3140,7 +3148,7 @@ move_point_topo_change_conflict_zone_known( //o.w. deleted_cells will point to null pointer or so and crash const { - Point_3 old_position = old_vertex->point(); + Point_3 old_position = wp2p_(old_vertex->point()); // make one set with conflict zone Cell_set conflict_zone; std::set_union(insertion_conflict_cells_begin, insertion_conflict_cells_end, @@ -3353,7 +3361,7 @@ get_least_square_surface_plane(const Vertex_handle& v, const Cell_handle& cell = fit->first; const int& i = fit->second; - surface_point_vector.push_back(cell->get_facet_surface_center(i)); + surface_point_vector.push_back(wp2p_(cell->get_facet_surface_center(i))); } } @@ -3396,9 +3404,9 @@ project_on_surface(const Point_3& p, return p; // Project - if ( ! equal(p, v->point()) ) + if ( ! equal(p, wp2p_(v->point())) ) return project_on_surface_aux(p, - v->point(), + wp2p_(v->point()), plane.orthogonal_vector()); else return project_on_surface_aux(p, diff --git a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h index 40e4d3b7814..dd1d8637db6 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h +++ b/Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h @@ -118,7 +118,7 @@ private: { Project_on_plane(const Plane_3& plane) : plane_(plane) {} - Point_3 operator()(const Point_3& p) const + Bare_point_3 operator()(const Bare_point_3& p) const { return Gt().construct_projected_point_3_object()(plane_,p); } private: @@ -133,7 +133,7 @@ private: To_2d(const Aff_transformation_3& to_2d) : to_2d_(to_2d) {} Point_2 operator()(const Point_3& p) const - { return Point_2(to_2d_.transform(p).x(), to_2d_.transform(p).y()); } + { return Point_2(to_2d_.transform(p.point()).x(), to_2d_.transform(p.point()).y()); } private: const Aff_transformation_3& to_2d_; @@ -147,7 +147,7 @@ private: To_3d(const Aff_transformation_3& to_3d) : to_3d_(to_3d) {} Point_3 operator()(const Point_2& p) const - { return to_3d_.transform(Point_3(Bare_point_3(p.x(),p.y(),0))); } + { return to_3d_.transform((Bare_point_3(p.x(),p.y(),0))); } private: const Aff_transformation_3& to_3d_; @@ -209,7 +209,7 @@ private: CGAL_precondition(c3t3.in_dimension(v) == 2); // get all surface delaunay ball point - std::vector points = extract_lloyd_boundary_points(v,c3t3); + std::vector points = extract_lloyd_boundary_points(v,c3t3); switch(points.size()) { @@ -246,14 +246,14 @@ private: * Returns a vector containing surface delaunay ball center of surface * facets incident to vertex \c v */ - std::vector extract_lloyd_boundary_points(const Vertex_handle& v, - const C3T3& c3t3) const + std::vector extract_lloyd_boundary_points(const Vertex_handle& v, + const C3T3& c3t3) const { Facet_vector incident_facets; incident_facets.reserve(64); c3t3.triangulation().finite_incident_facets(v,std::back_inserter(incident_facets)); - std::vector points; + std::vector points; points.reserve(64); // Get c3t3's facets incident to v, and add their surface delaunay ball @@ -328,7 +328,7 @@ private: // Fit plane using point-based PCA: compute least square fitting plane Plane_3 plane; - Point_3 point; + Bare_point_3 point; CGAL::linear_least_squares_fitting_3(first,last,plane, point, Dimension_tag<0>(), Gt(),Default_diagonalize_traits()); // Project all points to the plane diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h index a996035017e..73dab9381bb 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesh_global_optimizer.h @@ -224,7 +224,8 @@ class Mesh_global_optimizer typedef typename C3T3::Triangulation Tr; typedef typename Tr::Geom_traits Gt; - typedef typename Tr::Point Point_3; + typedef typename Gt::Point_3 Point_3; + typedef typename Gt::Weighted_point_3 Weighted_point_3; typedef typename Tr::Cell_handle Cell_handle; typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Edge Edge; @@ -344,6 +345,7 @@ private: else #endif // CGAL_LINKED_WITH_TBB { + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); // Get move for each moving vertex typename Moving_vertices_set::iterator vit = moving_vertices.begin(); for ( ; vit != moving_vertices.end() ; ) @@ -354,7 +356,7 @@ private: if ( CGAL::NULL_VECTOR != move ) { - Point_3 new_position = translate(oldv->point(),move); + Point_3 new_position = translate(wp2p(oldv->point()),move); FT size = (Sizing_field::is_vertex_update_needed ? sizing_field_(new_position, oldv) : 0); moves.push_back(cpp11::make_tuple(oldv,new_position,size)); @@ -477,10 +479,10 @@ private: void operator()(const Vertex_handle& oldv) const { Vector_3 move = m_mgo.compute_move(oldv); - + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); if ( CGAL::NULL_VECTOR != move ) { - Point_3 new_position = m_translate(oldv->point(), move); + Point_3 new_position = m_translate(wp2p(oldv->point()), move); FT size = (MGO::Sizing_field::is_vertex_update_needed ? m_sizing_field(new_position, oldv) : 0); // typedef Triangulation_helpers Th; @@ -508,6 +510,7 @@ private: { MGO & m_mgo; Local_list_ & m_local_lists; + typename Tr_::Geom_traits::Construct_point_3 wp2p; public: // Constructor @@ -529,7 +532,7 @@ private: Vertex_handle vh = Tr_::Triangulation_data_structure::Vertex_range::s_iterator_to(v); m_local_lists.local().push_back( - std::make_pair(v.point(), m_mgo.average_circumradius_length(vh))); + std::make_pair(wp2p(v.point()), m_mgo.average_circumradius_length(vh))); } }; @@ -544,8 +547,8 @@ private: Moving_vertices_set_ & m_moving_vertices; Outdated_cell_set_ & m_outdated_cells; - typedef typename Tr_::Point Point_3; - typedef typename Tr_::Vertex_handle Vertex_handle; + typedef typename Tr_::Geom_traits::Point_3 Point_3; + typedef typename Tr_::Vertex_handle Vertex_handle; public: // Constructor @@ -566,10 +569,12 @@ private: // operator() void operator()( const tbb::blocked_range& r ) const { + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); + for( size_t i = r.begin() ; i != r.end() ; ++i) { const Vertex_handle& v = cpp11::get<0>(m_moves[i]); - const Point_3& new_position = cpp11::get<1>(m_moves[i]); + const Point_3& new_position = wp2p(cpp11::get<1>(m_moves[i])); // Get size at new position if ( MGO::Sizing_field::is_vertex_update_needed ) { @@ -846,6 +851,9 @@ compute_move(const Vertex_handle& v) typename Gt::Construct_translated_point_3 translate = Gt().construct_translated_point_3_object(); + typename Gt::Construct_point_3 wp2p = + Gt().construct_point_3_object(); + Cell_vector incident_cells; incident_cells.reserve(64); #ifdef CGAL_LINKED_WITH_TBB @@ -866,8 +874,8 @@ compute_move(const Vertex_handle& v) // Project surface vertex if ( c3t3_.in_dimension(v) == 2 ) { - Point_3 new_position = translate(v->point(),move); - move = vector(v->point(), helper_.project_on_surface(new_position,v)); + Point_3 new_position = translate(wp2p(v->point()),move); + move = vector(wp2p(v->point()), helper_.project_on_surface(wp2p(new_position),v)); } FT local_sq_size = min_circumradius_sq_length(v, incident_cells); @@ -926,8 +934,10 @@ update_mesh(const Moves_vector& moves, it != moves.end() ; ++it ) { + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); + const Vertex_handle& v = cpp11::get<0>(*it); - const Point_3& new_position = cpp11::get<1>(*it); + const Point_3& new_position = wp2p(cpp11::get<1>(*it)); // Get size at new position if ( Sizing_field::is_vertex_update_needed ) { @@ -992,7 +1002,7 @@ void Mesh_global_optimizer:: fill_sizing_field() { - std::map value_map; + std::map value_map; #ifdef CGAL_LINKED_WITH_TBB // Parallel diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index 94ae610290a..6de90fb577f 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -147,6 +147,7 @@ public: #endif typedef typename C3T3::Triangulation Triangulation; typedef typename Triangulation::Point Point; + typedef typename Triangulation::Bare_point Bare_point; typedef typename Kernel_traits::Kernel Kernel; typedef typename Kernel::Vector_3 Vector; typedef typename MeshDomain::Index Index; @@ -549,7 +550,7 @@ initialize() # ifdef CGAL_CONCURRENT_MESH_3_VERBOSE std::cerr << "Adding points on a far sphere (radius = " << radius <<")..."; # endif - Random_points_on_sphere_3 random_point(radius); + Random_points_on_sphere_3 random_point(radius); const int NUM_PSEUDO_INFINITE_VERTICES = static_cast( float(tbb::task_scheduler_init::default_num_threads()) * Concurrent_mesher_config::get().num_pseudo_infinite_vertices_per_core); diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 270f283ecc6..266cab7fcab 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -113,8 +113,8 @@ public: typedef typename C3T3::Triangulation Tr; typedef typename Tr::Geom_traits Gt; typedef typename Gt::FT FT; - typedef typename Gt::Point_3 Weighted_point; - typedef typename Weighted_point::Point Bare_point; + typedef typename Gt::Weighted_point_3 Weighted_point; + typedef typename Gt::Point_3 Bare_point; typedef typename Weighted_point::Weight Weight; typedef typename C3T3::Cell_handle Cell_handle; diff --git a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h index 59d7dd95de8..94bd0e7a041 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Refine_facets_3.h @@ -427,8 +427,8 @@ protected: { const Facet mirror = mirror_facet(f); - f.first->set_facet_surface_center(f.second, p); - mirror.first->set_facet_surface_center(mirror.second, p); + f.first->set_facet_surface_center(f.second, p.point()); + mirror.first->set_facet_surface_center(mirror.second, p.point()); f.first->set_facet_surface_center_index(f.second,index); mirror.first->set_facet_surface_center_index(mirror.second,index); @@ -1826,7 +1826,7 @@ is_facet_encroached(const Facet& facet, // facet is encroached if the new point is near from center than // one vertex of the facet - return ( compare_distance(center, reference_point, point) != CGAL::SMALLER ); + return ( compare_distance(center.point(), reference_point, point) != CGAL::SMALLER ); } template @@ -1834,7 +1834,7 @@ bool Refine_facets_3_base:: is_encroached_facet_refinable(Facet& facet) const { - typedef typename Gt::Point_3 Point_3; + typedef typename Gt::Weighted_point_3 Weighted_point_3; typedef typename Gt::FT FT; typename Gt::Compute_squared_radius_smallest_orthogonal_sphere_3 sq_radius = @@ -1843,6 +1843,8 @@ is_encroached_facet_refinable(Facet& facet) const typename Gt::Compare_weighted_squared_radius_3 compare = Gt().compare_weighted_squared_radius_3_object(); + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); + const Cell_handle& c = facet.first; const int& k = facet.second; @@ -1871,9 +1873,9 @@ is_encroached_facet_refinable(Facet& facet) const ++wp_nb; } - const Point_3& p1 = c->vertex(k1)->point(); - const Point_3& p2 = c->vertex(k2)->point(); - const Point_3& p3 = c->vertex(k3)->point(); + const Weighted_point_3& p1 = c->vertex(k1)->point(); + const Weighted_point_3& p2 = c->vertex(k2)->point(); + const Weighted_point_3& p3 = c->vertex(k3)->point(); const FT min_ratio (0.16); // (0.2*2)^2 diff --git a/Mesh_3/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h b/Mesh_3/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h index d4a17f44f0c..6802555f7bd 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Robust_weighted_circumcenter_filtered_traits_3.h @@ -34,7 +34,6 @@ #include #include #include -#include #include namespace CGAL { @@ -49,6 +48,7 @@ public: typedef Cartesian_converter Back_from_exact; typedef typename K::Point_3 Point_3; + typedef typename K::Weighted_point_3 Weighted_point_3; typedef typename K::FT FT; typedef FT result_type; @@ -85,6 +85,14 @@ public: } #endif // CGAL_CFG_MATCHING_BUG_6 + FT operator()( const Weighted_point_3 & p, + const Weighted_point_3 & q, + const Weighted_point_3 & r, + const Weighted_point_3 & s ) const + { + return this->operator()(p.point(), q.point(), r.point(), s.point()); + } + FT operator() ( const Point_3 & p, const Point_3 & q, const Point_3 & r, @@ -155,15 +163,17 @@ public: typedef Cartesian_converter To_exact; typedef Cartesian_converter Back_from_exact; - typedef CGAL::Regular_triangulation_euclidean_traits_3 Rt; - typedef CGAL::Regular_triangulation_euclidean_traits_3 Exact_Rt; + typedef K_ Rt; + typedef EK Exact_Rt; typedef typename Rt::Weighted_point_3 Weighted_point_3; - typedef typename Rt::Bare_point Bare_point; + typedef typename Rt::Point_3 Bare_point; typedef typename Rt::FT FT; typedef typename Rt::Sphere_3 Sphere_3; typedef Bare_point result_type; + + typename Rt::Construct_point_3 wp2p = Rt().construct_point_3_object(); Bare_point operator() ( const Weighted_point_3 & p, const Weighted_point_3 & q, @@ -171,7 +181,7 @@ public: const Weighted_point_3 & s, bool force_exact = false) const { - CGAL_precondition(Rt().orientation_3_object()(p,q,r,s) == CGAL::POSITIVE); + CGAL_precondition(Rt().orientation_3_object()(p.point(),q.point(),r.point(),s.point()) == CGAL::POSITIVE); // We use power_side_of_power_sphere_3: it is static filtered and // we know that p,q,r,s are positive oriented @@ -225,7 +235,9 @@ public: const Weighted_point_3 & q, const Weighted_point_3 & r ) const { - CGAL_precondition(! Rt().collinear_3_object()(p,q,r) ); + CGAL_precondition(! Rt().collinear_3_object()(wp2p(p), + wp2p(q), + wp2p(r)) ); typename Rt::Side_of_bounded_sphere_3 side_of_bounded_sphere = Rt().side_of_bounded_sphere_3_object(); @@ -243,7 +255,7 @@ public: Bare_point res(p.x() + num_x*inv, p.y() - num_y*inv, p.z() + num_z*inv); // Fast output - if ( side_of_bounded_sphere(p,q,r,res) == CGAL::ON_BOUNDED_SIDE ) + if ( side_of_bounded_sphere(wp2p(p),wp2p(q),wp2p(r),res) == CGAL::ON_BOUNDED_SIDE ) return res; } @@ -271,7 +283,7 @@ public: result_type point = weighted_circumcenter(p,q); // Fast output - if ( side_of_bounded_sphere(p,q,point) == CGAL::ON_BOUNDED_SIDE ) + if ( side_of_bounded_sphere(p.point(),q.point(),point) == CGAL::ON_BOUNDED_SIDE ) return point; // Switch to exact @@ -295,8 +307,8 @@ public: typedef Cartesian_converter To_exact; typedef Cartesian_converter Back_from_exact; - typedef CGAL::Regular_triangulation_euclidean_traits_3 Rt; - typedef CGAL::Regular_triangulation_euclidean_traits_3 Exact_Rt; + typedef K_ Rt; + typedef EK Exact_Rt; typedef typename Rt::Weighted_point_3 Weighted_point_3; typedef typename Rt::FT FT; @@ -402,8 +414,9 @@ public: */ template struct Robust_weighted_circumcenter_filtered_traits_3 -: public CGAL::Regular_triangulation_euclidean_traits_3 +: public K_ { + typedef typename K_::Point_3 Bare_point; typedef CGAL::Robust_filtered_construct_weighted_circumcenter_3 Construct_weighted_circumcenter_3; diff --git a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h index 8383057a5be..e8e4e467908 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h +++ b/Mesh_3/include/CGAL/Mesh_3/Sliver_perturber.h @@ -482,6 +482,7 @@ class Sliver_perturber typedef typename Base::Bad_vertices_vector Bad_vertices_vector; typedef typename Gt::FT FT; + typedef typename Gt::Construct_point_3 Construct_point_3; // Helper typedef class C3T3_helpers C3T3_helpers; @@ -744,6 +745,7 @@ private: SliverCriterion sliver_criterion_; Perturbation_vector perturbation_vector_; C3T3_helpers helper_; + Construct_point_3 wp2p; // Internal perturbation ordering int next_perturbation_order_; @@ -771,6 +773,7 @@ Sliver_perturber(C3T3& c3t3, , domain_(domain) , sliver_criterion_(criterion) , helper_(c3t3_,domain_,get_lock_data_structure()) + , wp2p(c3t3_.triangulation().geom_traits().construct_point_3_object()) , next_perturbation_order_(0) , time_limit_(-1) , running_time_() @@ -1308,8 +1311,8 @@ perturb_vertex( PVertex pv return; } - Point_3 p = pv.vertex()->point(); - if (!helper_.try_lock_point_no_spin(p) || ! Gt().equal_3_object()(p,pv.vertex()->point())) + Point_3 p = wp2p(pv.vertex()->point()); + if (!helper_.try_lock_point_no_spin(p) || ! Gt().equal_3_object()(p,wp2p(pv.vertex()->point()))) { #ifdef CGAL_CONCURRENT_MESH_3_PROFILING bcounter.increment_branch_2(); // THIS is an early withdrawal! diff --git a/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h b/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h index 357a80b8c25..260cfabd53a 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h +++ b/Mesh_3/include/CGAL/Mesh_3/Slivers_exuder.h @@ -1124,7 +1124,7 @@ pump_vertex(const Vertex_handle& pumped_vertex, // If best_weight < pumped_vertex weight, nothing to do if ( best_weight > pumped_vertex->point().weight() ) { - Weighted_point wp(pumped_vertex->point(), best_weight); + Weighted_point wp(pumped_vertex->point().point(), best_weight); // Insert weighted point into mesh // note it can fail if the mesh is non-manifold at pumped_vertex @@ -1272,10 +1272,11 @@ expand_prestar(const Cell_handle& cell_to_add, // Update ratio (ratio is needed for cells of complex only) if ( c3t3_.is_in_complex(cell_to_add) ) { - Tetrahedron_3 tet(pumped_vertex->point(), - cell_to_add->vertex((i+1)&3)->point(), - cell_to_add->vertex((i+2)&3)->point(), - cell_to_add->vertex((i+3)&3)->point()); + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); + Tetrahedron_3 tet(wp2p(pumped_vertex->point()), + wp2p(cell_to_add->vertex((i+1)&3)->point()), + wp2p(cell_to_add->vertex((i+2)&3)->point()), + wp2p(cell_to_add->vertex((i+3)&3)->point())); double new_value = sliver_criteria_(tet); criterion_values.insert(std::make_pair(current_facet,new_value)); @@ -1787,6 +1788,8 @@ check_ratios(const Sliver_values& criterion_values, Facet_vector internal_facets; Facet_vector boundary_facets; + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); + tr_.find_conflicts(wp, vh->cell(), std::back_inserter(boundary_facets), @@ -1812,10 +1815,10 @@ check_ratios(const Sliver_values& criterion_values, continue; int k = it->second; - Tetrahedron_3 tet(vh->point(), - it->first->vertex((k+1)&3)->point(), - it->first->vertex((k+2)&3)->point(), - it->first->vertex((k+3)&3)->point()); + Tetrahedron_3 tet(wp2p(vh->point()), + wp2p(it->first->vertex((k+1)&3)->point()), + wp2p(it->first->vertex((k+2)&3)->point()), + wp2p(it->first->vertex((k+3)&3)->point())); double ratio = sliver_criteria_(tet); expected_ratios.push_back(ratio); diff --git a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h index 96023fa6337..db029ae1503 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/Triangulation_helpers.h @@ -71,7 +71,7 @@ class Triangulation_helpers const Point_3& operator()(const Vertex_handle &vh) const { - return (vh == m_vh ? m_p : vh->point()); + return (vh == m_vh ? m_p : vh->point().point()); // AF: Can this be NOT a weighted point? } private: @@ -156,8 +156,9 @@ no_topological_change(const Tr& tr, const Point_3& p, Cell_vector& cells_tos) const { + Tr::Geom_traits::Construct_point_3 wp2p = tr.geom_traits().construct_point_3_object(); bool np = true; - Point_3 fp = v0->point(); + Point_3 fp = wp2p(v0->point()); v0->set_point(p); if(!well_oriented(tr, cells_tos)) @@ -358,6 +359,7 @@ well_oriented(const Tr& tr, { typedef typename Tr::Geom_traits Gt; typename Gt::Orientation_3 orientation = tr.geom_traits().orientation_3_object(); + typename Cell_vector::const_iterator it = cells_tos.begin(); for( ; it != cells_tos.end() ; ++it) { diff --git a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h index c71bcb1daea..11b876a5c04 100644 --- a/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h +++ b/Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h @@ -125,7 +125,6 @@ protected: const Point_3& p3 = f.first->vertex((f.second+3)&3)->point(); const FT triangle_area = area(triangle(p1,p2,p3)); - const FT d12 = distance(p1,p2); const FT d13 = distance(p1,p3); const FT d23 = distance(p2,p3); @@ -285,7 +284,7 @@ protected: const Index& index = f.first->get_facet_surface_center_index(f.second); - const FT sq_bound = CGAL::square(size_(ball_center, 2, index)); + const FT sq_bound = CGAL::square(size_(ball_center.point(), 2, index)); CGAL_assertion(sq_bound > FT(0)); if ( sq_dist > sq_bound ) @@ -361,7 +360,7 @@ protected: const Index& index = f.first->get_facet_surface_center_index(f.second); const FT sq_radius = distance(p1,ball_center); - const FT sq_bound = CGAL::square(size_(ball_center, 2, index)); + const FT sq_bound = CGAL::square(size_(ball_center.point(), 2, index)); CGAL_assertion(sq_bound > FT(0)); if ( sq_radius > sq_bound ) diff --git a/Mesh_3/include/CGAL/Mesh_3/min_dihedral_angle.h b/Mesh_3/include/CGAL/Mesh_3/min_dihedral_angle.h index f34039a046d..96b6ed01b88 100644 --- a/Mesh_3/include/CGAL/Mesh_3/min_dihedral_angle.h +++ b/Mesh_3/include/CGAL/Mesh_3/min_dihedral_angle.h @@ -96,6 +96,9 @@ minimum_dihedral_angle( { typedef typename K::FT FT; + typename K::Construct_point_3 wp2p = + k.construct_point_3_object(); + typename K::Compute_determinant_3 determinant = k.compute_determinant_3_object(); typename K::Construct_cross_product_vector_3 cp = diff --git a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h index 0731e669b81..fc2c2fbbff8 100644 --- a/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h +++ b/Mesh_3/include/CGAL/Mesh_3/vertex_perturbation.h @@ -123,13 +123,13 @@ namespace Mesh_3 { edge_sq_length(const typename Tr::Edge& e) { typedef typename Tr::Geom_traits Gt; - typedef typename Gt::Point_3 Point_3; + typedef typename Gt::Weighted_point_3 Weighted_point_3; typename Gt::Compute_squared_distance_3 sq_distance = Gt().compute_squared_distance_3_object(); - const Point_3& p = e.first->vertex(e.second)->point(); - const Point_3& q = e.first->vertex(e.third)->point(); + const Weighted_point_3& p = e.first->vertex(e.second)->point(); + const Weighted_point_3& q = e.first->vertex(e.third)->point(); return sq_distance(p,q); } @@ -453,6 +453,9 @@ protected: typename Gt::Construct_translated_point_3 translate = Gt().construct_translated_point_3_object(); + typename Gt::Construct_point_3 wp2p = + Gt().construct_point_3_object(); + // create a helper typedef C3T3_helpers C3T3_helpers; C3T3_helpers helper(c3t3, domain); @@ -462,7 +465,7 @@ protected: // norm depends on the local size of the mesh FT sq_norm = this->compute_perturbation_sq_amplitude(v, c3t3, sq_step_size_); FT step_length = CGAL::sqrt(sq_norm/sq_length(gradient_vector)); - Point_3 new_loc = translate(v->point(), step_length * gradient_vector); + Point_3 new_loc = translate(wp2p(v->point()), step_length * gradient_vector); Point_3 final_loc = new_loc; if ( c3t3.in_dimension(v) < 3 ) @@ -633,13 +636,15 @@ private: typedef typename C3T3::Triangulation::Geom_traits Gt; typename Gt::Construct_translated_point_3 translate = Gt().construct_translated_point_3_object(); + typename Gt::Construct_point_3 wp2p = + Gt().construct_point_3_object(); // translate the tet so that cell->vertex((i+3)&3) is 0_{R^3} unsigned int index = cell->index(v); - Vector_3 translate_to_origin(CGAL::ORIGIN, cell->vertex((index+3)&3)->point()); //p4 - const Point_3& p1 = translate(v->point(), - translate_to_origin); - const Point_3& p2 = translate(cell->vertex((index+1)&3)->point(), - translate_to_origin); - const Point_3& p3 = translate(cell->vertex((index+2)&3)->point(), - translate_to_origin); + Vector_3 translate_to_origin(CGAL::ORIGIN, wp2p(cell->vertex((index+3)&3)->point())); //p4 + const Point_3& p1 = translate(wp2p(v->point()), - translate_to_origin); + const Point_3& p2 = translate(wp2p(cell->vertex((index+1)&3)->point()), - translate_to_origin); + const Point_3& p3 = translate(wp2p(cell->vertex((index+2)&3)->point()), - translate_to_origin); // pre-compute everything FT sq_p1 = p1.x()*p1.x() + p1.y()*p1.y() + p1.z()*p1.z(); @@ -794,7 +799,7 @@ private: const Vertex_handle& v) const { CGAL_assertion(cell->has_vertex(v)); - + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); const int i = cell->index(v); // fixed vertices: (the ones with index != i) @@ -805,9 +810,9 @@ private: if ( (i&1) == 0 ) std::swap(k1,k3); - const Point_3& p1 = cell->vertex(k1)->point(); - const Point_3& p2 = cell->vertex(k2)->point(); - const Point_3& p3 = cell->vertex(k3)->point(); + const Point_3& p1 = wp2p(cell->vertex(k1)->point()); + const Point_3& p2 = wp2p(cell->vertex(k2)->point()); + const Point_3& p3 = wp2p(cell->vertex(k3)->point()); FT gx = p2.y()*p3.z() + p1.y()*(p2.z()-p3.z()) - p3.y()*p2.z() - p1.z()*(p2.y()-p3.y()); @@ -937,8 +942,10 @@ private: { CGAL_assertion(cell->has_vertex(v)); + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); + const int i = cell->index(v); - const Point_3& p0 = v->point(); + const Point_3& p0 = wp2p(v->point()); // Other indices int k1 = (i+1)&3; @@ -957,9 +964,9 @@ private: std::swap(k2,k3); // Here edge k1k2 minimizes dihedral angle - const Point_3& p1 = cell->vertex(k1)->point(); - const Point_3& p2 = cell->vertex(k2)->point(); - const Point_3& p3 = cell->vertex(k3)->point(); + const Point_3& p1 = wp2p(cell->vertex(k1)->point()); + const Point_3& p2 = wp2p(cell->vertex(k2)->point()); + const Point_3& p3 = wp2p(cell->vertex(k3)->point()); // grad of min dihedral angle (in cell) wrt p0 const Vector_3 p1p0 (p1,p0); @@ -992,10 +999,12 @@ private: { typename Gt::Compute_approximate_dihedral_angle_3 approx_dihedral_angle = Gt().compute_approximate_dihedral_angle_3_object(); - return CGAL::abs(approx_dihedral_angle(p, - cell->vertex(k1)->point(), - cell->vertex(k2)->point(), - cell->vertex(k3)->point())); + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); + + return CGAL::abs(approx_dihedral_angle(wp2p(p), + wp2p(cell->vertex(k1)->point()), + wp2p(cell->vertex(k2)->point()), + wp2p(cell->vertex(k3)->point()))); } /** @@ -1012,6 +1021,7 @@ private: */ Vector_3 normal_estimate(const Cell_handle& ch, const int i) const { + typename Gt::Construct_point_3 wp2p = Gt().construct_point_3_object(); int k1 = (i+1)&3; int k2 = (i+2)&3; int k3 = (i+3)&3; @@ -1020,9 +1030,9 @@ private: if ( (i&1) == 1 ) std::swap(k1,k2); - const Point_3& p1 = ch->vertex(k1)->point(); - const Point_3& p2 = ch->vertex(k2)->point(); - const Point_3& p3 = ch->vertex(k3)->point(); + const Point_3& p1 = wp2p(ch->vertex(k1)->point()); + const Point_3& p2 = wp2p(ch->vertex(k2)->point()); + const Point_3& p3 = wp2p(ch->vertex(k3)->point()); // compute normal and return it Construct_point_3 cp; @@ -1252,7 +1262,7 @@ private: // norm depends on the local size of the mesh FT sq_norm = this->compute_perturbation_sq_amplitude(v, c3t3, this->sphere_sq_radius()); - const Point_3 initial_location = v->point(); + const Point_3 initial_location = v->point().point(); // Initialize loop variables bool criterion_improved = false; @@ -1295,7 +1305,7 @@ private: if ( update.first ) { criterion_improved = true; - best_location = moving_vertex->point(); + best_location = moving_vertex->point().point(); mod_vertices.insert(tmp_mod_vertices.begin(), tmp_mod_vertices.end()); diff --git a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h index 9661194be06..c3ee8219589 100644 --- a/Mesh_3/include/CGAL/Mesh_vertex_base_3.h +++ b/Mesh_3/include/CGAL/Mesh_vertex_base_3.h @@ -32,7 +32,7 @@ #include -#include +#include #include #include #include @@ -102,7 +102,7 @@ protected: // to the 3D input complex. template > + class Vb = Regular_triangulation_vertex_base_3 > class Mesh_vertex_base_3 : public Vb, public Mesh_vertex_base_3_base< diff --git a/Mesh_3/test/Mesh_3/test_mesh_criteria_creation.cpp b/Mesh_3/test/Mesh_3/test_mesh_criteria_creation.cpp index 2c4aa6e26fb..3a270218f33 100644 --- a/Mesh_3/test/Mesh_3/test_mesh_criteria_creation.cpp +++ b/Mesh_3/test/Mesh_3/test_mesh_criteria_creation.cpp @@ -48,7 +48,7 @@ int main() ch->set_subdomain_index(sub_index); // Init facet - Tr::Point facet_circum = + Tr::Bare_point facet_circum = tr.geom_traits().construct_weighted_circumcenter_3_object()( ch->vertex(k+1)->point(), ch->vertex(k+2)->point(), ch->vertex(k+3)->point()); @@ -71,35 +71,35 @@ int main() // Test edge criteria // ----------------------------------- Mc ec1(edge_size = 1); - assert( ec1.edge_criteria_object().sizing_field(p1,1,index) == 1 ); + assert( ec1.edge_criteria_object().sizing_field(p1.point(),1,index) == 1 ); Mc ec2(edge_sizing_field = Esf(2)); - assert( ec2.edge_criteria_object().sizing_field(p1,1,index) == 2 ); + assert( ec2.edge_criteria_object().sizing_field(p1.point(),1,index) == 2 ); Mc ec3(edge_sizing_field = 3.); - assert( ec3.edge_criteria_object().sizing_field(p1,1,index) == 3 ); + assert( ec3.edge_criteria_object().sizing_field(p1.point(),1,index) == 3 ); Mc ec4(edge_size = 4.1, edge_sizing_field = Esf(4.2)); - assert( ec4.edge_criteria_object().sizing_field(p1,1,index) == 4.1 ); + assert( ec4.edge_criteria_object().sizing_field(p1.point(),1,index) == 4.1 ); Mc ec5(sizing_field = 5.); - assert( ec5.edge_criteria_object().sizing_field(p1,1,index) == 5 ); + assert( ec5.edge_criteria_object().sizing_field(p1.point(),1,index) == 5 ); Mc ec6(sizing_field = 6.1, edge_sizing_field = 6.2); - assert( ec6.edge_criteria_object().sizing_field(p1,1,index) == 6.2 ); + assert( ec6.edge_criteria_object().sizing_field(p1.point(),1,index) == 6.2 ); Mc ec7(sizing_field = 7.1, edge_size = 7.2); - assert( ec7.edge_criteria_object().sizing_field(p1,1,index) == 7.2 ); + assert( ec7.edge_criteria_object().sizing_field(p1.point(),1,index) == 7.2 ); // ----------------------------------- // Test facet criteria // ----------------------------------- typedef Tr::Geom_traits::FT FT; - Tr::Geom_traits::Compute_squared_radius_3 squared_radius; + Tr::Geom_traits::Compute_squared_radius_3 squared_radius = tr.geom_traits().compute_squared_radius_3_object(); FT radius_facet = CGAL::sqrt(squared_radius(ch->vertex(k+1)->point(), ch->vertex(k+2)->point(), ch->vertex(k+3)->point())); diff --git a/Triangulation_3/include/CGAL/Regular_traits_adaptor.h b/Triangulation_3/include/CGAL/Regular_traits_adaptor.h index fd4c5f523b6..190ecaca14b 100644 --- a/Triangulation_3/include/CGAL/Regular_traits_adaptor.h +++ b/Triangulation_3/include/CGAL/Regular_traits_adaptor.h @@ -27,6 +27,10 @@ #include +#include +#include +#include + namespace CGAL { template < class RTT, class ConstructPoint, class Functor_> @@ -39,47 +43,128 @@ class Regular_traits_adaptor typedef Functor_ Functor; typedef typename RTraits::FT FT; - typedef typename RTraits::Point_3 Point_3; +#if 0 + typedef typename boost::mpl::eval_if_c< + internal::Has_nested_type_Bare_point::value, + typename internal::Bare_point_type, + boost::mpl::identity + >::type Point_3; +#else + typedef typename RTT::Point_3 Point_3; +#endif + typedef typename RTraits::Tetrahedron_3 Tetrahedron_3; + typedef typename RTraits::Plane_3 Plane_3; + typedef typename RTraits::Sphere_3 Sphere_3; typedef typename RTraits::Weighted_point_3 Weighted_point_3; -public: - typedef typename Functor::result_type result_type; + template + struct Conv_wp_to_p { + typedef T type; + }; + + template <> + struct Conv_wp_to_p { + typedef Point_3 type; + }; + + template <> + struct Conv_wp_to_p { + typedef const Point_3 type; + }; + + template <> + struct Conv_wp_to_p { + typedef const Point_3& type; + }; + + template struct result {}; + + template struct result { + typedef typename Conv_wp_to_p::type A0p; + typedef typename cpp11::result_of::type type; + }; + + template struct result { + typedef typename Conv_wp_to_p::type A0p; + typedef typename Conv_wp_to_p::type A1p; + typedef typename cpp11::result_of::type type; + }; + + template struct result { + typedef typename Conv_wp_to_p::type A0p; + typedef typename Conv_wp_to_p::type A1p; + typedef typename Conv_wp_to_p::type A2p; + typedef typename cpp11::result_of::type type; + }; + + template + struct result { + typedef typename Conv_wp_to_p::type A0p; + typedef typename Conv_wp_to_p::type A1p; + typedef typename Conv_wp_to_p::type A2p; + typedef typename Conv_wp_to_p::type A3p; + typedef typename cpp11::result_of::type type; + }; public: Regular_traits_adaptor (const ConstructPoint& cp, const Functor& f) : cp(cp), f(f) { } -public: + typename cpp11::result_of::type operator() (const Tetrahedron_3& t) const + { + return f(t); + } -public: - // with offset --------------------------------------------------------------- - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const + typename cpp11::result_of< Functor(Point_3,Point_3) >::type operator() (const Point_3& p0, const Point_3& p1) const + { + return f(p0, p1); + } + + typename cpp11::result_of< Functor(Point_3,Point_3) >::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1) const { return f(cp(p0), cp(p1)); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + typename cpp11::result_of::type operator() (const Plane_3& p0, const Weighted_point_3& p1) const + { + return f(p0, cp(p1)); + } + + + typename cpp11::result_of::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, const Weighted_point_3& p2) const { return f(cp(p0), cp(p1), cp(p2)); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + typename cpp11::result_of::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, const Weighted_point_3& p2, const Weighted_point_3& p3) const { return f(cp(p0), cp(p1), cp(p2), cp(p3)); } - result_type operator() (const Point_3& p0, const Weighted_point_3& p1, + typename cpp11::result_of::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Point_3& p2) const + { + return f(cp(p0), cp(p1), p2); + } + + typename cpp11::result_of::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + const Weighted_point_3& p2, const Point_3& p3) const + { + return f(cp(p0), cp(p1), cp(p2), p3); + } + + typename cpp11::result_of::type operator() (const Point_3& p0, const Weighted_point_3& p1, const Weighted_point_3& p2) const { return f(p0, cp(p1), cp(p2)); } - result_type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, + typename cpp11::result_of::type operator() (const Weighted_point_3& p0, const Weighted_point_3& p1, const Weighted_point_3& p2, const Weighted_point_3& p3, const FT w) const { diff --git a/Triangulation_3/include/CGAL/Regular_triangulation_3.h b/Triangulation_3/include/CGAL/Regular_triangulation_3.h index 0df9062e894..01d73241962 100644 --- a/Triangulation_3/include/CGAL/Regular_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Regular_triangulation_3.h @@ -30,32 +30,97 @@ #include #include +#include +#include namespace CGAL { template < typename K_ > struct Weighted_point_mapper_3 : public K_ { + Weighted_point_mapper_3() + : K_() + {} + + Weighted_point_mapper_3(const K_ k) + : K_(k) + {} + typedef typename K_::Weighted_point_3 Point_3; +}; + +namespace internal { + +template < typename K_ > +struct RegTraits + : public K_ +{ +#if 0 + typedef typename boost::mpl::eval_if_c< + internal::Has_nested_type_Bare_point::value, + typename internal::Bare_point_type, + boost::mpl::identity + >::type Point_3; + +#endif + typedef typename K_::Construct_point_3 Construct_point_3_base; + typedef typename K_::Construct_projected_point_3 Construct_projected_point_3_base; + typedef typename K_::Construct_vector_3 Construct_vector_3_base; typedef typename K_::Compare_xyz_3 Compare_xyz_3_base; + typedef typename K_::Compute_squared_radius_3 Compute_squared_radius_3_base; + typedef typename K_::Compute_squared_distance_3 Compute_squared_distance_3_base; + typedef typename K_::Compute_area_3 Compute_area_3_base; + typedef typename K_::Compute_volume_3 Compute_volume_3_base; + typedef typename K_::Collinear_3 Collinear_3_base; typedef typename K_::Less_x_3 Less_x_3_base; typedef typename K_::Less_y_3 Less_y_3_base; typedef typename K_::Less_z_3 Less_z_3_base; typedef typename K_::Orientation_3 Orientation_3_base; + typedef typename K_::Construct_centroid_3 Construct_centroid_3_base; typedef typename K_::Construct_segment_3 Construct_segment_3_base; + typedef typename K_::Construct_triangle_3 Construct_triangle_3_base; + typedef typename K_::Construct_tetrahedron_3 Construct_tetrahedron_3_base; typedef typename K_::Construct_plane_3 Construct_plane_3_base; typedef typename K_::Coplanar_orientation_3 Coplanar_orientation_3_base; - // typedef typename K_::_3 _base; + typedef typename K_::Side_of_bounded_sphere_3 Side_of_bounded_sphere_3_base; + typedef typename K_::Equal_3 Equal_3_base; Construct_point_3_base cp; - Weighted_point_mapper_3() {} - Weighted_point_mapper_3(const K_& k) + RegTraits() {} + RegTraits(const K_& k) : K_(k), cp(k.construct_point_3_object()) {} + + typedef Regular_traits_adaptor Equal_3; + + typedef Regular_traits_adaptor Construct_projected_point_3; + + typedef Regular_traits_adaptor Compute_area_3; + + typedef Regular_traits_adaptor Compute_volume_3; + typedef Regular_traits_adaptor Compute_squared_radius_3; + typedef Regular_traits_adaptor Compute_squared_distance_3; + + typedef Regular_traits_adaptor Collinear_3; + typedef Regular_traits_adaptor Less_x_3; @@ -84,10 +149,62 @@ struct Weighted_point_mapper_3 Construct_point_3_base, Coplanar_orientation_3_base > Coplanar_orientation_3; + typedef Regular_traits_adaptor Construct_vector_3; + + typedef Regular_traits_adaptor Construct_centroid_3; + typedef Regular_traits_adaptor Construct_segment_3; + typedef Regular_traits_adaptor Construct_triangle_3; + + typedef Regular_traits_adaptor Construct_tetrahedron_3; + + typedef Regular_traits_adaptor Side_of_bounded_sphere_3; + + + + Equal_3 equal_3_object() const + { + return Equal_3(cp, static_cast(*this).equal_3_object()); + } + + Compute_area_3 compute_area_3_object() const + { + return Compute_area_3(cp, static_cast(*this).compute_area_3_object()); + } + + Compute_volume_3 compute_volume_3_object() const + { + return Compute_volume_3(cp, static_cast(*this).compute_volume_3_object()); + } + + Compute_squared_radius_3 compute_squared_radius_3_object() const + { + return Compute_squared_radius_3(cp, static_cast(*this).compute_squared_radius_3_object()); + } + + Compute_squared_distance_3 compute_squared_distance_3_object() const + { + return Compute_squared_distance_3(cp, static_cast(*this).compute_squared_distance_3_object()); + } + + Collinear_3 collinear_3_object() const + { + return Collinear_3(cp, static_cast(*this).collinear_3_object()); + } + Less_x_3 less_x_3_object() const { return Less_x_3(cp, static_cast(*this).less_x_3_object()); @@ -108,18 +225,41 @@ struct Weighted_point_mapper_3 return Compare_xyz_3(cp, static_cast(*this).compare_xyz_3_object()); } - Orientation_3 orientation_3_object() const { return Orientation_3(cp, static_cast(*this).orientation_3_object()); } + Construct_vector_3 construct_vector_3_object() const + { + return Construct_vector_3(cp, static_cast(*this).construct_vector_3_object()); + } + + Construct_projected_point_3 construct_projected_point_3_object() const + { + return Construct_projected_point_3(cp, static_cast(*this).construct_projected_point_3_object()); + } + + Construct_centroid_3 construct_centroid_3_object() const + { + return Construct_centroid_3(cp, static_cast(*this).construct_centroid_3_object()); + } Construct_segment_3 construct_segment_3_object() const { return Construct_segment_3(cp, static_cast(*this).construct_segment_3_object()); } + Construct_triangle_3 construct_triangle_3_object() const + { + return Construct_triangle_3(cp, static_cast(*this).construct_triangle_3_object()); + } + + Construct_tetrahedron_3 construct_tetrahedron_3_object() const + { + return Construct_tetrahedron_3(cp, static_cast(*this).construct_tetrahedron_3_object()); + } + Construct_plane_3 construct_plane_3_object() const { return Construct_plane_3(cp, static_cast(*this).construct_plane_3_object()); @@ -129,8 +269,15 @@ struct Weighted_point_mapper_3 { return Coplanar_orientation_3(cp, static_cast(*this).coplanar_orientation_3_object()); } + + Side_of_bounded_sphere_3 side_of_bounded_sphere_3_object() const + { + return Side_of_bounded_sphere_3(cp, static_cast(*this).side_of_bounded_sphere_3_object()); + } }; + } // namespace internal + } // nmamespace CGAL #ifdef CGAL_LINKED_WITH_TBB @@ -147,8 +294,6 @@ struct Weighted_point_mapper_3 #include #include -#include -#include #ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO #include @@ -181,25 +326,33 @@ namespace CGAL { template < class Gt, class Tds_ = Default, class Lock_data_structure_ = Default > class Regular_triangulation_3 : public Triangulation_3< - Weighted_point_mapper_3, + Weighted_point_mapper_3 >, typename Default::Get, Regular_triangulation_cell_base_3 > >::type, Lock_data_structure_> { + public: + + typedef internal::RegTraits Geom_traits; + + private: typedef Regular_triangulation_3 Self; - typedef Weighted_point_mapper_3 Tr_Base_Gt; + typedef Weighted_point_mapper_3 Tr_Base_Gt; typedef typename Default::Get, Regular_triangulation_cell_base_3 > >::type Tds; + Geom_traits regular_geom_traits; + public: + typedef Triangulation_3 Tr_Base; typedef Tds Triangulation_data_structure; - typedef Gt Geom_traits; + typedef Geom_traits Traits; typedef typename Tr_Base::Concurrency_tag Concurrency_tag; typedef typename Tr_Base::Lock_data_structure Lock_data_structure; @@ -280,15 +433,15 @@ namespace CGAL { using Tr_Base::is_valid; Regular_triangulation_3(const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL) - : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this) + : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this), regular_geom_traits(gt) {} Regular_triangulation_3(Lock_data_structure *lock_ds, const Gt & gt = Gt()) - : Tr_Base(lock_ds, Tr_Base_Gt(gt)), hidden_point_visitor(this) + : Tr_Base(lock_ds, Tr_Base_Gt(gt)), hidden_point_visitor(this), regular_geom_traits(gt) {} Regular_triangulation_3(const Regular_triangulation_3 & rt) - : Tr_Base(rt), hidden_point_visitor(this) + : Tr_Base(rt), hidden_point_visitor(this), regular_geom_traits(rt.regular_geom_traits) { CGAL_triangulation_postcondition( is_valid() ); } @@ -297,7 +450,7 @@ namespace CGAL { template < typename InputIterator > Regular_triangulation_3(InputIterator first, InputIterator last, const Gt & gt = Gt(), Lock_data_structure *lock_ds = NULL) - : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this) + : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this), regular_geom_traits(gt) { insert(first, last); } @@ -305,11 +458,16 @@ namespace CGAL { template < typename InputIterator > Regular_triangulation_3(InputIterator first, InputIterator last, Lock_data_structure *lock_ds, const Gt & gt = Gt()) - : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this) + : Tr_Base(Tr_Base_Gt(gt), lock_ds), hidden_point_visitor(this), regular_geom_traits(gt) { insert(first, last); } + const Geom_traits& geom_traits() const + { + return regular_geom_traits; + } + private: #ifdef CGAL_CONCURRENT_TRIANGULATION_3_ADD_TEMPORARY_POINTS_ON_FAR_SPHERE @@ -411,7 +569,7 @@ namespace CGAL { size_type n = number_of_vertices(); std::vector points(first, last); - spatial_sort (points.begin(), points.end(), geom_traits()); + spatial_sort (points.begin(), points.end(), Tr_Base::geom_traits()); // Parallel #ifdef CGAL_LINKED_WITH_TBB @@ -509,7 +667,7 @@ namespace CGAL { spatial_sort( indices.begin(), indices.end(), - Search_traits(make_property_map(points),geom_traits()) ); + Search_traits(make_property_map(points),Tr_Base::geom_traits()) ); #ifdef CGAL_LINKED_WITH_TBB if (this->is_parallel()) { @@ -1269,7 +1427,7 @@ namespace CGAL { return v; } void hide_point(Cell_handle c, const Weighted_point &p) { - c->hide_point(p); + // AF c->hide_point(p); // What do we want to hide, a point or a weighted point? } }; @@ -1649,7 +1807,7 @@ dual(Cell_handle c) const CGAL_triangulation_precondition(dimension()==3); CGAL_triangulation_precondition( ! is_infinite(c) ); - return c->weighted_circumcenter(geom_traits()); + return geom_traits().construct_point_3_object()(c->weighted_circumcenter(geom_traits())); } template < class Gt, class Tds, class Lds > @@ -1722,7 +1880,7 @@ dual(Cell_handle c) const // We sort the points lexicographically. const Weighted_point * points[5] = {&p0, &p1, &p2, &p3, &p}; std::sort(points, points + 5, - boost::bind(geom_traits().compare_xyz_3_object(), + boost::bind(geom_traits().compare_xyz_3_object(), boost::bind(Dereference(), _1), boost::bind(Dereference(), _2)) == SMALLER); @@ -1832,7 +1990,7 @@ dual(Cell_handle c) const // We sort the points lexicographically. const Weighted_point * points[4] = {&p0, &p1, &p2, &p}; std::sort(points, points + 4, - boost::bind(geom_traits().compare_xyz_3_object(), + boost::bind(geom_traits().compare_xyz_3_object(), boost::bind(Dereference(), _1), boost::bind(Dereference(), _2)) == SMALLER); diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index ab95ab68a4f..6fa633be6d3 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -6616,8 +6616,8 @@ operator==(const Triangulation_3 &t1, using namespace boost; std::vector V1 (t1.points_begin(), t1.points_end()); std::vector V2 (t2.points_begin(), t2.points_end()); - std::sort(V1.begin(), V1.end(), boost::bind(cmp1, _1, _2) == NEGATIVE); - std::sort(V2.begin(), V2.end(), boost::bind(cmp2, _1, _2) == NEGATIVE); + std::sort(V1.begin(), V1.end(), boost::bind(cmp1, _1, _2) == NEGATIVE); + std::sort(V2.begin(), V2.end(), boost::bind(cmp2, _1, _2) == NEGATIVE); return V1 == V2; }