From 3c10ad672c7fd4a53a26ad5bc4dcd80b5e86ea09 Mon Sep 17 00:00:00 2001 From: Susan Hert Date: Fri, 19 Apr 2002 08:39:29 +0000 Subject: [PATCH] added some missing CGAL_NTS before gcd calls; added missing include of number_utils.h; added hacks for M$ to resolve ambiguities?; --- Packages/Nef_2/changes.txt | 5 +++ .../Nef_2/include/CGAL/Extended_homogeneous.h | 5 ++- .../CGAL/Filtered_extended_homogeneous.h | 7 ++-- .../Nef_2/include/CGAL/Nef_2/Polynomial.h | 39 +++++++++++-------- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/Packages/Nef_2/changes.txt b/Packages/Nef_2/changes.txt index 454b156401c..c81c6ae453e 100644 --- a/Packages/Nef_2/changes.txt +++ b/Packages/Nef_2/changes.txt @@ -1,6 +1,11 @@ Nef_2 Package: Release changes ---------------------------------------------------------------------- +1.9 (19 Apr 2002) + - added some missing CGAL_NTS before gcd calls + - added missing include of number_utils.h + - added hacks for M$ to resolve ambiguities? + 1.8 (17 Apr 2002) - removed test for MSVC version around certain macros so the macros get defined for VC7 as well. diff --git a/Packages/Nef_2/include/CGAL/Extended_homogeneous.h b/Packages/Nef_2/include/CGAL/Extended_homogeneous.h index 3ec40ac68af..e3c958e53a3 100644 --- a/Packages/Nef_2/include/CGAL/Extended_homogeneous.h +++ b/Packages/Nef_2/include/CGAL/Extended_homogeneous.h @@ -33,6 +33,7 @@ #include #include #include +#include #if (defined( _MSC_VER) && (_MSC_VER <= 1200)) #include #define Polynomial Polynomial_MSC @@ -186,9 +187,9 @@ on the extended geometric objects.}*/ Point_2 p = *start++; if ( is_standard(p) ) { R = CGAL_NTS max(CGAL_NTS abs(p.hx()[0])/p.hw()[0], - CGAL_NTS abs(p.hy()[0])/p.hw()[0]); + CGAL_NTS abs(p.hy()[0])/p.hw()[0]); } else { - RT rx = CGAL_NTS abs(p.hx()), ry = CGAL_NTS abs(p.hy()); + Standard_RT rx = CGAL_NTS abs(p.hx()), ry = CGAL_NTS abs(p.hy()); mx = ( rx.degree()>0 ? rx[1] : 0 ); nx = rx[0]; my = ( ry.degree()>0 ? ry[1] : 0 ); ny = ry[0]; if ( mx > my ) R = CGAL_NTS abs((ny-nx)/(mx-my)); diff --git a/Packages/Nef_2/include/CGAL/Filtered_extended_homogeneous.h b/Packages/Nef_2/include/CGAL/Filtered_extended_homogeneous.h index 9c12e5c6b00..a272be55466 100644 --- a/Packages/Nef_2/include/CGAL/Filtered_extended_homogeneous.h +++ b/Packages/Nef_2/include/CGAL/Filtered_extended_homogeneous.h @@ -32,6 +32,7 @@ #include #include #include +#include #undef _DEBUG #define _DEBUG 59 #include @@ -725,10 +726,10 @@ Extended_point intersection( #ifdef REDUCE_INTERSECTION_POINTS RT xgcd,ygcd; if ( x.m() == RT(0) ) xgcd = ( x.n() == 0 ? RT(1) : x.n() ); - else /* != 0 */ xgcd = ( x.n() == 0 ? x.m() : gcd(x.m(),x.n()) ); + else /* != 0 */ xgcd = ( x.n() == 0 ? x.m() : CGAL_NTS gcd(x.m(),x.n()) ); if ( y.m() == RT(0) ) ygcd = ( y.n() == 0 ? RT(1) : y.n() ); - else /* != 0 */ ygcd = ( y.n() == 0 ? y.m() : gcd(y.m(),y.n()) ); - RT d = gcd(w,gcd(xgcd,ygcd)); + else /* != 0 */ ygcd = ( y.n() == 0 ? y.m() : CGAL_NTS gcd(y.m(),y.n()) ); + RT d = CGAL_NTS gcd(w,CGAL_NTS gcd(xgcd,ygcd)); x /= d; y /= d; w /= d; diff --git a/Packages/Nef_2/include/CGAL/Nef_2/Polynomial.h b/Packages/Nef_2/include/CGAL/Nef_2/Polynomial.h index 79db23fe350..50bad30621a 100644 --- a/Packages/Nef_2/include/CGAL/Nef_2/Polynomial.h +++ b/Packages/Nef_2/include/CGAL/Nef_2/Polynomial.h @@ -1,4 +1,4 @@ -// ============================================================================ +// ====================================================================== // // Copyright (c) 1997-2000 The CGAL Consortium // @@ -6,24 +6,24 @@ // of the Computational Geometry Algorithms Library (CGAL). It is not // intended for general use. // -// ---------------------------------------------------------------------------- +// ---------------------------------------------------------------------- // -// release : $CGAL_Revision$ -// release_date : $CGAL_Date$ +// release : $CGAL_Revision: CGAL-2.4-I-78 $ +// release_date : $CGAL_Date: 2002/04/17 $ // -// file : include/CGAL/Nef_2/Nef_2/Polynomial.h -// package : Nef_2 +// file : include/CGAL/Nef_2/Polynomial.h +// package : Nef_2 (1.8) +// maintainer : Michael Seel // chapter : Nef Polyhedra // // revision : $Revision$ // revision_date : $Date$ // // author(s) : Michael Seel -// maintainer : Michael Seel // coordinator : Michael Seel // // implementation: Polynomials in one variable -// ============================================================================ +// ====================================================================== #ifndef CGAL_POLYNOMIAL_H #define CGAL_POLYNOMIAL_H @@ -47,8 +47,13 @@ #define SNIINST ,'c','c' #else #include +#if (!defined(_MSC_VER)) #define SNIHACK #define SNIINST +#else +#define SNIHACK ,char,char +#define SNIINST ,'c','c' +#endif #endif CGAL_BEGIN_NAMESPACE @@ -307,13 +312,13 @@ determines the sign for the limit process $x \rightarrow \infty$. #ifndef CGAL_SIMPLE_NEF_INTERFACE template - Polynomial(Forward_iterator first, Forward_iterator last) + Polynomial(Forward_iterator first, Forward_iterator last SNIHACK) /*{\Mcreate introduces a variable |\Mvar| of type |\Mname| representing the polynomial whose coefficients are determined by the iterator range, i.e. let $(a_0 = |*first|, a_1 = |*++first|, \ldots a_d = |*it|)$, where |++it == last| then |\Mvar| stores the polynomial $a_1 + a_2 x + \ldots a_d x^d$.}*/ - : Base(Polynomial_rep(first,last)) { reduce(); } + : Base(Polynomial_rep(first,last SNIINST)) { reduce(); } #else #define RPOL(I)\ @@ -655,13 +660,13 @@ determines the sign for the limit process $x \rightarrow \infty$. #ifndef CGAL_SIMPLE_NEF_INTERFACE template - Polynomial(Forward_iterator first, Forward_iterator last) + Polynomial(Forward_iterator first, Forward_iterator last SNIHACK) /*{\Xcreate introduces a variable |\Mvar| of type |\Mname| representing the polynomial whose coefficients are determined by the iterator range, i.e. let $(a_0 = |*first|, a_1 = |*++first|, \ldots a_d = |*it|)$, where |++it == last| then |\Mvar| stores the polynomial $a_1 + a_2 x + \ldots a_d x^d$.}*/ - : Base(Polynomial_rep(first,last)) { reduce(); } + : Base(Polynomial_rep(first,last SNIINST)) { reduce(); } #else #define RPOL(I)\ @@ -976,13 +981,13 @@ determines the sign for the limit process $x \rightarrow \infty$. #ifndef CGAL_SIMPLE_NEF_INTERFACE template - Polynomial(Forward_iterator first, Forward_iterator last) + Polynomial(Forward_iterator first, Forward_iterator last SNIHACK) /*{\Xcreate introduces a variable |\Mvar| of type |\Mname| representing the polynomial whose coefficients are determined by the iterator range, i.e. let $(a_0 = |*first|, a_1 = |*++first|, \ldots a_d = |*it|)$, where |++it == last| then |\Mvar| stores the polynomial $a_1 + a_2 x + \ldots a_d x^d$.}*/ - : Base(Polynomial_rep(first,last)) { reduce(); } + : Base(Polynomial_rep(first,last SNIINST)) { reduce(); } #else #define RPOL(I)\ @@ -1255,7 +1260,7 @@ template /*CGAL_KERNEL_MEDIUM_INLINE*/ Polynomial operator - (const Polynomial& p) { CGAL_assertion(p.degree()>=0); - Polynomial res(p.coeffs().begin(),p.coeffs().end()); + Polynomial res(p.coeffs().begin(),p.coeffs().end() SNIINST); typename Polynomial::iterator it, ite=res.coeffs().end(); for(it=res.coeffs().begin(); it!=ite; ++it) *it = -*it; return res; @@ -1799,7 +1804,7 @@ std::istream& operator >> (std::istream& is, Polynomial& p) else { typename Polynomial::Vector coeffs(d+1); for(i=0; i<=d; ++i) is >> coeffs[i]; - p = Polynomial(coeffs.begin(),coeffs.end()); + p = Polynomial(coeffs.begin(),coeffs.end() SNIINST); } break; case CGAL::IO::BINARY : @@ -1809,7 +1814,7 @@ std::istream& operator >> (std::istream& is, Polynomial& p) typename Polynomial::Vector coeffs(d+1); for(i=0; i<=d; ++i) { CGAL::read(is,c); coeffs[i]=c; } - p = Polynomial(coeffs.begin(),coeffs.end()); + p = Polynomial(coeffs.begin(),coeffs.end() SNIINST); } break; default: