ReactOS  0.4.11-dev-745-g76daaf9
directedLine Class Reference

#include <directedLine.h>

Collaboration diagram for directedLine:

Public Member Functions

 directedLine (short dir, sampledLine *sl)
 
 directedLine ()
 
 ~directedLine ()
 
void init (short dir, sampledLine *sl)
 
Realhead ()
 
Realtail ()
 
RealgetVertex (Int i)
 
Int get_npoints ()
 
directedLinegetPrev ()
 
directedLinegetNext ()
 
directedLinegetNextPolygon ()
 
sampledLinegetSampledLine ()
 
short getDirection ()
 
void putDirection (short dir)
 
void putPrev (directedLine *p)
 
void putNext (directedLine *p)
 
void insert (directedLine *nl)
 
void deletePolygonList ()
 
void deleteSinglePolygon ()
 
void deleteSinglePolygonWithSline ()
 
void deletePolygonListWithSline ()
 
void deleteSingleLine (directedLine *dline)
 
directedLinedeleteDegenerateLines ()
 
directedLinedeleteDegenerateLinesAllPolygons ()
 
directedLinecutIntersectionAllPoly (int &cutOccur)
 
short isPolygon ()
 
Int compInY (directedLine *nl)
 
Int compInX (directedLine *nl)
 
directedLine ** sortAllPolygons ()
 
Int numEdges ()
 
Int numEdgesAllPolygons ()
 
Int numPolygons ()
 
short isConnected ()
 
Real polyArea ()
 
void printSingle ()
 
void printList ()
 
void printAllPolygons ()
 
void writeAllPolygons (char *filename)
 
directedLineinsertPolygon (directedLine *newpolygon)
 
directedLinecutoffPolygon (directedLine *p)
 
Int toArraySinglePolygon (directedLine **array, Int index)
 
directedLine ** toArrayAllPolygons (Int &total_num_edges)
 
void connectDiagonal (directedLine *v1, directedLine *v2, directedLine **ret_p1, directedLine **ret_p2, sampledLine **generatedLine, directedLine *list)
 
void connectDiagonal_2slines (directedLine *v1, directedLine *v2, directedLine **ret_p1, directedLine **ret_p2, directedLine *list)
 
Int samePolygon (directedLine *v1, directedLine *v2)
 
void setRootBit ()
 
void resetRootBit ()
 
directedLinefindRoot ()
 
void rootLinkSet (directedLine *r)
 
directedLinerootLinkFindRoot ()
 
directedLinedeleteChain (directedLine *begin, directedLine *end)
 

Private Attributes

short direction
 
sampledLinesline
 
directedLinenext
 
directedLineprev
 
directedLinenextPolygon
 
Int rootBit
 
directedLinerootLink
 

Detailed Description

Definition at line 41 of file directedLine.h.

Constructor & Destructor Documentation

directedLine::directedLine ( short  dir,
sampledLine sl 
)

Definition at line 285 of file directedLine.cc.

286 {
287  direction = dir;
288  sline = sl;
289  next = this;
290  prev = this;
291  nextPolygon = NULL;
292 // prevPolygon = NULL;
293  rootBit = 0;/*important to initilzae to 0 meaning not root yet*/
294 
295  rootLink = NULL;
296 
297 }
directedLine * next
Definition: directedLine.h:44
sampledLine * sline
Definition: directedLine.h:43
PIN_DIRECTION dir
Definition: strmbase.h:230
smooth NULL
Definition: ftsmooth.c:416
directedLine * rootLink
Definition: directedLine.h:58
directedLine * nextPolygon
Definition: directedLine.h:50
directedLine * prev
Definition: directedLine.h:45
short direction
Definition: directedLine.h:42
directedLine::directedLine ( )

Definition at line 305 of file directedLine.cc.

Referenced by connectDiagonal(), connectDiagonal_2slines(), deleteChain(), and monoTriangulationRecGenOpt().

