49#define max(a,b) ((a>b)? a:b)
50#define min(a,b) ((a>b)? b:a)
60 if( (
A[1] <
B[1]) || (
A[1]==
B[1] &&
A[0]<
B[0]))
63 (
A[1] ==
B[1] &&
A[0] ==
B[0])
return 0;
75 Real* vert =
v->head();
91 Real* vert =
v->head();
102 Real *
A=
v->getPrev()->head();
105 if(
A[1] <
B[1] &&
B[1] <
C[1])
107 else if(
A[1] >
B[1] &&
B[1] >
C[1])
109 else if(
A[1] <
B[1] &&
C[1] <
B[1])
111 else if(
A[1] >
B[1] &&
C[1] >
B[1])
124 Real*
A =
v->getPrev()->head();
133 if(Bx*Cy - Cx*By < 0)
return 1;
156 ret->leftType = leftType;
158 ret->rightType = rightType;
224 return (leftEqual == 1 || rightEqual == 1);
262 Real e1_Ymax, e1_Ymin, e2_Ymax, e2_Ymin;
283 if(head1[1]>tail1[1]) {
292 if(head2[1]>tail2[1]) {
307 Real Ymax =
min(e1_Ymax, e2_Ymax);
308 Real Ymin =
max(e1_Ymin, e2_Ymin);
322 if(
x1<=
x2)
return -1;
330 return v1->compInY(
v2);
339 for(
i=0;
i<total_num_edges;
i++)
352 diagonal_vertices[
k++] = vert;
354 for(
j=
i+1;
j<total_num_edges;
j++)
357 diagonal_vertices[
k++] = sortedVertices[
j];
367 diagonal_vertices[
k++] = vert;
368 for(
j=
i-1;
j>=0;
j--)
371 diagonal_vertices[
k++] = sortedVertices[
j];
392 for(
i=0,
k=0;
i<num_diagonals;
i++,
k+=2)
401 (diagonal_vertices[
k] == new_vertices[
l] &&
402 diagonal_vertices[
k+1] == new_vertices[
l+1]
406 diagonal_vertices[
k] == new_vertices[
l+1] &&
407 diagonal_vertices[
k+1] == new_vertices[
l]
418 new_vertices[
index+
index+1] = diagonal_vertices[
k+1];
428 Int total_num_edges = 0;
437 assert(diagonal_vertices);
441 return diagonal_vertices;
449 Int total_num_edges = 0;
474 assert(diagonal_vertices);
491 for(
i=0;
i<num_diagonals;
i++)
492 removedDiagonals[
i] = 0;
498 for(
i=0,
k=0;
i<num_diagonals;
i++,
k+=2)
523 removedDiagonals[
i] = 1;
528 v1->connectDiagonal(
v1,
v2, &ret_p1, &ret_p2, &generatedLine, ret_polygons);
532 newSampledLines = generatedLine->
insert(newSampledLines);
562 for(ii=0, kk=0; ii<num_diagonals; ii++, kk+=2)
563 if( removedDiagonals[ii]==0)
571 v1->head(),
v1->tail(), d2->
head()))
584 v2->head(),
v2->tail(), d2->
head()))
598 v1->head(),
v1->tail(), d1->
head()))
610 v2->head(),
v2->tail(), d1->
head()))
627 for(
i=0,
k=0;
i<num_diagonals;
i++,
k += 2)
628 if(removedDiagonals[
i] == 0)
657 v1->connectDiagonal(
v1,
v2, &ret_p1, &ret_p2, &generatedLine, ret_polygons);
658 newSampledLines = generatedLine->
insert(newSampledLines);
668 for(
Int j=
i+1;
j<num_diagonals;
j++)
670 if(removedDiagonals[
j] ==0)
675 if(temp1==
v1 || temp1==
v2 || temp2==
v1 || temp2==
v2)
710 free(diagonal_vertices);
711 free(removedDiagonals);
713 *retSampledLines = newSampledLines;
729 for(
i=0;
i<nVertices;
i++)
directedLine * cutoffPolygon(directedLine *p)
void rootLinkSet(directedLine *r)
directedLine * insertPolygon(directedLine *newpolygon)
directedLine * findRoot()
directedLine * rootLinkFindRoot()
Int samePolygon(directedLine *v1, directedLine *v2)
directedLine ** toArrayAllPolygons(Int &total_num_edges)
sampledLine * insert(sampledLine *nline)
GLint GLint GLint GLint GLint GLint y
GLfloat GLfloat GLfloat v2
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_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Int isReflex(directedLine *v)
void findDiagonals(Int total_num_edges, directedLine **sortedVertices, sweepRange **ranges, Int &num_diagonals, directedLine **diagonal_vertices)
Int isCusp(directedLine *v)
sweepRange * sweepRangeMake(directedLine *left, Int leftType, directedLine *right, Int rightType)
Int cuspType(directedLine *v)
static Int compEdges(directedLine *e1, directedLine *e2)
Int deleteRepeatDiagonals(Int num_diagonals, directedLine **diagonal_vertices, directedLine **new_vertices)
Int isBelow(directedLine *v, directedLine *e)
void sweepY(Int nVertices, directedLine **sortedVertices, sweepRange **ret_ranges)
Int sweepRangeEqual(sweepRange *src1, sweepRange *src2)
inline Real intersectHoriz(Real x1, Real y1, Real x2, Real y2, Real y)
Int isAbove(directedLine *v, directedLine *e)
directedLine * partitionY(directedLine *polygons, sampledLine **retSampledLines)
static Int compVertInY(Real A[2], Real B[2])
void sweepRangeDelete(sweepRange *range)
directedLine ** DBGfindDiagonals(directedLine *polygons, Int &num_diagonals)
static Int compInY(directedLine *v1, directedLine *v2)
Int pointLeft2Lines(Real A[2], Real B[2], Real C[2], Real P[2])
void quicksort(void *v[], int left, int right, int(*comp)(void *, void *))
void TreeNodeDeleteSingleNode(treeNode *node)
treeNode * TreeNodePredecessor(treeNode *node)
treeNode * TreeNodeFind(treeNode *tree, void *key, int(*compkey)(void *, void *))
treeNode * TreeNodeMake(void *key)
treeNode * TreeNodeSuccessor(treeNode *node)
treeNode * TreeNodeInsert(treeNode *root, treeNode *newnode, int(*compkey)(void *, void *))
void TreeNodeDeleteWholeTree(treeNode *node)
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2