| 17 | // ---------------------------------------------------------------------------------------- |
| 18 | |
| 19 | class rectangle |
| 20 | { |
| 21 | /*! |
| 22 | INITIAL VALUE |
| 23 | The initial value of this object is defined by its constructor. |
| 24 | |
| 25 | CONVENTION |
| 26 | left() == l |
| 27 | top() == t |
| 28 | right() == r |
| 29 | bottom() == b |
| 30 | !*/ |
| 31 | |
| 32 | public: |
| 33 | |
| 34 | rectangle ( |
| 35 | long l_, |
| 36 | long t_, |
| 37 | long r_, |
| 38 | long b_ |
| 39 | ) : |
| 40 | l(l_), |
| 41 | t(t_), |
| 42 | r(r_), |
| 43 | b(b_) |
| 44 | {} |
| 45 | |
| 46 | rectangle ( |
| 47 | unsigned long w, |
| 48 | unsigned long h |
| 49 | ) : |
| 50 | l(0), |
| 51 | t(0), |
| 52 | r(static_cast<long>(w)-1), |
| 53 | b(static_cast<long>(h)-1) |
| 54 | { |
| 55 | DLIB_ASSERT((w > 0 && h > 0) || (w == 0 && h == 0), |
| 56 | "\trectangle(width,height)" |
| 57 | << "\n\twidth and height must be > 0 or both == 0" |
| 58 | << "\n\twidth: " << w |
| 59 | << "\n\theight: " << h |
| 60 | << "\n\tthis: " << this |
| 61 | ); |
| 62 | } |
| 63 | |
| 64 | rectangle ( |
| 65 | const point& p |
| 66 | ) : |
| 67 | l(p.x()), |
| 68 | t(p.y()), |
| 69 | r(p.x()), |
| 70 | b(p.y()) |
| 71 | { |
| 72 | } |
| 73 | |
| 74 | rectangle ( |
| 75 | const point& p1, |
| 76 | const point& p2 |
no outgoing calls