306 {
307  next = this;
308  prev = this;
309  nextPolygon = NULL;
310  rootBit = 0;/*important to initilzae to 0 meaning not root yet*/
311  rootLink = NULL;
313  sline = NULL;
314 }
directedLine * next
Definition: directedLine.h:44
sampledLine * sline
Definition: directedLine.h:43
smooth NULL
Definition: ftsmooth.c:416
directedLine * rootLink
Definition: directedLine.h:58
directedLine * nextPolygon
Definition: directedLine.h:50
directedLine * prev
Definition: directedLine.h:45
short direction
Definition: directedLine.h:42
directedLine::~directedLine ( )

Definition at line 316 of file directedLine.cc.

317 {
318 }

Member Function Documentation

Int directedLine::compInX ( directedLine nl)

Definition at line 438 of file directedLine.cc.

439 {
440  if(head()[0] < nl->head()[0]) return -1;
441  if(head()[0] == nl->head()[0] && head()[1] < nl->head()[1]) return -1;
442  return 1;
443 }
Real * head()
Int directedLine::compInY ( directedLine nl)

Definition at line 423 of file directedLine.cc.

Referenced by compInY(), compInY2(), and monoChain::monoChain().

424 {
425  if(head()[1] < nl->head()[1]) return -1;
426  if(head()[1] == nl->head()[1] && head()[0] < nl->head()[0]) return -1;
427  return 1;
428 }
Real * head()
void directedLine::connectDiagonal ( directedLine v1,
directedLine v2,
directedLine **  ret_p1,
directedLine **  ret_p2,
sampledLine **  generatedLine,
directedLine list 
)

Definition at line 632 of file directedLine.cc.

Referenced by MC_partitionY(), and partitionY().

637 {
638  sampledLine *nsline = new sampledLine(2);
639 
640 
641 
642  nsline->setPoint(0, v1->head());
643  nsline->setPoint(1, v2->head());
644 
645 
646 
647  /*the increasing line is from v1 head to v2 head*/
648  directedLine* newLineInc = new directedLine(INCREASING, nsline);
649 
650 
651 
652  directedLine* newLineDec = new directedLine(DECREASING, nsline);
653 
654 
655  directedLine* v1Prev = v1->prev;
656  directedLine* v2Prev = v2->prev;
657 
658  v1 ->prev = newLineDec;
659  v2Prev ->next = newLineDec;
660  newLineDec->next = v1;
661  newLineDec->prev = v2Prev;
662 
663  v2 ->prev = newLineInc;
664  v1Prev ->next = newLineInc;
665  newLineInc->next = v2;
666  newLineInc->prev = v1Prev;
667 
668  *ret_p1 = newLineDec;
669  *ret_p2 = newLineInc;
670  *generatedLine = nsline;
671 }
directedLine * next
Definition: directedLine.h:44
Real * head()
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
void setPoint(Int i, Real p[2])
Definition: sampledLine.cc:45
directedLine * prev
Definition: directedLine.h:45
GLfloat GLfloat v1
Definition: glext.h:6062
void directedLine::connectDiagonal_2slines ( directedLine v1,
directedLine v2,
directedLine **  ret_p1,
directedLine **  ret_p2,
directedLine list 
)

Definition at line 675 of file directedLine.cc.

Referenced by monoPolyPart(), monoTriangulationOpt(), monoTriangulationRecGenOpt(), and sampleMonoPoly().

679 {
680  sampledLine *nsline = new sampledLine(2);
681  sampledLine *nsline2 = new sampledLine(2);
682 
683  nsline->setPoint(0, v1->head());
684  nsline->setPoint(1, v2->head());
685  nsline2->setPoint(0, v1->head());
686  nsline2->setPoint(1, v2->head());
687 
688  /*the increasing line is from v1 head to v2 head*/
689  directedLine* newLineInc = new directedLine(INCREASING, nsline);
690 
691  directedLine* newLineDec = new directedLine(DECREASING, nsline2);
692 
693  directedLine* v1Prev = v1->prev;
694  directedLine* v2Prev = v2->prev;
695 
696  v1 ->prev = newLineDec;
697  v2Prev ->next = newLineDec;
698  newLineDec->next = v1;
699  newLineDec->prev = v2Prev;
700 
701  v2 ->prev = newLineInc;
702  v1Prev ->next = newLineInc;
703  newLineInc->next = v2;
704  newLineInc->prev = v1Prev;
705 
706  *ret_p1 = newLineDec;
707  *ret_p2 = newLineInc;
708 
709 }
directedLine * next
Definition: directedLine.h:44
Real * head()
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
void setPoint(Int i, Real p[2])
Definition: sampledLine.cc:45
directedLine * prev
Definition: directedLine.h:45
GLfloat GLfloat v1
Definition: glext.h:6062
directedLine * directedLine::cutIntersectionAllPoly ( int cutOccur)

