ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

intersect.cc
Go to the documentation of this file.
00001 /*
00002 ** License Applicability. Except to the extent portions of this file are
00003 ** made subject to an alternative license as permitted in the SGI Free
00004 ** Software License B, Version 1.1 (the "License"), the contents of this
00005 ** file are subject only to the provisions of the License. You may not use
00006 ** this file except in compliance with the License. You may obtain a copy
00007 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
00008 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
00009 **
00010 ** http://oss.sgi.com/projects/FreeB
00011 **
00012 ** Note that, as provided in the License, the Software is distributed on an
00013 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
00014 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
00015 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
00016 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
00017 **
00018 ** Original Code. The Original Code is: OpenGL Sample Implementation,
00019 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
00020 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
00021 ** Copyright in any portions created by third parties is as indicated
00022 ** elsewhere herein. All Rights Reserved.
00023 **
00024 ** Additional Notice Provisions: The application programming interfaces
00025 ** established by SGI in conjunction with the Original Code are The
00026 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
00027 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
00028 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
00029 ** Window System(R) (Version 1.3), released October 19, 1998. This software
00030 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
00031 ** published by SGI, but has not been independently verified as being
00032 ** compliant with the OpenGL(R) version 1.2.1 Specification.
00033 */
00034 
00035 /*
00036  * intersect.c++
00037  *
00038  * $Date: 2011-05-15 15:51:26 +0000 (Sun, 15 May 2011) $ $Revision: 1.1 $
00039  * $Header: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/glu32/libnurbs/internals/intersect.cc,v 1.1 2004/02/02 16:39:11 navaraf Exp $
00040  */
00041 
00042 #include "glimports.h"
00043 #include "myassert.h"
00044 #include "mystdio.h"
00045 #include "subdivider.h"
00046 #include "arc.h"
00047 #include "bin.h"
00048 #include "backend.h"
00049 #include "trimvertpool.h"
00050 
00051 /*#define NOTDEF*/
00052 
00053 enum i_result { INTERSECT_VERTEX, INTERSECT_EDGE };
00054 
00055 /* local functions */
00056 static int      arc_classify( Arc_ptr, int, REAL );
00057 static enum i_result    pwlarc_intersect( PwlArc *, int, REAL, int, int[3] );
00058 
00059 
00060 void
00061 Subdivider::partition( Bin & bin, Bin & left, Bin & intersections, 
00062             Bin & right, Bin & unknown, int param, REAL value )
00063 {
00064     Bin headonleft, headonright, tailonleft, tailonright;
00065 
00066     for( Arc_ptr jarc = bin.removearc(); jarc; jarc = bin.removearc() ) {
00067 
00068     REAL tdiff = jarc->tail()[param] - value;
00069     REAL hdiff = jarc->head()[param] - value;
00070 
00071     if( tdiff > 0.0 ) {
00072         if( hdiff > 0.0 ) {
00073         right.addarc( jarc  );
00074         } else if( hdiff == 0.0 ) {
00075         tailonright.addarc( jarc  );
00076         } else {
00077             Arc_ptr jtemp;
00078         switch( arc_split(jarc, param, value, 0) ) {
00079             case 2:
00080             tailonright.addarc( jarc  );
00081             headonleft.addarc( jarc->next  );
00082             break;
00083             case 31:
00084             assert( jarc->head()[param] > value );
00085             right.addarc( jarc  );
00086             tailonright.addarc( jtemp = jarc->next  );
00087             headonleft.addarc( jtemp->next  );
00088                 break;
00089             case 32:
00090             assert( jarc->head()[param] <= value );
00091             tailonright .addarc( jarc  );
00092             headonleft.addarc( jtemp = jarc->next  );
00093             left.addarc( jtemp->next  );
00094             break;
00095             case 4:
00096             right.addarc( jarc  );
00097             tailonright.addarc( jtemp = jarc->next  );
00098             headonleft.addarc( jtemp = jtemp->next  );
00099             left.addarc( jtemp->next  );
00100         }
00101         }
00102     } else if( tdiff == 0.0 ) {
00103         if( hdiff > 0.0 ) {
00104         headonright.addarc( jarc  );
00105         } else if( hdiff == 0.0 ) {
00106         unknown.addarc( jarc  );
00107         } else {
00108         headonleft.addarc( jarc  );
00109         }
00110     } else {
00111         if( hdiff > 0.0 ) {
00112             Arc_ptr jtemp;
00113         switch( arc_split(jarc, param, value, 1) ) {
00114             case 2:
00115             tailonleft.addarc( jarc  );
00116             headonright.addarc( jarc->next  );
00117             break;
00118             case 31:
00119             assert( jarc->head()[param] < value );
00120             left.addarc( jarc  );
00121             tailonleft.addarc( jtemp = jarc->next  );
00122             headonright.addarc( jtemp->next  );
00123             break;
00124             case 32:
00125             assert( jarc->head()[param] >= value );
00126             tailonleft.addarc( jarc  );
00127             headonright.addarc( jtemp = jarc->next  );
00128             right.addarc( jtemp->next  );
00129             break;
00130             case 4:
00131             left.addarc( jarc  );
00132             tailonleft.addarc( jtemp = jarc->next  );
00133             headonright.addarc( jtemp = jtemp->next  );
00134             right.addarc( jtemp->next  );
00135         }
00136         } else if( hdiff == 0.0 ) {
00137         tailonleft.addarc( jarc  );
00138         } else {
00139         left.addarc( jarc  );
00140         }
00141     }
00142     }
00143     if( param == 0 ) {
00144     classify_headonleft_s( headonleft, intersections, left, value );
00145     classify_tailonleft_s( tailonleft, intersections, left, value );
00146     classify_headonright_s( headonright, intersections, right, value );
00147     classify_tailonright_s( tailonright, intersections, right, value );
00148     } else {
00149     classify_headonleft_t( headonleft, intersections, left, value );
00150     classify_tailonleft_t( tailonleft, intersections, left, value );
00151     classify_headonright_t( headonright, intersections, right, value );
00152     classify_tailonright_t( tailonright, intersections, right, value );
00153     }
00154 }
00155 
00156 inline static void 
00157 vert_interp( TrimVertex *n, TrimVertex *l, TrimVertex *r, int p, REAL val )
00158 {
00159     assert( val > l->param[p]);
00160     assert( val < r->param[p]);
00161 
00162     n->nuid = l->nuid;
00163 
00164     n->param[p] = val;
00165     if( l->param[1-p] != r->param[1-p]  ) {
00166     REAL ratio = (val - l->param[p]) / (r->param[p] - l->param[p]);
00167     n->param[1-p] = l->param[1-p] + 
00168                 ratio * (r->param[1-p] - l->param[1-p]);
00169     } else {
00170     n->param[1-p] = l->param[1-p];
00171     }
00172 }
00173     
00174 int
00175 Subdivider::arc_split( Arc_ptr jarc, int param, REAL value, int dir )
00176 {
00177     int     maxvertex = jarc->pwlArc->npts;
00178     Arc_ptr jarc1;
00179     TrimVertex* v = jarc->pwlArc->pts;
00180 
00181     int     loc[3] = {0,0,0};
00182 
00183     switch( pwlarc_intersect( jarc->pwlArc, param, value, dir, loc ) ) {
00184 
00185         // When the parameter value lands on a vertex, life is sweet
00186     case INTERSECT_VERTEX: {
00187         jarc1 = new(arcpool) Arc( jarc, new( pwlarcpool) PwlArc( maxvertex-loc[1], &v[loc[1]] ) );
00188         jarc->pwlArc->npts = loc[1] + 1;
00189         jarc1->next = jarc->next;
00190         jarc1->next->prev = jarc1;
00191         jarc->next = jarc1;
00192         jarc1->prev = jarc;
00193         assert(jarc->check() != 0);
00194         return 2;
00195     }
00196 
00197         // When the parameter value intersects an edge, we have to
00198         // interpolate a new vertex.  There are special cases
00199         // if the new vertex is adjacent to one or both of the
00200         // endpoints of the arc.
00201     case INTERSECT_EDGE: {
00202         int i, j;
00203         if( dir == 0 ) {
00204         i = loc[0];
00205         j = loc[2];
00206         } else {
00207         i = loc[2];
00208         j = loc[0];
00209         }
00210 
00211 #ifndef NOTDEF
00212         // The split is between vertices at index j and i, in that
00213         // order (j < i)
00214         
00215         // JEB:  This code is my idea of how to do the split without
00216         // increasing the number of links.  I'm doing this so that
00217         // the is_rect routine can recognize rectangles created by
00218         // subdivision.  In exchange for simplifying the curve list,
00219             // however, it costs in allocated space and vertex copies.
00220         
00221         TrimVertex *newjunk = trimvertexpool.get(maxvertex -i+1 /*-j*/);
00222         int k;
00223         for(k=0; k<maxvertex-i; k++)
00224           {
00225         newjunk[k+1] = v[i+k];
00226         newjunk[k+1].nuid = jarc->nuid;
00227           }
00228         
00229         TrimVertex *vcopy = trimvertexpool.get(maxvertex);
00230         for(k=0; k<maxvertex; k++)
00231           {
00232         vcopy[k].param[0] = v[k].param[0];
00233         vcopy[k].param[1] = v[k].param[1];
00234           }
00235         jarc->pwlArc->pts=vcopy;
00236 
00237         v[i].nuid = jarc->nuid;
00238         v[j].nuid = jarc->nuid;
00239         vert_interp( &newjunk[0], &v[loc[0]], &v[loc[2]], param, value );
00240 
00241         if( showingDegenerate() )
00242         backend.triangle( &v[i], &newjunk[0], &v[j] );
00243 
00244             vcopy[j+1].param[0]=newjunk[0].param[0];
00245             vcopy[j+1].param[1]=newjunk[0].param[1];
00246 
00247 
00248         jarc1 = new(arcpool) Arc( jarc,
00249             new(pwlarcpool) PwlArc(maxvertex-i+1 , newjunk ) );
00250 
00251         jarc->pwlArc->npts = j+2;
00252         jarc1->next = jarc->next;
00253         jarc1->next->prev = jarc1;
00254         jarc->next = jarc1;
00255         jarc1->prev = jarc;
00256         assert(jarc->check() != 0);
00257 
00258         return 2;
00259 #endif //not NOTDEF
00260         // JEB: This is the original version:
00261 #ifdef NOTDEF
00262 
00263         TrimVertex *newjunk = trimvertexpool.get(3);
00264         v[i].nuid = jarc->nuid;
00265         v[j].nuid = jarc->nuid;
00266         newjunk[0] = v[j];
00267         newjunk[2] = v[i];
00268         vert_interp( &newjunk[1], &v[loc[0]], &v[loc[2]], param, value );
00269 
00270         if( showingDegenerate() )
00271         backend.triangle( &newjunk[2], &newjunk[1], &newjunk[0] );
00272 
00273         // New vertex adjacent to both endpoints
00274         if (maxvertex == 2) {
00275         jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
00276         jarc->pwlArc->npts = 2;
00277         jarc->pwlArc->pts = newjunk;
00278         jarc1->next = jarc->next;
00279         jarc1->next->prev = jarc1;
00280         jarc->next = jarc1;
00281         jarc1->prev = jarc;
00282         assert(jarc->check() != 0);
00283 
00284         return 2;
00285 
00286         // New vertex adjacent to ending point of arc
00287         } else if (maxvertex - j == 2) {
00288         jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk ) );
00289         jarc2 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
00290         jarc->pwlArc->npts = maxvertex-1;
00291         jarc2->next = jarc->next;
00292         jarc2->next->prev = jarc2;
00293         jarc->next = jarc1;
00294         jarc1->prev = jarc;
00295         jarc1->next = jarc2;
00296         jarc2->prev = jarc1;
00297         assert(jarc->check() != 0);
00298         return 31;
00299 
00300         // New vertex adjacent to starting point of arc
00301         } else if (i == 1) {
00302         jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
00303         jarc2 = new(arcpool) Arc( jarc, 
00304             new(pwlarcpool) PwlArc( maxvertex-1, &jarc->pwlArc->pts[1] ) );
00305         jarc->pwlArc->npts = 2;
00306         jarc->pwlArc->pts = newjunk;
00307         jarc2->next = jarc->next;
00308         jarc2->next->prev = jarc2;
00309         jarc->next = jarc1;
00310         jarc1->prev = jarc;
00311         jarc1->next = jarc2;
00312         jarc2->prev = jarc1;
00313         assert(jarc->check() != 0);
00314         return 32;
00315 
00316         // It's somewhere in the middle
00317         } else {
00318         jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk ) );
00319         jarc2 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) );
00320         jarc3 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( maxvertex-i, v+i ) );
00321         jarc->pwlArc->npts = j + 1;
00322         jarc3->next = jarc->next;
00323         jarc3->next->prev = jarc3;
00324         jarc->next = jarc1;
00325         jarc1->prev = jarc;
00326         jarc1->next = jarc2;
00327         jarc2->prev = jarc1;
00328         jarc2->next = jarc3;
00329         jarc3->prev = jarc2;
00330         assert(jarc->check() != 0);
00331         return 4;
00332         }
00333 #endif // NOTDEF
00334     }
00335     default:
00336     return -1; //picked -1 since it's not used
00337     }
00338 }
00339 
00340 /*----------------------------------------------------------------------------
00341  * pwlarc_intersect -  find intersection of pwlArc and isoparametric line
00342  *----------------------------------------------------------------------------
00343  */
00344 
00345 static enum i_result
00346 pwlarc_intersect(
00347     PwlArc *pwlArc,
00348     int param,
00349     REAL value,
00350     int dir,
00351     int loc[3] )
00352 {
00353     assert( pwlArc->npts > 0 );
00354 
00355     if( dir ) {
00356     TrimVertex *v = pwlArc->pts;
00357     int imin = 0; 
00358     int imax = pwlArc->npts - 1;
00359     assert( value > v[imin].param[param] );
00360     assert( value < v[imax].param[param] ); 
00361     while( (imax - imin) > 1 ) {
00362         int imid = (imax + imin)/2;
00363         if( v[imid].param[param] > value )
00364         imax = imid;
00365         else if( v[imid].param[param] < value )
00366         imin = imid;
00367         else {
00368         loc[1] = imid;
00369         return INTERSECT_VERTEX;
00370         }
00371     }
00372     loc[0] = imin;
00373     loc[2] = imax;
00374     return INTERSECT_EDGE;
00375     } else {
00376     TrimVertex *v = pwlArc->pts;
00377     int imax = 0; 
00378     int imin = pwlArc->npts - 1;
00379     assert( value > v[imin].param[param] );
00380     assert( value < v[imax].param[param] ); 
00381     while( (imin - imax) > 1 ) {
00382         int imid = (imax + imin)/2;
00383         if( v[imid].param[param] > value )
00384         imax = imid;
00385         else if( v[imid].param[param] < value )
00386         imin = imid;
00387         else {
00388         loc[1] = imid;
00389         return INTERSECT_VERTEX;
00390         }
00391     }
00392     loc[0] = imin;
00393     loc[2] = imax;
00394     return INTERSECT_EDGE;
00395     }
00396 }
00397 
00398 /*----------------------------------------------------------------------------
00399  * arc_classify - determine which side of a line a jarc lies 
00400  *----------------------------------------------------------------------------
00401  */
00402 
00403 static int
00404 arc_classify( Arc_ptr jarc, int param, REAL value )
00405 {
00406     REAL tdiff, hdiff;
00407     if( param == 0 ) {
00408     tdiff = jarc->tail()[0] - value;
00409     hdiff = jarc->head()[0] - value;
00410     } else {
00411     tdiff = jarc->tail()[1] - value;
00412     hdiff = jarc->head()[1] - value;
00413     }
00414 
00415     if( tdiff > 0.0 ) {
00416     if( hdiff > 0.0 ) {
00417         return 0x11;
00418     } else if( hdiff == 0.0 ) {
00419         return 0x12;
00420     } else {
00421         return 0x10;
00422     }
00423     } else if( tdiff == 0.0 ) {
00424     if( hdiff > 0.0 ) {
00425         return 0x21;
00426     } else if( hdiff == 0.0 ) {
00427         return 0x22;
00428     } else {
00429         return 0x20;
00430     }
00431     } else {
00432     if( hdiff > 0.0 ) {
00433         return 0x01;
00434     } else if( hdiff == 0.0 ) {
00435         return 0x02;
00436     } else {
00437         return 0;
00438     }
00439     }
00440 }
00441 
00442 void
00443 Subdivider::classify_tailonleft_s( Bin& bin, Bin& in, Bin& out, REAL val )
00444 {
00445     /* tail at left, head on line */
00446     Arc_ptr j;
00447 
00448     while( (j = bin.removearc()) != NULL ) {
00449     assert( arc_classify( j, 0, val ) == 0x02 );
00450     j->clearitail();
00451 
00452     REAL diff = j->next->head()[0] - val;
00453     if( diff > 0.0 ) {
00454         in.addarc( j );
00455     } else if( diff < 0.0 ) {
00456         if( ccwTurn_sl( j, j->next ) )
00457         out.addarc( j );
00458         else
00459         in.addarc( j );
00460     } else {
00461         if( j->next->tail()[1] > j->next->head()[1] ) 
00462         in.addarc(j);
00463         else
00464         out.addarc(j);
00465     }
00466     }
00467 }
00468 
00469 void
00470 Subdivider::classify_tailonleft_t( Bin& bin, Bin& in, Bin& out, REAL val )
00471 {
00472     /* tail at left, head on line */
00473     Arc_ptr j;
00474 
00475     while( (j = bin.removearc()) != NULL ) {
00476     assert( arc_classify( j, 1, val ) == 0x02 );
00477     j->clearitail();
00478 
00479         REAL diff = j->next->head()[1] - val;
00480     if( diff > 0.0 ) {
00481         in.addarc( j );
00482     } else if( diff < 0.0 ) {
00483         if( ccwTurn_tl( j, j->next ) )
00484         out.addarc( j );
00485         else
00486         in.addarc( j );
00487     } else {
00488         if (j->next->tail()[0] > j->next->head()[0] )
00489         out.addarc( j );
00490         else
00491         in.addarc( j );
00492     }
00493     }
00494 }
00495 
00496 void
00497 Subdivider::classify_headonleft_s( Bin& bin, Bin& in, Bin& out, REAL val )
00498 {
00499     /* tail on line, head at left */
00500     Arc_ptr j;
00501 
00502     while( (j = bin.removearc()) != NULL ) {
00503     assert( arc_classify( j, 0, val ) == 0x20 );
00504 
00505     j->setitail();
00506 
00507     REAL diff = j->prev->tail()[0] - val;
00508     if( diff > 0.0 ) {
00509         out.addarc( j );
00510     } else if( diff < 0.0 ) {
00511         if( ccwTurn_sl( j->prev, j ) )
00512         out.addarc( j );
00513         else
00514         in.addarc( j );
00515     } else {
00516         if( j->prev->tail()[1] > j->prev->head()[1] )
00517         in.addarc( j );
00518         else
00519         out.addarc( j );
00520     }
00521     }
00522 }
00523 
00524 void
00525 Subdivider::classify_headonleft_t( Bin& bin, Bin& in, Bin& out, REAL val )
00526 {
00527     /* tail on line, head at left */
00528     Arc_ptr j;
00529 
00530     while( (j = bin.removearc()) != NULL ) {
00531     assert( arc_classify( j, 1, val ) == 0x20 );
00532     j->setitail();
00533 
00534     REAL diff = j->prev->tail()[1] - val;
00535     if( diff > 0.0 ) {
00536         out.addarc( j );
00537     } else if( diff < 0.0 ) {
00538         if( ccwTurn_tl( j->prev, j ) )
00539         out.addarc( j );
00540         else
00541         in.addarc( j );
00542     } else {
00543         if( j->prev->tail()[0] > j->prev->head()[0] )
00544         out.addarc( j );
00545         else
00546         in.addarc( j );
00547     }
00548     }
00549 }
00550 
00551 
00552 void
00553 Subdivider::classify_tailonright_s( Bin& bin, Bin& in, Bin& out, REAL val )
00554 {
00555     /* tail at right, head on line */
00556     Arc_ptr j;
00557 
00558     while( (j = bin.removearc()) != NULL ) {
00559     assert( arc_classify( j, 0, val ) == 0x12);
00560     
00561     j->clearitail();
00562 
00563         REAL diff = j->next->head()[0] - val;
00564     if( diff > 0.0 ) {
00565         if( ccwTurn_sr( j, j->next ) )
00566         out.addarc( j );
00567         else
00568         in.addarc( j );
00569     } else if( diff < 0.0 ) {
00570         in.addarc( j );
00571     } else {
00572         if( j->next->tail()[1] > j->next->head()[1] ) 
00573         out.addarc( j );
00574         else
00575         in.addarc( j );
00576     }
00577     }
00578 }
00579 
00580 void
00581 Subdivider::classify_tailonright_t( Bin& bin, Bin& in, Bin& out, REAL val )
00582 {
00583     /* tail at right, head on line */
00584     Arc_ptr j;
00585 
00586     while( (j = bin.removearc()) != NULL ) {
00587     assert( arc_classify( j, 1, val ) == 0x12);
00588     
00589     j->clearitail();
00590 
00591     REAL diff =  j->next->head()[1] - val;
00592     if( diff > 0.0 ) {
00593         if( ccwTurn_tr( j, j->next ) )
00594         out.addarc( j );
00595         else
00596         in.addarc( j );
00597     } else if( diff < 0.0 ) { 
00598         in.addarc( j );
00599     } else {
00600         if( j->next->tail()[0] > j->next->head()[0] ) 
00601         in.addarc( j );
00602         else
00603         out.addarc( j );
00604     }
00605     }
00606 }
00607 
00608 void
00609 Subdivider::classify_headonright_s( Bin& bin, Bin& in, Bin& out, REAL val )
00610 {
00611     /* tail on line, head at right */
00612     Arc_ptr j;
00613 
00614     while( (j = bin.removearc()) != NULL ) {
00615     assert( arc_classify( j, 0, val ) == 0x21 );
00616     
00617     j->setitail();
00618 
00619         REAL diff = j->prev->tail()[0] - val;
00620     if( diff > 0.0 ) { 
00621         if( ccwTurn_sr( j->prev, j ) )
00622         out.addarc( j );
00623         else
00624         in.addarc( j );
00625     } else if( diff < 0.0 ) {
00626         out.addarc( j );
00627     } else {
00628         if( j->prev->tail()[1] > j->prev->head()[1] )
00629         out.addarc( j );
00630         else
00631         in.addarc( j );
00632     }
00633     }
00634 }
00635 
00636 void
00637 Subdivider::classify_headonright_t( Bin& bin, Bin& in, Bin& out, REAL val )
00638 {
00639     /* tail on line, head at right */
00640     Arc_ptr j;
00641 
00642     while( (j = bin.removearc()) != NULL ) {
00643     assert( arc_classify( j, 1, val ) == 0x21 );
00644     
00645     j->setitail();
00646 
00647         REAL diff = j->prev->tail()[1] - val;
00648     if( diff > 0.0 ) { 
00649         if( ccwTurn_tr( j->prev, j ) )
00650         out.addarc( j );
00651         else
00652         in.addarc( j );
00653     } else if( diff < 0.0 ) {
00654         out.addarc( j );
00655     } else {
00656         if( j->prev->tail()[0] > j->prev->head()[0] )
00657         in.addarc( j );
00658         else
00659         out.addarc( j );
00660     }
00661     }
00662 }
00663 

Generated on Sat May 26 2012 04:22:16 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.