30 inline bool leftHandturn(
double p1x,
double p1y,
double p2x,
double p2y,
double p3x,
double p3y )
34 return( ( ((p3y - p1y) * (p2x - p1x)) - ((p2y - p1y) * (p3x - p1x)) ) > 0 );
58 double dx, dy, sx, sy;
72 stripID(-1), regionID( -1 ), ola( -1 ), olb( -1 )
79 sx(rhs.sx), sy(rhs.sy),
80 la(rhs.la), lb(rhs.lb),
81 stripID( rhs.stripID), regionID( rhs.regionID ),
82 ola( rhs.ola ), olb( rhs.olb )
90 return( dx < sx || (dx == sx && dy < sy ) );
113 return dx == rhs.
dx && dy == rhs.
dy && sx == rhs.
sx && sy == rhs.
sy;
125 if( dx < rhs.
dx || (dx == rhs.
dx && dy < rhs.
dy ) )
return true;
126 else if( dx == rhs.
dx && dy == rhs.
dy ) {
128 if( isLeft() != rhs.
isLeft( ) )
return !isLeft();
130 else if( this->colinear( rhs ) && (sx < rhs.
sx || (sx == rhs.
sx && sy < rhs.
sy)) )
return true;
142 return 0 == ( ((rhs.
dy - dy) * (sx - dx)) - ((sy - dy) * (rhs.
dx - dx)) ) &&
143 0 == ( ((rhs.
sy - dy) * (sx - dx)) - ((sy - dy) * (rhs.
sx - dx)) ) ;
157 if( x == dx )
return dy;
158 else if( x == sx )
return sy;
159 return( ( (sy*x - sy*dx - dy*x + dy*dx) /
float((sx-dx))) + dy );
166 cerr <<
"[(" << rhs.
dx <<
"," << rhs.
dy <<
")(" << rhs.
sx <<
"," << rhs.
sy <<
") " << rhs.
la <<
", " << rhs.
lb <<
", " << rhs.
regionID <<
" <" << rhs.
ola <<
","<<rhs.
olb<<
">"<<
"]";
bool colinear(const halfsegment &rhs) const
holds a single halfsegment, along with labeling information and information indicating if the opposin...
int regionID
The region the seg belongs to.
bool leftHandturn(double p1x, double p1y, double p2x, double p2y, double p3x, double p3y)
double getYvalAtX(const double x) const
bool operator<(const halfsegment &rhs) const
double dx
dominating and submissive points
int la
label above, label below
friend ostream & operator<<(ostream &out, const halfsegment &rhs)
halfsegment(const halfsegment &rhs)
halfsegment getBrother() const
bool operator==(const halfsegment &rhs) const