SGI SI GLU library
[mesa.git] / src / glu / sgi / libnurbs / nurbtess / sampleCompRight.cc
1 /*
2 ** License Applicability. Except to the extent portions of this file are
3 ** made subject to an alternative license as permitted in the SGI Free
4 ** Software License B, Version 1.1 (the "License"), the contents of this
5 ** file are subject only to the provisions of the License. You may not use
6 ** this file except in compliance with the License. You may obtain a copy
7 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
8 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
9 **
10 ** http://oss.sgi.com/projects/FreeB
11 **
12 ** Note that, as provided in the License, the Software is distributed on an
13 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
14 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
15 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
16 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
17 **
18 ** Original Code. The Original Code is: OpenGL Sample Implementation,
19 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
20 ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
21 ** Copyright in any portions created by third parties is as indicated
22 ** elsewhere herein. All Rights Reserved.
23 **
24 ** Additional Notice Provisions: The application programming interfaces
25 ** established by SGI in conjunction with the Original Code are The
26 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
27 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
28 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
29 ** Window System(R) (Version 1.3), released October 19, 1998. This software
30 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
31 ** published by SGI, but has not been independently verified as being
32 ** compliant with the OpenGL(R) version 1.2.1 Specification.
33 **
34 ** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
35 */
36 /*
37 ** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
38 */
39
40 #include <stdlib.h>
41 #include <stdio.h>
42 #include "glimports.h"
43 #include "zlassert.h"
44 #include "sampleCompRight.h"
45
46 #define max(a,b) ((a>b)? a:b)
47 #define min(a,b) ((a>b)? b:a)
48
49
50
51 #ifdef NOT_TAKEOUT
52
53 /*notice that we need leftChain because the
54 *corners could be on the leftChain.
55 */
56 void sampleCompRight(Real* topVertex, Real* botVertex,
57 vertexArray* leftChain,
58 Int leftStartIndex, Int leftEndIndex,
59 vertexArray* rightChain,
60 Int rightStartIndex, Int rightEndIndex,
61 gridBoundaryChain* rightGridChain,
62 Int gridIndex1, Int gridIndex2,
63 Int up_rightCornerWhere,
64 Int up_rightCornerIndex,
65 Int down_rightCornerWhere,
66 Int down_rightCornerIndex,
67 primStream* pStream)
68 {
69 /*find out whether there is a trim vertex which is
70 *inbetween the top and bot grid lines or not.
71 */
72 Int midIndex1;
73 Int midIndex2;
74 Int gridMidIndex1, gridMidIndex2;
75 //midIndex1: array[i] <= v, array[i+1] > v
76 //midIndex2: array[i] >= v, array[i+1] < v
77 midIndex1 = rightChain->findIndexBelowGen(rightGridChain->get_v_value(gridIndex1),
78 rightStartIndex,
79 rightEndIndex);
80 midIndex2 = -1; //initilization
81 if(midIndex1 <= rightEndIndex && gridIndex1 < gridIndex2)
82 if(rightChain->getVertex(midIndex1)[1] >= rightGridChain->get_v_value(gridIndex2))
83 {
84 //midIndex2 must exist:
85 midIndex2 = rightChain->findIndexAboveGen(rightGridChain->get_v_value(gridIndex2),
86 midIndex1, //midIndex1<=midIndex2
87 rightEndIndex);
88 //find gridMidIndex1 so that either it=gridIndex1 when the gridline is
89 // at the same height as trim vertex midIndex1, or it is the last one
90 //which is strictly above midIndex1.
91 {
92 Real temp = rightChain->getVertex(midIndex1)[1];
93 if(rightGridChain->get_v_value(gridIndex1) == temp)
94 gridMidIndex1 = gridIndex1;
95 else
96 {
97 gridMidIndex1 = gridIndex1;
98 while(rightGridChain->get_v_value(gridMidIndex1) > temp)
99 gridMidIndex1++;
100 gridMidIndex1--;
101 }
102 }//end of find gridMindIndex1
103 //find gridMidIndex2 so that it is the (first one below or equal
104 //midIndex) last one above or equal midIndex2
105 {
106 Real temp = rightChain->getVertex(midIndex2)[1];
107 for(gridMidIndex2 = gridMidIndex1+1; gridMidIndex2 <= gridIndex2; gridMidIndex2++)
108 if(rightGridChain->get_v_value(gridMidIndex2) <= temp)
109 break;
110
111 assert(gridMidIndex2 <= gridIndex2);
112 }//end of find gridMidIndex2
113 }
114
115
116
117 //to interprete the corner information
118 Real* cornerTop;
119 Real* cornerBot;
120 Int cornerRightStart;
121 Int cornerRightEnd;
122 Int cornerLeftUpEnd;
123 Int cornerLeftDownStart;
124 if(up_rightCornerWhere == 2) //right corner is on right chain
125 {
126 cornerTop = rightChain->getVertex(up_rightCornerIndex);
127 cornerRightStart = up_rightCornerIndex+1;
128 cornerLeftUpEnd = -1; //no left
129 }
130 else if(up_rightCornerWhere == 1) //right corner is on top
131 {
132 cornerTop = topVertex;
133 cornerRightStart = rightStartIndex;
134 cornerLeftUpEnd = -1; //no left
135 }
136 else //right corner is on left chain
137 {
138 cornerTop = topVertex;
139 cornerRightStart = rightStartIndex;
140 cornerLeftUpEnd = up_rightCornerIndex;
141 }
142
143 if(down_rightCornerWhere == 2) //right corner is on right chan
144 {
145 cornerBot = rightChain->getVertex(down_rightCornerIndex);
146 cornerRightEnd = down_rightCornerIndex-1;
147 cornerLeftDownStart = leftEndIndex+1; //no left
148 }
149 else if (down_rightCornerWhere == 1) //right corner is at bot
150 {
151 cornerBot = botVertex;
152 cornerRightEnd = rightEndIndex;
153 cornerLeftDownStart = leftEndIndex+1; //no left
154 }
155 else //right corner is on the left chain
156 {
157 cornerBot = botVertex;
158 cornerRightEnd = rightEndIndex;
159 cornerLeftDownStart = down_rightCornerIndex;
160 }
161
162 //sample
163 if(midIndex2 >= 0) //there is a trm point between grid lines
164 {
165
166 sampleRightSingleTrimEdgeRegionGen(cornerTop, rightChain->getVertex(midIndex1),
167 rightChain,
168 cornerRightStart,
169 midIndex1-1,
170 rightGridChain,
171 gridIndex1,
172 gridMidIndex1,
173 leftChain,
174 leftStartIndex,
175 cornerLeftUpEnd,
176 0, //no left down section,
177 -1,
178 pStream);
179
180 sampleRightSingleTrimEdgeRegionGen(rightChain->getVertex(midIndex2),
181 cornerBot,
182 rightChain,
183 midIndex2+1,
184 cornerRightEnd,
185 rightGridChain,
186 gridMidIndex2,
187 gridIndex2,
188 leftChain,
189 0, //no left up section
190 -1,
191 cornerLeftDownStart,
192 leftEndIndex,
193 pStream);
194
195 sampleRightStripRecF(rightChain,
196 midIndex1,
197 midIndex2,
198 rightGridChain,
199 gridMidIndex1,
200 gridMidIndex2,
201 pStream);
202
203 }
204 else
205 {
206 sampleRightSingleTrimEdgeRegionGen(cornerTop, cornerBot,
207 rightChain,
208 cornerRightStart,
209 cornerRightEnd,
210 rightGridChain,
211 gridIndex1,
212 gridIndex2,
213 leftChain,
214 leftStartIndex,
215 cornerLeftUpEnd,
216 cornerLeftDownStart,
217 leftEndIndex,
218 pStream);
219 }
220 }
221
222 void sampleRightSingleTrimEdgeRegionGen(Real topVertex[2], Real botVertex[2],
223 vertexArray* rightChain,
224 Int rightStart,
225 Int rightEnd,
226 gridBoundaryChain* gridChain,
227 Int gridBeginIndex,
228 Int gridEndIndex,
229 vertexArray* leftChain,
230 Int leftUpBegin,
231 Int leftUpEnd,
232 Int leftDownBegin,
233 Int leftDownEnd,
234 primStream* pStream)
235 {
236 Int i,k;
237 /*creat an array to store all the up and down secments of the left chain,
238 *and the right end grid points
239 *
240 *although vertex array is a dynamic array, but to gain efficiency,
241 *it is better to initiliza the exact array size
242 */
243 vertexArray vArray(gridEndIndex-gridBeginIndex+1 +
244 max(0,leftUpEnd - leftUpBegin+1)+
245 max(0,leftDownEnd - leftDownBegin+1));
246 //append the vertices on the up section of the left chain
247 for(i=leftUpBegin; i<= leftUpEnd; i++)
248 vArray.appendVertex(leftChain->getVertex(i));
249
250 //append the vertices of the right extremal grid points,
251 //and at the same time, perform triangulation for the stair cases
252 vArray.appendVertex(gridChain->get_vertex(gridBeginIndex));
253
254 for(k=1, i=gridBeginIndex+1; i<= gridEndIndex; i++, k++)
255 {
256 vArray.appendVertex(gridChain->get_vertex(i));
257
258 //output the fan of the grid points of the (i)th and (i-1)th grid line.
259 gridChain->rightEndFan(i, pStream);
260 }
261
262 //append all the vertices on the down section of the left chain
263 for(i=leftDownBegin; i<= leftDownEnd; i++)
264 vArray.appendVertex(leftChain->getVertex(i));
265 monoTriangulationRecGen(topVertex, botVertex,
266 &vArray, 0, vArray.getNumElements()-1,
267 rightChain, rightStart, rightEnd,
268 pStream);
269 }
270
271 void sampleRightSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2],
272 gridBoundaryChain* gridChain,
273 Int beginIndex,
274 Int endIndex,
275 primStream* pStream)
276 {
277 Int i,k;
278 vertexArray vArray(endIndex-beginIndex+1);
279 vArray.appendVertex(gridChain->get_vertex(beginIndex));
280 for(k=1, i=beginIndex+1; i<= endIndex; i++, k++)
281 {
282 vArray.appendVertex(gridChain->get_vertex(i));
283 //output the fan of the grid points of the (i)_th and i-1th gridLine
284 gridChain->rightEndFan(i, pStream);
285 }
286 monoTriangulation2(upperVert, lowerVert, &vArray, 0, endIndex-beginIndex,
287 1, //increase chain (to the left)
288 pStream);
289 }
290
291
292 /*the gridlines from rightGridChainStartIndex to
293 *rightGridChainEndIndex are assumed to form a
294 *connected componenet
295 *the trm vertex of topRightIndex is assumed to be below
296 *or equal the first gridLine, and the trm vertex of
297 *botRightIndex is assumed to be above or equal the last gridline
298 **there could be multipe trm vertices equal to the last gridline, but
299 **only one could be equal to top gridline. shape: ____| (recall that
300 **for left chain recF, we allow shape: |----
301 *if botRightIndex<topRightIndex, then no connected componenet exists, and
302 *no triangles are generated.
303 *Othewise, botRightIndex>= topRightIndex, there is at least one triangles to
304 *output
305 */
306 void sampleRightStripRecF(vertexArray* rightChain,
307 Int topRightIndex,
308 Int botRightIndex,
309 gridBoundaryChain* rightGridChain,
310 Int rightGridChainStartIndex,
311 Int rightGridChainEndIndex,
312 primStream* pStream
313 )
314 {
315
316 //sstop conditionL: if topRightIndex > botRightIndex, then stop
317 if(topRightIndex > botRightIndex)
318 return;
319
320 //if there is only one grid line, return
321 if(rightGridChainStartIndex >= rightGridChainEndIndex)
322 return;
323
324
325 assert(rightChain->getVertex(topRightIndex)[1] <= rightGridChain->get_v_value(rightGridChainStartIndex) &&
326 rightChain->getVertex(botRightIndex)[1] >= rightGridChain->get_v_value(rightGridChainEndIndex));
327
328 //firstfind the first trim vertex which is strictly below the second top
329 //grid line: index1.
330 Real secondGridChainV = rightGridChain->get_v_value(rightGridChainStartIndex+1);
331 Int index1 = topRightIndex;
332 while(rightChain->getVertex(index1)[1] >= secondGridChainV){
333 index1++;
334 if(index1 > botRightIndex)
335 break;
336 }
337 //now rightChain->getVertex(index1-1)[1] >= secondGridChainV and
338 //rightChain->getVertex(index1)[1] < secondGridChainV and
339 //we should include index1-1 to perform a gridStep
340 index1--;
341
342 //now we have rightChain->getVertex(index1)[1] >= secondGridChainV, and
343 //rightChain->getVertex(index1+1)[1] < secondGridChainV
344 sampleRightOneGridStep(rightChain, topRightIndex, index1, rightGridChain, rightGridChainStartIndex, pStream);
345
346 //if rightChain->getVertex(index1)[1] ==secondGridChainV then we can
347 //recurvesively to the rest
348 if(rightChain->getVertex(index1)[1] == secondGridChainV)
349 {
350
351
352 sampleRightStripRecF(rightChain, index1, botRightIndex, rightGridChain, rightGridChainStartIndex+1, rightGridChainEndIndex, pStream);
353 }
354 else if(index1 < botRightIndex)
355 {
356 //otherwise, we have rightChain->getVertex(index1)[1] > secondV
357 //let the next trim vertex be nextTrimVertex, (which should be strictly
358 //below the second grid line). Find the last grid line index2 which is STRICTLY ABOVE
359 //nextTrimVertex.
360 //sample one trm edge region.
361 Real *uppervert, *lowervert;
362 uppervert = rightChain->getVertex(index1);
363 lowervert = rightChain->getVertex(index1+1); //okay since index1<botRightindex
364 Int index2 = rightGridChainStartIndex+1;
365 while(rightGridChain->get_v_value(index2) > lowervert[1])
366 {
367 index2++;
368 if(index2 > rightGridChainEndIndex)
369 break;
370 }
371 index2--;
372
373 sampleRightSingleTrimEdgeRegion(uppervert, lowervert, rightGridChain, rightGridChainStartIndex+1, index2, pStream);
374
375 //recursion
376 sampleRightStripRecF(rightChain, index1+1, botRightIndex, rightGridChain, index2, rightGridChainEndIndex, pStream);
377 }
378 }
379
380 //the degenerate case of sampleRightOneGridStep
381 void sampleRightOneGridStepNoMiddle(vertexArray* rightChain,
382 Int beginRightIndex,
383 Int endRightIndex,
384 gridBoundaryChain* rightGridChain,
385 Int rightGridChainStartIndex,
386 primStream* pStream)
387 {
388 /*since there is no middle, there is at most one point which is on the
389 *second grid line, there could be multiple points on the first (top)
390 *grid line.
391 */
392 rightGridChain->rightEndFan(rightGridChainStartIndex+1, pStream);
393 monoTriangulation2(rightGridChain->get_vertex(rightGridChainStartIndex),
394 rightGridChain->get_vertex(rightGridChainStartIndex+1),
395 rightChain,
396 beginRightIndex,
397 endRightIndex,
398 0, //decrease chain
399 pStream);
400 }
401
402 //sampling the right area in between two grid lines
403 //shape: _________|
404 void sampleRightOneGridStep(vertexArray* rightChain,
405 Int beginRightIndex,
406 Int endRightIndex,
407 gridBoundaryChain* rightGridChain,
408 Int rightGridChainStartIndex,
409 primStream* pStream)
410 {
411 if(checkMiddle(rightChain, beginRightIndex, endRightIndex,
412 rightGridChain->get_v_value(rightGridChainStartIndex),
413 rightGridChain->get_v_value(rightGridChainStartIndex+1))<0)
414 {
415 sampleRightOneGridStepNoMiddle(rightChain, beginRightIndex, endRightIndex, rightGridChain, rightGridChainStartIndex, pStream);
416 return;
417 }
418
419 //copy into a polygn
420 {
421 directedLine* poly = NULL;
422 sampledLine* sline;
423 directedLine* dline;
424 gridWrap* grid = rightGridChain->getGrid();
425 float vert1[2];
426 float vert2[2];
427 Int i;
428
429 Int innerInd = rightGridChain->getInnerIndex(rightGridChainStartIndex+1);
430 Int upperInd = rightGridChain->getUlineIndex(rightGridChainStartIndex);
431 Int lowerInd = rightGridChain->getUlineIndex(rightGridChainStartIndex+1);
432 Real upperV = rightGridChain->get_v_value(rightGridChainStartIndex);
433 Real lowerV = rightGridChain->get_v_value(rightGridChainStartIndex+1);
434
435 //the upper gridline
436 vert1[1]=vert2[1]=upperV;
437 for(i=upperInd;
438 i>innerInd;
439 i--)
440 {
441 vert1[0]=grid->get_u_value(i);
442 vert2[0]=grid->get_u_value(i-1);
443 sline = new sampledLine(vert1, vert2);
444 dline = new directedLine(INCREASING, sline);
445 if(poly == NULL)
446 poly = dline;
447 else
448 poly->insert(dline);
449 }
450
451 //the vertical grid line segment
452 vert1[0]=vert2[0] = grid->get_u_value(innerInd);
453 vert1[1]=upperV;
454 vert2[1]=lowerV;
455 sline=new sampledLine(vert1, vert2);
456 dline=new directedLine(INCREASING, sline);
457 if(poly == NULL)
458 poly = dline;
459 else
460 poly->insert(dline);
461
462 //the lower grid line
463 vert1[1]=vert2[1]=lowerV;
464 for(i=innerInd; i<lowerInd; i++)
465 {
466 vert1[0] = grid->get_u_value(i);
467 vert2[0] = grid->get_u_value(i+1);
468 sline = new sampledLine(vert1, vert2);
469 dline = new directedLine(INCREASING, sline);
470 poly->insert(dline);
471 }
472
473 //the edge connecting lower grid to right chain
474 vert1[0]=grid->get_u_value(lowerInd);
475 sline = new sampledLine(vert1, rightChain->getVertex(endRightIndex));
476 dline = new directedLine(INCREASING, sline);
477 poly->insert(dline);
478
479
480 //the right Chain
481 for(i=endRightIndex; i>beginRightIndex; i--)
482 {
483 sline = new sampledLine(rightChain->getVertex(i), rightChain->getVertex(i-1));
484 dline = new directedLine(INCREASING, sline);
485 poly->insert(dline);
486 }
487
488 //the edge connecting right chain with upper grid
489 vert2[1]=upperV;
490 vert2[0]=grid->get_u_value(upperInd);
491 sline = new sampledLine(rightChain->getVertex(beginRightIndex), vert2);
492 dline = new directedLine(INCREASING, sline);
493 poly->insert(dline);
494 monoTriangulationOpt(poly, pStream);
495 //clean up
496 poly->deleteSinglePolygonWithSline();
497
498 return;
499 }
500
501 //this following code cannot be reached, but leave it for debuggig purpose.
502 Int i;
503 //find the maximal U-monotone chain of beginRightIndex, beginRightIndex+1,...
504 i=beginRightIndex;
505 Real prevU = rightChain->getVertex(i)[0];
506 for(i=beginRightIndex+1; i<= endRightIndex; i++){
507 Real thisU = rightChain->getVertex(i)[0];
508 if(thisU < prevU)
509 prevU = thisU;
510 else
511 break;
512 }
513 //from beginRightIndex to i-1 is strictly U-monotne
514 //if(i-1==beginRightIndex and the vertex of rightchain is on the first
515 //gridline, then we should use 2 vertices on the right chain. Of we only
516 //use one (begin), we would output degenrate triangles.
517 if(i-1 == beginRightIndex && rightChain->getVertex(beginRightIndex)[1] == rightGridChain->get_v_value(rightGridChainStartIndex))
518 i++;
519
520 Int j = endRightIndex -1;
521 if(rightGridChain->getInnerIndex(rightGridChainStartIndex+1) < rightGridChain->getUlineIndex(rightGridChainStartIndex+1))
522 {
523 j = rightChain->findDecreaseChainFromEnd(i-1/*beginRightIndex*/, endRightIndex);
524 Int temp = endRightIndex;
525 //now from j+1 to end is strictly U-monotone.
526 //if j+1 is on the last grid line, then we wat to skip to the vertex
527 //whcih is strictly above the second grid line. This vertex must exist
528 //since there is a middle vertex
529 if(j+1 == endRightIndex)
530 {
531 while(rightChain->getVertex(j+1)[1] == rightGridChain->get_v_value(rightGridChainStartIndex+1))
532 j--;
533
534 monoTriangulation2(rightChain->getVertex(j+1),
535 rightGridChain->get_vertex(rightGridChainStartIndex+1),
536 rightChain,
537 j+2,
538 endRightIndex,
539 0, //a decrease chain
540 pStream);
541
542 temp = j+1;
543 }
544
545 stripOfFanRight(rightChain, temp, j+1, rightGridChain->getGrid(),
546 rightGridChain->getVlineIndex(rightGridChainStartIndex+1),
547 rightGridChain->getInnerIndex(rightGridChainStartIndex+1),
548 rightGridChain->getUlineIndex(rightGridChainStartIndex+1),
549 pStream,
550 0 //the grid line is below the trim line
551 );
552
553 }
554
555
556 stripOfFanRight(rightChain, i-1, beginRightIndex, rightGridChain->getGrid(),
557 rightGridChain->getVlineIndex(rightGridChainStartIndex),
558 rightGridChain->getInnerIndex(rightGridChainStartIndex+1),
559 rightGridChain->getUlineIndex(rightGridChainStartIndex),
560 pStream,
561 1 //the grid line is above the trm lines
562 );
563
564 //monotone triangulate the remaining rightchain together with the
565 //two vertices on the two grid v-lines
566 Real vert[2][2];
567 vert[0][0] = vert[1][0] = rightGridChain->getInner_u_value(rightGridChainStartIndex+1);
568 vert[0][1] = rightGridChain->get_v_value(rightGridChainStartIndex);
569 vert[1][1] = rightGridChain->get_v_value(rightGridChainStartIndex+1);
570
571 monoTriangulation2(&vert[0][0],
572 &vert[1][0],
573 rightChain,
574 i-1,
575 j+1,
576 0, ///a decreae chain
577 pStream);
578 }
579
580 #endif
581
582 void stripOfFanRight(vertexArray* rightChain,
583 Int largeIndex,
584 Int smallIndex,
585 gridWrap* grid,
586 Int vlineIndex,
587 Int ulineSmallIndex,
588 Int ulineLargeIndex,
589 primStream* pStream,
590 Int gridLineUp /*1 if the grid line is above the trim lines*/
591 )
592 {
593 assert(largeIndex >= smallIndex);
594
595 Real grid_v_value;
596 grid_v_value = grid->get_v_value(vlineIndex);
597
598 Real2* trimVerts=(Real2*) malloc(sizeof(Real2)* (largeIndex-smallIndex+1));
599 assert(trimVerts);
600
601
602 Real2* gridVerts=(Real2*) malloc(sizeof(Real2)* (ulineLargeIndex-ulineSmallIndex+1));
603 assert(gridVerts);
604
605 Int k,i;
606 if(! gridLineUp) /*trim line is above grid line, so trim vertices are going right when index increases*/
607 for(k=0, i=smallIndex; i<=largeIndex; i++, k++)
608 {
609 trimVerts[k][0] = rightChain->getVertex(i)[0];
610 trimVerts[k][1] = rightChain->getVertex(i)[1];
611 }
612 else
613 for(k=0, i=largeIndex; i>=smallIndex; i--, k++)
614 {
615 trimVerts[k][0] = rightChain->getVertex(i)[0];
616 trimVerts[k][1] = rightChain->getVertex(i)[1];
617 }
618
619 for(k=0, i=ulineSmallIndex; i<= ulineLargeIndex; i++, k++)
620 {
621 gridVerts[k][0] = grid->get_u_value(i);
622 gridVerts[k][1] = grid_v_value;
623 }
624
625 if(gridLineUp)
626 triangulateXYMono(
627 ulineLargeIndex-ulineSmallIndex+1, gridVerts,
628 largeIndex-smallIndex+1, trimVerts,
629 pStream);
630 else
631 triangulateXYMono(largeIndex-smallIndex+1, trimVerts,
632 ulineLargeIndex-ulineSmallIndex+1, gridVerts,
633 pStream);
634 free(trimVerts);
635 free(gridVerts);
636 }
637
638
639
640
641
642
643
644
645