Quote Originally Posted by tabstop View Post
You don't want to do things backwards with all your if and else clauses -- you're always returning false, the way it is. Something like this:
Code:
if (theta != rhs.theta)
    return (theta < rhs.theta);
if( abs(x_coord) != abs(rhs.x_coord) )
    return (x_coord < rhs.x_coord);
/* only thing left to check is y. */
return (y_coord < rhs.y_coord);
Note that I don't need else's, since returns will end the function. Essentially you're defining a sort order (theta first, x second, y last); and the first condition that gives a difference, you return that comparison.
Hey thanks. Yea, I wasn't sure about the way I had it, It certainly didn't make sense to return a theta that wasn't really less than the other. But what you have there certainly clears things up for me.