// Description: implementation of sweep status structure function object and utility classes // Revision history: 5/8/99/LY #include "decl.h" #include "sweep.h" bool SweepKeyCmp::operator() (const SweepElementKey& sw_lhs, const SweepElementKey& sw_rhs) const { // if sw_lhs is farther down the screen than sw_rhs if (sw_lhs.upper.second > sw_rhs.upper.second) { // find x-coord of sw_rhs at sw_lhs.upper.second double x = sw_rhs.upper.first + ((sw_lhs.upper.second - sw_rhs.upper.second)*sw_rhs.slope); return sw_lhs.upper.first <= x; } // if sw_rhs is farther down the screen than sw_lhs else if (sw_rhs.upper.second > sw_lhs.upper.second) { // find x-coord of sw_lhs at sw_rhs.upper.second double x = sw_lhs.upper.first + ((sw_rhs.upper.second - sw_lhs.upper.second)*sw_lhs.slope); return x < sw_rhs.upper.first; } // if sw_rhs and sw_lhs share the same upper endpoint (y-coordinate equality is implied at this juncture) else if (sw_rhs.upper.first == sw_lhs.upper.first) { return sw_lhs.slope < sw_rhs.slope; } // if sw_lhs and sw_rhs share upper endpoint y-coordinate but not x-coordinate else return sw_lhs < sw_rhs; }