1 // Copyright 2005-6 Ben Hutchings <ben@decadent.org.uk>.
2 // See the file "COPYING" for licence details.
4 #ifndef INC_GEOMETRY_HPP
5 #define INC_GEOMETRY_HPP
9 int left, top; // inclusive
10 int right, bottom; // exclusive
12 rectangle operator|=(const rectangle & other)
16 // use current extents unchanged
25 // find rectangle enclosing both extents
26 left = std::min(left, other.left);
27 top = std::min(top, other.top);
28 right = std::max(right, other.right);
29 bottom = std::max(bottom, other.bottom);
35 rectangle operator&=(const rectangle & other)
37 // find rectangle enclosed in both extents
38 left = std::max(left, other.left);
39 top = std::max(top, other.top);
40 right = std::max(left, std::min(right, other.right));
41 bottom = std::max(top, std::min(bottom, other.bottom));
47 return left == right || bottom == top;
51 #endif // !INC_GEOMETRY_HPP