Definition at line 208 of file directedLine.cc.

209 {
211  directedLine *tempNext = NULL;
213  directedLine* retEnd = NULL;
214  cutOccur = 0;
215  for(temp=this; temp != NULL; temp = tempNext)
216  {
217  int eachCutOccur=0;
218  tempNext = temp->nextPolygon;
219  temp->nextPolygon = NULL;
220  if(ret == NULL)
221  {
222 
223  ret = retEnd = DBG_cutIntersectionPoly(temp, eachCutOccur);
224  if(eachCutOccur)
225  cutOccur = 1;
226  }
227  else
228  {
229 
230  retEnd->nextPolygon = DBG_cutIntersectionPoly(temp, eachCutOccur);
231  retEnd = retEnd->nextPolygon;
232  if(eachCutOccur)
233  cutOccur = 1;
234  }
235  }
236  return ret;
237 }
directedLine * DBG_cutIntersectionPoly(directedLine *polygon, int &cutOccur)
Definition: polyDBG.cc:549
smooth NULL
Definition: ftsmooth.c:416
int ret
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
directedLine * directedLine::cutoffPolygon ( directedLine p)

Definition at line 514 of file directedLine.cc.

Referenced by MC_partitionY(), and partitionY().

515 {
517  directedLine* prev_polygon = NULL;
518  if(p == NULL) return this;
519 
520  for(temp=this; temp != p; temp = temp->nextPolygon)
521  {
522  if(temp == NULL)
523  {
524  fprintf(stderr, "in cutoffPolygon, not found\n");
525  exit(1);
526  }
527  prev_polygon = temp;
528  }
529 
530 /* prev_polygon = p->prevPolygon;*/
531 
532  p->resetRootBit();
533  if(prev_polygon == NULL) /*this is the one to cutoff*/
534  return nextPolygon;
535  else {
536  prev_polygon->nextPolygon = p->nextPolygon;
537  return this;
538  }
539 }
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
void resetRootBit()
Definition: directedLine.h:152
FILE * stderr
void exit(int exitcode)
Definition: _exit.c:33
GLfloat GLfloat p
Definition: glext.h:8902
directedLine * directedLine::deleteChain ( directedLine begin,
directedLine end 
)

Definition at line 53 of file directedLine.cc.

54 {
55  if(begin->head()[0] == end->tail()[0] &&
56  begin->head()[1] == end->tail()[1]
57  )
58  {
59  directedLine *ret = begin->prev;
60  begin->prev->next = end->next;
61  end->next->prev = begin->prev;
62  delete begin->sline;
63  delete end->sline;
64  delete begin;
65  delete end;
66 
67  return ret;
68  }
69 
70  directedLine* newLine;
71  sampledLine* sline = new sampledLine(begin->head(), end->tail());
72  newLine = new directedLine(INCREASING, sline);
73  directedLine *p = begin->prev;
74  directedLine *n = end->next;
75  p->next = newLine;
76  n->prev = newLine;
77  newLine->prev = p;
78  newLine->next = n;
79 
80  delete begin->sline;
81  delete end->sline;
82  delete begin;
83  delete end;
84  return newLine;
85 }
directedLine * next
Definition: directedLine.h:44
Real * head()
GLuint GLuint end
Definition: gl.h:1545
sampledLine * sline
Definition: directedLine.h:43
GLuint n
Definition: s_context.h:57
static clock_t begin
Definition: xmllint.c:466
sampledLine * next
Definition: sampledLine.h:65
int ret
Real * tail()
directedLine * prev
Definition: directedLine.h:45
GLfloat GLfloat p
Definition: glext.h:8902
directedLine * directedLine::deleteDegenerateLines ( )

