45#define max(a,b) ((a>b)? a:b)
46#define min(a,b) ((a>b)? b:a)
57 Int leftStartIndex,
Int leftEndIndex,
59 Int rightStartIndex,
Int rightEndIndex,
61 Int gridIndex1,
Int gridIndex2,
62 Int up_rightCornerWhere,
63 Int up_rightCornerIndex,
64 Int down_rightCornerWhere,
65 Int down_rightCornerIndex,
73 Int gridMidIndex1 = 0, gridMidIndex2 = 0;
80 if(midIndex1 <= rightEndIndex && gridIndex1 < gridIndex2)
93 gridMidIndex1 = gridIndex1;
96 gridMidIndex1 = gridIndex1;
106 for(gridMidIndex2 = gridMidIndex1+1; gridMidIndex2 <= gridIndex2; gridMidIndex2++)
110 assert(gridMidIndex2 <= gridIndex2);
119 Int cornerRightStart;
122 Int cornerLeftDownStart;
123 if(up_rightCornerWhere == 2)
125 cornerTop = rightChain->
getVertex(up_rightCornerIndex);
126 cornerRightStart = up_rightCornerIndex+1;
127 cornerLeftUpEnd = -1;
129 else if(up_rightCornerWhere == 1)
131 cornerTop = topVertex;
132 cornerRightStart = rightStartIndex;
133 cornerLeftUpEnd = -1;
137 cornerTop = topVertex;
138 cornerRightStart = rightStartIndex;
139 cornerLeftUpEnd = up_rightCornerIndex;
142 if(down_rightCornerWhere == 2)
144 cornerBot = rightChain->
getVertex(down_rightCornerIndex);
145 cornerRightEnd = down_rightCornerIndex-1;
146 cornerLeftDownStart = leftEndIndex+1;
148 else if (down_rightCornerWhere == 1)
150 cornerBot = botVertex;
151 cornerRightEnd = rightEndIndex;
152 cornerLeftDownStart = leftEndIndex+1;
156 cornerBot = botVertex;
157 cornerRightEnd = rightEndIndex;
158 cornerLeftDownStart = down_rightCornerIndex;
243 max(0,leftUpEnd - leftUpBegin+1)+
244 max(0,leftDownEnd - leftDownBegin+1));
246 for(
i=leftUpBegin;
i<= leftUpEnd;
i++)
253 for(
k=1,
i=gridBeginIndex+1;
i<= gridEndIndex;
i++,
k++)
262 for(
i=leftDownBegin;
i<= leftDownEnd;
i++)
266 rightChain, rightStart, rightEnd,
279 for(
k=1,
i=beginIndex+1;
i<= endIndex;
i++,
k++)
309 Int rightGridChainStartIndex,
310 Int rightGridChainEndIndex,
316 if(topRightIndex > botRightIndex)
320 if(rightGridChainStartIndex >= rightGridChainEndIndex)
325 rightChain->
getVertex(botRightIndex)[1] >= rightGridChain->
get_v_value(rightGridChainEndIndex));
329 Real secondGridChainV = rightGridChain->
get_v_value(rightGridChainStartIndex+1);
330 Int index1 = topRightIndex;
331 while(rightChain->
getVertex(index1)[1] >= secondGridChainV){
333 if(index1 > botRightIndex)
343 sampleRightOneGridStep(rightChain, topRightIndex, index1, rightGridChain, rightGridChainStartIndex, pStream);
347 if(rightChain->
getVertex(index1)[1] == secondGridChainV)
351 sampleRightStripRecF(rightChain, index1, botRightIndex, rightGridChain, rightGridChainStartIndex+1, rightGridChainEndIndex, pStream);
353 else if(index1 < botRightIndex)
360 Real *uppervert, *lowervert;
361 uppervert = rightChain->
getVertex(index1);
362 lowervert = rightChain->
getVertex(index1+1);
363 Int index2 = rightGridChainStartIndex+1;
364 while(rightGridChain->
get_v_value(index2) > lowervert[1])
367 if(index2 > rightGridChainEndIndex)
375 sampleRightStripRecF(rightChain, index1+1, botRightIndex, rightGridChain, index2, rightGridChainEndIndex, pStream);
384 Int rightGridChainStartIndex,
391 rightGridChain->
rightEndFan(rightGridChainStartIndex+1, pStream);
393 rightGridChain->
get_vertex(rightGridChainStartIndex+1),
407 Int rightGridChainStartIndex,
410 if(
checkMiddle(rightChain, beginRightIndex, endRightIndex,
411 rightGridChain->
get_v_value(rightGridChainStartIndex),
412 rightGridChain->
get_v_value(rightGridChainStartIndex+1))<0)
435 vert1[1]=vert2[1]=upperV;
462 vert1[1]=vert2[1]=lowerV;
463 for(
i=innerInd;
i<lowerInd;
i++)
480 for(
i=endRightIndex;
i>beginRightIndex;
i--)
505 for(
i=beginRightIndex+1;
i<= endRightIndex;
i++){
516 if(
i-1 == beginRightIndex && rightChain->
getVertex(beginRightIndex)[1] == rightGridChain->
get_v_value(rightGridChainStartIndex))
519 Int j = endRightIndex -1;
528 if(
j+1 == endRightIndex)
534 rightGridChain->
get_vertex(rightGridChainStartIndex+1),
566 vert[0][0] = vert[1][0] = rightGridChain->
getInner_u_value(rightGridChainStartIndex+1);
567 vert[0][1] = rightGridChain->
get_v_value(rightGridChainStartIndex);
568 vert[1][1] = rightGridChain->
get_v_value(rightGridChainStartIndex+1);
592 assert(largeIndex >= smallIndex);
606 for(
k=0,
i=smallIndex;
i<=largeIndex;
i++,
k++)
612 for(
k=0,
i=largeIndex;
i>=smallIndex;
i--,
k++)
618 for(
k=0,
i=ulineSmallIndex;
i<= ulineLargeIndex;
i++,
k++)
621 gridVerts[
k][1] = grid_v_value;
626 ulineLargeIndex-ulineSmallIndex+1, gridVerts,
627 largeIndex-smallIndex+1, trimVerts,
631 ulineLargeIndex-ulineSmallIndex+1, gridVerts,
void deleteSinglePolygonWithSline()
void insert(directedLine *nl)
Real getInner_u_value(Int i)
void rightEndFan(Int i, primStream *pStream)
void appendVertex(Real *ptr)
Int findIndexBelowGen(Real v, Int startIndex, Int EndIndex)
Int findDecreaseChainFromEnd(Int begin, Int end)
Int findIndexAboveGen(Real v, Int startIndex, Int EndIndex)
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
void monoTriangulationRecGen(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 monoTriangulation2(Real *topVertex, Real *botVertex, vertexArray *inc_chain, Int inc_smallIndex, Int inc_largeIndex, Int is_increase_chain, primStream *pStream)
void monoTriangulationOpt(directedLine *poly, primStream *pStream)
void sampleCompRight(Real *topVertex, Real *botVertex, vertexArray *leftChain, Int leftStartIndex, Int leftEndIndex, vertexArray *rightChain, Int rightStartIndex, Int rightEndIndex, gridBoundaryChain *rightGridChain, Int gridIndex1, Int gridIndex2, Int up_rightCornerWhere, Int up_rightCornerIndex, Int down_rightCornerWhere, Int down_rightCornerIndex, primStream *pStream)
void sampleRightOneGridStep(vertexArray *rightChain, Int beginRightIndex, Int endRightIndex, gridBoundaryChain *rightGridChain, Int rightGridChainStartIndex, primStream *pStream)
void sampleRightSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2], gridBoundaryChain *gridChain, Int beginIndex, Int endIndex, primStream *pStream)
void sampleRightSingleTrimEdgeRegionGen(Real topVertex[2], Real botVertex[2], vertexArray *rightChain, Int rightStart, Int rightEnd, gridBoundaryChain *gridChain, Int gridBeginIndex, Int gridEndIndex, vertexArray *leftChain, Int leftUpBegin, Int leftUpEnd, Int leftDownBegin, Int leftDownEnd, primStream *pStream)
void sampleRightOneGridStepNoMiddle(vertexArray *rightChain, Int beginRightIndex, Int endRightIndex, gridBoundaryChain *rightGridChain, Int rightGridChainStartIndex, primStream *pStream)
void sampleRightStripRecF(vertexArray *rightChain, Int topRightIndex, Int botRightIndex, gridBoundaryChain *rightGridChain, Int rightGridChainStartIndex, Int rightGridChainEndIndex, primStream *pStream)
void stripOfFanRight(vertexArray *rightChain, Int largeIndex, Int smallIndex, gridWrap *grid, Int vlineIndex, Int ulineSmallIndex, Int ulineLargeIndex, primStream *pStream, Int gridLineUp)
Int checkMiddle(vertexArray *chain, Int begin, Int end, Real vup, Real vbelow)
void triangulateXYMono(Int n_upper, Real upperVerts[][2], Int n_lower, Real lowerVerts[][2], primStream *pStream)