diff options
Diffstat (limited to 'src/glu/sgi/libnurbs')
-rw-r--r-- | src/glu/sgi/libnurbs/interface/bezierEval.cc | 40 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/interface/glrenderer.cc | 58 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/interface/glsurfeval.cc | 404 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/internals/arc.cc | 71 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/internals/basiccrveval.cc | 30 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/internals/basicsurfeval.cc | 56 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/internals/coveandtiler.cc | 84 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/internals/knotvector.cc | 41 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/nurbtess/directedLine.cc | 122 | ||||
-rw-r--r-- | src/glu/sgi/libnurbs/nurbtess/polyDBG.cc | 111 |
10 files changed, 515 insertions, 502 deletions
diff --git a/src/glu/sgi/libnurbs/interface/bezierEval.cc b/src/glu/sgi/libnurbs/interface/bezierEval.cc index a1bbbf52a78..c72d64f787f 100644 --- a/src/glu/sgi/libnurbs/interface/bezierEval.cc +++ b/src/glu/sgi/libnurbs/interface/bezierEval.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -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/11/29 16:16:55 $ $Revision: 1.2 $ +** $Date: 2003/10/14 23:48:57 $ $Revision: 1.3 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/bezierEval.cc,v 1.3 2003/10/14 23:48:57 kendallb Exp $ */ #include <stdlib.h> @@ -43,6 +43,10 @@ #include <math.h> #include "bezierEval.h" +#ifdef __WATCOMC__ +#pragma warning 14 10 +#endif + #define TOLERANCE 0.0001 #ifndef MAX_ORDER @@ -88,7 +92,7 @@ void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride } } - + /*order = degree +1 >=1. */ @@ -109,7 +113,7 @@ void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int st buf[r][i][j] = (1-uprime)*buf[r-1][i][j] + uprime*buf[r-1][i+1][j]; } } - + for(j=0; j<dimension; j++) retpoint[j] = buf[order-1][0][j]; } @@ -135,10 +139,10 @@ void bezierCurveEvalDer(float u0, float u1, int order, float *ctlpoints, int str } ctlptr += stride; } - + bezierCurveEval(u0, u1, order-1, (float*) buf, MAX_DIMENSION, dimension, u, retDer); } - + void bezierCurveEvalDerGen(int der, float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[]) { int i,k,r; @@ -179,12 +183,12 @@ void bezierSurfEvalDerGen(int uder, int vder, float u0, float u1, int uorder, fl bezierCurveEvalDerGen(vder, v0, v1, vorder, ctlpoints+ustride*i, vstride, dimension, v, newPoints[i]); } - + bezierCurveEvalDerGen(uder, u0, u1, uorder, (float *) newPoints, MAX_DIMENSION, dimension, u, ret); } -/*division by w is performed*/ +/*division by w is performed*/ void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[]) { bezierSurfEvalDerGen(0, 0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, ret); @@ -192,7 +196,7 @@ void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vord ret[0] /= ret[3]; ret[1] /= ret[3]; ret[2] /= ret[3]; - } + } } void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float retNormal[]) @@ -202,7 +206,7 @@ void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, in assert(dimension>=3 && dimension <=4); bezierSurfEvalDerGen(1,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialU); bezierSurfEvalDerGen(0,1, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialV); - + if(dimension == 3){/*inhomogeneous*/ crossProduct(partialU, partialV, retNormal); @@ -215,11 +219,11 @@ void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, in float newPartialU[MAX_DIMENSION]; float newPartialV[MAX_DIMENSION]; int i; - bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val); + bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val); for(i=0; i<=2; i++){ newPartialU[i] = partialU[i] * val[3] - val[i] * partialU[3]; - newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3]; + newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3]; } crossProduct(newPartialU, newPartialV, retNormal); normalize(retNormal); @@ -231,7 +235,7 @@ static void normalize(float vec[3]) { float size = (float)sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); - if(size < TOLERANCE) + if(size < TOLERANCE) { #ifdef DEBUG fprintf(stderr, "Warning: in oglBSpline.c normal is 0\n"); @@ -244,7 +248,7 @@ static void normalize(float vec[3]) vec[2] = vec[2]/size; } } - + static void crossProduct(float x[3], float y[3], float ret[3]) { diff --git a/src/glu/sgi/libnurbs/interface/glrenderer.cc b/src/glu/sgi/libnurbs/interface/glrenderer.cc index 15bea9c212e..7c9da9f45b1 100644 --- a/src/glu/sgi/libnurbs/interface/glrenderer.cc +++ b/src/glu/sgi/libnurbs/interface/glrenderer.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -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:40 $ $Revision: 1.1 $ +** $Date: 2003/10/14 23:48:57 $ $Revision: 1.2 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.cc,v 1.2 2003/10/14 23:48:57 kendallb Exp $ */ #include "gluos.h" @@ -99,7 +99,7 @@ GLUnurbs::GLUnurbs() //default autoloadmode is true autoloadmode = 1; - //default callbackFlag is 0 + //default callbackFlag is 0 callbackFlag = 0; errorCallback = NULL; @@ -127,8 +127,8 @@ GLUnurbs::errorHandler(int i) postError( gluError ); } -void -GLUnurbs::loadGLMatrices(void) +void +GLUnurbs::loadGLMatrices(void) { GLfloat vmat[4][4]; GLint viewport[4]; @@ -140,20 +140,20 @@ GLUnurbs::loadGLMatrices(void) } void -GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16], +GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16], const GLfloat projMatrix[16], const GLint viewport[4]) { GLfloat vmat[4][4]; - multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix, + multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix, (const GLfloat (*)[4]) projMatrix); loadCullingMatrix((GLfloat (*)[4]) vmat); loadSamplingMatrix((const GLfloat (*)[4]) vmat, (const GLint *) viewport); } /*-------------------------------------------------------------------------- - * grabGLMatrix + * grabGLMatrix *-------------------------------------------------------------------------- */ @@ -164,8 +164,8 @@ GLUnurbs::grabGLMatrix(GLfloat vmat[4][4]) ::glGetFloatv((GLenum) GL_MODELVIEW_MATRIX, (GLfloat *) &(m1[0][0])); ::glGetFloatv((GLenum) GL_PROJECTION_MATRIX, (GLfloat *) &(m2[0][0])); - multmatrix4d((GLfloat (*)[4]) vmat, - (GLfloat (*)[4]) m1, (GLfloat (*)[4]) m2); + multmatrix4d((GLfloat (*)[4]) vmat, + (const GLfloat (*)[4]) m1, (const GLfloat (*)[4]) m2); } //for object space tesselation: view independent @@ -180,27 +180,27 @@ GLUnurbs::setSamplingMatrixIdentity( void ) }; const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]); const long cstride = 1; - - setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + + setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); } void -GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], +GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], const GLint viewport[4]) { /* rescale the mapping to correspond to pixels in x/y */ REAL xsize = 0.5 * (REAL) (viewport[2]); REAL ysize = 0.5 * (REAL) (viewport[3]); - + INREAL smat[4][4]; smat[0][0] = vmat[0][0] * xsize; smat[1][0] = vmat[1][0] * xsize; @@ -225,13 +225,13 @@ GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]); const long cstride = 1; - setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, cstride); } @@ -263,14 +263,14 @@ GLUnurbs::loadCullingMatrix(GLfloat vmat[4][4]) const long rstride = sizeof(cmat[0]) / sizeof(cmat[0][0]); const long cstride = 1; - setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); //added for curves by zl - setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); - setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, + setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, cstride); } diff --git a/src/glu/sgi/libnurbs/interface/glsurfeval.cc b/src/glu/sgi/libnurbs/interface/glsurfeval.cc index 3f6ff87942e..6f63aff44bc 100644 --- a/src/glu/sgi/libnurbs/interface/glsurfeval.cc +++ b/src/glu/sgi/libnurbs/interface/glsurfeval.cc @@ -35,8 +35,8 @@ /* * glsurfeval.c++ * - * $Date: 2001/07/16 15:46:42 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.2 2001/07/16 15:46:42 brianp Exp $ + * $Date: 2003/10/14 23:48:57 $ $Revision: 1.3 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.3 2003/10/14 23:48:57 kendallb Exp $ */ /* Polynomial Evaluator Interface */ @@ -58,14 +58,14 @@ /*#define NO_EVALUATION*/ //#define USE_LOD //for LOD test, have to turn on USE_LOD in insurfeval.c++ too - + /*for statistics*/ //#define STATISTICS #ifdef STATISTICS static int STAT_num_of_triangles=0; static int STAT_num_of_eval_vertices=0; static int STAT_num_of_quad_strips=0; -#endif +#endif /*for output triangles*/ /*#define OUTPUT_TRIANGLES*/ @@ -74,16 +74,16 @@ static int STAT_num_of_quad_strips=0; /*#define FOR_CHRIS*/ #ifdef FOR_CHRIS extern "C" { void evalUStripExt(int n_upper, REAL v_upper, REAL* upper_val, - int n_lower, REAL v_lower, REAL* lower_val);} + int n_lower, REAL v_lower, REAL* lower_val);} extern "C" { void evalVStripExt(int n_left, REAL u_left, REAL* left_val, - int n_right, REAL u_right, REAL* right_val); + int n_right, REAL u_right, REAL* right_val); } #endif /**************begin for LOD_eval_list***********/ -void OpenGLSurfaceEvaluator::LOD_eval_list(int level) +void OpenGLSurfaceEvaluator::LOD_eval_list(int level) { if(level == 0) LOD_eval_level = 1; @@ -98,8 +98,8 @@ void OpenGLSurfaceEvaluator::LOD_eval_list(int level) } -OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() -{ +OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() +{ int i; for (i=0; i<VERTEX_CACHE_SIZE; i++) { @@ -120,7 +120,7 @@ OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() global_uorder_BV = 0; global_vorder_BV = 0; global_baseData = NULL; - + global_bpm = NULL; output_triangles = 0; //don't output triangles by default @@ -161,8 +161,8 @@ OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() #endif } -OpenGLSurfaceEvaluator::~OpenGLSurfaceEvaluator() -{ +OpenGLSurfaceEvaluator::~OpenGLSurfaceEvaluator() +{ for (int ii= 0; ii< VERTEX_CACHE_SIZE; ii++) { delete vertexCache[ii]; vertexCache[ii]= 0; @@ -197,11 +197,11 @@ void OpenGLSurfaceEvaluator::mapgrid2f(long nu, REAL u0, REAL u1, long nv, REAL v0, REAL v1) { #ifdef USE_INTERNAL_EVAL - inMapGrid2f((int) nu, (REAL) u0, (REAL) u1, (int) nv, + inMapGrid2f((int) nu, (REAL) u0, (REAL) u1, (int) nv, (REAL) v0, (REAL) v1); #else - if(output_triangles) + if(output_triangles) { global_grid_u0 = u0; global_grid_u1 = u1; @@ -211,7 +211,7 @@ OpenGLSurfaceEvaluator::mapgrid2f(long nu, REAL u0, REAL u1, long nv, REAL v0, R global_grid_nv = nv; } else - glMapGrid2d((GLint) nu, (GLdouble) u0, (GLdouble) u1, (GLint) nv, + glMapGrid2d((GLint) nu, (GLdouble) u0, (GLdouble) u1, (GLint) nv, (GLdouble) v0, (GLdouble) v1); #endif @@ -225,7 +225,7 @@ OpenGLSurfaceEvaluator::polymode(long style) switch(style) { default: case N_MESHFILL: - + glPolygonMode((GLenum) GL_FRONT_AND_BACK, (GLenum) GL_FILL); break; case N_MESHLINE: @@ -361,11 +361,11 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i /* *the algorithm works by scanning from left to right. *leftMostV: the left most of the remaining verteces (on both upper and lower). - * it could an element of upperVerts or lowerVerts. - *i: upperVerts[i] is the first vertex to the right of leftMostV on upper line - *j: lowerVerts[j] is the first vertex to the right of leftMostV on lower line + * it could an element of upperVerts or lowerVerts. + *i: upperVerts[i] is the first vertex to the right of leftMostV on upper line + *j: lowerVerts[j] is the first vertex to the right of leftMostV on lower line */ - + /*initialize i,j,and leftMostV */ if(upper_val[0] <= lower_val[0]) @@ -385,140 +385,140 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i leftMostV[1] = v_lower; } - + /*the main loop. - *the invariance is that: - *at the beginning of each loop, the meaning of i,j,and leftMostV are + *the invariance is that: + *at the beginning of each loop, the meaning of i,j,and leftMostV are *maintained */ while(1) { if(i >= n_upper) /*case1: no more in upper*/ - { - if(j<n_lower-1) /*at least two vertices in lower*/ - { - bgntfan(); + { + if(j<n_lower-1) /*at least two vertices in lower*/ + { + bgntfan(); coord2f(leftMostV[0], leftMostV[1]); // glNormal3fv(leftMostNormal); -// glVertex3fv(leftMostXYZ); +// glVertex3fv(leftMostXYZ); - while(j<n_lower){ + while(j<n_lower){ coord2f(lower_val[j], v_lower); // glNormal3fv(lowerNormal[j]); // glVertex3fv(lowerXYZ[j]); j++; - } - endtfan(); - } - break; /*exit the main loop*/ - } + } + endtfan(); + } + break; /*exit the main loop*/ + } else if(j>= n_lower) /*case2: no more in lower*/ - { - if(i<n_upper-1) /*at least two vertices in upper*/ - { - bgntfan(); + { + if(i<n_upper-1) /*at least two vertices in upper*/ + { + bgntfan(); coord2f(leftMostV[0], leftMostV[1]); // glNormal3fv(leftMostNormal); // glVertex3fv(leftMostXYZ); - - for(k=n_upper-1; k>=i; k--) /*reverse order for two-side lighting*/ + + for(k=n_upper-1; k>=i; k--) /*reverse order for two-side lighting*/ { coord2f(upper_val[k], v_upper); // glNormal3fv(upperNormal[k]); // glVertex3fv(upperXYZ[k]); } - endtfan(); - } - break; /*exit the main loop*/ - } + endtfan(); + } + break; /*exit the main loop*/ + } else /* case3: neither is empty, plus the leftMostV, there is at least one triangle to output*/ - { - if(upper_val[i] <= lower_val[j]) - { + { + if(upper_val[i] <= lower_val[j]) + { bgntfan(); coord2f(lower_val[j], v_lower); // glNormal3fv(lowerNormal[j]); // glVertex3fv(lowerXYZ[j]); - /*find the last k>=i such that - *upperverts[k][0] <= lowerverts[j][0] - */ - k=i; + /*find the last k>=i such that + *upperverts[k][0] <= lowerverts[j][0] + */ + k=i; - while(k<n_upper) - { - if(upper_val[k] > lower_val[j]) - break; - k++; + while(k<n_upper) + { + if(upper_val[k] > lower_val[j]) + break; + k++; - } - k--; + } + k--; - for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ - { + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { coord2f(upper_val[l], v_upper); // glNormal3fv(upperNormal[l]); // glVertex3fv(upperXYZ[l]); - } + } coord2f(leftMostV[0], leftMostV[1]); // glNormal3fv(leftMostNormal); // glVertex3fv(leftMostXYZ); - endtfan(); + endtfan(); - /*update i and leftMostV for next loop - */ - i = k+1; + /*update i and leftMostV for next loop + */ + i = k+1; leftMostV[0] = upper_val[k]; leftMostV[1] = v_upper; // leftMostNormal = upperNormal[k]; // leftMostXYZ = upperXYZ[k]; - } - else /*upperVerts[i][0] > lowerVerts[j][0]*/ - { + } + else /*upperVerts[i][0] > lowerVerts[j][0]*/ + { bgntfan(); coord2f(upper_val[i], v_upper); // glNormal3fv(upperNormal[i]); // glVertex3fv(upperXYZ[i]); - + coord2f(leftMostV[0], leftMostV[1]); -// glNormal3fv(leftMostNormal); +// glNormal3fv(leftMostNormal); // glVertex3fv(leftMostXYZ); - - - /*find the last k>=j such that - *lowerverts[k][0] < upperverts[i][0] - */ - k=j; - while(k< n_lower) - { - if(lower_val[k] >= upper_val[i]) - break; + + + /*find the last k>=j such that + *lowerverts[k][0] < upperverts[i][0] + */ + k=j; + while(k< n_lower) + { + if(lower_val[k] >= upper_val[i]) + break; coord2f(lower_val[k], v_lower); // glNormal3fv(lowerNormal[k]); // glVertex3fv(lowerXYZ[k]); - k++; - } - endtfan(); + k++; + } + endtfan(); - /*update j and leftMostV for next loop - */ - j=k; + /*update j and leftMostV for next loop + */ + j=k; leftMostV[0] = lower_val[j-1]; leftMostV[1] = v_lower; // leftMostNormal = lowerNormal[j-1]; // leftMostXYZ = lowerXYZ[j-1]; - } - } + } + } } - //clean up + //clean up // free(upperXYZ); // free(lowerXYZ); // free(upperNormal); @@ -526,7 +526,7 @@ OpenGLSurfaceEvaluator::evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, i #endif } - + void OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int n_right, REAL u_right, REAL* right_val) @@ -548,11 +548,11 @@ OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int /* *the algorithm works by scanning from bot to top. *botMostV: the bot most of the remaining verteces (on both left and right). - * it could an element of leftVerts or rightVerts. - *i: leftVerts[i] is the first vertex to the top of botMostV on left line + * it could an element of leftVerts or rightVerts. + *i: leftVerts[i] is the first vertex to the top of botMostV on left line *j: rightVerts[j] is the first vertex to the top of botMostV on rightline */ - + /*initialize i,j,and botMostV */ if(left_val[0] <= right_val[0]) @@ -573,142 +573,142 @@ OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int } /*the main loop. - *the invariance is that: - *at the beginning of each loop, the meaning of i,j,and botMostV are + *the invariance is that: + *at the beginning of each loop, the meaning of i,j,and botMostV are *maintained */ while(1) { if(i >= n_left) /*case1: no more in left*/ - { - if(j<n_right-1) /*at least two vertices in right*/ - { - bgntfan(); + { + if(j<n_right-1) /*at least two vertices in right*/ + { + bgntfan(); coord2f(botMostV[0], botMostV[1]); - while(j<n_right){ + while(j<n_right){ coord2f(u_right, right_val[j]); // glNormal3fv(rightNormal[j]); // glVertex3fv(rightXYZ[j]); j++; - } - endtfan(); - } - break; /*exit the main loop*/ - } + } + endtfan(); + } + break; /*exit the main loop*/ + } else if(j>= n_right) /*case2: no more in right*/ - { - if(i<n_left-1) /*at least two vertices in left*/ - { - bgntfan(); - coord2f(botMostV[0], botMostV[1]); + { + if(i<n_left-1) /*at least two vertices in left*/ + { + bgntfan(); + coord2f(botMostV[0], botMostV[1]); // glNormal3fv(botMostNormal); // glVertex3fv(botMostXYZ); - - for(k=n_left-1; k>=i; k--) /*reverse order for two-side lighting*/ + + for(k=n_left-1; k>=i; k--) /*reverse order for two-side lighting*/ { coord2f(u_left, left_val[k]); // glNormal3fv(leftNormal[k]); // glVertex3fv(leftXYZ[k]); } - endtfan(); - } - break; /*exit the main loop*/ - } + endtfan(); + } + break; /*exit the main loop*/ + } else /* case3: neither is empty, plus the botMostV, there is at least one triangle to output*/ - { - if(left_val[i] <= right_val[j]) - { + { + if(left_val[i] <= right_val[j]) + { bgntfan(); coord2f(u_right, right_val[j]); // glNormal3fv(rightNormal[j]); // glVertex3fv(rightXYZ[j]); - /*find the last k>=i such that - *leftverts[k][0] <= rightverts[j][0] - */ - k=i; + /*find the last k>=i such that + *leftverts[k][0] <= rightverts[j][0] + */ + k=i; - while(k<n_left) - { - if(left_val[k] > right_val[j]) - break; - k++; + while(k<n_left) + { + if(left_val[k] > right_val[j]) + break; + k++; - } - k--; + } + k--; - for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ - { + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { coord2f(u_left, left_val[l]); // glNormal3fv(leftNormal[l]); // glVertex3fv(leftXYZ[l]); - } + } coord2f(botMostV[0], botMostV[1]); // glNormal3fv(botMostNormal); // glVertex3fv(botMostXYZ); - endtfan(); + endtfan(); - /*update i and botMostV for next loop - */ - i = k+1; + /*update i and botMostV for next loop + */ + i = k+1; botMostV[0] = u_left; botMostV[1] = left_val[k]; // botMostNormal = leftNormal[k]; // botMostXYZ = leftXYZ[k]; - } - else /*left_val[i] > right_val[j])*/ - { + } + else /*left_val[i] > right_val[j])*/ + { bgntfan(); coord2f(u_left, left_val[i]); // glNormal3fv(leftNormal[i]); // glVertex3fv(leftXYZ[i]); - + coord2f(botMostV[0], botMostV[1]); -// glNormal3fv(botMostNormal); +// glNormal3fv(botMostNormal); // glVertex3fv(botMostXYZ); - - - /*find the last k>=j such that - *rightverts[k][0] < leftverts[i][0] - */ - k=j; - while(k< n_right) - { - if(right_val[k] >= left_val[i]) - break; + + + /*find the last k>=j such that + *rightverts[k][0] < leftverts[i][0] + */ + k=j; + while(k< n_right) + { + if(right_val[k] >= left_val[i]) + break; coord2f(u_right, right_val[k]); // glNormal3fv(rightNormal[k]); // glVertex3fv(rightXYZ[k]); - k++; - } - endtfan(); + k++; + } + endtfan(); - /*update j and botMostV for next loop - */ - j=k; + /*update j and botMostV for next loop + */ + j=k; botMostV[0] = u_right; botMostV[1] = right_val[j-1]; // botMostNormal = rightNormal[j-1]; // botMostXYZ = rightXYZ[j-1]; - } - } + } + } } - //clean up + //clean up // free(leftXYZ); // free(leftNormal); // free(rightXYZ); // free(rightNormal); #endif } - + void OpenGLSurfaceEvaluator::bgnqstrip(void) @@ -742,25 +742,25 @@ OpenGLSurfaceEvaluator::bgnmap2f(long) { if(output_triangles) { - /*deallocate the space which may has been + /*deallocate the space which may has been *allocated by global_bpm previously */ if(global_bpm != NULL) { bezierPatchMeshListDelete(global_bpm); global_bpm = NULL; } - + /* auto_normal_flag = 1; //always output normal in callback mode. - //we could have used the following code, - //but Inspector doesn't have gl context - //before it calls tessellator. - //this way is temporary. + //we could have used the following code, + //but Inspector doesn't have gl context + //before it calls tessellator. + //this way is temporary. */ //NEWCALLBACK //if one of the two normal callback functions are set, - //then set + //then set if(normalCallBackN != NULL || normalCallBackData != NULL) auto_normal_flag = 1; @@ -777,19 +777,19 @@ OpenGLSurfaceEvaluator::bgnmap2f(long) if(glIsEnabled(GL_AUTO_NORMAL) == GL_TRUE) auto_normal_flag = 1; else if (callback_auto_normal == 1) - auto_normal_flag = 1; + auto_normal_flag = 1; else auto_normal_flag = 0; */ //NEWCALLBACK: no need to worry about gl states when gling clalback } - else + else { glPushAttrib((GLbitfield) GL_EVAL_BIT); - + /*to avoid side effect, we restor the opengl state for GL_POLYGON_MODE - */ + */ glGetIntegerv(GL_POLYGON_MODE, gl_polygon_mode); } @@ -806,17 +806,17 @@ OpenGLSurfaceEvaluator::endmap2f(void) if(output_triangles) { //bezierPatchMeshListDelDeg(global_bpm); - + // bezierPatchMeshListEval(global_bpm); //surfcount++; //printf("surfcount=%i\n", surfcount); //if(surfcount == 8) exit(0); - + inBPMListEvalEM(global_bpm); - - - + + + /* global_bpm = bezierPatchMeshListReverse(global_bpm); { @@ -837,7 +837,7 @@ OpenGLSurfaceEvaluator::endmap2f(void) //bezierPatchMeshListPrint(global_bpm); //bezierPatchMeshListDraw(global_bpm); -// printf("num triangles=%i\n", bezierPatchMeshListNumTriangles(global_bpm)); +// printf("num triangles=%i\n", bezierPatchMeshListNumTriangles(global_bpm)); #ifdef USE_LOD #else @@ -873,20 +873,20 @@ glPopAttrib(); void OpenGLSurfaceEvaluator::map2f( long _type, - REAL _ulower, /* u lower domain coord */ + REAL _ulower, /* u lower domain coord */ REAL _uupper, /* u upper domain coord */ long _ustride, /* interpoint distance */ long _uorder, /* parametric order */ - REAL _vlower, /* v lower domain coord */ - REAL _vupper, /* v upper domain coord */ + REAL _vlower, /* v lower domain coord */ + REAL _vupper, /* v upper domain coord */ long _vstride, /* interpoint distance */ long _vorder, /* parametric order */ - REAL *pts) /* control points */ + REAL *pts) /* control points */ { #ifdef USE_INTERNAL_EVAL - inMap2f((int) _type, (REAL) _ulower, (REAL) _uupper, - (int) _ustride, (int) _uorder, (REAL) _vlower, - (REAL) _vupper, (int) _vstride, (int) _vorder, + inMap2f((int) _type, (REAL) _ulower, (REAL) _uupper, + (int) _ustride, (int) _uorder, (REAL) _vlower, + (REAL) _vupper, (int) _vstride, (int) _vorder, (REAL *) pts); #else @@ -897,7 +897,7 @@ OpenGLSurfaceEvaluator::map2f( if(global_bpm == NULL) global_bpm = bezierPatchMeshMake2(10,10); if( - (global_bpm->bpatch == NULL && + (global_bpm->bpatch == NULL && (_type == GL_MAP2_VERTEX_3 || _type == GL_MAP2_VERTEX_4)) || (global_bpm->bpatch_normal == NULL && @@ -922,7 +922,7 @@ OpenGLSurfaceEvaluator::map2f( global_bpm = bezierPatchMeshListInsert(global_bpm, temp); /* - global_bpm = bezierPatchMeshListInsert(global_bpm, + global_bpm = bezierPatchMeshListInsert(global_bpm, bezierPatchMeshMake( (int) _type, _ulower, _uupper,(int) _ustride, (int) _uorder, _vlower, _vupper, (int) _vstride, (int) _vorder, pts, 10, 10)); */ @@ -930,12 +930,12 @@ OpenGLSurfaceEvaluator::map2f( } else /*not output triangles*/ { - glMap2f((GLenum) _type, (GLfloat) _ulower, (GLfloat) _uupper, - (GLint) _ustride, (GLint) _uorder, (GLfloat) _vlower, - (GLfloat) _vupper, (GLint) _vstride, (GLint) _vorder, + glMap2f((GLenum) _type, (GLfloat) _ulower, (GLfloat) _uupper, + (GLint) _ustride, (GLint) _uorder, (GLfloat) _vlower, + (GLfloat) _vupper, (GLint) _vstride, (GLint) _vorder, (const GLfloat *) pts); } - + #endif } @@ -976,18 +976,18 @@ if(output_triangles) if(global_grid_nu == 0 || global_grid_nv == 0) return; /*no points need to be output*/ du = (global_grid_u1 - global_grid_u0) / (REAL)global_grid_nu; - dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; - + dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; + if(global_grid_nu >= global_grid_nv){ for(i=umin; i<umax; i++){ REAL u1 = (i==global_grid_nu)? global_grid_u1:(global_grid_u0 + i*du); REAL u2 = ((i+1) == global_grid_nu)? global_grid_u1: (global_grid_u0+(i+1)*du); - + bgnqstrip(); for(j=vmax; j>=vmin; j--){ REAL v1 = (j == global_grid_nv)? global_grid_v1: (global_grid_v0 +j*dv); - + coord2f(u1, v1); coord2f(u2, v1); } @@ -999,10 +999,10 @@ if(output_triangles) for(i=vmin; i<vmax; i++){ REAL v1 = (i==global_grid_nv)? global_grid_v1:(global_grid_v0 + i*dv); REAL v2 = ((i+1) == global_grid_nv)? global_grid_v1: (global_grid_v0+(i+1)*dv); - + bgnqstrip(); for(j=umax; j>=umin; j--){ - REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du); + REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du); coord2f(u1, v2); coord2f(u1, v1); } @@ -1016,15 +1016,15 @@ else switch(style) { default: case N_MESHFILL: - glEvalMesh2((GLenum) GL_FILL, (GLint) umin, (GLint) umax, + glEvalMesh2((GLenum) GL_FILL, (GLint) umin, (GLint) umax, (GLint) vmin, (GLint) vmax); break; case N_MESHLINE: - glEvalMesh2((GLenum) GL_LINE, (GLint) umin, (GLint) umax, + glEvalMesh2((GLenum) GL_LINE, (GLint) umin, (GLint) umax, (GLint) vmin, (GLint) vmax); break; case N_MESHPOINT: - glEvalMesh2((GLenum) GL_POINT, (GLint) umin, (GLint) umax, + glEvalMesh2((GLenum) GL_POINT, (GLint) umin, (GLint) umax, (GLint) vmin, (GLint) vmax); break; } @@ -1171,7 +1171,7 @@ return; if (vcount == 2) { vertexCache[0]->invoke(this); vertexCache[1]->invoke(this); - coord2f(u,v); + coord2f(u,v); } else { vcount++; diff --git a/src/glu/sgi/libnurbs/internals/arc.cc b/src/glu/sgi/libnurbs/internals/arc.cc index 845f05fab92..3b968303bdc 100644 --- a/src/glu/sgi/libnurbs/internals/arc.cc +++ b/src/glu/sgi/libnurbs/internals/arc.cc @@ -35,8 +35,8 @@ /* * arc.c++ * - * $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 $ + * $Date: 2003/10/14 23:48:57 $ $Revision: 1.3 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.cc,v 1.3 2003/10/14 23:48:57 kendallb Exp $ */ #include <stdio.h> @@ -50,11 +50,11 @@ #include "simplemath.h" /* local preprocessor definitions */ -#define ZERO 0.00001/*0.000001*/ +#define ZERO 0.00001/*0.000001*/ -const int Arc::bezier_tag = (1<<13); -const int Arc::arc_tag = (1<<3); -const int Arc::tail_tag = (1<<6); +const int Arc::bezier_tag = (1<<13); +const int Arc::arc_tag = (1<<3); +const int Arc::tail_tag = (1<<6); /*-------------------------------------------------------------------------- * makeSide - attach a pwl arc to an arc and mark it as a border arc @@ -72,7 +72,7 @@ Arc::makeSide( PwlArc *pwl, arc_side side ) clearbezier(); setside( side ); } - + /*-------------------------------------------------------------------------- * numpts - count number of points on arc loop @@ -100,7 +100,7 @@ void Arc::markverts( void ) { Arc_ptr jarc = this; - + do { TrimVertex *p = jarc->pwlArc->pts; for( int i=0; i<jarc->pwlArc->npts; i++ ) @@ -125,22 +125,22 @@ Arc::getextrema( Arc_ptr extrema[4] ) botpt = toppt = this->tail()[1]; for( Arc_ptr jarc = this->next; jarc != this; jarc = jarc->next ) { - if ( jarc->tail()[0] < leftpt || + if ( jarc->tail()[0] < leftpt || (jarc->tail()[0] <= leftpt && jarc->rhead()[0]<=leftpt)) { leftpt = jarc->pwlArc->pts->param[0]; extrema[1] = jarc; } - if ( jarc->tail()[0] > rightpt || + if ( jarc->tail()[0] > rightpt || (jarc->tail()[0] >= rightpt && jarc->rhead()[0] >= rightpt)) { rightpt = jarc->pwlArc->pts->param[0]; extrema[3] = jarc; } - if ( jarc->tail()[1] < botpt || - (jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt )) { + if ( jarc->tail()[1] < botpt || + (jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt )) { botpt = jarc->pwlArc->pts->param[1]; extrema[2] = jarc; } - if ( jarc->tail()[1] > toppt || + if ( jarc->tail()[1] > toppt || (jarc->tail()[1] >= toppt && jarc->rhead()[1] >= toppt)) { toppt = jarc->pwlArc->pts->param[1]; extrema[0] = jarc; @@ -160,7 +160,7 @@ Arc::show() #ifndef NDEBUG dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts ); for( int i = 0; i < pwlArc->npts; i++ ) { - dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0], + dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0], pwlArc->pts[i].param[1] ); } #endif @@ -176,13 +176,6 @@ Arc::print( void ) { Arc_ptr jarc = this; - if( ! this ) { -#ifndef NDEBUG - dprintf( "\n\nEMPTY TRIM\n\n" ); -#endif - return; - } - #ifndef NDEBUG dprintf( "BGNTRIM\n" ); #endif @@ -217,10 +210,10 @@ Arc::isDisconnected( void ) #endif return 1; } else { - /* average two points together */ - p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5; - p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5; - return 0; + /* average two points together */ + p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5; + p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5; + return 0; } } @@ -251,29 +244,29 @@ Arc::check( void ) do { assert( (jarc->pwlArc != 0) || (jarc->bezierArc != 0) ); - if (jarc->prev == 0 || jarc->next == 0) { + if (jarc->prev == 0 || jarc->next == 0) { #ifndef NDEBUG dprintf( "checkjarc:null next/prev pointer\n"); jarc->print( ); #endif return 0; - } + } - if (jarc->next->prev != jarc) { + if (jarc->next->prev != jarc) { #ifndef NDEBUG dprintf( "checkjarc: pointer linkage screwed up\n"); jarc->print( ); #endif return 0; - } + } - if( jarc->pwlArc ) { + if( jarc->pwlArc ) { #ifndef NDEBUG assert( jarc->pwlArc->npts >= 1 ); assert( jarc->pwlArc->npts < 100000 ); /* for( int i=0; i < jarc->pwlArc->npts-1; i++ ) - assert( neq_vert( jarc->pwlArc->pts[i].param, + assert( neq_vert( jarc->pwlArc->pts[i].param, jarc->pwlArc->pts[i+1].param) ); */ #endif @@ -287,7 +280,7 @@ Arc::check( void ) return 0; } if( jarc->tail()[0] != jarc->prev->rhead()[0] ) { - + #ifndef NDEBUG dprintf( "checkjarc: geometric linkage screwed up 2\n"); jarc->prev->show(); @@ -316,13 +309,13 @@ Arc::check( void ) } if( jarc->isbezier() ) { assert( jarc->pwlArc->npts == 2 ); - assert( (jarc->pwlArc->pts[0].param[0] == \ - jarc->pwlArc->pts[1].param[0]) ||\ - (jarc->pwlArc->pts[0].param[1] == \ - jarc->pwlArc->pts[1].param[1]) ); + assert( (jarc->pwlArc->pts[0].param[0] == \ + jarc->pwlArc->pts[1].param[0]) ||\ + (jarc->pwlArc->pts[0].param[1] == \ + jarc->pwlArc->pts[1].param[1]) ); } } - jarc = jarc->next; + jarc = jarc->next; } while (jarc != this); return 1; } @@ -347,9 +340,9 @@ Arc::append( Arc_ptr jarc ) if( jarc != 0 ) { next = jarc->next; prev = jarc; - next->prev = prev->next = this; + next->prev = prev->next = this; } else { - next = prev = this; + next = prev = this; } return this; } diff --git a/src/glu/sgi/libnurbs/internals/basiccrveval.cc b/src/glu/sgi/libnurbs/internals/basiccrveval.cc index 0d3d5aa8d38..24b33f0667c 100644 --- a/src/glu/sgi/libnurbs/internals/basiccrveval.cc +++ b/src/glu/sgi/libnurbs/internals/basiccrveval.cc @@ -35,15 +35,15 @@ /* * basiccrveval.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/basiccrveval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2003/10/14 23:48:57 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.cc,v 1.2 2003/10/14 23:48:57 kendallb Exp $ */ #include "mystdio.h" #include "types.h" #include "basiccrveval.h" -void +void BasicCurveEvaluator::domain1f( REAL, REAL ) { #ifndef NDEBUG @@ -51,15 +51,15 @@ BasicCurveEvaluator::domain1f( REAL, REAL ) #endif } -void -BasicCurveEvaluator::range1f( long type, REAL *, REAL * ) +void +BasicCurveEvaluator::range1f( long , REAL *, REAL * ) { #ifndef NDEBUG dprintf( "range1f\n" ); #endif } -void +void BasicCurveEvaluator::enable( long ) { #ifndef NDEBUG @@ -67,7 +67,7 @@ BasicCurveEvaluator::enable( long ) #endif } -void +void BasicCurveEvaluator::disable( long ) { #ifndef NDEBUG @@ -75,7 +75,7 @@ BasicCurveEvaluator::disable( long ) #endif } -void +void BasicCurveEvaluator::bgnmap1f( long ) { #ifndef NDEBUG @@ -83,7 +83,7 @@ BasicCurveEvaluator::bgnmap1f( long ) #endif } -void +void BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * ) { #ifndef NDEBUG @@ -91,7 +91,7 @@ BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * ) #endif } -void +void BasicCurveEvaluator::mapgrid1f( long, REAL, REAL ) { #ifndef NDEBUG @@ -99,7 +99,7 @@ BasicCurveEvaluator::mapgrid1f( long, REAL, REAL ) #endif } -void +void BasicCurveEvaluator::mapmesh1f( long, long, long ) { #ifndef NDEBUG @@ -107,7 +107,7 @@ BasicCurveEvaluator::mapmesh1f( long, long, long ) #endif } -void +void BasicCurveEvaluator::evalcoord1f( long, REAL ) { #ifndef NDEBUG @@ -115,7 +115,7 @@ BasicCurveEvaluator::evalcoord1f( long, REAL ) #endif } -void +void BasicCurveEvaluator::endmap1f( void ) { #ifndef NDEBUG @@ -123,7 +123,7 @@ BasicCurveEvaluator::endmap1f( void ) #endif } -void +void BasicCurveEvaluator::bgnline( void ) { #ifndef NDEBUG @@ -131,7 +131,7 @@ BasicCurveEvaluator::bgnline( void ) #endif } -void +void BasicCurveEvaluator::endline( void ) { #ifndef NDEBUG diff --git a/src/glu/sgi/libnurbs/internals/basicsurfeval.cc b/src/glu/sgi/libnurbs/internals/basicsurfeval.cc index 0ade6fa8f7d..f84d3b6074f 100644 --- a/src/glu/sgi/libnurbs/internals/basicsurfeval.cc +++ b/src/glu/sgi/libnurbs/internals/basicsurfeval.cc @@ -35,15 +35,19 @@ /* * basicsurfaceevaluator.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/basicsurfeval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2003/10/14 23:48:57 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.cc,v 1.2 2003/10/14 23:48:57 kendallb Exp $ */ #include "mystdio.h" #include "types.h" #include "basicsurfeval.h" -void +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif + +void BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL ) { #ifndef NDEBUG @@ -51,7 +55,7 @@ BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL ) #endif } -void +void BasicSurfaceEvaluator::polymode( long ) { #ifndef NDEBUG @@ -63,12 +67,12 @@ void BasicSurfaceEvaluator::range2f( long type, REAL *from, REAL *to ) { #ifndef NDEBUG - dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n", + dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n", type, from[0], from[1], to[0], to[1] ); #endif } -void +void BasicSurfaceEvaluator::enable( long ) { #ifndef NDEBUG @@ -76,7 +80,7 @@ BasicSurfaceEvaluator::enable( long ) #endif } -void +void BasicSurfaceEvaluator::disable( long ) { #ifndef NDEBUG @@ -84,7 +88,7 @@ BasicSurfaceEvaluator::disable( long ) #endif } -void +void BasicSurfaceEvaluator::bgnmap2f( long ) { #ifndef NDEBUG @@ -92,7 +96,7 @@ BasicSurfaceEvaluator::bgnmap2f( long ) #endif } -void +void BasicSurfaceEvaluator::endmap2f( void ) { #ifndef NDEBUG @@ -100,8 +104,8 @@ BasicSurfaceEvaluator::endmap2f( void ) #endif } -void -BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, +void +BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, REAL, REAL, long, long, REAL * ) { @@ -110,7 +114,7 @@ BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, #endif } -void +void BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL ) { #ifndef NDEBUG @@ -118,7 +122,7 @@ BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL ) #endif } -void +void BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long ) { #ifndef NDEBUG @@ -126,7 +130,7 @@ BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long ) #endif } -void +void BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL ) { #ifndef NDEBUG @@ -134,7 +138,7 @@ BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL ) #endif } -void +void BasicSurfaceEvaluator::evalpoint2i( long, long ) { #ifndef NDEBUG @@ -142,7 +146,7 @@ BasicSurfaceEvaluator::evalpoint2i( long, long ) #endif } -void +void BasicSurfaceEvaluator::bgnline( void ) { #ifndef NDEBUG @@ -150,7 +154,7 @@ BasicSurfaceEvaluator::bgnline( void ) #endif } -void +void BasicSurfaceEvaluator::endline( void ) { #ifndef NDEBUG @@ -158,7 +162,7 @@ BasicSurfaceEvaluator::endline( void ) #endif } -void +void BasicSurfaceEvaluator::bgnclosedline( void ) { #ifndef NDEBUG @@ -166,7 +170,7 @@ BasicSurfaceEvaluator::bgnclosedline( void ) #endif } -void +void BasicSurfaceEvaluator::endclosedline( void ) { #ifndef NDEBUG @@ -174,7 +178,7 @@ BasicSurfaceEvaluator::endclosedline( void ) #endif } -void +void BasicSurfaceEvaluator::bgntfan( void ) { #ifndef NDEBUG @@ -182,13 +186,13 @@ BasicSurfaceEvaluator::bgntfan( void ) #endif } -void +void BasicSurfaceEvaluator::endtfan( void ) { } -void +void BasicSurfaceEvaluator::bgntmesh( void ) { #ifndef NDEBUG @@ -196,7 +200,7 @@ BasicSurfaceEvaluator::bgntmesh( void ) #endif } -void +void BasicSurfaceEvaluator::swaptmesh( void ) { #ifndef NDEBUG @@ -204,7 +208,7 @@ BasicSurfaceEvaluator::swaptmesh( void ) #endif } -void +void BasicSurfaceEvaluator::endtmesh( void ) { #ifndef NDEBUG @@ -212,7 +216,7 @@ BasicSurfaceEvaluator::endtmesh( void ) #endif } -void +void BasicSurfaceEvaluator::bgnqstrip( void ) { #ifndef NDEBUG @@ -220,7 +224,7 @@ BasicSurfaceEvaluator::bgnqstrip( void ) #endif } -void +void BasicSurfaceEvaluator::endqstrip( void ) { #ifndef NDEBUG diff --git a/src/glu/sgi/libnurbs/internals/coveandtiler.cc b/src/glu/sgi/libnurbs/internals/coveandtiler.cc index 61ca3b8f70f..9297d3fc21f 100644 --- a/src/glu/sgi/libnurbs/internals/coveandtiler.cc +++ b/src/glu/sgi/libnurbs/internals/coveandtiler.cc @@ -35,8 +35,8 @@ /* * coveandtiler.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/coveandtiler.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $ + * $Date: 2003/10/14 23:48:57 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/coveandtiler.cc,v 1.2 2003/10/14 23:48:57 kendallb Exp $ */ #include "glimports.h" @@ -52,7 +52,7 @@ const int CoveAndTiler::MAXSTRIPSIZE = 1000; CoveAndTiler::CoveAndTiler( Backend& b ) - : backend( b ) + : backend( b ) { } CoveAndTiler::~CoveAndTiler( void ) @@ -76,19 +76,19 @@ CoveAndTiler::output( GridTrimVertex& g ) backend.tmeshvert( &g ); } -void +void CoveAndTiler::coveAndTile( void ) { long ustart = (top.ustart >= bot.ustart) ? top.ustart : bot.ustart; - long uend = (top.uend <= bot.uend) ? top.uend : bot.uend; + long uend = (top.uend <= bot.uend) ? top.uend : bot.uend; if( ustart <= uend ) { tile( bot.vindex, ustart, uend ); - if( top.ustart >= bot.ustart ) + if( top.ustart >= bot.ustart ) coveUpperLeft(); - else + else coveLowerLeft(); - - if( top.uend <= bot.uend ) + + if( top.uend <= bot.uend ) coveUpperRight(); else coveLowerRight(); @@ -126,7 +126,7 @@ CoveAndTiler::coveAndTile( void ) } else { tllv.set( bot.ustart-1, top.vindex ); } - coveLowerLeftNoGrid( tl ); + coveLowerLeftNoGrid( tl ); } TrimVertex brv, trv, *br, *tr; @@ -158,7 +158,7 @@ CoveAndTiler::coveAndTile( void ) br = rl; brrv.set( rl ); if( rf->param[0] < uarray.uarray[bot.uend+1] ) { - assert( rf->param[0] >= uarray.uarray[bot.uend] ); + assert( rf->param[0] >= uarray.uarray[bot.uend] ); trrv.set( rf ); } else { trrv.set( bot.uend+1, top.vindex ); @@ -179,7 +179,7 @@ CoveAndTiler::coveAndTile( void ) } } -void +void CoveAndTiler::tile( long vindex, long ustart, long uend ) { long numsteps = uend - ustart; @@ -195,7 +195,7 @@ CoveAndTiler::tile( long vindex, long ustart, long uend ) } } -void +void CoveAndTiler::coveUpperRight( void ) { GridVertex tgv( top.uend, top.vindex ); @@ -207,7 +207,7 @@ CoveAndTiler::coveUpperRight( void ) output( tgv ); backend.swaptmesh(); output( gv ); - coveUR(); + coveUR(); backend.endtmesh(); } @@ -215,15 +215,15 @@ void CoveAndTiler::coveUpperRightNoGrid( TrimVertex* br ) { backend.bgntmesh( "coveUpperRight" ); - output( right.first() ); + output( right.first() ); output( right.next() ); backend.swaptmesh(); output( br ); - coveUR(); + coveUR(); backend.endtmesh(); } -void +void CoveAndTiler::coveUR( ) { GridVertex gv( top.uend, bot.vindex ); @@ -238,7 +238,7 @@ CoveAndTiler::coveUR( ) backend.swaptmesh(); } } else while( 1 ) { - if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { + if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { output( vert ); backend.swaptmesh(); vert = right.next(); @@ -250,7 +250,7 @@ CoveAndTiler::coveUR( ) for( ; vert; vert = right.next() ) { output( vert ); backend.swaptmesh(); - } + } break; } } @@ -269,7 +269,7 @@ CoveAndTiler::coveUpperLeft( void ) output( left.next() ); output( gv ); backend.swaptmesh(); - coveUL(); + coveUL(); backend.endtmesh(); } @@ -277,15 +277,15 @@ void CoveAndTiler::coveUpperLeftNoGrid( TrimVertex* bl ) { backend.bgntmesh( "coveUpperLeftNoGrid" ); - output( left.first() ); + output( left.first() ); output( left.next() ); output( bl ); backend.swaptmesh(); - coveUL(); + coveUL(); backend.endtmesh(); } -void +void CoveAndTiler::coveUL() { GridVertex gv( top.ustart, bot.vindex ); @@ -318,7 +318,7 @@ CoveAndTiler::coveUL() } } -void +void CoveAndTiler::coveLowerLeft( void ) { GridVertex bgv( bot.ustart, bot.vindex ); @@ -330,7 +330,7 @@ CoveAndTiler::coveLowerLeft( void ) output( bgv ); backend.swaptmesh(); output( gv ); - coveLL(); + coveLL(); backend.endtmesh(); } @@ -338,15 +338,15 @@ void CoveAndTiler::coveLowerLeftNoGrid( TrimVertex* tl ) { backend.bgntmesh( "coveLowerLeft" ); - output( left.last() ); + output( left.last() ); output( left.prev() ); backend.swaptmesh(); output( tl ); - coveLL( ); + coveLL( ); backend.endtmesh(); } -void +void CoveAndTiler::coveLL() { GridVertex gv( bot.ustart, top.vindex ); @@ -360,7 +360,7 @@ CoveAndTiler::coveLL() backend.swaptmesh(); } } else while( 1 ) { - if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){ + if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){ output( vert ); backend.swaptmesh(); vert = left.prev(); @@ -369,29 +369,29 @@ CoveAndTiler::coveLL() backend.swaptmesh(); output( gv ); if( gv.prevu() == top.ustart ) { - for( ; vert; vert = left.prev() ) { + for( ; vert; vert = left.prev() ) { output( vert ); backend.swaptmesh(); - } - break; + } + break; } } } } -void +void CoveAndTiler::coveLowerRight( void ) { GridVertex bgv( bot.uend, bot.vindex ); GridVertex gv( bot.uend, top.vindex ); right.last(); - backend.bgntmesh( "coveLowerRight" ); + backend.bgntmesh( "coveLowerRight" ); output( bgv ); output( right.prev() ); output( gv ); backend.swaptmesh(); - coveLR(); + coveLR(); backend.endtmesh( ); } @@ -399,15 +399,15 @@ void CoveAndTiler::coveLowerRightNoGrid( TrimVertex* tr ) { backend.bgntmesh( "coveLowerRIght" ); - output( right.last() ); + output( right.last() ); output( right.prev() ); output( tr ); backend.swaptmesh(); - coveLR(); + coveLR(); backend.endtmesh(); } -void +void CoveAndTiler::coveLR( ) { GridVertex gv( bot.uend, top.vindex ); @@ -421,7 +421,7 @@ CoveAndTiler::coveLR( ) output( vert ); } } else while( 1 ) { - if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { + if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { backend.swaptmesh(); output( vert ); vert = right.prev(); @@ -430,11 +430,11 @@ CoveAndTiler::coveLR( ) output( gv ); backend.swaptmesh(); if( gv.nextu() == top.uend ) { - for( ; vert; vert = right.prev() ) { + for( ; vert; vert = right.prev() ) { backend.swaptmesh(); output( vert ); - } - break; + } + break; } } } diff --git a/src/glu/sgi/libnurbs/internals/knotvector.cc b/src/glu/sgi/libnurbs/internals/knotvector.cc index b48efbd4bfa..3e047456f5c 100644 --- a/src/glu/sgi/libnurbs/internals/knotvector.cc +++ b/src/glu/sgi/libnurbs/internals/knotvector.cc @@ -35,8 +35,8 @@ /* * knotvector.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/knotvector.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $ + * $Date: 2003/10/14 23:48:57 $ $Revision: 1.2 $ + * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/knotvector.cc,v 1.2 2003/10/14 23:48:57 kendallb Exp $ */ #include "glimports.h" @@ -45,17 +45,20 @@ #include "knotvector.h" #include "defines.h" +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif void Knotvector::init( long _knotcount, long _stride, long _order, INREAL *_knotlist ) { - knotcount = _knotcount; - stride = _stride; - order = _order; + knotcount = _knotcount; + stride = _stride; + order = _order; knotlist = new Knot[_knotcount]; assert( knotlist != 0 ); for( int i = 0; i != _knotcount; i++ ) - knotlist[i] = (Knot) _knotlist[i]; + knotlist[i] = (Knot) _knotlist[i]; } Knotvector::Knotvector( void ) @@ -70,7 +73,7 @@ Knotvector::~Knotvector( void ) int Knotvector::validate( void ) { - /* kindex is used as an array index so subtract one first, + /* kindex is used as an array index so subtract one first, * this propagates throughout the code so study carefully */ long kindex = knotcount-1; @@ -85,7 +88,7 @@ int Knotvector::validate( void ) } if( identical( knotlist[kindex-(order-1)], knotlist[order-1]) ) { - // valid knot range is empty + // valid knot range is empty return( 3 ); } @@ -94,33 +97,33 @@ int Knotvector::validate( void ) // decreasing knot sequence return( 4 ); } - + /* check for valid multiplicity */ /* kindex is currently the index of the last knot. * In the next loop it is decremented to ignore the last knot - * and the loop stops when kindex is 2 so as to ignore the first - * knot as well. These knots are not used in computing - * knot multiplicities. + * and the loop stops when kindex is 2 so as to ignore the first + * knot as well. These knots are not used in computing + * knot multiplicities. */ long multi = 1; for( ; kindex >= 1; kindex-- ) { if( knotlist[kindex] - knotlist[kindex-1] < TOLERANCE ) { - multi++; + multi++; continue; - } + } if ( multi > order ) { - // knot multiplicity greater than order of spline + // knot multiplicity greater than order of spline return( 5 ); - } + } multi = 1; } if ( multi > order ) { - // knot multiplicity greater than order of spline + // knot multiplicity greater than order of spline return( 5 ); - } + } return 0; } @@ -128,7 +131,7 @@ int Knotvector::validate( void ) void Knotvector::show( char *msg ) { #ifndef NDEBUG - dprintf( "%s\n", msg ); + dprintf( "%s\n", msg ); dprintf( "order = %ld, count = %ld\n", order, knotcount ); for( int i=0; i<knotcount; i++ ) diff --git a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc index 81e01049154..18720458305 100644 --- a/src/glu/sgi/libnurbs/nurbtess/directedLine.cc +++ b/src/glu/sgi/libnurbs/nurbtess/directedLine.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -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/11/29 16:16:55 $ $Revision: 1.2 $ +** $Date: 2003/10/14 23:48:57 $ $Revision: 1.3 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/directedLine.cc,v 1.3 2003/10/14 23:48:57 kendallb Exp $ */ #include <stdlib.h> @@ -47,6 +47,10 @@ #include "directedLine.h" #include "polyDBG.h" +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif + //we must return the newLine directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end) { @@ -61,10 +65,10 @@ directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end) delete end->sline; delete begin; delete end; - + return ret; } - + directedLine* newLine; sampledLine* sline = new sampledLine(begin->head(), end->tail()); newLine = new directedLine(INCREASING, sline); @@ -85,9 +89,9 @@ directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end) void directedLine::deleteSingleLine(directedLine* dline) { - //make sure that dline->prev->tail is the same as + //make sure that dline->prev->tail is the same as //dline->next->head. This is for numerical erros. - //for example, if we delete a line which is almost degeneate + //for example, if we delete a line which is almost degeneate //within (epsilon), then we want to make that the polygon after deletion //is still a valid polygon @@ -107,18 +111,18 @@ static Int myequal(Real a[2], Real b[2]) if(a[0]==b[0] && a[1] == b[1]) return 1; else - return 0; + return 0; */ - + if(fabs(a[0]-b[0]) < 0.00001 && fabs(a[1]-b[1]) < 0.00001) return 1; else return 0; - + } - + directedLine* directedLine::deleteDegenerateLines() { //if there is only one edge or two edges, don't do anything @@ -136,7 +140,7 @@ directedLine* directedLine::deleteDegenerateLines() head()[1] != tail()[1]) */ first = this; - else + else { for(temp = this->next; temp != this; temp = temp->next) { @@ -149,7 +153,7 @@ directedLine* directedLine::deleteDegenerateLines() first = temp; break; } - + } } @@ -164,17 +168,17 @@ directedLine* directedLine::deleteDegenerateLines() for(temp =first->next; temp != first; temp = tempNext) { tempNext = temp->getNext(); -/* +/* if(temp->head()[0] == temp->tail()[0] && temp->head()[1] == temp->tail()[1]) -*/ +*/ if(myequal(temp->head(), temp->tail())) deleteSingleLine(temp); - } + } return first; } - + directedLine* directedLine::deleteDegenerateLinesAllPolygons() { directedLine* temp; @@ -188,7 +192,7 @@ directedLine* directedLine::deleteDegenerateLinesAllPolygons() if(ret == NULL) { ret = retEnd = temp->deleteDegenerateLines(); - + } else { @@ -277,7 +281,7 @@ void directedLine::deletePolygonList() temp->deleteSinglePolygon(); } } - + /*a loop by itself*/ directedLine::directedLine(short dir, sampledLine* sl) @@ -289,7 +293,7 @@ directedLine::directedLine(short dir, sampledLine* sl) nextPolygon = NULL; // prevPolygon = NULL; rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ - + rootLink = NULL; } @@ -305,7 +309,7 @@ directedLine::directedLine() next = this; prev = this; nextPolygon = NULL; - rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ + rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ rootLink = NULL; } @@ -344,7 +348,7 @@ Int directedLine::numEdges() Int ret=0; directedLine* temp; if(next == this) return 1; - + ret = 1; for(temp = next; temp != this; temp = temp->next) ret++; @@ -373,7 +377,7 @@ short directedLine::isPolygon() /*check this edge*/ if(! isConnected()) return 0; - + /*check all other edges*/ for(temp=next; temp != this; temp = temp->next){ if(!isConnected()) return 0; @@ -381,14 +385,14 @@ short directedLine::isPolygon() return 1; } -/*check if the head of this edge is connected to +/*check if the head of this edge is connected to *the tail of the prev */ short directedLine::isConnected() { if( (head()[0] == prev->tail()[0]) && (head()[1] == prev->tail()[1])) return 1; - else + else return 0; } @@ -410,9 +414,9 @@ Int compV2InX(Real A[2], Real B[2]) /*compare two vertices NOT lines! *A vertex is the head of a directed line. - *(x_1, y_1) <= (x_2, y_2) if + *(x_1, y_1) <= (x_2, y_2) if *either y_1 < y_2 - *or y_1 == y_2 && x_1 < x_2. + *or y_1 == y_2 && x_1 < x_2. *return -1 if this->head() <= nl->head(), *return 1 otherwise */ @@ -425,9 +429,9 @@ Int directedLine::compInY(directedLine* nl) /*compare two vertices NOT lines! *A vertex is the head of a directed line. - *(x_1, y_1) <= (x_2, y_2) if + *(x_1, y_1) <= (x_2, y_2) if *either x_1 < x_2 - *or x_1 == x_2 && y_1 < y_2. + *or x_1 == x_2 && y_1 < y_2. *return -1 if this->head() <= nl->head(), *return 1 otherwise */ @@ -467,8 +471,8 @@ void directedLine::printSingle() { if(direction == INCREASING) printf("direction is INCREASING\n"); - else - printf("direction is DECREASING\n"); + else + printf("direction is DECREASING\n"); printf("head=%f,%f)\n", head()[0], head()[1]); sline->print(); } @@ -515,7 +519,7 @@ directedLine* directedLine::cutoffPolygon(directedLine *p) for(temp=this; temp != p; temp = temp->nextPolygon) { - if(temp == NULL) + if(temp == NULL) { fprintf(stderr, "in cutoffPolygon, not found\n"); exit(1); @@ -531,7 +535,7 @@ directedLine* directedLine::cutoffPolygon(directedLine *p) else { prev_polygon->nextPolygon = p->nextPolygon; return this; - } + } } Int directedLine::numPolygons() @@ -539,9 +543,9 @@ Int directedLine::numPolygons() if(nextPolygon == NULL) return 1; else return 1+nextPolygon->numPolygons(); } - -/*let array[index ...] denote + +/*let array[index ...] denote *all the edges in this polygon *return the next available index of array. */ @@ -555,8 +559,8 @@ Int directedLine::toArraySinglePolygon(directedLine** array, Int index) } return index; } - -/*the space is allocated. The caller is responsible for + +/*the space is allocated. The caller is responsible for *deallocate the space. *total_num_edges is set to be the total number of edges of all polygons */ @@ -602,14 +606,14 @@ Real directedLine::polyArea() /*******************split or combine polygons begin********************/ /*conect a diagonal of a single simple polygon or two simple polygons. *If the two vertices v1 (head) and v2 (head) are in the same simple polygon, - *then we actually split the simple polygon into two polygons. + *then we actually split the simple polygon into two polygons. *If instead two vertices velong to two difference polygons, *then we combine the two polygons into one polygon. - *It is upto the caller to decide whether this is a split or a + *It is upto the caller to decide whether this is a split or a *combination. * *Case Split: - *split a single simple polygon into two simple polygons by + *split a single simple polygon into two simple polygons by *connecting a diagonal (two vertices). *v1, v2: the two vertices are the head() of the two directedLines. * this routine generates one new sampledLine which is returned in @@ -625,11 +629,11 @@ Real directedLine::polyArea() *the returned polygon is returned in ret_p1. */ /*ARGSUSED*/ -void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, - directedLine** ret_p1, +void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, + directedLine** ret_p1, directedLine** ret_p2, sampledLine** generatedLine, - directedLine* polygonList ) + directedLine* polygonList ) { sampledLine *nsline = new sampledLine(2); @@ -637,7 +641,7 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, nsline->setPoint(0, v1->head()); nsline->setPoint(1, v2->head()); - + /*the increasing line is from v1 head to v2 head*/ @@ -651,12 +655,12 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, directedLine* v1Prev = v1->prev; directedLine* v2Prev = v2->prev; - v1 ->prev = newLineDec; + v1 ->prev = newLineDec; v2Prev ->next = newLineDec; newLineDec->next = v1; newLineDec->prev = v2Prev; - v2 ->prev = newLineInc; + v2 ->prev = newLineInc; v1Prev ->next = newLineInc; newLineInc->next = v2; newLineInc->prev = v1Prev; @@ -668,19 +672,19 @@ void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, //see the function connectDiangle /*ARGSUSED*/ -void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, - directedLine** ret_p1, +void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, + directedLine** ret_p1, directedLine** ret_p2, - directedLine* polygonList ) + directedLine* polygonList ) { sampledLine *nsline = new sampledLine(2); - sampledLine *nsline2 = new sampledLine(2); + sampledLine *nsline2 = new sampledLine(2); nsline->setPoint(0, v1->head()); nsline->setPoint(1, v2->head()); nsline2->setPoint(0, v1->head()); nsline2->setPoint(1, v2->head()); - + /*the increasing line is from v1 head to v2 head*/ directedLine* newLineInc = new directedLine(INCREASING, nsline); @@ -689,12 +693,12 @@ void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, directedLine* v1Prev = v1->prev; directedLine* v2Prev = v2->prev; - v1 ->prev = newLineDec; + v1 ->prev = newLineDec; v2Prev ->next = newLineDec; newLineDec->next = v1; newLineDec->prev = v2Prev; - v2 ->prev = newLineInc; + v2 ->prev = newLineInc; v1Prev ->next = newLineInc; newLineInc->next = v2; newLineInc->prev = v1Prev; @@ -793,7 +797,7 @@ directedLine* readAllPolygons(char* filename) Int nPolygons; fscanf(fp, "%i", &nPolygons); directedLine *ret = NULL; - + for(i=0; i<nPolygons; i++) { Int nEdges; @@ -810,7 +814,7 @@ directedLine* readAllPolygons(char* filename) sampledLine *sLine = new sampledLine(2, vert); directedLine *thisPoly = new directedLine(INCREASING, sLine); thisPoly->rootLinkSet(NULL); - + directedLine *dLine; for(j=2; j<nEdges; j++) { @@ -830,7 +834,7 @@ dLine->rootLinkSet(thisPoly); dLine = new directedLine(INCREASING, sLine); dLine->rootLinkSet(thisPoly); thisPoly->insert(dLine); - + ret = thisPoly->insertPolygon(ret); } fclose(fp); diff --git a/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc b/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc index e4a65c2eb3c..76f1076623c 100644 --- a/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc +++ b/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc @@ -6,21 +6,21 @@ ** this file except in compliance with the License. You may obtain a copy ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: -** +** ** http://oss.sgi.com/projects/FreeB -** +** ** Note that, as provided in the License, the Software is distributed on an ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. -** +** ** Original Code. The Original Code is: OpenGL Sample Implementation, ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. ** Copyright in any portions created by third parties is as indicated ** elsewhere herein. All Rights Reserved. -** +** ** Additional Notice Provisions: The application programming interfaces ** established by SGI in conjunction with the Original Code are The ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released @@ -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/11/29 16:16:55 $ $Revision: 1.2 $ +** $Date: 2003/10/14 23:48:57 $ $Revision: 1.3 $ */ /* -** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.2 2001/11/29 16:16:55 kschultz Exp $ +** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc,v 1.3 2003/10/14 23:48:57 kendallb Exp $ */ #include <stdlib.h> @@ -43,6 +43,11 @@ #include "zlassert.h" #include "polyDBG.h" +#ifdef __WATCOMC__ +#pragma warning 14 10 +#pragma warning 391 10 +#pragma warning 726 10 +#endif static Real area(Real A[2], Real B[2], Real C[2]) { @@ -71,7 +76,7 @@ Int DBG_is_U_monotone(directedLine* poly) { Int n_changes = 0; Int prev_sign; - Int cur_sign; + Int cur_sign; directedLine* temp; cur_sign = compV2InX(poly->tail(), poly->head()); @@ -119,7 +124,7 @@ Int DBG_is_U_direction(directedLine* poly) if(temp->head()[0] == temp->tail()[0]) V_count += temp->get_npoints(); else if(temp->head()[1] == temp->tail()[1]) - U_count += temp->get_npoints(); + U_count += temp->get_npoints(); */ } @@ -142,7 +147,7 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) (l1->tail()[1] - l1->head()[1])*(l2->tail()[1]-l2->head()[1]) >=0) return 0; //not intersect else - return 1; + return 1; } //else we use the normal code } @@ -154,8 +159,8 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) (l2->tail()[1] - l2->head()[1])*(l1->tail()[1]-l1->head()[1]) >=0) return 0; //not intersect else - return 1; - } + return 1; + } //else we use the normal code } else //the two edges are not connected @@ -165,11 +170,11 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) (l1->tail()[0] == l2->tail()[0] && l1->tail()[1] == l2->tail()[1])) return 1; - + } - - if( + + if( ( area(l1->head(), l1->tail(), l2->head()) * @@ -184,7 +189,7 @@ Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) ) ) return 1; - else + else return 0; } @@ -207,7 +212,7 @@ Int DBG_edgesIntersectGen(Real A[2], Real B[2], Real C[2], Real D[2]) else return 0; } - + /*determien whether (A,B) interesect chain[start] to [end] */ Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B[2]) @@ -216,13 +221,13 @@ Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B for(i=start; i<=end-2; i++) if(DBG_edgesIntersectGen(chain->getVertex(i), chain->getVertex(i+1), A, B)) return 1; - + return 0; } /*determine whether a polygon intersect itself or not *return 1 is it does, - * 0 otherwise + * 0 otherwise */ Int DBG_polygonSelfIntersect(directedLine* poly) { @@ -235,7 +240,7 @@ Int DBG_polygonSelfIntersect(directedLine* poly) { return 1; } - + } for(temp1=poly->getNext(); temp1 != poly; temp1 = temp1->getNext()) @@ -261,7 +266,7 @@ Int DBG_edgeIntersectPoly(directedLine* edge, directedLine* poly) return 1; return 0; } - + /*check whether two polygons intersect */ Int DBG_polygonsIntersect(directedLine* p1, directedLine* p2) @@ -291,7 +296,7 @@ Int DBG_polygonListIntersect(directedLine* pList) if(DBG_polygonsIntersect(temp, temp2)) return 1; } - + return 0; } @@ -303,16 +308,16 @@ Int DBG_isCounterclockwise(directedLine* poly) /*ray: v0 with direction (dx,dy). *edge: v1-v2. - * the extra point v10[2] is given for the information at + * the extra point v10[2] is given for the information at *v1. Basically this edge is connectd to edge - * v10-v1. If v1 is on the ray, + * v10-v1. If v1 is on the ray, * then we need v10 to determine whether this ray intersects - * the edge or not (that is, return 1 or return 0). + * the edge or not (that is, return 1 or return 0). * If v1 is on the ray, then if v2 and v10 are on the same side of the ray, * we return 0, otherwise return 1. *For v2, if v2 is on the ray, we always return 0. *Notice that v1 and v2 are not symmetric. So the edge is directed!!! - * The purpose for this convention is such that: a point is inside a polygon + * The purpose for this convention is such that: a point is inside a polygon * if and only if it intersets with odd number of edges. */ Int DBG_rayIntersectEdge(Real v0[2], Real dx, Real dy, Real v10[2], Real v1[2], Real v2[2]) @@ -330,17 +335,17 @@ if( (v1[1] >= v0[1] && v2[1]<= v0[1] ) /*if the ray is parallel to the edge, return 0: not intersect*/ - if(denom == 0.0) + if(denom == 0.0) return 0; /*if v0 is on the edge, return 0: not intersect*/ - if(nomRay == 0.0) + if(nomRay == 0.0) return 0; - + /*if v1 is on the positive ray, and the neighbor of v1 crosses the ray *return 1: intersect */ - if(nomEdge == 0) + if(nomEdge == 0) { /*v1 is on the positive or negative ray*/ /* @@ -351,7 +356,7 @@ if( (v1[1] >= v0[1] && v2[1]<= v0[1] ) { if(area(v0, v1, v10) * area(v0, v1, v2) >0) return 0; - else + else return 1; } else /*v1 on negative ray*/ @@ -378,10 +383,10 @@ Int DBG_rayIntersectPoly(Real v0[2], Real dx, Real dy, directedLine* poly) Int count=0; if(DBG_rayIntersectEdge(v0, dx, dy, poly->getPrev()->head(), poly->head(), poly->tail())) count++; - + for(temp=poly->getNext(); temp != poly; temp = temp->getNext()) if(DBG_rayIntersectEdge(v0, dx, dy, temp->getPrev()->head(), temp->head(), temp->tail())) - count++; + count++; /*printf("ray intersect poly: count=%i\n", count);*/ return count; } @@ -398,8 +403,8 @@ poly->printList(); == (DBG_rayIntersectPoly(v,1,Real(0.1234), poly) % 2 ) ); if(DBG_rayIntersectPoly(v, 1, 0, poly) % 2 == 1) - return 1; - else + return 1; + else return 0; } @@ -410,8 +415,8 @@ Int DBG_enclosingPolygons(directedLine* poly, directedLine* list) { directedLine* temp; Int count=0; -/* -printf("%i\n", DBG_pointInsidePoly(poly->head(), +/* +printf("%i\n", DBG_pointInsidePoly(poly->head(), list->getNextPolygon() ->getNextPolygon() ->getNextPolygon() @@ -423,15 +428,15 @@ printf("%i\n", DBG_pointInsidePoly(poly->head(), { if(poly != temp) if(DBG_pointInsidePoly(poly->head(), temp)) - count++; -/* printf("count=%i\n", count);*/ + count++; +/* printf("count=%i\n", count);*/ } return count; } void DBG_reverse(directedLine* poly) { - if(poly->getDirection() == INCREASING) + if(poly->getDirection() == INCREASING) poly->putDirection(DECREASING); else poly->putDirection(INCREASING); @@ -443,7 +448,7 @@ void DBG_reverse(directedLine* poly) directedLine* temp; for(temp=oldNext; temp!=poly; temp = oldNext) { - if(temp->getDirection() == INCREASING) + if(temp->getDirection() == INCREASING) temp->putDirection(DECREASING); else temp->putDirection(INCREASING); @@ -512,7 +517,7 @@ Int DBG_check(directedLine *polyList) correctDir = 0; /*clockwise*/ Int actualDir = DBG_isCounterclockwise(temp); - + if(correctDir != actualDir) { fprintf(stderr, "DBG_check: polygon with incorrect orientations. reversed\n"); @@ -526,7 +531,7 @@ Int DBG_check(directedLine *polyList) /**************handle self intersections*****************/ //determine whether e interects [begin, end] or not -static directedLine* DBG_edgeIntersectChainD(directedLine *e, +static directedLine* DBG_edgeIntersectChainD(directedLine *e, directedLine *begin, directedLine *end) { directedLine *temp; @@ -537,10 +542,10 @@ static directedLine* DBG_edgeIntersectChainD(directedLine *e, } if(DBG_edgesIntersect(e, end)) return end; - return NULL; + return NULL; } -//given a polygon, cut the edges off and finally obtain a +//given a polygon, cut the edges off and finally obtain a //a polygon without intersections. The cut-off edges are //dealloated. The new polygon is returned. directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) @@ -563,7 +568,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) Int n=5; buf[0] = interc->tail()[0]; buf[1] = interc->tail()[1]; - + for(i=1; i<n; i++) { Real r = ((Real)i) / ((Real) n); @@ -591,7 +596,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) { cutOccur = 1; begin->deleteSingleLine(next); - + if(begin != end) { if(DBG_polygonSelfIntersect(begin)) @@ -615,7 +620,7 @@ directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) return begin; } -//given a polygon, cut the edges off and finally obtain a +//given a polygon, cut the edges off and finally obtain a //a polygon without intersections. The cut-off edges are //dealloated. The new polygon is returned. static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) @@ -642,7 +647,7 @@ static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) crt=crt->deleteChain(crt, crt->getNext()); } else - { + { //now we know crt and crt->getNext do not intersect begin = crt; end = crt->getNext(); @@ -651,8 +656,8 @@ static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) for(temp=end->getNext(); temp!=begin; temp= temp->getNext()) { //printf("temp=(%f,%f)\n", temp->head()[0], temp->head()[1]); - directedLine *intersect = DBG_edgeIntersectChainD(temp, begin, end); - if(intersect != NULL) + directedLine *intersect = DBG_edgeIntersectChainD(temp, begin, end); + if(intersect != NULL) { crt = crt->deleteChain(intersect, temp); find=1; @@ -686,7 +691,7 @@ directedLine* DBG_cutIntersectionAllPoly(directedLine* list) if(left != NULL) ret=left->insertPolygon(ret); } - return ret; + return ret; } sampledLine* DBG_collectSampledLinesAllPoly(directedLine *polygonList) @@ -709,7 +714,7 @@ sampledLine* DBG_collectSampledLinesAllPoly(directedLine *polygonList) DBG_collectSampledLinesPoly(temp, tempHead, tempTail); cTail->insert(tempHead); cTail = tempTail; - } + } return cHead; } @@ -721,7 +726,7 @@ void DBG_collectSampledLinesPoly(directedLine *polygon, sampledLine*& retHead, retTail = NULL; if(polygon == NULL) return; - + retHead = retTail = polygon->getSampledLine(); for(temp = polygon->getNext(); temp != polygon; temp=temp->getNext()) { |