12 bool Region::overlappedBy(Region& d)
31 Region Region::operator + (Region& other)
35 toReturn.x = (x <= other.x ? x : other.x);
36 toReturn.y = (y <= other.y ? y : other.y);
37 toReturn.w = ((x+w) >= (other.x+other.h) ? (x+w) : (other.x+other.h)) - toReturn.x;
38 toReturn.h = ((y+h) >= (other.y+other.h) ? (y+h) : (other.y+other.h)) - toReturn.y;
45 Region Region::subtract(Region& other)
47 OK printf("This: %i %i %i %i\n", x, y, w, h);
48 OK printf("Subtract this: %i %i %i %i\n", other.x, other.y, other.w, other.h);
55 OK printf("Case 1\n");
61 else if (x2() > other.x2())
63 OK printf("Case 2\n");
71 OK printf("Case 3\n");
77 else if (y2() > other.y2())
79 OK printf("Case 4\n");
92 OK printf("Result: %i %i %i %i\n", s.x, s.y, s.w, s.h);
98 //i.x = (x >= other.x ? x : other.x);
99 //i.y = (y >= other.y ? y : other.y);
100 //i.w = (x2() <= other.x2() ? x2() : other.x2()) - i.x;
101 //i.h = (y2() <= other.y2() ? y2() : other.y2()) - i.y;