diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2002-06-30 16:58:11 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2002-06-30 16:58:11 +0000 |
commit | 89f9cf8addb7f6d36f466ffdcd622b70fa607ffb (patch) | |
tree | a303eb3e8e753430874a4b0153003a73f8730581 /src/glu/sgi/libnurbs/internals/slicer.cc | |
parent | c2fa38d5aeb73f99572cc0fdf4d0c987a9c401a1 (diff) |
Added divide by zero check (Jon Perry). Remove dead vars. Fix indentation.
Diffstat (limited to 'src/glu/sgi/libnurbs/internals/slicer.cc')
-rw-r--r-- | src/glu/sgi/libnurbs/internals/slicer.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/glu/sgi/libnurbs/internals/slicer.cc b/src/glu/sgi/libnurbs/internals/slicer.cc index 70dd550972..0d7149144d 100644 --- a/src/glu/sgi/libnurbs/internals/slicer.cc +++ b/src/glu/sgi/libnurbs/internals/slicer.cc @@ -35,8 +35,8 @@ /* * slicer.c++ * - * $Date: 2001/05/01 14:56:00 $ $Revision: 1.2 $ - * $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.2 2001/05/01 14:56:00 brianp Exp $ + * $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 $ */ #include <stdlib.h> @@ -309,7 +309,6 @@ static void triangulateRectAux(PwlArc* top, PwlArc* bot, PwlArc* left, PwlArc* r static void triangulateRect(Arc_ptr loop, Backend& backend, int TB_or_LR, int ulinear, int vlinear) { - int i; //we know the loop is a rectangle, but not sure which is top Arc_ptr top, bot, left, right; if(loop->tail()[1] == loop->head()[1]) @@ -572,8 +571,6 @@ static void triangulateRectCenter(int n_ulines, REAL* u_val, int n_vlines, REAL* v_val, Backend& backend) { - TrimVertex trimVert; - trimVert.nuid = 0;//???? // XXX this code was patched by Diego Santa Cruz <Diego.SantaCruz@epfl.ch> // to fix a problem in which glMapGrid2f() was called with bad parameters. @@ -1075,18 +1072,21 @@ void Slicer::slice_new(Arc_ptr loop) mydu = (du>0)? du: -du; mydv = (dv>0)? dv: -dv; - for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next) - { - - if(jarc->tail()[0] < uMin) - uMin = jarc->tail()[0]; - if(jarc->tail()[0] > uMax) - uMax = jarc->tail()[0]; - if(jarc->tail()[1] < vMin) - vMin = jarc->tail()[1]; - if(jarc->tail()[1] > vMax) - vMax = jarc->tail()[1]; - } + for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next) + { + + if(jarc->tail()[0] < uMin) + uMin = jarc->tail()[0]; + if(jarc->tail()[0] > uMax) + uMax = jarc->tail()[0]; + if(jarc->tail()[1] < vMin) + vMin = jarc->tail()[1]; + if(jarc->tail()[1] > vMax) + vMax = jarc->tail()[1]; + } + + if (uMax == uMin) + return; // prevent divide-by-zero. Jon Perry. 17 June 2002 if(mydu > uMax - uMin) num_ulines = 2; |