ReactOS  0.4.14-dev-337-gf981a68
monoChain Class Reference

#include <monoChain.h>

Collaboration diagram for monoChain:

Public Member Functions

 monoChain (directedLine *cHead, directedLine *cTail)
 
 ~monoChain ()
 
void setNext (monoChain *n)
 
void setPrev (monoChain *p)
 
void setNextPolygon (monoChain *np)
 
monoChaingetNext ()
 
monoChaingetPrev ()
 
directedLinegetHead ()
 
directedLinegetTail ()
 
void resetCurrent ()
 
void deleteLoop ()
 
void deleteLoopList ()
 
void insert (monoChain *nc)
 
Int numChainsSingleLoop ()
 
Int numChainsAllLoops ()
 
monoChain ** toArrayAllLoops (Int &num_chains)
 
Int toArraySingleLoop (monoChain **array, Int index)
 
Real chainIntersectHoriz (Real y)
 
directedLinefind (Real y)
 
void printOneChain ()
 
void printChainLoop ()
 
void printAllLoops ()
 

Public Attributes

Int isKey
 
Real keyY
 

Private Attributes

directedLinechainHead
 
directedLinechainTail
 
monoChainnext
 
monoChainprev
 
monoChainnextPolygon
 
Real minX
 
Real maxX
 
Real minY
 
Real maxY
 
Int isIncrease
 
directedLinecurrent
 

Detailed Description

Definition at line 41 of file monoChain.h.

Constructor & Destructor Documentation

◆ monoChain()

monoChain::monoChain ( directedLine cHead,
directedLine cTail 
)

Definition at line 90 of file monoChain.cc.

91 {
92  chainHead = cHead;
93  chainTail = cTail;
94  next = this;
95  prev = this;
96 
97  nextPolygon = NULL;
98 
99  //compute bounding box
101  minX = maxX = chainTail->head()[0];
102  minY = maxY = chainTail->head()[1];
103 
104  for(temp=chainHead; temp!=cTail; temp = temp->getNext())
105  {
106  if(temp->head()[0] < minX)
107  minX = temp->head()[0];
108  if(temp->head()[0] > maxX)
109  maxX = temp->head()[0];
110 
111  if(temp->head()[1] < minY)
112  minY = temp->head()[1];
113  if(temp->head()[1] > maxY)
114  maxY = temp->head()[1];
115  }
116 
117  //check whether the chain is increasing or decreasing
118  if(chainHead->compInY(chainTail) <0)
119  isIncrease = 1;
120  else
121  isIncrease = 0;
122 
123  //initilize currrent, this is used for accelerating search
124  if(isIncrease)
125  current = chainHead;
126  else
127  current = chainTail;
128 
129  isKey = 0;
130  keyY = 0;
131 }
monoChain * next
Definition: monoChain.h:44
Real * head()
Real minY
Definition: monoChain.h:50
monoChain * prev
Definition: monoChain.h:45
Real keyY
Definition: monoChain.h:83
Int isIncrease
Definition: monoChain.h:51
Int isKey
Definition: monoChain.h:82
directedLine * current
Definition: monoChain.h:55
Real maxX
Definition: monoChain.h:50
Real maxY
Definition: monoChain.h:50
smooth NULL
Definition: ftsmooth.c:416
Int compInY(directedLine *nl)
monoChain * nextPolygon
Definition: monoChain.h:46
directedLine * chainTail
Definition: monoChain.h:43
directedLine * chainHead
Definition: monoChain.h:42
Real minX
Definition: monoChain.h:50
static calc_node_t temp
Definition: rpn_ieee.c:38

◆ ~monoChain()

monoChain::~monoChain ( )
inline

Definition at line 59 of file monoChain.h.

59 {}

Member Function Documentation

◆ chainIntersectHoriz()

Real monoChain::chainIntersectHoriz ( Real  y)

Definition at line 208 of file monoChain.cc.

209 {
211  if(isIncrease)
212  {
213  for(temp= current; temp != chainTail; temp = temp->getNext())
214  {
215  if(temp->head()[1] > y)
216  break;
217  }
218  current = temp->getPrev();
219  }
220  else
221  {
222  for(temp = current; temp != chainHead; temp = temp->getPrev())
223  {
224  if(temp->head()[1] > y)
225  break;
226  }
227  current = temp->getNext();
228  }
229  return intersectHoriz(current->head()[0], current->head()[1], current->tail()[0], current->tail()[1], y);
230 }
Real * head()
Real intersectHoriz(Real x1, Real y1, Real x2, Real y2, Real y)
Definition: monoChain.cc:79
Int isIncrease
Definition: monoChain.h:51
directedLine * current
Definition: monoChain.h:55
directedLine * chainTail
Definition: monoChain.h:43
directedLine * chainHead
Definition: monoChain.h:42
Real * tail()
static calc_node_t temp
Definition: rpn_ieee.c:38
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ deleteLoop()

void monoChain::deleteLoop ( )

Definition at line 142 of file monoChain.cc.

143 {
144  monoChain *temp, *tempNext;
145  prev->next = NULL;
146  for(temp=this; temp != NULL; temp = tempNext)
147  {
148  tempNext = temp->next;
149  delete temp;
150  }
151 }
monoChain * next
Definition: monoChain.h:44
monoChain * prev
Definition: monoChain.h:45
smooth NULL
Definition: ftsmooth.c:416
static calc_node_t temp
Definition: rpn_ieee.c:38

◆ deleteLoopList()

void monoChain::deleteLoopList ( )

Definition at line 153 of file monoChain.cc.

154 {
155  monoChain *temp, *tempNext;
156  for(temp=this; temp != NULL; temp = tempNext)
157  {
158  tempNext = temp->nextPolygon;
159  temp->deleteLoop();
160  }
161 }
smooth NULL
Definition: ftsmooth.c:416
static calc_node_t temp
Definition: rpn_ieee.c:38

Referenced by MC_partitionY().

◆ find()

directedLine * monoChain::find ( Real  y)

Definition at line 393 of file monoChain.cc.

394 {
395  directedLine *ret;
397  assert(current->head()[1] <= y);
398  if(isIncrease)
399  {
400  assert(chainTail->head()[1] >=y);
401  for(temp=current; temp!=chainTail; temp = temp->getNext())
402  {
403  if(temp->head()[1] > y)
404  break;
405  }
406  current = temp->getPrev();
407  ret = current;
408  }
409  else
410  {
411  for(temp=current; temp != chainHead; temp = temp->getPrev())
412  {
413  if(temp->head()[1] > y)
414  break;
415  }
416  current = temp->getNext();
417  ret = temp;
418  }
419  return ret;
420 }
Real * head()
#define assert(x)
Definition: debug.h:53
Int isIncrease
Definition: monoChain.h:51
directedLine * current
Definition: monoChain.h:55
directedLine * chainTail
Definition: monoChain.h:43
directedLine * chainHead
Definition: monoChain.h:42
int ret
static calc_node_t temp
Definition: rpn_ieee.c:38
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by compChains().

◆ getHead()

directedLine* monoChain::getHead ( )
inline

Definition at line 66 of file monoChain.h.

66 {return chainHead;}
directedLine * chainHead
Definition: monoChain.h:42

Referenced by compChainHeadInY(), MC_findDiagonals(), and MC_sweepY().

◆ getNext()

monoChain* monoChain::getNext ( )
inline

Definition at line 64 of file monoChain.h.

64 {return next;}
monoChain * next
Definition: monoChain.h:44

◆ getPrev()

monoChain* monoChain::getPrev ( )
inline

Definition at line 65 of file monoChain.h.

65 {return prev;}
monoChain * prev
Definition: monoChain.h:45

Referenced by MC_sweepY().

◆ getTail()

directedLine* monoChain::getTail ( )
inline

Definition at line 67 of file monoChain.h.

67 {return chainTail;}
directedLine * chainTail
Definition: monoChain.h:43

◆ insert()

void monoChain::insert ( monoChain nc)

Definition at line 134 of file monoChain.cc.

135 {
136  nc->next = this;
137  nc->prev = prev;
138  prev->next = nc;
139  prev = nc;
140 }
monoChain * next
Definition: monoChain.h:44
monoChain * prev
Definition: monoChain.h:45

◆ numChainsAllLoops()

Int monoChain::numChainsAllLoops ( )

Definition at line 198 of file monoChain.cc.

199 {
200  Int ret=0;
201  monoChain *temp;
202  for(temp =this; temp != NULL; temp = temp->nextPolygon)
203  ret += temp->numChainsSingleLoop();
204  return ret;
205 }
smooth NULL
Definition: ftsmooth.c:416
int ret
static calc_node_t temp
Definition: rpn_ieee.c:38
int Int
Definition: definitions.h:37

Referenced by toArrayAllLoops().

◆ numChainsSingleLoop()

Int monoChain::numChainsSingleLoop ( )

Definition at line 187 of file monoChain.cc.

188 {
189  Int ret=0;
190  monoChain* temp;
191  if(next == this) return 1;
192  ret = 1;
193  for(temp=next; temp != this; temp = temp->next)
194  ret++;
195  return ret;
196 }
monoChain * next
Definition: monoChain.h:44
int ret
static calc_node_t temp
Definition: rpn_ieee.c:38
int Int
Definition: definitions.h:37

◆ printAllLoops()

void monoChain::printAllLoops ( )

Definition at line 443 of file monoChain.cc.

444 {
445  monoChain* temp;
446  for(temp=this; temp != NULL; temp = temp->nextPolygon)
447  temp->printChainLoop();
448 }
smooth NULL
Definition: ftsmooth.c:416
static calc_node_t temp
Definition: rpn_ieee.c:38

◆ printChainLoop()

void monoChain::printChainLoop ( )

Definition at line 432 of file monoChain.cc.

433 {
434  monoChain* temp;
435  this->printOneChain();
436  for(temp = next; temp != this; temp = temp->next)
437  {
438  temp->printOneChain();
439  }
440  printf("\n");
441 }
monoChain * next
Definition: monoChain.h:44
static calc_node_t temp
Definition: rpn_ieee.c:38
#define printf
Definition: config.h:203
void printOneChain()
Definition: monoChain.cc:422

◆ printOneChain()

void monoChain::printOneChain ( )

Definition at line 422 of file monoChain.cc.

423 {
425  for(temp = chainHead; temp != chainTail; temp = temp->getNext())
426  {
427  printf("(%f,%f) ", temp->head()[0], temp->head()[1]);
428  }
429  printf("(%f,%f) \n", chainTail->head()[0], chainTail->head()[1]);
430 }
Real * head()
directedLine * chainTail
Definition: monoChain.h:43
directedLine * chainHead
Definition: monoChain.h:42
static calc_node_t temp
Definition: rpn_ieee.c:38
#define printf
Definition: config.h:203

Referenced by printChainLoop().

◆ resetCurrent()

void monoChain::resetCurrent ( )
inline

Definition at line 69 of file monoChain.h.

Int isIncrease
Definition: monoChain.h:51
directedLine * current
Definition: monoChain.h:55
directedLine * chainTail
Definition: monoChain.h:43
directedLine * chainHead
Definition: monoChain.h:42

◆ setNext()

void monoChain::setNext ( monoChain n)
inline

Definition at line 61 of file monoChain.h.

61 {next = n;}
monoChain * next
Definition: monoChain.h:44
GLdouble n
Definition: glext.h:7729

◆ setNextPolygon()

