Public Member Functions | |
GrahamComparator (tCoord const &reference) | |
bool | operator() (tCoord const &a, tCoord const &b) |
Private Attributes | |
tCoord const & | m_reference |
Definition at line 85 of file tCoord.h.
tCoord::GrahamComparator::GrahamComparator | ( | tCoord const & | reference | ) | [inline] |
Definition at line 89 of file tCoord.h.
References EPS, m_reference, tCoord::NormSquared(), REAL, and tCoord::Tangent().
00089 { 00090 REAL ta = Tangent(m_reference, a), tb = Tangent(m_reference, b); 00091 00092 //check for 90 degree angles... 00093 if(ta == NAN && tb == NAN) return fabs((m_reference-a).NormSquared()) < fabs((m_reference-b).NormSquared()); 00094 if(ta == NAN) return tb<0; 00095 if(tb == NAN) return ta>0; 00096 00097 //check for opposite sides 00098 if(ta>0 && tb<0) return true; 00099 if(tb>0 && ta<0) return false; 00100 00101 return (ta<tb-EPS) || ((fabs(ta-tb)<EPS) && fabs((m_reference-a).NormSquared()) < fabs((m_reference-b).NormSquared())); 00102 }
tCoord const& tCoord::GrahamComparator::m_reference [private] |