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