From ac93cec931845c803289127fa32d98c46979cf50 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 21 Mar 2018 07:59:53 +0100 Subject: [PATCH] Fix Homogeneous and Visibility --- .../CGAL/Homogeneous/Aff_transformationH2.h | 25 +++++++++++++++---- .../CGAL/Homogeneous/Aff_transformationH3.h | 12 +++++++-- .../CGAL/Rotational_sweep_visibility_2.h | 4 ++- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h index 2a3205e60ac..81cea7f6115 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h @@ -917,21 +917,24 @@ cartesian(int i, int j) const case 0: return FT(_cos) / FT(_den); case 1: return - FT(_sin) / FT(_den); case 2: return RT(0); + default: CGAL_ASSUME(false); } case 1: switch (j) { case 0: return FT(_sin) / FT(_den); case 1: return FT(_cos) / FT(_den); case 2: return FT(0); + default: CGAL_ASSUME(false); } case 2: switch (j) { case 0: return FT(0); case 1: return FT(0); case 2: return FT(1); + default: CGAL_ASSUME(false); } } - return FT(0); + CGAL_ASSUME(false); } template < class R > @@ -947,21 +950,24 @@ homogeneous(int i, int j) const case 0: return _sf_num; case 1: return RT(0); case 2: return RT(0); + default: CGAL_ASSUME(false); } case 1: switch (j) { case 0: return RT(0); case 1: return _sf_num; case 2: return RT(0); + default: CGAL_ASSUME(false); } case 2: switch (j) { case 0: return RT(0); case 1: return RT(0); case 2: return _sf_den; + default: CGAL_ASSUME(false); } } - return RT(0); + CGAL_ASSUME(false); } template @@ -977,21 +983,24 @@ cartesian(int i, int j) const case 0: return FT(_sf_num) / FT(_sf_den); case 1: return FT(0); case 2: return FT(0); + default: CGAL_ASSUME(false); } case 1: switch (j) { case 0: return FT(0); case 1: return FT(_sf_num) / FT(_sf_den); case 2: return FT(0); + default: CGAL_ASSUME(false); } case 2: switch (j) { case 0: return FT(0); case 1: return FT(0); case 2: return FT(1); + default: CGAL_ASSUME(false); } } - return FT(0); + CGAL_ASSUME(false); } template < class R > @@ -1008,21 +1017,24 @@ homogeneous(int i, int j) const case 0: return l.b()*l.b() - l.a()*l.a(); case 1: return l.a()*l.b()*mRT2; case 2: return l.a()*l.c()*mRT2; + default: CGAL_ASSUME(false); } case 1: switch (j) { case 0: return l.a()*l.b()*mRT2; case 1: return l.a()*l.a() - l.b()*l.b(); case 2: return l.b()*l.c()*mRT2; + default: CGAL_ASSUME(false); } case 2: switch (j) { case 0: return RT(0); case 1: return RT(0); case 2: return l.a()*l.a() + l.b()*l.b(); + default: CGAL_ASSUME(false); } } - return RT(0); + CGAL_ASSUME(false); } template @@ -1039,21 +1051,24 @@ cartesian(int i, int j) const case 0: return FT( l.b()-l.a() ) / FT( l.a()+l.b()); case 1: return FT( homogeneous(0,1)) / de; case 2: return FT( homogeneous(0,2)) / de; + default: CGAL_ASSUME(false); } case 1: switch (j) { case 0: return FT( homogeneous(1,0)) / de; case 1: return FT( l.a()-l.b() ) / FT( l.a()+l.b()); case 2: return FT( homogeneous(1,2)) / de; + default: CGAL_ASSUME(false); } case 2: switch (j) { case 0: return FT(0); case 1: return FT(0); case 2: return FT(1); + default: CGAL_ASSUME(false); } } - return FT(0); + GAL_ASSUME(false); } } //namespace CGAL diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h index 282d4152e1f..8d05ea24397 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h @@ -551,6 +551,7 @@ homogeneous(int i, int j) const case 1: return t01; case 2: return t02; case 3: return t03; + default: CGAL_ASSUME(false); } case 1: switch (j) { @@ -558,6 +559,7 @@ homogeneous(int i, int j) const case 1: return t11; case 2: return t12; case 3: return t13; + default: CGAL_ASSUME(false); } case 2: switch (j) { @@ -565,6 +567,7 @@ homogeneous(int i, int j) const case 1: return t21; case 2: return t22; case 3: return t23; + default: CGAL_ASSUME(false); } case 3: switch (j) { @@ -572,9 +575,10 @@ homogeneous(int i, int j) const case 1: return RT0; case 2: return RT0; case 3: return t33; + default: CGAL_ASSUME(false); } } - return RT0; + CGAL_ASSUME(false); } template < class R > @@ -695,6 +699,7 @@ Translation_repH3::homogeneous(int i, int j) const case 1: return RT0; case 2: return RT0; case 3: return tv.hx(); + default: CGAL_ASSUME(false); } case 1: switch (j) { @@ -702,6 +707,7 @@ Translation_repH3::homogeneous(int i, int j) const case 1: return tv.hw(); case 2: return RT0; case 3: return tv.hy(); + default: CGAL_ASSUME(false); } case 2: switch (j) { @@ -709,6 +715,7 @@ Translation_repH3::homogeneous(int i, int j) const case 1: return RT0; case 2: return tv.hw(); case 3: return tv.hz(); + default: CGAL_ASSUME(false); } case 3: switch (j) { @@ -716,9 +723,10 @@ Translation_repH3::homogeneous(int i, int j) const case 1: return RT0; case 2: return RT0; case 3: return tv.hw(); + default: CGAL_ASSUME(false); } } - return RT0; + CGAL_ASSUME(false); } template < class R > diff --git a/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h b/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h index ef1d4cdfdf3..a6a2dcf60f6 100644 --- a/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h +++ b/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h @@ -129,8 +129,8 @@ private: return 1; case LEFT_TURN: return 2; + default: CGAL_ASSUME(false); } - return -1; } @@ -223,6 +223,7 @@ private: == Visibility_2::orientation_2(geom_traits, s2, t2, s1); else return true; + default: CGAL_ASSUME(false); } case LEFT_TURN: switch (Visibility_2::orientation_2(geom_traits, s1, t1, s2)) { @@ -240,6 +241,7 @@ private: == Visibility_2::orientation_2(geom_traits, s2, t2, s1); else return true; + default: CGAL_ASSUME(false); } }