Definition at line 124 of file directedLine.cc.

Referenced by deleteDegenerateLinesAllPolygons().

125 {
126  //if there is only one edge or two edges, don't do anything
127  if(this->next == this)
128  return this;
129  if(this->next == this->prev)
130  return this;
131 
132  //find a nondegenerate line
135  if(! myequal(head(), tail()))
136  /*
137  if(head()[0] != tail()[0] ||
138  head()[1] != tail()[1])
139  */
140  first = this;
141  else
142  {
143  for(temp = this->next; temp != this; temp = temp->next)
144  {
145  /*
146  if(temp->head()[0] != temp->tail()[0] ||
147  temp->head()[1] != temp->tail()[1])
148  */
149  if(! myequal(temp->head(), temp->tail()))
150  {
151  first = temp;
152  break;
153  }
154 
155  }
156  }
157 
158  //if there are no non-degenerate lines, then we simply return NULL.
159  if(first == NULL)
160  {
162  return NULL;
163  }
164 
165  directedLine* tempNext = NULL;
166  for(temp =first->next; temp != first; temp = tempNext)
167  {
168  tempNext = temp->getNext();
169 /*
170  if(temp->head()[0] == temp->tail()[0] &&
171  temp->head()[1] == temp->tail()[1])
172 */
173 
174  if(myequal(temp->head(), temp->tail()))
175  deleteSingleLine(temp);
176  }
177  return first;
178 }
directedLine * next
Definition: directedLine.h:44
Real * head()
const GLint * first
Definition: glext.h:5794
void deleteSinglePolygonWithSline()
directedLine * getNext()
Definition: directedLine.h:74
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
Real * tail()
void deleteSingleLine(directedLine *dline)
Definition: directedLine.cc:88
directedLine * prev
Definition: directedLine.h:45
static Int myequal(Real a[2], Real b[2])
directedLine * directedLine::deleteDegenerateLinesAllPolygons ( )

Definition at line 180 of file directedLine.cc.

Referenced by Subdivider::drawSurfaces().

181 {
183  directedLine *tempNext = NULL;
185  directedLine* retEnd = NULL;
186  for(temp=this; temp != NULL; temp = tempNext)
187  {
188  tempNext = temp->nextPolygon;
189  temp->nextPolygon = NULL;
190  if(ret == NULL)
191  {
192  ret = retEnd = temp->deleteDegenerateLines();
193 
194  }
195  else
196  {
197  directedLine *newPolygon = temp->deleteDegenerateLines();
198  if(newPolygon != NULL)
199  {
200  retEnd->nextPolygon = temp->deleteDegenerateLines();
201  retEnd = retEnd->nextPolygon;
202  }
203  }
204  }
205  return ret;
206 }
smooth NULL
Definition: ftsmooth.c:416
int ret
directedLine * deleteDegenerateLines()
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
void directedLine::deletePolygonList ( )

Definition at line 273 of file directedLine.cc.

274 {
275  directedLine *temp, *tempNext;
276  for(temp=this; temp != NULL; temp=tempNext)
277  {
278  tempNext = temp->nextPolygon;
279  temp->deleteSinglePolygon();
280  }
281 }
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
void deleteSinglePolygon()
void directedLine::deletePolygonListWithSline ( )

Definition at line 252 of file directedLine.cc.

Referenced by monoTriangulationRecGenOpt().

253 {
254  directedLine *temp, *tempNext;
255  for(temp=this; temp != NULL; temp=tempNext)
256  {
257  tempNext = temp->nextPolygon;
259  }
260 }
void deleteSinglePolygonWithSline()
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
void directedLine::deleteSingleLine ( directedLine dline)

Definition at line 88 of file directedLine.cc.

