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

sampleCompRight.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 ** $Date: 2006-03-12 00:07:02 +0000 (Sun, 12 Mar 2006) $ $Revision: 1.1 $
00035 */
00036 /*
00037 ** $Header: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/glu32/libnurbs/nurbtess/sampleCompRight.cc,v 1.1 2004/02/02 16:39:14 navaraf Exp $
00038 */
00039 
00040 #include <stdlib.h>
00041 #include <stdio.h>
00042 #include "gluos.h"
00043 #include "glimports.h"
00044 #include "zlassert.h"
00045 #include "sampleCompRight.h"
00046 
00047 #define max(a,b) ((a>b)? a:b)
00048 #define min(a,b) ((a>b)? b:a)
00049 
00050 
00051 
00052 #ifdef NOT_TAKEOUT
00053 
00054 /*notice that we need leftChain because the 
00055  *corners could be on the leftChain.
00056  */
00057 void sampleCompRight(Real* topVertex, Real* botVertex,
00058             vertexArray* leftChain,
00059             Int leftStartIndex, Int leftEndIndex,
00060             vertexArray* rightChain,
00061             Int rightStartIndex, Int rightEndIndex,
00062             gridBoundaryChain* rightGridChain,
00063             Int gridIndex1, Int gridIndex2,
00064             Int up_rightCornerWhere,
00065             Int up_rightCornerIndex,
00066             Int down_rightCornerWhere,
00067             Int down_rightCornerIndex,
00068             primStream* pStream)
00069 {
00070   /*find out whether there is a trim vertex  which is
00071    *inbetween the top and bot grid lines or not.
00072    */
00073   Int midIndex1;
00074   Int midIndex2;
00075   Int gridMidIndex1 =0, gridMidIndex2 =0;
00076   //midIndex1: array[i] <= v, array[i+1] > v
00077   //midIndex2: array[i] >= v,  array[i+1] < v
00078   midIndex1 = rightChain->findIndexBelowGen(rightGridChain->get_v_value(gridIndex1),
00079                         rightStartIndex,
00080                         rightEndIndex);
00081   midIndex2 = -1; //initilization
00082   if(midIndex1 <= rightEndIndex && gridIndex1 < gridIndex2)
00083     if(rightChain->getVertex(midIndex1)[1] >= rightGridChain->get_v_value(gridIndex2))
00084       {
00085     //midIndex2 must exist:
00086     midIndex2 = rightChain->findIndexAboveGen(rightGridChain->get_v_value(gridIndex2),
00087                           midIndex1, //midIndex1<=midIndex2
00088                           rightEndIndex);
00089     //find gridMidIndex1 so that either it=gridIndex1 when the gridline is 
00090     // at the same height as trim vertex midIndex1, or it is the last one 
00091     //which is strictly above midIndex1.
00092     {
00093       Real temp = rightChain->getVertex(midIndex1)[1];
00094       if(rightGridChain->get_v_value(gridIndex1) == temp)
00095         gridMidIndex1 = gridIndex1;
00096       else
00097         {
00098         gridMidIndex1 = gridIndex1;
00099         while(rightGridChain->get_v_value(gridMidIndex1) > temp)
00100           gridMidIndex1++;
00101         gridMidIndex1--;
00102         }
00103     }//end of find gridMindIndex1
00104     //find gridMidIndex2 so that it is the (first one below or equal 
00105     //midIndex) last one above or equal midIndex2
00106     {
00107       Real temp = rightChain->getVertex(midIndex2)[1];
00108       for(gridMidIndex2 = gridMidIndex1+1; gridMidIndex2 <= gridIndex2; gridMidIndex2++)
00109         if(rightGridChain->get_v_value(gridMidIndex2) <= temp)
00110           break;
00111 
00112       assert(gridMidIndex2 <= gridIndex2);
00113     }//end of find gridMidIndex2
00114       }
00115 
00116 
00117   
00118   //to interprete the corner information
00119   Real* cornerTop;
00120   Real* cornerBot;
00121   Int cornerRightStart;
00122   Int cornerRightEnd;
00123   Int cornerLeftUpEnd;
00124   Int cornerLeftDownStart;
00125   if(up_rightCornerWhere == 2) //right corner is on right chain
00126     {
00127       cornerTop = rightChain->getVertex(up_rightCornerIndex);
00128       cornerRightStart = up_rightCornerIndex+1;
00129       cornerLeftUpEnd = -1; //no left
00130     }
00131   else if(up_rightCornerWhere == 1) //right corner is on top
00132     {
00133       cornerTop = topVertex;
00134       cornerRightStart = rightStartIndex;
00135       cornerLeftUpEnd = -1; //no left
00136     }
00137   else //right corner is on left chain
00138     {
00139       cornerTop = topVertex;
00140       cornerRightStart = rightStartIndex;
00141       cornerLeftUpEnd = up_rightCornerIndex;
00142     }
00143   
00144   if(down_rightCornerWhere == 2) //right corner is on right chan
00145     {
00146       cornerBot = rightChain->getVertex(down_rightCornerIndex);
00147       cornerRightEnd = down_rightCornerIndex-1;
00148       cornerLeftDownStart = leftEndIndex+1; //no left
00149     }
00150   else if (down_rightCornerWhere == 1) //right corner is at bot
00151     {
00152       cornerBot = botVertex;
00153       cornerRightEnd = rightEndIndex;
00154       cornerLeftDownStart = leftEndIndex+1; //no left     
00155     }
00156   else //right corner is on the left chain
00157     {
00158       cornerBot = botVertex;
00159       cornerRightEnd = rightEndIndex;
00160       cornerLeftDownStart = down_rightCornerIndex;
00161     }
00162 
00163   //sample
00164   if(midIndex2 >= 0) //there is a trm point between grid lines
00165     {
00166 
00167       sampleRightSingleTrimEdgeRegionGen(cornerTop, rightChain->getVertex(midIndex1),
00168                      rightChain,
00169                      cornerRightStart,
00170                      midIndex1-1,
00171                      rightGridChain,
00172                      gridIndex1,
00173                      gridMidIndex1,
00174                      leftChain,
00175                      leftStartIndex,
00176                      cornerLeftUpEnd,
00177                      0, //no left down section,
00178                      -1,
00179                      pStream);
00180 
00181       sampleRightSingleTrimEdgeRegionGen(rightChain->getVertex(midIndex2),
00182                      cornerBot,
00183                      rightChain,
00184                      midIndex2+1,
00185                      cornerRightEnd,
00186                      rightGridChain,
00187                      gridMidIndex2,
00188                      gridIndex2,
00189                      leftChain,
00190                      0, //no left up section
00191                      -1,
00192                      cornerLeftDownStart,
00193                      leftEndIndex,
00194                      pStream);
00195 
00196       sampleRightStripRecF(rightChain,
00197                midIndex1,
00198                midIndex2,
00199                rightGridChain,
00200                gridMidIndex1,
00201                gridMidIndex2,
00202                pStream);
00203 
00204     }
00205   else
00206     {
00207       sampleRightSingleTrimEdgeRegionGen(cornerTop, cornerBot,
00208                      rightChain,
00209                      cornerRightStart,
00210                      cornerRightEnd,
00211                      rightGridChain,
00212                      gridIndex1,
00213                      gridIndex2,
00214                      leftChain,
00215                      leftStartIndex,
00216                      cornerLeftUpEnd,
00217                      cornerLeftDownStart,
00218                      leftEndIndex,
00219                      pStream);
00220     }
00221 }
00222 
00223 void sampleRightSingleTrimEdgeRegionGen(Real topVertex[2], Real botVertex[2],
00224                      vertexArray* rightChain,
00225                      Int rightStart,
00226                      Int rightEnd,
00227                      gridBoundaryChain* gridChain,
00228                      Int gridBeginIndex,
00229                      Int gridEndIndex,
00230                      vertexArray* leftChain,
00231                      Int leftUpBegin,
00232                      Int leftUpEnd,
00233                      Int leftDownBegin,
00234                      Int leftDownEnd,
00235                      primStream* pStream)
00236 {
00237   Int i,k;
00238    /*creat an array to store all the up and down secments of the left chain,
00239    *and the right end grid points
00240    *
00241    *although vertex array is a dynamic array, but to gain efficiency,
00242    *it is better to initiliza the exact array size
00243    */
00244   vertexArray vArray(gridEndIndex-gridBeginIndex+1 +
00245              max(0,leftUpEnd - leftUpBegin+1)+
00246              max(0,leftDownEnd - leftDownBegin+1));
00247   //append the vertices on the up section of the left chain
00248   for(i=leftUpBegin; i<= leftUpEnd; i++)
00249     vArray.appendVertex(leftChain->getVertex(i));
00250   
00251   //append the vertices of the right extremal grid points,
00252   //and at the same time, perform triangulation for the stair cases
00253   vArray.appendVertex(gridChain->get_vertex(gridBeginIndex));
00254   
00255   for(k=1, i=gridBeginIndex+1; i<= gridEndIndex; i++, k++)
00256     {
00257       vArray.appendVertex(gridChain->get_vertex(i));
00258       
00259       //output the fan of the grid points of the (i)th and (i-1)th grid line.
00260       gridChain->rightEndFan(i, pStream);
00261     }
00262   
00263   //append all the vertices on the down section of the left chain
00264   for(i=leftDownBegin; i<= leftDownEnd; i++)
00265     vArray.appendVertex(leftChain->getVertex(i));
00266   monoTriangulationRecGen(topVertex, botVertex,
00267               &vArray, 0, vArray.getNumElements()-1,
00268               rightChain, rightStart, rightEnd,
00269               pStream);
00270 }
00271   
00272 void sampleRightSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2],
00273                      gridBoundaryChain* gridChain,
00274                      Int beginIndex,
00275                      Int endIndex,
00276                      primStream* pStream)
00277 {
00278   Int i,k;
00279   vertexArray vArray(endIndex-beginIndex+1);
00280   vArray.appendVertex(gridChain->get_vertex(beginIndex));
00281   for(k=1, i=beginIndex+1; i<= endIndex; i++, k++)
00282     {
00283       vArray.appendVertex(gridChain->get_vertex(i));
00284       //output the fan of the grid points of the (i)_th and i-1th gridLine
00285       gridChain->rightEndFan(i, pStream);
00286     }
00287   monoTriangulation2(upperVert, lowerVert, &vArray, 0, endIndex-beginIndex, 
00288              1, //increase chain (to the left)
00289              pStream);
00290 }
00291               
00292 
00293 /*the gridlines from rightGridChainStartIndex to 
00294  *rightGridChainEndIndex are assumed to form a 
00295  *connected componenet
00296  *the trm vertex of topRightIndex is assumed to be below
00297  *or equal the first gridLine, and the trm vertex of
00298  *botRightIndex is assumed to be above or equal the last gridline
00299  **there could be multipe trm vertices equal to the last gridline, but
00300  **only one could be equal to top gridline. shape: ____| (recall that
00301  **for left chain recF, we allow shape: |----
00302  *if botRightIndex<topRightIndex, then no connected componenet exists, and 
00303  *no triangles are generated.
00304  *Othewise, botRightIndex>= topRightIndex, there is at least one triangles to 
00305  *output
00306  */
00307 void sampleRightStripRecF(vertexArray* rightChain,
00308              Int topRightIndex,
00309              Int botRightIndex,
00310              gridBoundaryChain* rightGridChain,
00311              Int rightGridChainStartIndex,
00312              Int rightGridChainEndIndex,    
00313              primStream* pStream
00314              )
00315 {
00316 
00317   //sstop conditionL: if topRightIndex > botRightIndex, then stop
00318   if(topRightIndex > botRightIndex)
00319     return;
00320   
00321   //if there is only one grid line, return
00322   if(rightGridChainStartIndex >= rightGridChainEndIndex)
00323     return;
00324 
00325 
00326   assert(rightChain->getVertex(topRightIndex)[1] <= rightGridChain->get_v_value(rightGridChainStartIndex) &&
00327      rightChain->getVertex(botRightIndex)[1] >= rightGridChain->get_v_value(rightGridChainEndIndex));
00328 
00329   //firstfind the first trim vertex which is strictly below the second top
00330   //grid line: index1. 
00331   Real secondGridChainV = rightGridChain->get_v_value(rightGridChainStartIndex+1);
00332   Int index1 = topRightIndex;
00333   while(rightChain->getVertex(index1)[1] >= secondGridChainV){
00334     index1++;
00335     if(index1 >  botRightIndex)
00336       break;
00337   }
00338   //now rightChain->getVertex(index1-1)[1] >= secondGridChainV and
00339   //rightChain->getVertex(index1)[1] < secondGridChainV and
00340   //we should include index1-1 to perform a gridStep
00341     index1--;
00342 
00343   //now we have rightChain->getVertex(index1)[1] >= secondGridChainV, and
00344   //rightChain->getVertex(index1+1)[1] < secondGridChainV
00345   sampleRightOneGridStep(rightChain, topRightIndex, index1, rightGridChain, rightGridChainStartIndex, pStream);
00346 
00347   //if rightChain->getVertex(index1)[1] ==secondGridChainV then we can 
00348   //recurvesively to the rest
00349   if(rightChain->getVertex(index1)[1] == secondGridChainV)
00350     {
00351 
00352       
00353       sampleRightStripRecF(rightChain, index1, botRightIndex, rightGridChain, rightGridChainStartIndex+1, rightGridChainEndIndex, pStream);
00354     }
00355   else if(index1 < botRightIndex)
00356     {
00357       //otherwise, we have rightChain->getVertex(index1)[1] > secondV
00358       //let the next trim vertex be nextTrimVertex, (which should be strictly
00359       //below the second grid line). Find the last grid line index2 which is STRICTLY ABOVE
00360       //nextTrimVertex.
00361       //sample one trm edge region.
00362       Real *uppervert, *lowervert;
00363       uppervert = rightChain->getVertex(index1);
00364       lowervert = rightChain->getVertex(index1+1); //okay since index1<botRightindex
00365       Int index2 = rightGridChainStartIndex+1;
00366       while(rightGridChain->get_v_value(index2) > lowervert[1])
00367     {
00368       index2++;
00369       if(index2 > rightGridChainEndIndex)
00370         break;
00371     }
00372       index2--;
00373       
00374       sampleRightSingleTrimEdgeRegion(uppervert, lowervert, rightGridChain, rightGridChainStartIndex+1, index2, pStream);
00375       
00376       //recursion
00377       sampleRightStripRecF(rightChain, index1+1, botRightIndex, rightGridChain, index2, rightGridChainEndIndex, pStream);
00378     }
00379 }
00380 
00381 //the degenerate case of sampleRightOneGridStep
00382 void sampleRightOneGridStepNoMiddle(vertexArray* rightChain,
00383                     Int beginRightIndex,
00384                     Int endRightIndex,
00385                     gridBoundaryChain* rightGridChain,
00386                     Int rightGridChainStartIndex,
00387                     primStream* pStream)
00388 {
00389   /*since there is no middle, there is at most one point which is on the 
00390    *second grid line, there could be multiple points on the first (top)
00391    *grid line.
00392    */
00393   rightGridChain->rightEndFan(rightGridChainStartIndex+1, pStream);
00394   monoTriangulation2(rightGridChain->get_vertex(rightGridChainStartIndex),
00395              rightGridChain->get_vertex(rightGridChainStartIndex+1),
00396              rightChain,
00397              beginRightIndex,
00398              endRightIndex,
00399              0, //decrease chain
00400              pStream);
00401 }
00402 
00403 //sampling the right area in between two grid lines
00404 //shape: _________|
00405 void sampleRightOneGridStep(vertexArray* rightChain, 
00406                 Int beginRightIndex,
00407                 Int endRightIndex,
00408                 gridBoundaryChain* rightGridChain,
00409                 Int rightGridChainStartIndex,
00410                 primStream* pStream)
00411 {
00412   if(checkMiddle(rightChain, beginRightIndex, endRightIndex,
00413          rightGridChain->get_v_value(rightGridChainStartIndex),
00414          rightGridChain->get_v_value(rightGridChainStartIndex+1))<0)
00415     {
00416       sampleRightOneGridStepNoMiddle(rightChain, beginRightIndex, endRightIndex, rightGridChain, rightGridChainStartIndex, pStream);
00417       return;
00418     }
00419 
00420   //copy into a polygn
00421   {
00422     directedLine* poly = NULL;
00423     sampledLine* sline;
00424     directedLine* dline;
00425     gridWrap* grid = rightGridChain->getGrid();
00426     float vert1[2];
00427     float vert2[2];
00428     Int i;
00429     
00430     Int innerInd = rightGridChain->getInnerIndex(rightGridChainStartIndex+1);
00431     Int upperInd = rightGridChain->getUlineIndex(rightGridChainStartIndex);
00432     Int lowerInd = rightGridChain->getUlineIndex(rightGridChainStartIndex+1);
00433     Real upperV = rightGridChain->get_v_value(rightGridChainStartIndex);
00434     Real lowerV = rightGridChain->get_v_value(rightGridChainStartIndex+1);
00435     
00436     //the upper gridline
00437     vert1[1]=vert2[1]=upperV;
00438     for(i=upperInd;
00439     i>innerInd;
00440     i--)
00441       {
00442     vert1[0]=grid->get_u_value(i);
00443     vert2[0]=grid->get_u_value(i-1);
00444     sline = new sampledLine(vert1, vert2);
00445     dline = new directedLine(INCREASING, sline);
00446     if(poly == NULL)
00447       poly = dline;
00448     else
00449       poly->insert(dline);
00450       }
00451     
00452     //the vertical grid line segment
00453     vert1[0]=vert2[0] = grid->get_u_value(innerInd);
00454     vert1[1]=upperV;
00455     vert2[1]=lowerV;
00456     sline=new sampledLine(vert1, vert2);
00457     dline=new directedLine(INCREASING, sline);
00458     if(poly == NULL)
00459       poly = dline;
00460     else
00461       poly->insert(dline);
00462     
00463     //the lower grid line
00464     vert1[1]=vert2[1]=lowerV;
00465     for(i=innerInd; i<lowerInd; i++)
00466       {
00467     vert1[0] = grid->get_u_value(i);
00468     vert2[0] = grid->get_u_value(i+1);
00469     sline = new sampledLine(vert1, vert2);
00470     dline = new directedLine(INCREASING, sline);
00471     poly->insert(dline);       
00472       }
00473 
00474     //the edge connecting lower grid to right chain
00475     vert1[0]=grid->get_u_value(lowerInd);
00476     sline = new sampledLine(vert1, rightChain->getVertex(endRightIndex));
00477     dline = new directedLine(INCREASING, sline);
00478     poly->insert(dline);
00479     
00480     
00481     //the right Chain
00482     for(i=endRightIndex; i>beginRightIndex; i--)
00483       {
00484     sline = new sampledLine(rightChain->getVertex(i), rightChain->getVertex(i-1));
00485     dline = new directedLine(INCREASING, sline);
00486     poly->insert(dline);
00487       }
00488 
00489     //the edge connecting right chain with upper grid
00490     vert2[1]=upperV;
00491     vert2[0]=grid->get_u_value(upperInd);
00492     sline = new sampledLine(rightChain->getVertex(beginRightIndex), vert2);
00493     dline = new directedLine(INCREASING, sline);
00494     poly->insert(dline);    
00495     monoTriangulationOpt(poly, pStream);
00496     //clean up
00497     poly->deleteSinglePolygonWithSline();
00498 
00499     return;
00500   }
00501        
00502   //this following code cannot be reached, but leave it for debuggig purpose.
00503   Int i;
00504   //find the maximal U-monotone chain of beginRightIndex, beginRightIndex+1,...
00505   i=beginRightIndex;
00506   Real prevU = rightChain->getVertex(i)[0];
00507   for(i=beginRightIndex+1; i<= endRightIndex; i++){
00508     Real thisU = rightChain->getVertex(i)[0];
00509     if(thisU < prevU)
00510       prevU = thisU;
00511     else
00512       break;
00513   }
00514   //from beginRightIndex to i-1 is strictly U-monotne
00515   //if(i-1==beginRightIndex and the vertex of rightchain is on the first 
00516   //gridline, then we should use 2 vertices  on the right chain. Of we only 
00517   //use one (begin), we would output degenrate triangles.
00518   if(i-1 == beginRightIndex && rightChain->getVertex(beginRightIndex)[1] == rightGridChain->get_v_value(rightGridChainStartIndex))
00519     i++;
00520   
00521   Int j = endRightIndex -1;
00522   if(rightGridChain->getInnerIndex(rightGridChainStartIndex+1) < rightGridChain->getUlineIndex(rightGridChainStartIndex+1))
00523     {
00524       j = rightChain->findDecreaseChainFromEnd(i-1/*beginRightIndex*/, endRightIndex);
00525       Int temp = endRightIndex;
00526       //now from j+1 to end is strictly U-monotone.
00527       //if j+1 is on the last grid line, then we wat to skip to the vertex   
00528       //whcih is strictly above the second grid line. This vertex must exist 
00529       //since there is a middle vertex
00530       if(j+1 == endRightIndex)
00531     {
00532       while(rightChain->getVertex(j+1)[1] == rightGridChain->get_v_value(rightGridChainStartIndex+1))
00533         j--;
00534 
00535       monoTriangulation2(rightChain->getVertex(j+1),
00536                  rightGridChain->get_vertex(rightGridChainStartIndex+1),
00537                  rightChain,
00538                  j+2,
00539                  endRightIndex,
00540                  0, //a decrease chain
00541                  pStream);
00542 
00543       temp = j+1;
00544     }
00545 
00546       stripOfFanRight(rightChain, temp, j+1, rightGridChain->getGrid(),
00547               rightGridChain->getVlineIndex(rightGridChainStartIndex+1),
00548               rightGridChain->getInnerIndex(rightGridChainStartIndex+1),
00549               rightGridChain->getUlineIndex(rightGridChainStartIndex+1),
00550               pStream,
00551               0 //the grid line is below the trim line
00552               );
00553 
00554     }
00555 
00556 
00557   stripOfFanRight(rightChain, i-1, beginRightIndex, rightGridChain->getGrid(),
00558           rightGridChain->getVlineIndex(rightGridChainStartIndex),
00559           rightGridChain->getInnerIndex(rightGridChainStartIndex+1),
00560           rightGridChain->getUlineIndex(rightGridChainStartIndex),
00561           pStream,
00562           1 //the grid line is above the trm lines
00563           );
00564 
00565   //monotone triangulate the remaining rightchain together with the
00566   //two vertices on the two grid v-lines
00567   Real vert[2][2];
00568   vert[0][0] = vert[1][0] = rightGridChain->getInner_u_value(rightGridChainStartIndex+1);
00569   vert[0][1] = rightGridChain->get_v_value(rightGridChainStartIndex);
00570   vert[1][1] = rightGridChain->get_v_value(rightGridChainStartIndex+1);
00571 
00572   monoTriangulation2(&vert[0][0], 
00573              &vert[1][0],
00574              rightChain,
00575              i-1,
00576              j+1,
00577              0, 
00578              pStream);
00579 }
00580           
00581 #endif    
00582 
00583 void stripOfFanRight(vertexArray* rightChain, 
00584             Int largeIndex,
00585             Int smallIndex,
00586             gridWrap* grid,
00587             Int vlineIndex,
00588             Int ulineSmallIndex,
00589             Int ulineLargeIndex,
00590             primStream* pStream,
00591             Int gridLineUp /*1 if the grid line is above the trim lines*/
00592              )
00593 {
00594   assert(largeIndex >= smallIndex);
00595 
00596   Real grid_v_value;
00597   grid_v_value = grid->get_v_value(vlineIndex);
00598 
00599   Real2* trimVerts=(Real2*) malloc(sizeof(Real2)* (largeIndex-smallIndex+1));
00600   assert(trimVerts);
00601 
00602 
00603   Real2* gridVerts=(Real2*) malloc(sizeof(Real2)* (ulineLargeIndex-ulineSmallIndex+1));
00604   assert(gridVerts);
00605 
00606   Int k,i;
00607   if(! gridLineUp) /*trim line is above grid line, so trim vertices are going right when index increases*/
00608     for(k=0, i=smallIndex; i<=largeIndex; i++, k++)
00609       {
00610       trimVerts[k][0] = rightChain->getVertex(i)[0];
00611       trimVerts[k][1] = rightChain->getVertex(i)[1];
00612     }
00613   else
00614     for(k=0, i=largeIndex; i>=smallIndex; i--, k++)
00615       {
00616     trimVerts[k][0] = rightChain->getVertex(i)[0];
00617     trimVerts[k][1] = rightChain->getVertex(i)[1];
00618       }
00619 
00620   for(k=0, i=ulineSmallIndex; i<= ulineLargeIndex; i++, k++)
00621     {
00622       gridVerts[k][0] = grid->get_u_value(i);
00623       gridVerts[k][1] = grid_v_value;
00624     }
00625 
00626   if(gridLineUp)
00627     triangulateXYMono(
00628               ulineLargeIndex-ulineSmallIndex+1, gridVerts,
00629               largeIndex-smallIndex+1, trimVerts,
00630               pStream);
00631   else
00632     triangulateXYMono(largeIndex-smallIndex+1, trimVerts,
00633               ulineLargeIndex-ulineSmallIndex+1, gridVerts,
00634               pStream);
00635   free(trimVerts);
00636   free(gridVerts);
00637 }
00638 
00639 
00640 
00641 
00642 
00643 
00644 
00645 
00646 

Generated on Mon May 28 2012 04:23:37 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.