44#define max(a,b) ((a>b)? a:b)
47#define min(a,b) ((a>b)? b:a)
91 for(
i=0;
i<=
temp->get_npoints()-2;
i++)
111 for(tempV = topV; tempV != botV; tempV = tempV->
getNext())
116 for(tempV = botV; tempV != topV; tempV = tempV->
getNext())
130 for(
i=0;
i<n_leftVerts;
i++)
131 leftVerts[
i] = temp_leftVerts[
i];
132 for(
i=0;
i<n_rightVerts;
i++)
133 rightVerts[
i] = temp_rightVerts[
i];
136 for(tempV = topV; tempV != botV; tempV = tempV->
getNext())
160 free(temp_leftVerts);
161 free(temp_rightVerts);
173 for(tempV = leftV; tempV != rightV; tempV = tempV->
getNext())
178 for(tempV = rightV; tempV != leftV; tempV = tempV->
getNext())
187 for(tempV = leftV; tempV != rightV; tempV = tempV->
getNext())
219 topV = botV = polygon;
221 for(tempV = polygon->
getNext(); tempV != polygon; tempV = tempV->
getNext())
233 for(tempV = topV; tempV != botV; tempV = tempV->
getNext())
235 if(tempV->
tail()[0] >= tempV->
head()[0])
240 for(tempV = botV; tempV != topV; tempV = tempV->
getNext())
242 if(tempV->
tail()[0] <= tempV->
head()[0])
276 Int rightCornerWhere,
277 Int rightCornerIndex,
278 Int bot_leftCornerWhere,
279 Int bot_leftCornerIndex,
280 Int bot_rightCornerWhere,
281 Int bot_rightCornerIndex)
285 Real* bot_leftCornerV;
286 Real* bot_rightCornerV;
288 if(leftCornerWhere == 1)
290 else if(leftCornerWhere == 0)
291 leftCornerV = leftChain->
getVertex(leftCornerIndex);
293 leftCornerV = rightChain->
getVertex(leftCornerIndex);
295 if(rightCornerWhere == 1)
297 else if(rightCornerWhere == 0)
298 rightCornerV = leftChain->
getVertex(rightCornerIndex);
300 rightCornerV = rightChain->
getVertex(rightCornerIndex);
302 if(bot_leftCornerWhere == 1)
303 bot_leftCornerV = botV;
304 else if(bot_leftCornerWhere == 0)
305 bot_leftCornerV = leftChain->
getVertex(bot_leftCornerIndex);
307 bot_leftCornerV = rightChain->
getVertex(bot_leftCornerIndex);
309 if(bot_rightCornerWhere == 1)
310 bot_rightCornerV = botV;
311 else if(bot_rightCornerWhere == 0)
312 bot_rightCornerV = leftChain->
getVertex(bot_rightCornerIndex);
314 bot_rightCornerV = rightChain->
getVertex(bot_rightCornerIndex);
353 for(tempV = topV->
getNext(); tempV != botV; tempV = tempV->
getNext())
360 for(tempV = topV->
getPrev(); tempV != botV; tempV = tempV->
getPrev())
376 topV = botV = polygon;
377 for(tempV = polygon->
getNext(); tempV != polygon; tempV = tempV->
getNext())
407 Int *leftGridIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
409 Int *rightGridIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
411 Int *leftGridInnerIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
412 assert(leftGridInnerIndices);
413 Int *rightGridInnerIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
414 assert(rightGridInnerIndices);
416 findLeftGridIndices(topV, firstGridIndex, lastGridIndex, grid, leftGridIndices, leftGridInnerIndices);
418 findRightGridIndices(topV, firstGridIndex, lastGridIndex, grid, rightGridIndices, rightGridInnerIndices);
420 leftGridChain =
new gridBoundaryChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, leftGridIndices, leftGridInnerIndices);
422 rightGridChain =
new gridBoundaryChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, rightGridIndices, rightGridInnerIndices);
424 free(leftGridIndices);
425 free(rightGridIndices);
426 free(leftGridInnerIndices);
427 free(rightGridInnerIndices);
436 Int& ret_leftCornerWhere,
437 Int& ret_leftCornerIndex,
438 Int& ret_rightCornerWhere,
439 Int& ret_rightCornerIndex
443printf(
"*************enter find donw corner\n");
444printf(
"finddownCorner: v=%f, uleft=%f, uright=%f\n",
v, uleft, uright);
445printf(
"(%i,%i,%i,%i)\n", leftChainStartIndex, leftChainEndIndex,rightChainStartIndex, rightChainEndIndex);
448printf(
"right chain is\n");
453 Real leftGridPoint[2];
454 leftGridPoint[0] = uleft;
455 leftGridPoint[1] =
v;
456 Real rightGridPoint[2];
457 rightGridPoint[0] = uright;
458 rightGridPoint[1] =
v;
466 if(index2 <= rightChainEndIndex)
469 if(index1>leftChainEndIndex && index2 > rightChainEndIndex)
473 ret_leftCornerWhere = 1;
474 ret_rightCornerWhere = 1;
476 else if(index1>leftChainEndIndex )
479 ret_rightCornerWhere = 2;
480 ret_rightCornerIndex = index2;
485 for(
i=index2+1;
i<= rightChainEndIndex;
i++)
496 leftGridPoint, botVertex))
498 ret_leftCornerWhere = 2;
499 ret_leftCornerIndex = index2;
501 else if(botVertex[0] < tempMin)
502 ret_leftCornerWhere = 1;
505 ret_leftCornerWhere = 2;
506 ret_leftCornerIndex = tempI;
509 else if(index2> rightChainEndIndex)
511 ret_leftCornerWhere = 0;
512 ret_leftCornerIndex = index1;
520 for(tempI = index1; tempI <= leftChainEndIndex; tempI++)
523 if(tempI > leftChainEndIndex)
524 ret_rightCornerWhere = 1;
528 for(
i=tempI;
i<= leftChainEndIndex;
i++)
540 rightGridPoint, botVertex))
542 ret_rightCornerWhere = 0;
543 ret_rightCornerIndex = index1;
545 else if(botVertex[0] > tempMax)
548 ret_rightCornerWhere = 1;
552 ret_rightCornerWhere = 0;
553 ret_rightCornerIndex = tempI;
562 ret_leftCornerWhere = 0;
563 ret_leftCornerIndex = index1;
569 tempMax = leftChain->
getVertex(index1)[0];
572 for(
i=index1+1;
i<= leftChainEndIndex;
i++)
587 ret_rightCornerWhere = 0;
588 ret_rightCornerIndex = index1;
590 else if(tempMax >= rightChain->
getVertex(index2)[0] ||
595 ret_rightCornerWhere = 0;
596 ret_rightCornerIndex = tempI;
600 ret_rightCornerWhere = 2;
601 ret_rightCornerIndex = index2;
606 ret_rightCornerWhere = 2;
607 ret_rightCornerIndex = index2;
613 tempMin = rightChain->
getVertex(index2)[0];
616 for(
i=index2+1;
i<= rightChainEndIndex;
i++)
631 ret_leftCornerWhere = 2;
632 ret_leftCornerIndex = index2;
634 else if(tempMin <= leftChain->getVertex(index1)[0] ||
637 ret_leftCornerWhere = 2;
638 ret_leftCornerIndex = tempI;
642 ret_leftCornerWhere = 0;
643 ret_leftCornerIndex = index1;
657 Int& ret_leftCornerWhere,
658 Int& ret_leftCornerIndex,
659 Int& ret_rightCornerWhere,
660 Int& ret_rightCornerIndex
664printf(
"***********enter findUpCorners\n");
668 Real leftGridPoint[2];
669 leftGridPoint[0] = uleft;
670 leftGridPoint[1] =
v;
671 Real rightGridPoint[2];
672 rightGridPoint[0] = uright;
673 rightGridPoint[1] =
v;
683 if(index2>= leftChainStartIndex)
686 if(index1<leftChainStartIndex && index2 <rightChainStartIndex)
689 ret_leftCornerWhere = 1;
690 ret_rightCornerWhere = 1;
692 else if(index1<leftChainStartIndex )
694 ret_rightCornerWhere = 2;
695 ret_rightCornerIndex = index2;
700 for(
i=index2-1;
i>=rightChainStartIndex;
i--)
710 leftGridPoint, topVertex))
712 ret_leftCornerWhere = 2;
713 ret_leftCornerIndex = index2;
715 else if(topVertex[0] < tempMin)
716 ret_leftCornerWhere = 1;
719 ret_leftCornerWhere = 2;
720 ret_leftCornerIndex = tempI;
724 else if(index2< rightChainStartIndex)
726 ret_leftCornerWhere = 0;
727 ret_leftCornerIndex = index1;
733 for(
i=index1-1;
i>=leftChainStartIndex;
i--){
746 rightGridPoint, topVertex))
748 ret_rightCornerWhere = 0;
749 ret_rightCornerIndex = index1;
751 else if(topVertex[0] > tempMax)
752 ret_rightCornerWhere = 1;
755 ret_rightCornerWhere = 0;
756 ret_rightCornerIndex = tempI;
763 ret_leftCornerWhere = 0;
764 ret_leftCornerIndex = index1;
770 tempMax = leftChain->
getVertex(index1)[0];
773 for(
i=index1-1;
i>= leftChainStartIndex;
i--)
787 ret_rightCornerWhere = 0;
788 ret_rightCornerIndex = index1;
790 else if(tempMax >= rightChain->
getVertex(index2)[0] ||
793 ret_rightCornerWhere = 0;
794 ret_rightCornerIndex = tempI;
798 ret_rightCornerWhere = 2;
799 ret_rightCornerIndex = index2;
804 ret_rightCornerWhere = 2;
805 ret_rightCornerIndex = index2;
811 tempMin = rightChain->
getVertex(index2)[0];
814 for(
i=index2-1;
i>= rightChainStartIndex;
i--)
826 leftGridPoint, leftChain->
getVertex(index1)))
828 ret_leftCornerWhere = 2;
829 ret_leftCornerIndex = index2;
831 else if(tempMin <= leftChain->getVertex(index1)[0] ||
834 ret_leftCornerWhere = 2;
835 ret_leftCornerIndex = tempI;
839 ret_leftCornerWhere = 0;
840 ret_leftCornerIndex = index1;
845printf(
"***********leave findUpCorners\n");
879 for(
i=gridStartIndex;
i<n_vlines;
i++)
886 if(lowerGridIndex == n_vlines)
890 Int botLeft2, botRight2;
905 if(botRight2 < botRightIndex) botRight2=botRightIndex;
907 if(botLeft2 < botLeftIndex) botLeft2 = botLeftIndex;
909 assert(botLeft2 >= botLeftIndex);
910 assert(botRight2 >= botRightIndex);
913 Int tempI = botLeftIndex;
915 for(
i=botLeftIndex+1;
i<= botLeft2;
i++)
923 tempI = botRightIndex;
925 for(
i=botRightIndex+1;
i<= botRight2;
i++)
947 assert(botLeftIndex < leftChain->getNumElements() &&
948 botRightIndex < rightChain->getNumElements());
955 leftLastIndex = botLeftIndex;
964 rightLastIndex = botRightIndex;
985 Real slop = 0.0, uinterc;
987#ifdef SHORTEN_GRID_LINE
1001 for(
k=0,
i=firstGridIndex;
i>=lastGridIndex;
i--,
k++)
1007 if(vtail > grid_v_value)
1012 while( (vtail=dLine->
tail()[1]) > grid_v_value){
1014 tempMaxU =
max(tempMaxU, dLine->
tail()[0]);
1015 dLine = dLine -> getNext();
1023 slop = (dLine->
head()[0] - dLine->
tail()[0]) / (dLine->
head()[1]-vtail);
1029 uinterc =
max(dLine->
head()[0], dLine->
tail()[0]);
1033 uinterc = slop * (grid_v_value - vtail) + dLine->
tail()[0];
1036 tempMaxU =
max(tempMaxU, uinterc);
1038 if(uinterc < uMin && uinterc >= uMin -
ZERO)
1040 if(uinterc > uMax && uinterc <= uMax +
ZERO)
1043#ifdef SHORTEN_GRID_LINE
1044 uintercBuf[
k] = uinterc;
1047 assert(uinterc >= uMin && uinterc <= uMax);
1049 ret_indices[
k] = n_ulines-1;
1051 ret_indices[
k] = (
Int)(((uinterc-uMin)/(uMax - uMin)) * (n_ulines-1)) + 1;
1052 if(ret_indices[
k] >= n_ulines)
1053 ret_indices[
k] = n_ulines-1;
1056 ret_innerIndices[
k] = (
Int)(((tempMaxU-uMin)/(uMax - uMin)) * (n_ulines-1)) + 1;
1061#ifdef SHORTEN_GRID_LINE
1066 for(
k=0,
i=firstGridIndex;
i>=lastGridIndex;
i--,
k++)
1072 assert(uintercBuf[
k] >=
a && uintercBuf <
b);
1073 if( (
b-uintercBuf[
k]) <= 0.2 * (
b-
a))
1081 if(ret_innerIndices[
k] < ret_indices[
k-1])
1082 ret_innerIndices[
k] = ret_indices[
k-1];
1083 if(ret_innerIndices[
k] < ret_indices[
k])
1084 ret_innerIndices[
k] = ret_indices[
k];
1103 Real slop = 0.0, uinterc;
1105#ifdef SHORTEN_GRID_LINE
1108 Real *uintercBuf = (
Real *)
malloc (
sizeof(
Real) * (firstGridIndex-lastGridIndex+1));
1118 for(
k=0,
i=firstGridIndex;
i>=lastGridIndex;
i--,
k++)
1125 if(vhead >= grid_v_value)
1130 while( (vhead=dLine->
head()[1]) > grid_v_value){
1131 tempMinU =
min(tempMinU, dLine->
head()[0]);
1132 dLine = dLine -> getPrev();
1136 while(dLine->
head()[1] == grid_v_value)
1140 slop = (dLine->
tail()[0] - dLine->
head()[0]) / (dLine->
tail()[1]-dLine->
head()[1]);
1151 uinterc = slop * (grid_v_value - dLine->
head()[1]) + dLine->
head()[0];
1156 else if(uinterc > uMax)
1159#ifdef SHORTEN_GRID_LINE
1160 uintercBuf[
k] = uinterc;
1163 tempMinU =
min(tempMinU, uinterc);
1165 assert(uinterc >= uMin && uinterc <= uMax);
1170 ret_indices[
k] = (
int)
ceil((((uinterc-uMin)/(uMax - uMin)) * (n_ulines-1))) -1;
1183 ret_innerIndices[
k] = (
int)
ceil ((((tempMinU-uMin)/(uMax - uMin)) * (n_ulines-1))) -1;
1187#ifdef SHORTEN_GRID_LINE
1192 for(
k=0,
i=firstGridIndex;
i>=lastGridIndex;
i--,
k++)
1198 assert(uintercBuf[
k] >
a && uintercBuf <=
b);
1199 if( (uintercBuf[
k]-
a) <= 0.2 * (
b-
a))
1207 if(ret_innerIndices[
k] > ret_indices[
k-1])
1208 ret_innerIndices[
k] = ret_indices[
k-1];
1209 if(ret_innerIndices[
k] > ret_indices[
k])
1210 ret_innerIndices[
k] = ret_indices[
k];
1258 else if(n_cusps == 1)
1305 topV = botV = polygon;
1307 for(tempV = polygon->
getNext(); tempV != polygon; tempV = tempV->
getNext())
1329 Int *leftGridIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
1331 Int *rightGridIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
1332 assert(rightGridIndices);
1333 Int *leftGridInnerIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
1334 assert(leftGridInnerIndices);
1335 Int *rightGridInnerIndices = (
Int*)
malloc(
sizeof(
Int) * (firstGridIndex - lastGridIndex +1));
1336 assert(rightGridInnerIndices);
1338 findLeftGridIndices(topV, firstGridIndex, lastGridIndex, grid, leftGridIndices, leftGridInnerIndices);
1340 findRightGridIndices(topV, firstGridIndex, lastGridIndex, grid, rightGridIndices, rightGridInnerIndices);
1342 gridBoundaryChain leftGridChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, leftGridIndices, leftGridInnerIndices);
1344 gridBoundaryChain rightGridChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, rightGridIndices, rightGridInnerIndices);
1363 for(tempV = topV->
getNext(); tempV != botV; tempV = tempV->
getNext())
1371 for(tempV = topV->
getPrev(); tempV != botV; tempV = tempV->
getPrev())
1395 free(leftGridIndices);
1396 free(rightGridIndices);
1397 free(leftGridInnerIndices);
1398 free(rightGridInnerIndices);
1407 Int rightStartIndex,
1419 if(topVertex[1] <= botVertex[1])
1423 Int i=gridStartIndex;
1424 while (i < leftGridChain->get_nVlines())
1436 int num_skipped_grid_lines=0;
1437 while(index1 < leftGridChain->get_nVlines())
1441 num_skipped_grid_lines++;
1457if(num_skipped_grid_lines <2)
1461 rightChain, rightStartIndex,
1470 rightChain, rightStartIndex, pStream);
1491 if(index2 < leftGridChain->get_nVlines())
1508 Int up_leftCornerWhere;
1509 Int up_leftCornerIndex;
1510 Int up_rightCornerWhere;
1511 Int up_rightCornerIndex;
1512 Int down_leftCornerWhere;
1513 Int down_leftCornerIndex;
1514 Int down_rightCornerWhere;
1515 Int down_rightCornerIndex;
1517 Real* tempBotVertex;
1519 Int nextLeftStartIndex=0;
1520 Int nextRightStartIndex=0;
1535 if(!
findNeckF(leftChain, botLeftIndex, rightChain, botRightIndex,
1536 leftGridChain, rightGridChain, index2, neckLeftIndex, neckRightIndex))
1543 printf(
"neck NOT exists, botRightIndex=%i\n", botRightIndex);
1546 tempBotVertex = botVertex;
1547 nextTopVertex = botVertex;
1564printf(
"neck is found, neckLeftIndex=%i, neckRightIndex=%i\n", neckLeftIndex, neckRightIndex);
1571 if(leftChain->
getVertex(neckLeftIndex)[1] <= rightChain->
getVertex(neckRightIndex)[1])
1573 tempBotVertex = leftChain->
getVertex(neckLeftIndex);
1574 botLeftIndex = neckLeftIndex-1;
1575 botRightIndex = neckRightIndex;
1576 nextTopVertex = rightChain->
getVertex(neckRightIndex);
1577 nextLeftStartIndex = neckLeftIndex;
1578 nextRightStartIndex = neckRightIndex+1;
1582 tempBotVertex = rightChain->
getVertex(neckRightIndex);
1583 botLeftIndex = neckLeftIndex;
1584 botRightIndex = neckRightIndex-1;
1585 nextTopVertex = leftChain->
getVertex(neckLeftIndex);
1586 nextLeftStartIndex = neckLeftIndex+1;
1587 nextRightStartIndex = neckRightIndex;
1593 leftStartIndex, botLeftIndex,
1595 rightStartIndex, botRightIndex,
1601 up_rightCornerWhere,
1602 up_rightCornerIndex);
1606 leftStartIndex, botLeftIndex,
1608 rightStartIndex, botRightIndex,
1612 down_leftCornerWhere,
1613 down_leftCornerIndex,
1614 down_rightCornerWhere,
1615 down_rightCornerIndex);
1617 printf(
"find corners done, down_leftwhere=%i, down_righwhere=%i,\n",down_leftCornerWhere, down_rightCornerWhere );
1618 printf(
"find corners done, up_leftwhere=%i, up_righwhere=%i,\n",up_leftCornerWhere, up_rightCornerWhere );
1619 printf(
"find corners done, up_leftindex=%i, up_righindex=%i,\n",up_leftCornerIndex, up_rightCornerIndex );
1620 printf(
"find corners done, down_leftindex=%i, down_righindex=%i,\n",down_leftCornerIndex, down_rightCornerIndex );
1645 leftStartIndex, botLeftIndex,
1647 rightStartIndex, botRightIndex,
1653 up_rightCornerWhere,
1654 up_rightCornerIndex,
1655 down_leftCornerWhere,
1656 down_leftCornerIndex,
1657 down_rightCornerWhere,
1658 down_rightCornerIndex,
1671 nextRightStartIndex,
1686 Int leftGridChainStartIndex,
1687 Int leftGridChainEndIndex,
1701 Real *upperVert, *lowerVert;
1702 upperVert = leftChain->
getVertex(topLeftIndex);
1703 lowerVert = leftChain->
getVertex(topLeftIndex+1);
1705 Int index = leftGridChainStartIndex;
1708 if(
index > leftGridChainEndIndex)
1715 leftGridChainStartIndex,
1719 leftGridChain,
index, leftGridChainEndIndex,
1728 Int leftGridChainStartIndex,
1729 Int leftGridChainEndIndex,
1737 if(topLeftIndex >= botLeftIndex)
1746 Real secondGridChainV = leftGridChain->
get_v_value(leftGridChainStartIndex+1);
1747 assert(leftGridChainStartIndex < leftGridChainEndIndex);
1748 Int index1 = topLeftIndex;
1749 while(leftChain->
getVertex(index1)[1] > secondGridChainV)
1753 sampleLeftOneGridStep(leftChain, topLeftIndex, index1, leftGridChain, leftGridChainStartIndex, pStream);
1763 Real *uppervert, *lowervert;
1764 uppervert = leftChain->
getVertex(index1);
1765 lowervert = leftChain->
getVertex(index1+1);
1766 Int index2 = leftGridChainStartIndex+1;
1768 while(leftGridChain->
get_v_value(index2) >= lowervert[1])
1771 if(index2 > leftGridChainEndIndex)
1786 sampleLeftStripRec(leftChain, index1+1, botLeftIndex, leftGridChain, index2, leftGridChainEndIndex, pStream);
1807 Int leftGridChainStartIndex,
1808 Int leftGridChainEndIndex,
1816 if(topLeftIndex > botLeftIndex)
1821 if(leftGridChainStartIndex>=leftGridChainEndIndex)
1831 Real secondGridChainV = leftGridChain->
get_v_value(leftGridChainStartIndex+1);
1834 Int index1 = topLeftIndex;
1836 while(leftChain->
getVertex(index1)[1] > secondGridChainV){
1838 if(index1>botLeftIndex)
1847 if(index1>botLeftIndex)
1849 else if(leftChain->
getVertex(index1)[1] < secondGridChainV)
1857 sampleLeftOneGridStep(leftChain, topLeftIndex, index1, leftGridChain, leftGridChainStartIndex, pStream);
1862 if(leftChain->
getVertex(index1)[1] == secondGridChainV)
1865 sampleLeftStripRecF(leftChain, index1, botLeftIndex,leftGridChain, leftGridChainStartIndex+1, leftGridChainEndIndex, pStream);
1867 else if(index1 < botLeftIndex)
1877 Real *uppervert, *lowervert;
1878 uppervert = leftChain->
getVertex(index1);
1879 lowervert = leftChain->
getVertex(index1+1);
1880 Int index2 = leftGridChainStartIndex+1;
1883 while(leftGridChain->
get_v_value(index2) >= lowervert[1])
1886 if(index2 > leftGridChainEndIndex)
1896 sampleLeftStripRecF(leftChain, index1+1, botLeftIndex, leftGridChain, index2, leftGridChainEndIndex, pStream);
1918 for(
k=1,
i=beginIndex+1;
i<=endIndex;
i++,
k++)
1956 thisU =
chain->getVertex(
i)[0];
1977 if(
chain->getVertex(
i)[1] < vup &&
chain->getVertex(
i)[1]>vbelow)
1988 Int leftGridChainStartIndex,
1996 leftGridChain->
leftEndFan(leftGridChainStartIndex+1, pStream);
1999 leftGridChain->
get_vertex(leftGridChainStartIndex+1),
2015 Int leftGridChainStartIndex,
2019 if(
checkMiddle(leftChain, beginLeftIndex, endLeftIndex,
2020 leftGridChain->
get_v_value(leftGridChainStartIndex),
2021 leftGridChain->
get_v_value(leftGridChainStartIndex+1))<0)
2046 vert1[1] = vert2[1] = upperV;
2047 for(
i=innerInd;
i>upperInd;
i--)
2070 for(
i=beginLeftIndex;
i<endLeftIndex;
i++)
2085 vert1[1] = vert2[1] = lowerV;
2086 for(
i=lowerInd;
i<innerInd;
i++)
2122 for(
i=endLeftIndex-1;
i>=beginLeftIndex;
i--){
2135 if(
i+1 == endLeftIndex && leftChain->
getVertex(endLeftIndex)[1] == leftGridChain->
get_v_value(1+leftGridChainStartIndex))
2138 Int j = beginLeftIndex+1;
2150 if(
j-1 == beginLeftIndex)
2156 vert[0] = leftGridChain->
get_u_value(leftGridChainStartIndex);
2157 vert[1] = leftGridChain->
get_v_value(leftGridChainStartIndex);
2193 vert[0][0]=vert[1][0] = leftGridChain->
getInner_u_value(leftGridChainStartIndex+1);
2194 vert[0][1] = leftGridChain->
get_v_value(leftGridChainStartIndex);
2195 vert[1][1] = leftGridChain->
get_v_value(leftGridChainStartIndex+1);
2214 for(
i=beginLeftIndex+1;
i<=endLeftIndex;
i++){
2237 vert[0][0]=vert[1][0] = leftGridChain->
get_u_value(leftGridChainStartIndex+1);
2238 vert[0][1] = leftGridChain->
get_v_value(leftGridChainStartIndex);
2239 vert[1][1] = leftGridChain->
get_v_value(leftGridChainStartIndex+1);
2259 Int n_lower,
Real lowerVerts[][2],
2265 assert(n_upper>=1 && n_lower>=1);
2266 if(upperVerts[0][0] <= lowerVerts[0][0])
2270 leftMostV = upperVerts[0];
2276 leftMostV = lowerVerts[0];
2287 pStream->
insert(leftMostV);
2289 pStream->
insert(lowerVerts[
j]);
2297 else if(
j>= n_lower)
2303 pStream->
insert(leftMostV);
2305 for(
k=n_upper-1;
k>=
i;
k--)
2306 pStream->
insert(upperVerts[
k]);
2316 if(upperVerts[
i][0] <= lowerVerts[
j][0])
2319 pStream->
insert(lowerVerts[
j]);
2327 if(upperVerts[
k][0] > lowerVerts[
j][0])
2334 pStream->
insert(upperVerts[
l]);
2336 pStream->
insert(leftMostV);
2341 leftMostV = upperVerts[
k];
2347 pStream->
insert(upperVerts[
i]);
2348 pStream->
insert(leftMostV);
2354 if(lowerVerts[
k][0] >= upperVerts[
i][0])
2356 pStream->
insert(lowerVerts[
k]);
2361 leftMostV = lowerVerts[
j-1];
2373 Int ulineSmallIndex,
2374 Int ulineLargeIndex,
2379 assert(largeIndex >= smallIndex);
2393 for(
k=0,
i=smallIndex;
i<=largeIndex;
i++,
k++)
2399 for(
k=0,
i=largeIndex;
i>=smallIndex;
i--,
k++)
2405 for(
k=0,
i=ulineSmallIndex;
i<= ulineLargeIndex;
i++,
k++)
2408 gridVerts[
k][1] = grid_v_value;
2413 ulineLargeIndex-ulineSmallIndex+1, gridVerts,
2414 largeIndex-smallIndex+1, trimVerts,
2418 ulineLargeIndex-ulineSmallIndex+1, gridVerts,
void deleteSinglePolygonWithSline()
void connectDiagonal_2slines(directedLine *v1, directedLine *v2, directedLine **ret_p1, directedLine **ret_p2, directedLine *list)
void insert(directedLine *nl)
Real getInner_u_value(Int i)
void leftEndFan(Int i, primStream *pStream)
void insert(Real u, Real v)
void setPoint(Int i, Real p[2])
Int findIndexStrictBelowGen(Real v, Int startIndex, Int EndIndex)
Int skipEqualityFromStart(Real v, Int start, Int end)
Int findIndexFirstAboveEqualGen(Real v, Int startIndex, Int endIndex)
void appendVertex(Real *ptr)
Int findIndexBelowGen(Real v, Int startIndex, Int EndIndex)
Int findIndexAboveGen(Real v, Int startIndex, Int EndIndex)
Int compV2InY(Real A[2], Real B[2])
Int compV2InX(Real A[2], Real B[2])
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLAPI void GLAPIENTRY glVertex2f(GLfloat x, GLfloat y)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glEnd(void)
GLAPI void GLAPIENTRY glVertex2fv(const GLfloat *v)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
_Check_return_ _CRTIMP double __cdecl ceil(_In_ double x)
void monoTriangulationRec(Real *topVertex, Real *botVertex, vertexArray *inc_chain, Int inc_current, vertexArray *dec_chain, Int dec_current, Backend *backend)
void triangulateXYMonoTB(Int n_left, Real **leftVerts, Int n_right, Real **rightVerts, primStream *pStream)
void monoTriangulation2(Real *topVertex, Real *botVertex, vertexArray *inc_chain, Int inc_smallIndex, Int inc_largeIndex, Int is_increase_chain, primStream *pStream)
void monoTriangulationRecGenOpt(Real *topVertex, Real *botVertex, vertexArray *inc_chain, Int inc_current, Int inc_end, vertexArray *dec_chain, Int dec_current, Int dec_end, primStream *pStream)
void monoTriangulationFun(directedLine *monoPolygon, Int(*compFun)(Real *, Real *), primStream *pStream)
void monoTriangulationOpt(directedLine *poly, primStream *pStream)
void findInteriorCuspsX(directedLine *polygon, Int &ret_n_interior_cusps, directedLine **ret_interior_cusps)
directedLine * findDiagonal_singleCuspX(directedLine *cusp)
Int DBG_isConvex(directedLine *poly)
Int DBG_is_U_direction(directedLine *poly)
Int DBG_intersectChain(vertexArray *chain, Int start, Int end, Real A[2], Real B[2])
void sampleConnectedComp(Real *topVertex, Real *botVertex, vertexArray *leftChain, Int leftStartIndex, Int leftEndIndex, vertexArray *rightChain, Int rightStartIndex, Int rightEndIndex, gridBoundaryChain *leftGridChain, gridBoundaryChain *rightGridChain, Int gridIndex1, Int gridIndex2, Int up_leftCornerWhere, Int up_leftCornerIndex, Int up_rightCornerWhere, Int up_rightCornerIndex, Int down_leftCornerWhere, Int down_leftCornerIndex, Int down_rightCornerWhere, Int down_rightCornerIndex, primStream *pStream, rectBlockArray *rbArray)
void sampleLeftStripRec(vertexArray *leftChain, Int topLeftIndex, Int botLeftIndex, gridBoundaryChain *leftGridChain, Int leftGridChainStartIndex, Int leftGridChainEndIndex, primStream *pStream)
void sampleLeftOneGridStep(vertexArray *leftChain, Int beginLeftIndex, Int endLeftIndex, gridBoundaryChain *leftGridChain, Int leftGridChainStartIndex, primStream *pStream)
void sampleLeftStripRecF(vertexArray *leftChain, Int topLeftIndex, Int botLeftIndex, gridBoundaryChain *leftGridChain, Int leftGridChainStartIndex, Int leftGridChainEndIndex, primStream *pStream)
Int findIncreaseChainFromBegin(vertexArray *chain, Int begin, Int end)
Int checkMiddle(vertexArray *chain, Int begin, Int end, Real vup, Real vbelow)
void sampleLeftStrip(vertexArray *leftChain, Int topLeftIndex, Int botLeftIndex, gridBoundaryChain *leftGridChain, Int leftGridChainStartIndex, Int leftGridChainEndIndex, primStream *pStream)
directedLine * polygonConvert(directedLine *polygon)
void stripOfFanLeft(vertexArray *leftChain, Int largeIndex, Int smallIndex, gridWrap *grid, Int vlineIndex, Int ulineSmallIndex, Int ulineLargeIndex, primStream *pStream, Int gridLineUp)
void sampleMonoPoly(directedLine *polygon, gridWrap *grid, Int ulinear, Int vlinear, primStream *pStream, rectBlockArray *rbArray)
void findLeftGridIndices(directedLine *topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap *grid, Int *ret_indices, Int *ret_innerIndices)
void findDownCorners(Real *botVertex, vertexArray *leftChain, Int leftChainStartIndex, Int leftChainEndIndex, vertexArray *rightChain, Int rightChainStartIndex, Int rightChainEndIndex, Real v, Real uleft, Real uright, Int &ret_leftCornerWhere, Int &ret_leftCornerIndex, Int &ret_rightCornerWhere, Int &ret_rightCornerIndex)
void triangulateXYMono(Int n_upper, Real upperVerts[][2], Int n_lower, Real lowerVerts[][2], primStream *pStream)
void findRightGridIndices(directedLine *topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap *grid, Int *ret_indices, Int *ret_innerIndices)
void triangulateConvexPolyVertical(directedLine *topV, directedLine *botV, primStream *pStream)
void sampleLeftSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2], gridBoundaryChain *gridChain, Int beginIndex, Int endIndex, primStream *pStream)
void sampleLeftOneGridStepNoMiddle(vertexArray *leftChain, Int beginLeftIndex, Int endLeftIndex, gridBoundaryChain *leftGridChain, Int leftGridChainStartIndex, primStream *pStream)
void drawCorners(Real *topV, Real *botV, vertexArray *leftChain, vertexArray *rightChain, gridBoundaryChain *leftGridChain, gridBoundaryChain *rightGridChain, Int gridIndex1, Int gridIndex2, Int leftCornerWhere, Int leftCornerIndex, Int rightCornerWhere, Int rightCornerIndex, Int bot_leftCornerWhere, Int bot_leftCornerIndex, Int bot_rightCornerWhere, Int bot_rightCornerIndex)
void triangulateConvexPolyHoriz(directedLine *leftV, directedLine *rightV, primStream *pStream)
void findNeck(vertexArray *leftChain, Int botLeftIndex, vertexArray *rightChain, Int botRightIndex, Int &leftLastIndex, Int &rightLastIndex)
void triangulateConvexPoly(directedLine *polygon, Int ulinear, Int vlinear, primStream *pStream)
void findTopAndBot(directedLine *polygon, directedLine *&topV, directedLine *&botV)
void toVertexArrays(directedLine *topV, directedLine *botV, vertexArray &leftChain, vertexArray &rightChain)
void findUpCorners(Real *topVertex, vertexArray *leftChain, Int leftChainStartIndex, Int leftChainEndIndex, vertexArray *rightChain, Int rightChainStartIndex, Int rightChainEndIndex, Real v, Real uleft, Real uright, Int &ret_leftCornerWhere, Int &ret_leftCornerIndex, Int &ret_rightCornerWhere, Int &ret_rightCornerIndex)
Int findNeckF(vertexArray *leftChain, Int botLeftIndex, vertexArray *rightChain, Int botRightIndex, gridBoundaryChain *leftGridChain, gridBoundaryChain *rightGridChain, Int gridStartIndex, Int &neckLeft, Int &neckRight)
void findGridChains(directedLine *topV, directedLine *botV, gridWrap *grid, gridBoundaryChain *&leftGridChain, gridBoundaryChain *&rightGridChain)
void sampleMonoPolyRec(Real *topVertex, Real *botVertex, vertexArray *leftChain, Int leftStartIndex, vertexArray *rightChain, Int rightStartIndex, gridBoundaryChain *leftGridChain, gridBoundaryChain *rightGridChain, Int gridStartIndex, primStream *pStream, rectBlockArray *rbArray)