From 675814c5f8df7f7d7a505c5b9ff6175b64e61ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 1 Sep 2011 13:26:45 +0000 Subject: [PATCH] normalized plane now first check if FT is a fraction --- Nef_S2/include/CGAL/Nef_S2/Normalizing.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Normalizing.h b/Nef_S2/include/CGAL/Nef_S2/Normalizing.h index c142073fa28..400002b94ad 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Normalizing.h +++ b/Nef_S2/include/CGAL/Nef_S2/Normalizing.h @@ -282,9 +282,9 @@ class Normalizing { } #endif - + template static - CGAL::Plane_3 normalized(const CGAL::Plane_3& h) { + CGAL::Plane_3 normalized(const CGAL::Plane_3& h,Tag_true) { CGAL_assertion(!(h.a()==0 && h.b()==0 && h.c()==0 && h.d()==0)); typedef typename R::FT FT; @@ -326,6 +326,26 @@ class Normalizing { composer(vec[2],1), composer(vec[3],1)); } + + + + template static + CGAL::Plane_3 normalized(const CGAL::Plane_3& h,Tag_false) { + CGAL_assertion(!(h.a()==0 && h.b()==0 && h.c()==0 && h.d()==0)); + typedef typename R::FT FT; + if (h.a()!=0) + return typename R::Plane_3(FT(1),h.b()/h.a(),h.c()/h.a(),h.d()/h.a()); + if (h.b()!=0) + return typename R::Plane_3(h.a()/h.b(),FT(1),h.c()/h.b(),h.d()/h.b()); + if (h.c()!=0) + return typename R::Plane_3(h.a()/h.c(),h.b()/h.c(),FT(1),h.d()/h.c()); + return typename R::Plane_3(h.a()/h.d(),h.b()/h.d(),h.c()/h.d(),FT(1)); + } + + template static + CGAL::Plane_3 normalized(const CGAL::Plane_3& h) { + return normalized( h,typename Fraction_traits::Is_fraction() ); + } template static CGAL::Sphere_circle normalized(CGAL::Sphere_circle& c) {