From 034e8641bb2e3a8ff9b313719ba3c44282bf07c1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 1 Nov 2002 23:35:07 +0000 Subject: renamed abs() function glu_abs() --- src/glu/sgi/libnurbs/internals/arc.cc | 6 +++--- src/glu/sgi/libnurbs/internals/arctess.cc | 16 ++++++++-------- src/glu/sgi/libnurbs/internals/ccw.cc | 6 +++--- src/glu/sgi/libnurbs/internals/patch.cc | 8 ++++---- src/glu/sgi/libnurbs/internals/quilt.cc | 10 +++++----- src/glu/sgi/libnurbs/internals/reader.cc | 6 +++--- src/glu/sgi/libnurbs/internals/simplemath.h | 6 +++--- src/glu/sgi/libnurbs/internals/slicer.cc | 25 +++++++++++++------------ src/glu/sgi/libnurbs/internals/varray.cc | 12 ++++++------ src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc | 8 ++++---- 10 files changed, 52 insertions(+), 51 deletions(-) (limited to 'src/glu') diff --git a/src/glu/sgi/libnurbs/internals/arc.cc b/src/glu/sgi/libnurbs/internals/arc.cc index 4f7fb9ed30..845f05fab9 100644 --- a/src/glu/sgi/libnurbs/internals/arc.cc +++ b/src/glu/sgi/libnurbs/internals/arc.cc @@ -35,8 +35,8 @@ /* * arc.c++ * - * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $ */ #include @@ -332,7 +332,7 @@ Arc::check( void ) inline long tooclose( REAL x, REAL y ) { - return (abs(x-y) < TOL) ? 1 : 0; + return (glu_abs(x-y) < TOL) ? 1 : 0; } diff --git a/src/glu/sgi/libnurbs/internals/arctess.cc b/src/glu/sgi/libnurbs/internals/arctess.cc index 0559c35029..b3222a88d7 100644 --- a/src/glu/sgi/libnurbs/internals/arctess.cc +++ b/src/glu/sgi/libnurbs/internals/arctess.cc @@ -35,8 +35,8 @@ /* * arctessellator.c++ * - * $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $ */ #include "glimports.h" @@ -247,8 +247,8 @@ ArcTessellator::pwl( Arc *arc, REAL s1, REAL s2, REAL t1, REAL t2, REAL rate ) /* if(rate <= 0.06) rate = 0.06;*/ - int snsteps = 1 + (int) (abs(s2 - s1) / rate ); - int tnsteps = 1 + (int) (abs(t2 - t1) / rate ); + int snsteps = 1 + (int) (glu_abs(s2 - s1) / rate ); + int tnsteps = 1 + (int) (glu_abs(t2 - t1) / rate ); int nsteps = max(1,max( snsteps, tnsteps )); REAL sstepsize = (s2 - s1) / (REAL) nsteps; @@ -395,8 +395,8 @@ ArcTessellator::tessellateNonlinear( Arc *arc, REAL geo_stepsize, REAL arc_steps vert->param[0] = u/w; vert->param[1] = v/w; #ifndef NOELIMINATION - REAL ds = abs(vert[0].param[0] - vert[-1].param[0]); - REAL dt = abs(vert[0].param[1] - vert[-1].param[1]); + REAL ds = glu_abs(vert[0].param[0] - vert[-1].param[0]); + REAL dt = glu_abs(vert[0].param[1] - vert[-1].param[1]); int canremove = (dsparam[0] = u; vert->param[1] = v; #ifndef NOELIMINATION - REAL ds = abs(vert[0].param[0] - vert[-1].param[0]); - REAL dt = abs(vert[0].param[1] - vert[-1].param[1]); + REAL ds = glu_abs(vert[0].param[0] - vert[-1].param[0]); + REAL dt = glu_abs(vert[0].param[1] - vert[-1].param[1]); int canremove = (ds @@ -49,7 +49,7 @@ #include "mapdesc.h" #include "quilt.h" #include "nurbsconsts.h" -#include "simplemath.h" //for abs function in ::singleStep(); +#include "simplemath.h" //for glu_abs function in ::singleStep(); /*-------------------------------------------------------------------------- @@ -464,7 +464,7 @@ Patch::getstepsize( void ) void Patchspec::singleStep() { - stepsize = sidestep[0] = sidestep[1] = abs(range[2]); + stepsize = sidestep[0] = sidestep[1] = glu_abs(range[2]); } void diff --git a/src/glu/sgi/libnurbs/internals/quilt.cc b/src/glu/sgi/libnurbs/internals/quilt.cc index b1a9e617a3..17d3c99142 100644 --- a/src/glu/sgi/libnurbs/internals/quilt.cc +++ b/src/glu/sgi/libnurbs/internals/quilt.cc @@ -35,8 +35,8 @@ /* * quilt.c++ * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $ */ #include "glimports.h" @@ -48,7 +48,7 @@ #include "flist.h" #include "knotvector.h" #include "patchlist.h" -#include "math.h" //fabs() +#include "math.h" //fglu_abs() #include "simplemath.h" //min() /* local preprocessor definitions */ @@ -265,8 +265,8 @@ Quilt::findSampleRates( Flist& slist, Flist& tlist ) patchlist.getstepsize(); { - float edge_len_s = min(fabs(ptb[0]-pta[0]),1.0); - float edge_len_t = min(fabs(ptb[1]-pta[1]),1.0); + float edge_len_s = min(glu_abs(ptb[0]-pta[0]),1.0); + float edge_len_t = min(glu_abs(ptb[1]-pta[1]),1.0); if( patchlist.getStepsize(0)/edge_len_s < qspec[0].step_size ) qspec[0].step_size = patchlist.getStepsize(0)/edge_len_s; diff --git a/src/glu/sgi/libnurbs/internals/reader.cc b/src/glu/sgi/libnurbs/internals/reader.cc index 35bf2ee6f1..271a32fbc1 100644 --- a/src/glu/sgi/libnurbs/internals/reader.cc +++ b/src/glu/sgi/libnurbs/internals/reader.cc @@ -35,8 +35,8 @@ /* * reader.c++ * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/reader.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/reader.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $ */ #include @@ -55,7 +55,7 @@ #define ELIMINATE_REDUNDANT_POINTS #ifdef ELIMINATE_REDUNDANT_POINTS -#define equal(x,y) ( abs(x-y) <= 0.00001) +#define equal(x,y) ( glu_abs(x-y) <= 0.00001) #endif #ifdef ELIMINATE_REDUNDANT_POINTS diff --git a/src/glu/sgi/libnurbs/internals/simplemath.h b/src/glu/sgi/libnurbs/internals/simplemath.h index e5aaddf0ed..f2efee35f1 100644 --- a/src/glu/sgi/libnurbs/internals/simplemath.h +++ b/src/glu/sgi/libnurbs/internals/simplemath.h @@ -35,8 +35,8 @@ /* * simplemath.h * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/simplemath.h,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/simplemath.h,v 1.2 2002/11/01 23:35:07 brianp Exp $ */ #ifndef __glusimplemath_h_ @@ -51,6 +51,6 @@ inline REAL min( REAL x, REAL y ) { return ( x > y ) ? y : x; } inline REAL -abs( REAL x ) { return ( x < 0.0 ) ? -x : x; } +glu_abs( REAL x ) { return ( x < 0.0 ) ? -x : x; } #endif /* __glusimplemath_h_ */ diff --git a/src/glu/sgi/libnurbs/internals/slicer.cc b/src/glu/sgi/libnurbs/internals/slicer.cc index 0d7149144d..6418e81669 100644 --- a/src/glu/sgi/libnurbs/internals/slicer.cc +++ b/src/glu/sgi/libnurbs/internals/slicer.cc @@ -35,8 +35,8 @@ /* * slicer.c++ * - * $Date: 2002/06/30 16:58:11 $ $Revision: 1.3 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.3 2002/06/30 16:58:11 brianp Exp $ + * $Date: 2002/11/01 23:35:07 $ $Revision: 1.4 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.4 2002/11/01 23:35:07 brianp Exp $ */ #include @@ -50,6 +50,7 @@ #include "backend.h" #include "arc.h" #include "gridtrimvertex.h" +#include "simplemath.h" #include "trimvertex.h" #include "varray.h" @@ -81,7 +82,7 @@ Int num_quads = 0; #define max(a,b) ((a>b)? a:b) #define ZERO 0.00001 /*determing whether a loop is a rectngle or not*/ -#define equalRect(a,b) ((fabs(a-b) <= ZERO)? 1:0) //only used in tessellating a rectangle +#define equalRect(a,b) ((glu_abs(a-b) <= ZERO)? 1:0) //only used in tessellating a rectangle static Int is_Convex(Arc_ptr loop) { @@ -233,23 +234,23 @@ printf("loop->tail=(%f,%f)\n", loop->tail()[0], loop->tail()[1]); printf("loop->head=(%f,%f)\n", loop->head()[0], loop->head()[1]); printf("loop->next->tail=(%f,%f)\n", loop->next->tail()[0], loop->next->tail()[1]); printf("loop->next->head=(%f,%f)\n", loop->next->head()[0], loop->next->head()[1]); -if(fabs(loop->tail()[0] - loop->head()[0])<0.000001) +if(fglu_abs(loop->tail()[0] - loop->head()[0])<0.000001) printf("equal 1\n"); if(loop->next->tail()[1] == loop->next->head()[1]) printf("equal 2\n"); */ - if( (fabs(loop->tail()[0] - loop->head()[0])<=ZERO) && - (fabs(loop->next->tail()[1] - loop->next->head()[1])<=ZERO) && - (fabs(loop->prev->tail()[1] - loop->prev->head()[1])<=ZERO) && - (fabs(loop->prev->prev->tail()[0] - loop->prev->prev->head()[0])<=ZERO) + if( (glu_abs(loop->tail()[0] - loop->head()[0])<=ZERO) && + (glu_abs(loop->next->tail()[1] - loop->next->head()[1])<=ZERO) && + (glu_abs(loop->prev->tail()[1] - loop->prev->head()[1])<=ZERO) && + (glu_abs(loop->prev->prev->tail()[0] - loop->prev->prev->head()[0])<=ZERO) ) return 1; else if - ( (fabs(loop->tail()[1] - loop->head()[1]) <= ZERO) && - (fabs(loop->next->tail()[0] - loop->next->head()[0]) <= ZERO) && - (fabs(loop->prev->tail()[0] - loop->prev->head()[0]) <= ZERO) && - (fabs(loop->prev->prev->tail()[1] - loop->prev->prev->head()[1]) <= ZERO) + ( (glu_abs(loop->tail()[1] - loop->head()[1]) <= ZERO) && + (glu_abs(loop->next->tail()[0] - loop->next->head()[0]) <= ZERO) && + (glu_abs(loop->prev->tail()[0] - loop->prev->head()[0]) <= ZERO) && + (glu_abs(loop->prev->prev->tail()[1] - loop->prev->prev->head()[1]) <= ZERO) ) return 1; else diff --git a/src/glu/sgi/libnurbs/internals/varray.cc b/src/glu/sgi/libnurbs/internals/varray.cc index c97b030e82..969bba080e 100644 --- a/src/glu/sgi/libnurbs/internals/varray.cc +++ b/src/glu/sgi/libnurbs/internals/varray.cc @@ -35,8 +35,8 @@ /* * varray.c++ * - * $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/varray.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/varray.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $ */ #include "glimports.h" @@ -44,7 +44,7 @@ #include "mystdio.h" #include "varray.h" #include "arc.h" -#include "math.h" // fabs() +#include "simplemath.h" // glu_abs() #define TINY 0.0001 inline long sgn( REAL x ) @@ -114,9 +114,9 @@ Varray::init( REAL delta, Arc_ptr toparc, Arc_ptr botarc ) update( right, rdir, right->tail()[1] ); break; case 0: - if( fabs(left->tail()[1] - botarc->tail()[1]) < TINY) goto end; - if( fabs(left->tail()[0]-right->prev->tail()[0]) < TINY && - fabs(left->tail()[1]-right->prev->tail()[1]) < TINY) goto end; + if( glu_abs(left->tail()[1] - botarc->tail()[1]) < TINY) goto end; + if( glu_abs(left->tail()[0]-right->prev->tail()[0]) < TINY && + glu_abs(left->tail()[1]-right->prev->tail()[1]) < TINY) goto end; left = left->next; break; } diff --git a/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc b/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc index 1ddfa2ce45..8a90eb17fe 100644 --- a/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc +++ b/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc @@ -31,10 +31,10 @@ ** published by SGI, but has not been independently verified as being ** compliant with the OpenGL(R) version 1.2.1 Specification. ** -** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $ +** $Date: 2002/11/01 23:35:08 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc,v 1.2 2002/11/01 23:35:08 brianp Exp $ */ #include "gluos.h" @@ -520,13 +520,13 @@ rightChain->print(); Real tempI; //skip those points which are equal to v. (avoid degeneratcy) for(tempI = index1; tempI <= leftChainEndIndex; tempI++) - if(leftChain->getVertex(tempI)[1] < v) + if(leftChain->getVertex((Int) tempI)[1] < v) break; if(tempI > leftChainEndIndex) ret_rightCornerWhere = 1; else { - Real tempMax = leftChain->getVertex(tempI)[0]; + Real tempMax = leftChain->getVertex((Int) tempI)[0]; for(i=(int)tempI; i<= leftChainEndIndex; i++) if(leftChain->getVertex(i)[0] > tempMax) { -- cgit v1.2.3