Something of an arbitrary order for storing in a set
| 44 | |
| 45 | // Something of an arbitrary order for storing in a set |
| 46 | bool operator<(const Rect<T> &other) const |
| 47 | { |
| 48 | auto thisSize = this->size(); |
| 49 | auto otherSize = other.size(); |
| 50 | if (thisSize.x != otherSize.x) |
| 51 | return thisSize.x < otherSize.x; |
| 52 | if (thisSize.y != otherSize.y) |
| 53 | return thisSize.y < otherSize.y; |
| 54 | // If both height and width are the same they must have a different |
| 55 | // p0, or be equal |
| 56 | if (this->p0.x != other.p0.x) |
| 57 | return this->p0.x < other.p0.x; |
| 58 | return this->p0.y < other.p0.y; |
| 59 | } |
| 60 | |
| 61 | // Attempts to merge rects adjacent rects in a set, returns the number merged. |
| 62 | // This keeps looping until |