From 81bc8604f048a50dcc93a00c953fe7327c0d491b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 12 Apr 2017 18:24:28 +0200 Subject: [PATCH] Fixed Bare_point / Weighted_point across Skin_surface This also removes the definition of Bare_point from the Skin surface traits class (as it should be: Skin_surface defines Bare_point) --- Skin_surface_3/include/CGAL/Skin_surface_3.h | 12 ++- .../include/CGAL/Skin_surface_base_3.h | 84 +++++++++++-------- .../include/CGAL/Skin_surface_traits_3.h | 3 - .../Triangulated_mixed_complex_observer_3.h | 10 ++- .../include/CGAL/Union_of_balls_3.h | 12 ++- .../CGAL/triangulate_mixed_complex_3.h | 14 ++-- .../CGAL/triangulate_power_diagram_3.h | 8 +- 7 files changed, 74 insertions(+), 69 deletions(-) diff --git a/Skin_surface_3/include/CGAL/Skin_surface_3.h b/Skin_surface_3/include/CGAL/Skin_surface_3.h index a59555baf03..1ebd5d2c38b 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_3.h @@ -36,14 +36,12 @@ class Skin_surface_3 : public Skin_surface_base_3 { typedef Skin_surface_3 Self; typedef Skin_surface_base_3 Base; public: - typedef MixedComplexTraits_3 Geometric_traits; - - typedef typename Gt::Weighted_point Weighted_point; - typedef typename Gt::Bare_point Bare_point; - typedef typename Gt::FT FT; - // For normal(): - typedef typename Gt::Vector_3 Vector; + typedef MixedComplexTraits_3 Geometric_traits; + typedef typename Base::FT FT; + typedef typename Base::Bare_point Bare_point; + typedef typename Base::Weighted_point Weighted_point; + typedef typename Base::Vector Vector; typedef typename Base::Regular Regular; typedef typename Base::Vertex_handle Vertex_handle; diff --git a/Skin_surface_3/include/CGAL/Skin_surface_base_3.h b/Skin_surface_3/include/CGAL/Skin_surface_base_3.h index 6d462968a0a..98ef1449dd1 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_base_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_base_3.h @@ -52,6 +52,11 @@ #include #include +#include + +#include +#include + namespace CGAL { template @@ -61,8 +66,14 @@ class Skin_surface_base_3 { public: typedef MixedComplexTraits_3 Geometric_traits; - typedef typename Gt::Weighted_point Weighted_point; - typedef typename Gt::Bare_point Bare_point; + + typedef typename Gt::Weighted_point_3 Weighted_point; + typedef typename boost::mpl::eval_if_c< + internal::Has_nested_type_Bare_point::value, + typename internal::Bare_point_type, + boost::mpl::identity + >::type Bare_point; + typedef typename Gt::FT FT; // For normal typedef typename Gt::Vector_3 Vector; @@ -155,7 +166,8 @@ public: template - static typename Gt2::Bare_point + static + typename Skin_surface_base_3::Bare_point get_weighted_circumcenter(const Simplex &s, Gt2 &traits); Vector @@ -163,7 +175,8 @@ public: TMC_Cell_handle start = TMC_Cell_handle()) const; template - static typename Gt2::Bare_point + static + typename Skin_surface_base_3::Bare_point get_anchor_point(const Anchor_point &anchor, Gt2 &traits); private: @@ -314,13 +327,16 @@ sign(TMC_Vertex_handle vit) const { } CGAL_BRANCH_PROFILER_BRANCH(tmp); Protect_FPU_rounding P(CGAL_FE_TONEAREST); - typedef Exact_predicates_exact_constructions_kernel EK; - Skin_surface_traits_3 exact_traits(shrink_factor()); - typename Skin_surface_traits_3::Bare_point p_exact = - get_anchor_point(vit->info(), exact_traits); - return construct_surface(vit->cell()->info().first, - EK() ).sign(p_exact); + typedef Exact_predicates_exact_constructions_kernel EK; + typedef Skin_surface_traits_3 Exact_skin_surface_traits; + typedef Skin_surface_base_3 Exact_skin_surface_base; + typedef typename Exact_skin_surface_base::Bare_point Exact_bare_point; + + Exact_skin_surface_traits exact_traits(shrink_factor()); + Exact_bare_point p_exact = get_anchor_point(vit->info(), exact_traits); + + return construct_surface(vit->cell()->info().first, EK()).sign(p_exact); } template @@ -384,11 +400,6 @@ intersect(Bare_point &p1, Bare_point &p2, TMC_Cell_handle &s1, TMC_Cell_handle &s2, Bare_point &p) const { - typedef typename Bare_point::R Traits; - typedef typename Traits::FT FT; - Cartesian_converter converter; - FT sq_dist = squared_distance(p1,p2); // Use value to make the computation robust (endpoints near the surface) if (compare(s1->info(), p1, s2->info(), p2) == LARGER) { @@ -398,7 +409,7 @@ intersect(Bare_point &p1, Bare_point &p2, while ((s1 != s2) && (sq_dist > 1e-8)) { p = midpoint(p1, p2); - sp = locate_in_tmc(converter(p), sp); + sp = locate_in_tmc(p, sp); if (sign_inexact(p, sp->info()) == NEGATIVE) { p1 = p; s1 = sp; } else { p2 = p; s2 = sp; } @@ -445,7 +456,7 @@ intersect_with_transversal_segment( } } - Cartesian_converter converter; + Cartesian_converter converter; Object obj; typename FK::Point_3 tmc_point; Bare_point tet_pts[4]; @@ -501,10 +512,7 @@ Skin_surface_base_3:: construct_bounding_box() { typedef typename Regular::Finite_vertices_iterator Finite_vertices_iterator; - typedef typename Regular::Geom_traits GT; - typedef typename GT::Weighted_point Weighted_point; - typedef typename GT::FT FT; - + Finite_vertices_iterator vit = regular().finite_vertices_begin(); if (vit != regular().finite_vertices_end()) { Bbox_3 bbox = vit->point().bbox(); @@ -557,10 +565,11 @@ construct_bounding_box() template template -typename Gt2::Bare_point +typename Skin_surface_base_3::Bare_point Skin_surface_base_3:: -get_anchor_point(const Anchor_point &anchor, Gt2 &traits) { - typename Gt2::Bare_point p_del, p_vor; +get_anchor_point(const Anchor_point &anchor, Gt2 &traits) +{ + typename Skin_surface_base_3::Bare_point p_del, p_vor; p_del = get_weighted_circumcenter(anchor.first, traits); p_vor = get_weighted_circumcenter(anchor.second, traits); return traits.construct_anchor_point_3_object()(p_del,p_vor); @@ -570,11 +579,11 @@ template template< class Traits > Skin_surface_quadratic_surface_3 Skin_surface_base_3:: -construct_surface(const Simplex &sim, const Traits &) const { - typedef Skin_surface_quadratic_surface_3 Quadratic_surface; - typedef Cartesian_converter< - typename Geometric_traits::Bare_point::R, Traits> Converter; - typedef typename Traits::Weighted_point_3 Weighted_point; +construct_surface(const Simplex &sim, const Traits &) const +{ + typedef Skin_surface_quadratic_surface_3 Quadratic_surface; + typedef Cartesian_converter Converter; + typedef typename Traits::Weighted_point_3 Weighted_point; Converter conv; @@ -705,7 +714,7 @@ locate_in_tmc(const Bare_point &p0, } catch (Uncertain_conversion_exception) { Protect_FPU_rounding P(CGAL_FE_TONEAREST); typedef Exact_predicates_exact_constructions_kernel EK; - Cartesian_converter converter_ek; + Cartesian_converter converter_ek; Skin_surface_traits_3 exact_traits(shrink_factor()); @@ -749,23 +758,26 @@ locate_in_tmc(const Bare_point &p0, template template -typename Gt2::Bare_point +typename Skin_surface_base_3::Bare_point Skin_surface_base_3:: -get_weighted_circumcenter(const Simplex &s, Gt2 &traits) { +get_weighted_circumcenter(const Simplex &s, Gt2 &traits) +{ + typedef typename Skin_surface_base_3::Bare_point Gt2_Bare_point; + Vertex_handle vh; Edge e; Facet f; Cell_handle ch; - Cartesian_converter converter; + Cartesian_converter converter; - typename Gt2::Bare_point result; + Gt2_Bare_point result; switch(s.dimension()) { case 0: { vh = s; - result = Gt2().construct_point_3_object()(converter(vh->point())); + result = traits.construct_point_3_object()(converter(vh->point())); break; } case 1: diff --git a/Skin_surface_3/include/CGAL/Skin_surface_traits_3.h b/Skin_surface_3/include/CGAL/Skin_surface_traits_3.h index b448d33b6c2..1f7b7fb8982 100644 --- a/Skin_surface_3/include/CGAL/Skin_surface_traits_3.h +++ b/Skin_surface_3/include/CGAL/Skin_surface_traits_3.h @@ -117,9 +117,6 @@ public: typedef Skin_surface_traits_base_3 Self; typedef typename Kernel::FT FT; - typedef typename Kernel::Point_3 Bare_point; - typedef typename Kernel::Weighted_point_3 Weighted_point; - typedef Weighted_point Weighted_point_3; typedef CGAL::Side_of_mixed_cell_3 Side_of_mixed_cell_3; typedef typename Kernel::Construct_weighted_circumcenter_3 diff --git a/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h b/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h index 624d17f8dc7..9f660936ce4 100644 --- a/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h +++ b/Skin_surface_3/include/CGAL/Triangulated_mixed_complex_observer_3.h @@ -44,9 +44,11 @@ template class Triangulated_mixed_complex_observer_3 { public: + typedef SkinSurface_3 Skin_surface; + typedef TriangulatedMixedComplex_3 Triangulated_mixed_complex; + typedef typename SkinSurface_3::Regular Regular; typedef typename Regular::Geom_traits Regular_traits; - typedef TriangulatedMixedComplex_3 Triangulated_mixed_complex; typedef typename Triangulated_mixed_complex::Geom_traits Triangulated_mixed_complex_traits; typedef typename Triangulated_mixed_complex::Triangulation_data_structure @@ -61,7 +63,7 @@ public: typedef typename Regular::Cell_handle Rt_Cell_handle; typedef Triangulation_simplex_3 Rt_Simplex; - typedef typename Regular::Bare_point Rt_Point; + typedef typename Regular::Bare_point Rt_Bare_point; typedef typename Regular::Geom_traits Rt_Geom_traits; typedef typename Rt_Geom_traits::RT Rt_RT; typedef typename Regular::Weighted_point Rt_Weighted_point; @@ -78,8 +80,8 @@ public: typedef typename Surface_traits::Weighted_point_3 Surface_weighted_point; typedef - Cartesian_converter < typename Regular_traits::Bare_point::R, - typename Quadratic_surface::K > R2S_converter; + Cartesian_converter < typename Rt_Bare_point::R, + typename Quadratic_surface::K > R2S_converter; Triangulated_mixed_complex_observer_3(FT shrink) : shrink(shrink) {} diff --git a/Skin_surface_3/include/CGAL/Union_of_balls_3.h b/Skin_surface_3/include/CGAL/Union_of_balls_3.h index 18183f84b04..e4287ed2ef1 100644 --- a/Skin_surface_3/include/CGAL/Union_of_balls_3.h +++ b/Skin_surface_3/include/CGAL/Union_of_balls_3.h @@ -35,14 +35,12 @@ class Union_of_balls_3 : public Skin_surface_base_3 { typedef Union_of_balls_3 Self; typedef Skin_surface_base_3 Base; public: - typedef MixedComplexTraits_3 Geometric_traits; - - typedef typename Gt::Weighted_point Weighted_point; - typedef typename Gt::Bare_point Bare_point; - typedef typename Gt::FT FT; - // For normal(): - typedef typename Gt::Vector_3 Vector; + typedef MixedComplexTraits_3 Geometric_traits; + typedef typename Base::FT FT; + typedef typename Base::Bare_point Bare_point; + typedef typename Base::Weighted_point Weighted_point; + typedef typename Base::Vector Vector; typedef typename Base::Regular Regular; typedef typename Base::Vertex_handle Vertex_handle; diff --git a/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h b/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h index ddf1a64576f..17bf770d892 100644 --- a/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h +++ b/Skin_surface_3/include/CGAL/triangulate_mixed_complex_3.h @@ -74,7 +74,7 @@ private: typedef typename Regular::Cell_circulator Rt_Cell_circulator; typedef Triangulation_simplex_3 Rt_Simplex; - typedef typename Regular::Bare_point Rt_Point; + typedef typename Regular::Bare_point Rt_Bare_point; typedef typename Regular_traits::FT Rt_FT; typedef typename Regular::Weighted_point Rt_Weighted_point; @@ -258,9 +258,7 @@ private: typename Tmc_traits::Construct_weighted_circumcenter_3 weighted_circumcenter_obj; - Cartesian_converter - r2t_converter_object; + Cartesian_converter r2t_converter_object; Construct_anchor_point_3< // Regular_triangulation_euclidean_traits_3< @@ -1265,15 +1263,17 @@ orientation(Tmc_Cell_handle ch) { typedef Exact_predicates_exact_constructions_kernel EK; typedef Cartesian_converter Exact_converter; typedef Skin_surface_traits_3 Exact_traits; + typedef Skin_surface_base_3 Exact_skin_surface; Exact_converter converter; Exact_traits exact_traits(shrink); - typename EK::Point_3 e_pts[4]; + typename Exact_skin_surface::Bare_point e_pts[4]; for (int k=0; k<4; k++) { e_pts[k] = - Skin_surface_base_3:: - get_anchor_point(ch->vertex(k)->info(), exact_traits); + Triangulated_mixed_complex_observer::Skin_surface:: + get_anchor_point(ch->vertex(k)->info(), exact_traits); + // Store the more precise point ch->vertex(k)->point() = converter(e_pts[k]); } diff --git a/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h b/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h index b7a34176791..9d3ee5c17d8 100644 --- a/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h +++ b/Skin_surface_3/include/CGAL/triangulate_power_diagram_3.h @@ -69,7 +69,7 @@ private: typedef typename Regular::Cell_circulator Rt_Cell_circulator; typedef Triangulation_simplex_3 Rt_Simplex; - typedef typename Regular::Bare_point Rt_Point; + typedef typename Regular::Bare_point Rt_Bare_point; typedef typename Regular_traits::FT Rt_FT; typedef typename Regular::Weighted_point Rt_Weighted_point; @@ -209,10 +209,8 @@ private: Compute_anchor_3 compute_anchor_obj; bool verbose; - Cartesian_converter - r2t_converter_object; - + Cartesian_converter r2t_converter_object; static const int edge_index[4][4]; struct Index_c4 { Tmc_Vertex_handle V[4]; };