2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice including the dates of first publication and
13 * either this permission notice or a reference to
14 * http://oss.sgi.com/projects/FreeB/
15 * shall be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * Except as contained in this notice, the name of Silicon Graphics, Inc.
26 * shall not be used in advertising or otherwise to promote the sale, use or
27 * other dealings in this Software without prior written authorization from
28 * Silicon Graphics, Inc.
33 #ifndef _SAMPLEMONOPOLY_H
34 #define _SAMPLEMONOPOLY_H
36 #include "monoTriangulation.h"
38 #include "rectBlock.h"
41 void triangulateXYMono(Int n_upper, Real upperVerts[][2],
42 Int n_lower, Real lowerVerts[][2],
45 void stripOfFanLeft(vertexArray* leftChain,
55 void sampleLeftOneGridStep(vertexArray* leftChain,
58 gridBoundaryChain* leftGridChain,
59 Int leftGridChainStartIndex,
63 void sampleLeftSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2],
64 gridBoundaryChain* gridChain,
69 void sampleLeftStripRec(vertexArray* leftChain,
72 gridBoundaryChain* leftGridChain,
73 Int leftGridChainStartIndex,
74 Int leftGridChainEndIndex,
78 void sampleLeftStrip(vertexArray* leftChain,
81 gridBoundaryChain* leftGridChain,
82 Int leftGridChainStartIndex,
83 Int leftGridChainEndIndex,
87 void findLeftGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_inner);
89 void findRightGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_inner);
91 void sampleMonoPoly(directedLine* polygon, gridWrap* grid, Int ulinear, Int vlinear, primStream *pStream, rectBlockArray* rbArray);
93 void sampleMonoPolyRec(
96 vertexArray* leftChain,
98 vertexArray* rightChain,
100 gridBoundaryChain* leftGridChain,
101 gridBoundaryChain* rightGridChain,
104 rectBlockArray* rbArray
107 void sampleLeftStripRecF(vertexArray* leftChain,
110 gridBoundaryChain* leftGridChain,
111 Int leftGridChainStartIndex,
112 Int leftGridChainEndIndex,
116 void findUpCorners(Real *topVertex,
117 vertexArray *leftChain,
118 Int leftChainStartIndex, Int leftChainEndIndex,
119 vertexArray *rightChain,
120 Int rightChainStartIndex, Int rightChainEndIndex,
124 Int& ret_leftCornerWhere,
125 Int& ret_leftCornerIndex,
126 Int& ret_rightCornerWhere,
127 Int& ret_rightCornerIndex
129 void findDownCorners(Real *botVertex,
130 vertexArray *leftChain, Int leftChainStartIndex, Int leftChainEndIndex,
131 vertexArray *rightChain, Int rightChainStartIndex, Int rightChainEndIndex,
135 Int& ret_leftCornerWhere,
136 Int& ret_leftCornerIndex,
137 Int& ret_rightCornerWhere,
138 Int& ret_rightCornerIndex
140 void findNeck(vertexArray *leftChain, Int botLeftIndex,
141 vertexArray *rightChain, Int botRightIndex,
142 Int& leftLastIndex, /*left point of the neck*/
143 Int& rightLastIndex /*right point of the neck*/
146 Int findNeckF(vertexArray *leftChain, Int botLeftIndex,
147 vertexArray *rightChain, Int botRightIndex,
148 gridBoundaryChain* leftGridChain,
149 gridBoundaryChain* rightGridChain,
154 void findTopAndBot(directedLine* polygon,
156 directedLine*& botV);
157 void findGridChains(directedLine* top, directedLine* bot,
159 gridBoundaryChain*& leftGridChain,
160 gridBoundaryChain*& rightGridChain);
161 void toVertexArrays(directedLine* topV, directedLine* botV, vertexArray& leftChain, vertexArray& rightChain);
164 Real* topV, Real* botV,
165 vertexArray* leftChain,
166 vertexArray* rightChain,
167 gridBoundaryChain* leftGridChain,
168 gridBoundaryChain* rightGridChain,
173 Int rightCornerWhere,
174 Int rightCornerIndex,
175 Int bot_leftCornerWhere,
176 Int bot_leftCornerIndex,
177 Int bot_rightCornerWhere,
178 Int bot_rightCornerIndex);
180 Int checkMiddle(vertexArray* chain, Int begin, Int end,
181 Real vup, Real vbelow);