renamed abs() function glu_abs()

This commit is contained in:
Brian Paul 2002-11-01 23:35:07 +00:00
parent 026b40f416
commit 034e8641bb
10 changed files with 52 additions and 51 deletions

View file

@ -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 <stdio.h>
@ -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;
}

View file

@ -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 = (ds<geo_stepsize && dt<geo_stepsize) ? 1 : 0;
REAL ods=0.0, odt=0.0;
@ -454,8 +454,8 @@ ArcTessellator::tessellateNonlinear( Arc *arc, REAL geo_stepsize, REAL arc_steps
vert->param[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<geo_stepsize && dt<geo_stepsize) ? 1 : 0;
REAL ods=0.0, odt=0.0;

View file

@ -35,8 +35,8 @@
/*
* ccw.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/ccw.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/ccw.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $
*/
#include "glimports.h"
@ -562,6 +562,6 @@ int
Subdivider::ccw( TrimVertex *a, TrimVertex *b, TrimVertex *c )
{
REAL d = det3( a, b, c );
if( abs(d) < 0.0001 ) return -1;
if( glu_abs(d) < 0.0001 ) return -1;
return (d < 0.0) ? 0 : 1;
}

View file

@ -35,8 +35,8 @@
/*
* patch.c++
*
* $Date: 2001/08/13 16:52:18 $ $Revision: 1.2 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.2 2001/08/13 16:52:18 brianp Exp $
* $Date: 2002/11/01 23:35:07 $ $Revision: 1.3 $
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.3 2002/11/01 23:35:07 brianp Exp $
*/
#include <stdio.h>
@ -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

View file

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

View file

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

View file

@ -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_ */

View file

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

View file

@ -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;
}

View file

@ -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)
{