1*c2c66affSColin Finck /* 2*c2c66affSColin Finck * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) 3*c2c66affSColin Finck * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. 4*c2c66affSColin Finck * 5*c2c66affSColin Finck * Permission is hereby granted, free of charge, to any person obtaining a 6*c2c66affSColin Finck * copy of this software and associated documentation files (the "Software"), 7*c2c66affSColin Finck * to deal in the Software without restriction, including without limitation 8*c2c66affSColin Finck * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9*c2c66affSColin Finck * and/or sell copies of the Software, and to permit persons to whom the 10*c2c66affSColin Finck * Software is furnished to do so, subject to the following conditions: 11*c2c66affSColin Finck * 12*c2c66affSColin Finck * The above copyright notice including the dates of first publication and 13*c2c66affSColin Finck * either this permission notice or a reference to 14*c2c66affSColin Finck * http://oss.sgi.com/projects/FreeB/ 15*c2c66affSColin Finck * shall be included in all copies or substantial portions of the Software. 16*c2c66affSColin Finck * 17*c2c66affSColin Finck * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18*c2c66affSColin Finck * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19*c2c66affSColin Finck * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20*c2c66affSColin Finck * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21*c2c66affSColin Finck * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 22*c2c66affSColin Finck * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23*c2c66affSColin Finck * SOFTWARE. 24*c2c66affSColin Finck * 25*c2c66affSColin Finck * Except as contained in this notice, the name of Silicon Graphics, Inc. 26*c2c66affSColin Finck * shall not be used in advertising or otherwise to promote the sale, use or 27*c2c66affSColin Finck * other dealings in this Software without prior written authorization from 28*c2c66affSColin Finck * Silicon Graphics, Inc. 29*c2c66affSColin Finck */ 30*c2c66affSColin Finck /* 31*c2c66affSColin Finck */ 32*c2c66affSColin Finck 33*c2c66affSColin Finck #ifndef _SAMPLEMONOPOLY_H 34*c2c66affSColin Finck #define _SAMPLEMONOPOLY_H 35*c2c66affSColin Finck 36*c2c66affSColin Finck #include "monoTriangulation.h" 37*c2c66affSColin Finck //#include "gridWrap.h" 38*c2c66affSColin Finck #include "rectBlock.h" 39*c2c66affSColin Finck 40*c2c66affSColin Finck 41*c2c66affSColin Finck void triangulateXYMono(Int n_upper, Real upperVerts[][2], 42*c2c66affSColin Finck Int n_lower, Real lowerVerts[][2], 43*c2c66affSColin Finck primStream* pStream); 44*c2c66affSColin Finck 45*c2c66affSColin Finck void stripOfFanLeft(vertexArray* leftChain, 46*c2c66affSColin Finck Int largeIndex, 47*c2c66affSColin Finck Int smallIndex, 48*c2c66affSColin Finck gridWrap* grid, 49*c2c66affSColin Finck Int vlineIndex, 50*c2c66affSColin Finck Int ulineSmallIndex, 51*c2c66affSColin Finck Int ulineLargeIndex, 52*c2c66affSColin Finck primStream* pStream, 53*c2c66affSColin Finck Int gridLineUp 54*c2c66affSColin Finck ); 55*c2c66affSColin Finck void sampleLeftOneGridStep(vertexArray* leftChain, 56*c2c66affSColin Finck Int beginLeftIndex, 57*c2c66affSColin Finck Int endLeftIndex, 58*c2c66affSColin Finck gridBoundaryChain* leftGridChain, 59*c2c66affSColin Finck Int leftGridChainStartIndex, 60*c2c66affSColin Finck primStream* pStream 61*c2c66affSColin Finck ); 62*c2c66affSColin Finck 63*c2c66affSColin Finck void sampleLeftSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2], 64*c2c66affSColin Finck gridBoundaryChain* gridChain, 65*c2c66affSColin Finck Int beginIndex, 66*c2c66affSColin Finck Int endIndex, 67*c2c66affSColin Finck primStream* pStream); 68*c2c66affSColin Finck 69*c2c66affSColin Finck void sampleLeftStripRec(vertexArray* leftChain, 70*c2c66affSColin Finck Int topLeftIndex, 71*c2c66affSColin Finck Int botLeftIndex, 72*c2c66affSColin Finck gridBoundaryChain* leftGridChain, 73*c2c66affSColin Finck Int leftGridChainStartIndex, 74*c2c66affSColin Finck Int leftGridChainEndIndex, 75*c2c66affSColin Finck primStream* pStream 76*c2c66affSColin Finck ); 77*c2c66affSColin Finck 78*c2c66affSColin Finck void sampleLeftStrip(vertexArray* leftChain, 79*c2c66affSColin Finck Int topLeftIndex, 80*c2c66affSColin Finck Int botLeftIndex, 81*c2c66affSColin Finck gridBoundaryChain* leftGridChain, 82*c2c66affSColin Finck Int leftGridChainStartIndex, 83*c2c66affSColin Finck Int leftGridChainEndIndex, 84*c2c66affSColin Finck primStream* pStream 85*c2c66affSColin Finck ); 86*c2c66affSColin Finck 87*c2c66affSColin Finck void findLeftGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_inner); 88*c2c66affSColin Finck 89*c2c66affSColin Finck void findRightGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_inner); 90*c2c66affSColin Finck 91*c2c66affSColin Finck void sampleMonoPoly(directedLine* polygon, gridWrap* grid, Int ulinear, Int vlinear, primStream *pStream, rectBlockArray* rbArray); 92*c2c66affSColin Finck 93*c2c66affSColin Finck void sampleMonoPolyRec( 94*c2c66affSColin Finck Real* topVertex, 95*c2c66affSColin Finck Real* botVertex, 96*c2c66affSColin Finck vertexArray* leftChain, 97*c2c66affSColin Finck Int leftStartIndex, 98*c2c66affSColin Finck vertexArray* rightChain, 99*c2c66affSColin Finck Int rightStartIndex, 100*c2c66affSColin Finck gridBoundaryChain* leftGridChain, 101*c2c66affSColin Finck gridBoundaryChain* rightGridChain, 102*c2c66affSColin Finck Int gridStartIndex, 103*c2c66affSColin Finck primStream* pStream, 104*c2c66affSColin Finck rectBlockArray* rbArray 105*c2c66affSColin Finck ); 106*c2c66affSColin Finck 107*c2c66affSColin Finck void sampleLeftStripRecF(vertexArray* leftChain, 108*c2c66affSColin Finck Int topLeftIndex, 109*c2c66affSColin Finck Int botLeftIndex, 110*c2c66affSColin Finck gridBoundaryChain* leftGridChain, 111*c2c66affSColin Finck Int leftGridChainStartIndex, 112*c2c66affSColin Finck Int leftGridChainEndIndex, 113*c2c66affSColin Finck primStream* pStream 114*c2c66affSColin Finck ); 115*c2c66affSColin Finck 116*c2c66affSColin Finck void findUpCorners(Real *topVertex, 117*c2c66affSColin Finck vertexArray *leftChain, 118*c2c66affSColin Finck Int leftChainStartIndex, Int leftChainEndIndex, 119*c2c66affSColin Finck vertexArray *rightChain, 120*c2c66affSColin Finck Int rightChainStartIndex, Int rightChainEndIndex, 121*c2c66affSColin Finck Real v, 122*c2c66affSColin Finck Real uleft, 123*c2c66affSColin Finck Real uright, 124*c2c66affSColin Finck Int& ret_leftCornerWhere, 125*c2c66affSColin Finck Int& ret_leftCornerIndex, 126*c2c66affSColin Finck Int& ret_rightCornerWhere, 127*c2c66affSColin Finck Int& ret_rightCornerIndex 128*c2c66affSColin Finck ); 129*c2c66affSColin Finck void findDownCorners(Real *botVertex, 130*c2c66affSColin Finck vertexArray *leftChain, Int leftChainStartIndex, Int leftChainEndIndex, 131*c2c66affSColin Finck vertexArray *rightChain, Int rightChainStartIndex, Int rightChainEndIndex, 132*c2c66affSColin Finck Real v, 133*c2c66affSColin Finck Real uleft, 134*c2c66affSColin Finck Real uright, 135*c2c66affSColin Finck Int& ret_leftCornerWhere, 136*c2c66affSColin Finck Int& ret_leftCornerIndex, 137*c2c66affSColin Finck Int& ret_rightCornerWhere, 138*c2c66affSColin Finck Int& ret_rightCornerIndex 139*c2c66affSColin Finck ); 140*c2c66affSColin Finck void findNeck(vertexArray *leftChain, Int botLeftIndex, 141*c2c66affSColin Finck vertexArray *rightChain, Int botRightIndex, 142*c2c66affSColin Finck Int& leftLastIndex, /*left point of the neck*/ 143*c2c66affSColin Finck Int& rightLastIndex /*right point of the neck*/ 144*c2c66affSColin Finck ); 145*c2c66affSColin Finck 146*c2c66affSColin Finck Int findNeckF(vertexArray *leftChain, Int botLeftIndex, 147*c2c66affSColin Finck vertexArray *rightChain, Int botRightIndex, 148*c2c66affSColin Finck gridBoundaryChain* leftGridChain, 149*c2c66affSColin Finck gridBoundaryChain* rightGridChain, 150*c2c66affSColin Finck Int gridStartIndex, 151*c2c66affSColin Finck Int& neckLeft, 152*c2c66affSColin Finck Int& neckRight); 153*c2c66affSColin Finck 154*c2c66affSColin Finck void findTopAndBot(directedLine* polygon, 155*c2c66affSColin Finck directedLine*& topV, 156*c2c66affSColin Finck directedLine*& botV); 157*c2c66affSColin Finck void findGridChains(directedLine* top, directedLine* bot, 158*c2c66affSColin Finck gridWrap* grid, 159*c2c66affSColin Finck gridBoundaryChain*& leftGridChain, 160*c2c66affSColin Finck gridBoundaryChain*& rightGridChain); 161*c2c66affSColin Finck void toVertexArrays(directedLine* topV, directedLine* botV, vertexArray& leftChain, vertexArray& rightChain); 162*c2c66affSColin Finck 163*c2c66affSColin Finck void drawCorners( 164*c2c66affSColin Finck Real* topV, Real* botV, 165*c2c66affSColin Finck vertexArray* leftChain, 166*c2c66affSColin Finck vertexArray* rightChain, 167*c2c66affSColin Finck gridBoundaryChain* leftGridChain, 168*c2c66affSColin Finck gridBoundaryChain* rightGridChain, 169*c2c66affSColin Finck Int gridIndex1, 170*c2c66affSColin Finck Int gridIndex2, 171*c2c66affSColin Finck Int leftCornerWhere, 172*c2c66affSColin Finck Int leftCornerIndex, 173*c2c66affSColin Finck Int rightCornerWhere, 174*c2c66affSColin Finck Int rightCornerIndex, 175*c2c66affSColin Finck Int bot_leftCornerWhere, 176*c2c66affSColin Finck Int bot_leftCornerIndex, 177*c2c66affSColin Finck Int bot_rightCornerWhere, 178*c2c66affSColin Finck Int bot_rightCornerIndex); 179*c2c66affSColin Finck 180*c2c66affSColin Finck Int checkMiddle(vertexArray* chain, Int begin, Int end, 181*c2c66affSColin Finck Real vup, Real vbelow); 182*c2c66affSColin Finck 183*c2c66affSColin Finck #endif 184*c2c66affSColin Finck 185