void monoChain::setNextPolygon ( monoChain np)
inline

Definition at line 63 of file monoChain.h.

63 {nextPolygon = np;}
monoChain * nextPolygon
Definition: monoChain.h:46

Referenced by directedLineLoopListToMonoChainLoopList().

◆ setPrev()

void monoChain::setPrev ( monoChain p)
inline

Definition at line 62 of file monoChain.h.

62 {prev = p;}
monoChain * prev
Definition: monoChain.h:45
GLfloat GLfloat p
Definition: glext.h:8902

◆ toArrayAllLoops()

monoChain ** monoChain::toArrayAllLoops ( Int num_chains)

Definition at line 174 of file monoChain.cc.

175 {
176  num_chains = numChainsAllLoops();
177  monoChain **ret = (monoChain**) malloc(sizeof(monoChain*) * num_chains);
178  assert(ret);
179  monoChain *temp;
180  Int index = 0;
181  for(temp = this; temp != NULL; temp=temp->nextPolygon){
182  index = temp->toArraySingleLoop(ret, index);
183  }
184  return ret;
185 }
Int numChainsAllLoops()
Definition: monoChain.cc:198
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
int ret
static calc_node_t temp
Definition: rpn_ieee.c:38
#define malloc
Definition: debug_ros.c:4
int Int
Definition: definitions.h:37

Referenced by MC_partitionY().

◆ toArraySingleLoop()

Int monoChain::toArraySingleLoop ( monoChain **  array,
Int  index 
)

Definition at line 163 of file monoChain.cc.

164 {
165  monoChain *temp;
166  array[index++] = this;
167  for(temp = next; temp != this; temp = temp->next)
168  {
169  array[index++] = temp;
170  }
171  return index;
172 }
monoChain * next
Definition: monoChain.h:44
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
static calc_node_t temp
Definition: rpn_ieee.c:38

Member Data Documentation

◆ chainHead

directedLine* monoChain::chainHead
private

Definition at line 42 of file monoChain.h.

Referenced by chainIntersectHoriz(), find(), getHead(), monoChain(), printOneChain(), and resetCurrent().

◆ chainTail

directedLine* monoChain::chainTail
private

Definition at line 43 of file monoChain.h.

Referenced by chainIntersectHoriz(), find(), getTail(), monoChain(), printOneChain(), and resetCurrent().

◆ current

directedLine* monoChain::current
private

Definition at line 55 of file monoChain.h.

Referenced by chainIntersectHoriz(), find(), monoChain(), and resetCurrent().

◆ isIncrease

Int monoChain::isIncrease
private

Definition at line 51 of file monoChain.h.

Referenced by chainIntersectHoriz(), find(), monoChain(), and resetCurrent().

◆ isKey

Int monoChain::isKey

Definition at line 82 of file monoChain.h.

Referenced by compChains(), MC_sweepY(), and monoChain().

◆ keyY

Real monoChain::keyY

Definition at line 83 of file monoChain.h.

Referenced by compChains(), MC_sweepY(), and monoChain().

◆ maxX

Real monoChain::maxX
private

Definition at line 50 of file monoChain.h.

Referenced by monoChain().

◆ maxY

Real monoChain::maxY
private

Definition at line 50 of file monoChain.h.

Referenced by monoChain().

◆ minX

Real monoChain::minX
private

Definition at line 50 of file monoChain.h.

Referenced by monoChain().

◆ minY

Real monoChain::minY
private

Definition at line 50 of file monoChain.h.

Referenced by monoChain().

◆ next

monoChain* monoChain::next
private

◆ nextPolygon

monoChain* monoChain::nextPolygon
private

Definition at line 46 of file monoChain.h.

Referenced by monoChain(), and setNextPolygon().

◆ prev

monoChain* monoChain::prev
private

Definition at line 45 of file monoChain.h.

Referenced by deleteLoop(), getPrev(), insert(), monoChain(), and setPrev().


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