46 vector<halfsegment> eq;
56 if( eq.empty() || eq[eq.size()-1] < h1 ) {
61 for( vector<halfsegment>::iterator it = eq.begin(); ;it++ ){
93 eq.erase( eq.begin() );
107 cerr <<
"eq:-----"<<endl;
108 for(
int i = 0; i < eq.size(); i++ )
109 cerr << eq[i] << endl;
110 cerr <<
"^^^^^^"<< endl;
134 vector<halfsegment> al;
172 if( newH1.
dx == h1.
sx && newH1.
dy == h1.
sy ) {
180 if( newH2.
dx == h2.
sx && newH2.
dy == h2.
sy ) {
190 if( h1Y < h2Y )
return true;
191 else if( h1Y > h2Y )
return false;
197 if( newH1 < newH2 )
return false;
201 if( newH1 < newH2 )
return true;
207 if( !newH1.
isLeft() )
return true;
211 cerr<<
"AL comp. got a left and right" << endl;
212 cerr<<
"xval: " << std::setprecision(100)<< xVal << endl;
213 cerr << std::setprecision(100) << h1 << endl << h2 << endl << newH1 << endl << newH2 << endl;
247 if( al.empty() || !
alHsegLT( h1, al[al.size()-1]) ) {
250 segIndex = al.size()-1;
255 for( vector<halfsegment>::iterator it = al.begin(); ; it++ ){
295 for(
int i= 0; i < al.size(); i++ ){
310 int index =
find( h1 );
311 if( index <0 || index >= al.size() ){
312 cerr <<
"replace: did not find halfsegment: " << h1 << endl;
329 if( index <0 || index >= al.size() ){
330 cerr <<
"replace: did not find halfsegment: " << h1 << endl;
333 if( al[index] == h1 ){
338 cerr <<
"trying to replace a seg by index that does not match" <<endl;
352 if( index < 0 || index > al.size() ){
353 cerr <<
"invalid size getAbove AL"<<endl;
356 if( index >= al.size()-1 ){
359 theAbove = al[index+1];
372 int index = this->
find( h1 );
374 if( index < 0 || index > al.size() ){
375 cerr <<
"invalid size getAbove AL"<<endl;
378 if( index >= al.size()-1 ){
381 theAbove = al[index+1];
392 if( index < 0 || index >= al.size() ){
393 cerr <<
"invalid size getBelow AL"<<endl;
399 theBelow = al[index-1];
411 int index = this->
find( h1 );
412 if( index < 0 || index >= al.size() ){
413 cerr <<
"invalid size getBelow AL"<<endl;
419 theBelow = al[index-1];
426 if( index < 0 || index >= al.size() )
429 vector<halfsegment>::iterator it = al.begin() + index;
436 cerr <<
"trying to erase a seg by index that does not match" <<endl;
448 for(vector<halfsegment>::iterator it = al.begin();it != al.end() ; it++ ){
461 cerr <<
"al:-----"<<endl;
462 for(
int i = 0; i < al.size(); i++ )
463 cerr << al[i] << endl;
464 cerr <<
"^^^^^^" << endl;
bool colinear(const halfsegment &rhs) const
A vector-based implementation of a plane sweep event queue.
holds a single halfsegment, along with labeling information and information indicating if the opposin...
bool alHsegLT(const halfsegment &h1, const halfsegment &h2)
double getYvalAtX(const double x) const
bool getBelow(const halfsegment &h1, halfsegment &theBelow, const int index)
bool alHsegEQ(const halfsegment &h1, const halfsegment &h2)
bool exists(const halfsegment &h1, halfsegment &theCopy, int &index)
double dx
dominating and submissive points
bool getAbove(const halfsegment &h1, halfsegment &theAbove)
A vector-based implementation of a plane sweep active list.
void replace(const halfsegment &h1, const halfsegment &newH1, const int index)
void replace(const halfsegment &h1, const halfsegment &newH1)
void insert(const halfsegment &h1, bool &duplicate, halfsegment &theDup, int &segIndex)
bool getBelow(const halfsegment &h1, halfsegment &theBelow)
bool getAbove(const halfsegment &h1, halfsegment &theAbove, const int index)
void insert(const halfsegment &h1)
double xVal
The current position of the sweep line.
void erase(const halfsegment &h1)
int find(const halfsegment &h1)
void erase(const halfsegment &h1, const int index)
bool peek(halfsegment &h1)