Referenced by DBG_cutIntersectionPoly(), and deleteDegenerateLines().

89 {
90  //make sure that dline->prev->tail is the same as
91  //dline->next->head. This is for numerical erros.
92  //for example, if we delete a line which is almost degeneate
93  //within (epsilon), then we want to make that the polygon after deletion
94  //is still a valid polygon
95 
96  dline->next->head()[0] = dline->prev->tail()[0];
97  dline->next->head()[1] = dline->prev->tail()[1];
98 
99  dline->prev->next = dline->next;
100  dline->next->prev = dline->prev;
101 
102  delete dline;
103 
104 }
directedLine * next
Definition: directedLine.h:44
Real * head()
Real * tail()
directedLine * prev
Definition: directedLine.h:45
void directedLine::deleteSinglePolygon ( )

Definition at line 262 of file directedLine.cc.

Referenced by deletePolygonList().

263 {
264  directedLine *temp, *tempNext;
265  prev->next = NULL;
266  for(temp=this; temp != NULL; temp = tempNext)
267  {
268  tempNext = temp->next;
269  delete temp;
270  }
271 }
directedLine * next
Definition: directedLine.h:44
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
directedLine * prev
Definition: directedLine.h:45
void directedLine::deleteSinglePolygonWithSline ( )

Definition at line 240 of file directedLine.cc.

Referenced by deleteDegenerateLines(), deletePolygonListWithSline(), monoTriangulationOpt(), monoTriangulationRecGenOpt(), sampleLeftOneGridStep(), sampleMonoPoly(), sampleRightOneGridStep(), and Slicer::slice_new().

241 {
242  directedLine *temp, *tempNext;
243  prev->next = NULL;
244  for(temp=this; temp != NULL; temp = tempNext)
245  {
246  tempNext = temp->next;
247  delete temp->sline;
248  delete temp;
249  }
250 }
directedLine * next
Definition: directedLine.h:44
sampledLine * sline
Definition: directedLine.h:43
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
directedLine * prev
Definition: directedLine.h:45
directedLine * directedLine::findRoot ( )

Definition at line 722 of file directedLine.cc.

Referenced by MC_partitionY(), and partitionY().

723 {
724  if(rootBit) return this;
726  for(temp = next; temp != this; temp = temp->next)
727  if(temp -> rootBit ) return temp;
728  return NULL; /*should not happen*/
729 }
directedLine * next
Definition: directedLine.h:44
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
short directedLine::getDirection ( )
inline

Definition at line 78 of file directedLine.h.

Referenced by DBG_reverse().

78 {return direction;}
short direction
Definition: directedLine.h:42
sampledLine* directedLine::getSampledLine ( )
inline

Definition at line 76 of file directedLine.h.

Referenced by DBG_collectSampledLinesPoly().

76 {return sline;}
sampledLine * sline
Definition: directedLine.h:43
Real * directedLine::getVertex ( Int  i)
void directedLine::init ( short  dir,
sampledLine sl 
)

Definition at line 299 of file directedLine.cc.

300 {
301  direction = dir;
302  sline = sl;
303 }
sampledLine * sline
Definition: directedLine.h:43
PIN_DIRECTION dir
Definition: strmbase.h:230
short direction
Definition: directedLine.h:42
void directedLine::insert ( directedLine nl)

Definition at line 337 of file directedLine.cc.

Referenced by arcToMultDLines(), monoTriangulationRecGenOpt(), o_pwlcurve_to_DLines(), polygonConvert(), readAllPolygons(), sampleLeftOneGridStep(), and sampleRightOneGridStep().

338 {
339  nl->next = this;
340  nl->prev = prev;
341  prev->next = nl;
342  prev = nl;
343  nl->rootLink = this; /*assuming that 'this' is the root!!!*/
344 }
directedLine * next
Definition: directedLine.h:44
directedLine * rootLink
Definition: directedLine.h:58
directedLine * prev
Definition: directedLine.h:45
directedLine * directedLine::insertPolygon ( directedLine newpolygon)

Definition at line 501 of file directedLine.cc.

