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
19 Rect::Rect(): l(0), r(0), t(0), b(0)
24 Rect::Rect(double ll, double rr, double tt, double bb):
25 l(ll), r(rr), t(tt), b(bb)
31 Rect::Rect(Point tl, Point br): l(tl.x), r(br.x), t(tl.y), b(br.y)
37 Rect & Rect::operator*=(double scale)
47 Rect & Rect::operator|=(Rect r2)
49 //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);
66 void Rect::Normalize(void)
84 void Rect::Translate(Point p)
93 void Rect::Expand(double amt)
102 double Rect::Width(void)
108 double Rect::Height(void)
114 bool Rect::Contains(Point p)
116 return ((p.x >= l) && (p.x <= r) && (p.y >= b) && (p.y <= t) ? true : false);
120 Point Rect::TopLeft(void)
126 Point Rect::BottomRight(void)