2 // rect.cpp: Rectangle object implementation
4 // Part of the Architektonas Project
5 // (C) 2016 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
8 // JLH = James Hammons <jlhamm@acm.org>
11 // --- ---------- ------------------------------------------------------------
12 // JLH 11/10/2016 Created this file
18 Rect::Rect(): l(0), r(0), t(0), b(0)
22 Rect::Rect(double ll, double rr, double tt, double bb):
23 l(ll), r(rr), t(tt), b(bb)
28 Rect::Rect(Point tl, Point br): l(tl.x), r(br.x), t(tl.y), b(br.y)
33 Rect & Rect::operator*=(double scale)
43 Rect & Rect::operator|=(Rect r2)
45 //printf("operatore|=\nthis = (%lf, %lf, %lf, %lf), r = (%lf, %lf, %lf, %lf)\n", l, t, r, b, r2.l, r2.t, r2.r, r2.b);
61 void Rect::Normalize(void)
78 void Rect::Translate(Point p)
86 void Rect::Expand(double amt)
94 double Rect::Width(void)
99 double Rect::Height(void)
104 bool Rect::Contains(Point p)
106 return ((p.x >= l) && (p.x <= r) && (p.y >= b) && (p.y <= t) ? true : false);
109 Point Rect::TopLeft(void)
114 Point Rect::TopRight(void)
119 Point Rect::BottomLeft(void)
124 Point Rect::BottomRight(void)