Referenced by bin_to_DLineLoops(), DBG_cutIntersectionAllPoly(), MC_partitionY(), monoPolyPart(), o_trim_to_DLineLoops(), partitionY(), and readAllPolygons().

502 {
503  /*this polygon is a root*/
504  setRootBit();
505  if(oldList == NULL) return this;
506  nextPolygon = oldList;
507 /* oldList->prevPolygon = this;*/
508  return this;
509 }
smooth NULL
Definition: ftsmooth.c:416
directedLine * nextPolygon
Definition: directedLine.h:50
void setRootBit()
Definition: directedLine.h:151
short directedLine::isConnected ( )

Definition at line 391 of file directedLine.cc.

Referenced by isPolygon().

392 {
393  if( (head()[0] == prev->tail()[0]) && (head()[1] == prev->tail()[1]))
394  return 1;
395  else
396  return 0;
397 }
Real * head()
Real * tail()
directedLine * prev
Definition: directedLine.h:45
short directedLine::isPolygon ( )

Definition at line 371 of file directedLine.cc.

372 {
374 
375  /*a polygon contains at least 3 edges*/
376  if(numEdges() <=2) return 0;
377 
378  /*check this edge*/
379  if(! isConnected()) return 0;
380 
381  /*check all other edges*/
382  for(temp=next; temp != this; temp = temp->next){
383  if(!isConnected()) return 0;
384  }
385  return 1;
386 }
directedLine * next
Definition: directedLine.h:44
static stack_node_t temp
Definition: rpn.c:18
short isConnected()
Int directedLine::numEdges ( )

Definition at line 346 of file directedLine.cc.

Referenced by isPolygon(), monoTriangulationOpt(), monoTriangulationRecGenOpt(), numEdgesAllPolygons(), and sampleMonoPoly().

347 {
348  Int ret=0;
350  if(next == this) return 1;
351 
352  ret = 1;
353  for(temp = next; temp != this; temp = temp->next)
354  ret++;
355  return ret;
356 }
directedLine * next
Definition: directedLine.h:44
int ret
static stack_node_t temp
Definition: rpn.c:18
int Int
Definition: definitions.h:37
Int directedLine::numEdgesAllPolygons ( )

Definition at line 358 of file directedLine.cc.

Referenced by toArrayAllPolygons().

359 {
360  Int ret=0;
362  for(temp=this; temp!= NULL; temp=temp->nextPolygon)
363  {
364  ret += temp->numEdges();
365  }
366  return ret;
367 }
smooth NULL
Definition: ftsmooth.c:416
int ret
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
int Int
Definition: definitions.h:37
Int directedLine::numPolygons ( )

Definition at line 541 of file directedLine.cc.

Referenced by numPolygons(), and writeAllPolygons().

542 {
543  if(nextPolygon == NULL) return 1;
544  else return 1+nextPolygon->numPolygons();
545 }
smooth NULL
Definition: ftsmooth.c:416
directedLine * nextPolygon
Definition: directedLine.h:50
Real directedLine::polyArea ( )

Definition at line 585 of file directedLine.cc.

Referenced by DBG_isCounterclockwise().

