Debian Codegraph @

Oodle/src/CRect.cpp

raw
1 #include "oodle.h"
2
3 CRect::CRect(double x, double y, double width, double height)
4 : x(x), y(y), width(width), height(height)
5 { }
6
7 double CRect::getHeight()
8 {
9 return height;
10 }
11
12 double CRect::getWidth()
13 {
14 return width;
15 }
16
17 double CRect::getX()
18 {
19 return x;
20 }
21
22 double CRect::getY()
23 {
24 return y;
25 }
26
27 bool CRect::checkLeft(double x)
28 {
29 return (x >= CRect::x);
30 }
31
32 bool CRect::checkRight(double x)
33 {
34 return (x <= CRect::x + width);
35 }
36
37 bool CRect::checkTop(double y)
38 {
39 return (y >= CRect::y);
40 }
41
42 bool CRect::checkBottom(double y)
43 {
44 //cout << y << " <= " << CRect::y + height << endl;
45 return (y <= CRect::y + height);
46 }
47
48 bool CRect::contains(double x, double y)
49 {
50 return ( (checkLeft(x) && checkRight(x) ) &&
51 (checkTop(y) && checkBottom(y) ) );
52 }
53
54 bool CRect::contains(CVector v)
55 {
56 double x = v.getX();
57 double y = v.getY();
58
59 return ( (checkLeft(x) && checkRight(x) ) &&
60 (checkTop(y) && checkBottom(y) ) );
61 }
62
63 bool CRect::operator!=(CRect b)
64 {
65 return ! (b == *this);
66 }
67
68 bool CRect::operator==(CRect b)
69 {
70 return (b.width == width && b.height == height && b.x == x && b.y == y);
71 }