From b29dcaaf63ed2099b9e18856b9a33767e3dcea72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 09:47:38 +0100 Subject: [PATCH 1/5] add missing documented function --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 7a5dc5ffc9d..29e4ae47c89 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -350,6 +350,11 @@ public: f->mark() == true); } + bool is_sphere() const + { + return is_plane(); + } + void extract_complement() { CGAL_NEF_TRACEN("extract complement"); if ( this->is_shared() ) clone_rep(); From 881fdab58d7d5e678acb0417fa540e009517658d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 09:57:43 +0100 Subject: [PATCH 2/5] fix setting of mark --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 29e4ae47c89..71eb311e6a1 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -395,7 +395,7 @@ public: CGAL_forall_svertices(v,D) v->mark() = true; CGAL_forall_sedges(e,D) e->mark() = true; CGAL_forall_sfaces(f,D) f->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = D.shalfoop()->twin() = true; + if ( D.has_sloop() ) D.shalfloop()->mark() = D.shalfoop()->twin()->mark() = true; D.simplify(); } From 7c6450192e8f9fdb4837bc3105ead9a5d56eae9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 10:16:58 +0100 Subject: [PATCH 3/5] add a function that convert to double and do the normalization --- .../include/CGAL/Nef_S2/Sphere_geometry_OGL.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h index e7904529787..fa177c9c0bc 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h @@ -71,6 +71,23 @@ VVector convert(const CGAL::Vector_3& v) CGAL::to_double(v.y()), CGAL::to_double(v.z())); } +template +VVector normalize_and_convert(const CGAL::Vector_3& v) +{ + typename R::FT xa = CGAL::abs(v.x()); + typename R::FT ya = CGAL::abs(v.y()); + typename R::FT za = CGAL::abs(v.z()); + typename R::FT m = (std::max)((std::max)(xa,ya),za); + if (m==0) { + return VVector(0,0,0); + } else { + double xd = CGAL::to_double(v.x()/m); + double yd = CGAL::to_double(v.y()/m); + double zd = CGAL::to_double(v.z()/m); + VVector u(xd,yd,zd); + return u / CGAL_NTS sqrt(u*u) ; // normalize + } +} const double refinement_angle = 0.1; const double shrink_fac = 0.995; From 4d3b5ce0c739dc9ccf76019a47031550bc045a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 3 Dec 2018 10:32:59 +0100 Subject: [PATCH 4/5] use convert_and_normalize() --- Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h index fa177c9c0bc..f0527bb932b 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_geometry_OGL.h @@ -97,8 +97,7 @@ class Approximator { public: static VPoint approximate(const CGAL::Sphere_point& p) { - VVector v = convert(p-CGAL::ORIGIN); - v = v / CGAL_NTS sqrt(v*v) ; // normalize + VVector v = normalize_and_convert(p-CGAL::ORIGIN); return CGAL::ORIGIN+v; } From 1f51c8ab10583fe50188e05c7bd60b7d5c1c9bb2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 26 Nov 2018 15:44:17 +0100 Subject: [PATCH 5/5] has_sloop() -> has_shalfloop() --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 71eb311e6a1..c980fabd6f3 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -380,7 +380,7 @@ public: SHalfedge_iterator e; CGAL_forall_svertices(v,D) v->mark() = false; CGAL_forall_sedges(e,D) e->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = false; + if ( D.has_shalfloop() ) D.shalfloop()->mark() = false; D.simplify(); } @@ -395,7 +395,7 @@ public: CGAL_forall_svertices(v,D) v->mark() = true; CGAL_forall_sedges(e,D) e->mark() = true; CGAL_forall_sfaces(f,D) f->mark() = false; - if ( D.has_sloop() ) D.shalfloop()->mark() = D.shalfoop()->twin()->mark() = true; + if ( D.has_shalfloop() ) D.shalfloop()->mark() = D.shalfoop()->twin()->mark() = true; D.simplify(); }