586 {
588  Real ret=0.0;
589  Real x1,y1,x2,y2;
590  x1 = this->head()[0];
591  y1 = this->head()[1];
592  x2 = this->next->head()[0];
593  y2 = this->next->head()[1];
594  ret = -(x2*y1-x1*y2);
595  for(temp=this->next; temp!=this; temp = temp->next)
596  {
597  x1 = temp->head()[0];
598  y1 = temp->head()[1];
599  x2 = temp->next->head()[0];
600  y2 = temp->next->head()[1];
601  ret += -( x2*y1-x1*y2);
602  }
603  return Real(0.5)*ret;
604 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
directedLine * next
Definition: directedLine.h:44
Real * head()
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
int ret
static stack_node_t temp
Definition: rpn.c:18
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
float Real
Definition: definitions.h:36
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
void directedLine::printAllPolygons ( )

Definition at line 490 of file directedLine.cc.

491 {
493  for(temp = this; temp!=NULL; temp = temp->nextPolygon)
494  {
495  printf("polygon:\n");
496  temp->printList();
497  }
498 }
smooth NULL
Definition: ftsmooth.c:416
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
void printList()
#define printf
Definition: config.h:203
void directedLine::printList ( )

Definition at line 481 of file directedLine.cc.

Referenced by printAllPolygons().

482 {
484  printSingle();
485  for(temp = next; temp!=this; temp=temp->next)
486  temp->printSingle();
487 }
directedLine * next
Definition: directedLine.h:44
static stack_node_t temp
Definition: rpn.c:18
void printSingle()
void directedLine::printSingle ( )

Definition at line 470 of file directedLine.cc.

Referenced by printList(), and sweepY().

471 {
472  if(direction == INCREASING)
473  printf("direction is INCREASING\n");
474  else
475  printf("direction is DECREASING\n");
476  printf("head=%f,%f)\n", head()[0], head()[1]);
477  sline->print();
478 }
Real * head()
sampledLine * sline
Definition: directedLine.h:43
void print()
Definition: sampledLine.cc:129
short direction
Definition: directedLine.h:42
#define printf
Definition: config.h:203
void directedLine::putDirection ( short  dir)
inline

Definition at line 79 of file directedLine.h.

Referenced by DBG_reverse().

79 {direction = dir;}
PIN_DIRECTION dir
Definition: strmbase.h:230
short direction
Definition: directedLine.h:42
void directedLine::putNext ( directedLine p)
inline

Definition at line 81 of file directedLine.h.

Referenced by DBG_reverse().

81 {next = p;}
directedLine * next
Definition: directedLine.h:44
GLfloat GLfloat p
Definition: glext.h:8902
void directedLine::putPrev ( directedLine p)
inline

Definition at line 80 of file directedLine.h.

Referenced by DBG_reverse().

80 {prev = p;}
directedLine * prev
Definition: directedLine.h:45
GLfloat GLfloat p
Definition: glext.h:8902
void directedLine::resetRootBit ( )
inline

Definition at line 152 of file directedLine.h.

Referenced by cutoffPolygon().

152 {rootBit = 0;}
directedLine * directedLine::rootLinkFindRoot ( )

Definition at line 731 of file directedLine.cc.

Referenced by MC_partitionY(), and partitionY().

732 {
733  directedLine* tempRoot;
734  directedLine* tempLink;
735  tempRoot = this;
736  tempLink = rootLink;
737  while(tempLink != NULL){
738  tempRoot = tempLink;
739  tempLink = tempRoot->rootLink;
740  }
741  return tempRoot;
742 }
smooth NULL
Definition: ftsmooth.c:416
directedLine * rootLink
Definition: directedLine.h:58
void directedLine::rootLinkSet ( directedLine r)
inline

Definition at line 155 of file directedLine.h.

Referenced by MC_partitionY(), partitionY(), and readAllPolygons().

155 {rootLink = r;}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
directedLine * rootLink
Definition: directedLine.h:58
Int directedLine::samePolygon ( directedLine v1,
directedLine v2 
)

Definition at line 711 of file directedLine.cc.

Referenced by MC_partitionY(), and partitionY().

712 {
713  if(v1 == v2) return 1;
715  for(temp = v1->next; temp != v1; temp = temp->next)
716  {
717  if(temp == v2) return 1;
718  }
719  return 0;
720 }
directedLine * next
Definition: directedLine.h:44
static stack_node_t temp
Definition: rpn.c:18
void directedLine::setRootBit ( )
inline

Definition at line 151 of file directedLine.h.

Referenced by insertPolygon().

151 {rootBit = 1;}
directedLine ** directedLine::sortAllPolygons ( )

Definition at line 461 of file directedLine.cc.

462 {
463  Int total_num_edges = 0;
464  directedLine** array = toArrayAllPolygons(total_num_edges);
465  quicksort( (void**)array, 0, total_num_edges-1, (Int (*)(void *, void *)) compInY2);
466 
467  return array;
468 }
void quicksort(void *v[], int left, int right, int(*comp)(void *, void *))
Definition: quicksort.cc:62
static Int compInY2(directedLine *v1, directedLine *v2)
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum array
Definition: glfuncs.h:84
directedLine ** toArrayAllPolygons(Int &total_num_edges)
int Int
Definition: definitions.h:37
directedLine ** directedLine::toArrayAllPolygons ( Int total_num_edges)

Definition at line 567 of file directedLine.cc.

Referenced by DBGfindDiagonals(), partitionY(), and sortAllPolygons().

568 {
569  total_num_edges=numEdgesAllPolygons();
570  directedLine** ret = (directedLine**) malloc(sizeof(directedLine*) * total_num_edges);
571  assert(ret);
572 
574  Int index = 0;
575  for(temp=this; temp != NULL; temp=temp->nextPolygon) {
576  index = temp->toArraySinglePolygon(ret, index);
577  }
578  return ret;
579 }
Int toArraySinglePolygon(directedLine **array, Int index)
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
int ret
Int numEdgesAllPolygons()
static stack_node_t temp
Definition: rpn.c:18
directedLine * nextPolygon
Definition: directedLine.h:50
#define malloc
Definition: debug_ros.c:4
int Int
Definition: definitions.h:37
Int directedLine::toArraySinglePolygon ( directedLine **  array,
Int  index 
)

Definition at line 552 of file directedLine.cc.

Referenced by toArrayAllPolygons().

553 {
555  array[index++] = this;
556  for(temp = next; temp != this; temp = temp->next)
557  {
558  array[index++] = temp;
559  }
560  return index;
561 }
directedLine * next
Definition: directedLine.h:44
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
static stack_node_t temp
Definition: rpn.c:18
void directedLine::writeAllPolygons ( char filename)

Definition at line 756 of file directedLine.cc.

757 {
758  FILE* fp = fopen(filename, "w");
759  assert(fp);
760  Int nPolygons = numPolygons();
762  fprintf(fp, "%i\n", nPolygons);
763  for(root = this; root != NULL; root = root->nextPolygon)
764  {
766  Int npoints=0;
767  npoints = root->get_npoints()-1;
768  for(temp = root->next; temp != root; temp=temp->next)
769  npoints += temp->get_npoints()-1;
770  fprintf(fp, "%i\n", npoints/*root->numEdges()*/);
771 
772 
773  for(Int i=0; i<root->get_npoints()-1; i++){
774  fprintf(fp, "%f ", root->getVertex(i)[0]);
775  fprintf(fp, "%f ", root->getVertex(i)[1]);
776  }
777 
778  for(temp=root->next; temp != root; temp = temp->next)
779  {
780  for(Int i=0; i<temp->get_npoints()-1; i++){
781 
782  fprintf(fp, "%f ", temp->getVertex(i)[0]);
783  fprintf(fp, "%f ", temp->getVertex(i)[1]);
784  }
785  fprintf(fp,"\n");
786  }
787  fprintf(fp, "\n");
788  }
789  fclose(fp);
790 }
directedLine * next
Definition: directedLine.h:44
struct _root root
#define assert(x)
Definition: debug.h:53
const char * filename
Definition: ioapi.h:135
GLenum GLclampf GLint i
Definition: glfuncs.h:14
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
Real * getVertex(Int i)
smooth NULL
Definition: ftsmooth.c:416
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
static stack_node_t temp
Definition: rpn.c:18
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
directedLine * nextPolygon
Definition: directedLine.h:50
Int get_npoints()
Definition: directedLine.h:72
int Int
Definition: definitions.h:37

Member Data Documentation

short directedLine::direction
private
Int directedLine::rootBit
private

Definition at line 55 of file directedLine.h.

Referenced by directedLine(), findRoot(), resetRootBit(), and setRootBit().

directedLine* directedLine::rootLink
private

Definition at line 58 of file directedLine.h.

Referenced by directedLine(), insert(), rootLinkFindRoot(), and rootLinkSet().


The documentation for this class was generated from the following files: