added some missing CGAL_NTS before gcd calls;

added missing include of number_utils.h;
added hacks for M$ to resolve ambiguities?;
This commit is contained in:
Susan Hert 2002-04-19 08:39:29 +00:00
parent c93cef1113
commit 3c10ad672c
4 changed files with 34 additions and 22 deletions

View File

@ -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.

View File

@ -33,6 +33,7 @@
#include <CGAL/Point_2.h>
#include <CGAL/Line_2_Line_2_intersection.h>
#include <CGAL/squared_distance_2.h>
#include <CGAL/number_utils.h>
#if (defined( _MSC_VER) && (_MSC_VER <= 1200))
#include <CGAL/Nef_2/Polynomial_MSC.h>
#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));

View File

@ -32,6 +32,7 @@
#include <CGAL/Handle_for.h>
#include <CGAL/Interval_arithmetic.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/number_utils.h>
#undef _DEBUG
#define _DEBUG 59
#include <CGAL/Nef_2/debug.h>
@ -725,10 +726,10 @@ Extended_point<RT> 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;

View File

@ -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 <seel@mpi-sb.mpg.de>
// chapter : Nef Polyhedra
//
// revision : $Revision$
// revision_date : $Date$
//
// author(s) : Michael Seel <seel@mpi-sb.mpg.de>
// maintainer : Michael Seel <seel@mpi-sb.mpg.de>
// coordinator : Michael Seel <seel@mpi-sb.mpg.de>
//
// implementation: Polynomials in one variable
// ============================================================================
// ======================================================================
#ifndef CGAL_POLYNOMIAL_H
#define CGAL_POLYNOMIAL_H
@ -47,8 +47,13 @@
#define SNIINST ,'c','c'
#else
#include <vector>
#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 <class Forward_iterator>
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<NT>(first,last)) { reduce(); }
: Base(Polynomial_rep<NT>(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 <class Forward_iterator>
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<int>(first,last)) { reduce(); }
: Base(Polynomial_rep<int>(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 <class Forward_iterator>
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<double>(first,last)) { reduce(); }
: Base(Polynomial_rep<double>(first,last SNIINST)) { reduce(); }
#else
#define RPOL(I)\
@ -1255,7 +1260,7 @@ template <class NT> /*CGAL_KERNEL_MEDIUM_INLINE*/
Polynomial<NT> operator - (const Polynomial<NT>& p)
{
CGAL_assertion(p.degree()>=0);
Polynomial<NT> res(p.coeffs().begin(),p.coeffs().end());
Polynomial<NT> res(p.coeffs().begin(),p.coeffs().end() SNIINST);
typename Polynomial<NT>::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<NT>& p)
else {
typename Polynomial<NT>::Vector coeffs(d+1);
for(i=0; i<=d; ++i) is >> coeffs[i];
p = Polynomial<NT>(coeffs.begin(),coeffs.end());
p = Polynomial<NT>(coeffs.begin(),coeffs.end() SNIINST);
}
break;
case CGAL::IO::BINARY :
@ -1809,7 +1814,7 @@ std::istream& operator >> (std::istream& is, Polynomial<NT>& p)
typename Polynomial<NT>::Vector coeffs(d+1);
for(i=0; i<=d; ++i)
{ CGAL::read(is,c); coeffs[i]=c; }
p = Polynomial<NT>(coeffs.begin(),coeffs.end());
p = Polynomial<NT>(coeffs.begin(),coeffs.end() SNIINST);
}
break;
default: