equal
deleted
inserted
replaced
34 PointRaw::x = (T)src.x; |
34 PointRaw::x = (T)src.x; |
35 PointRaw::y = (T)src.y; |
35 PointRaw::y = (T)src.y; |
36 return *this; |
36 return *this; |
37 } |
37 } |
38 |
38 |
|
39 bool operator ==(const PointRaw &other) const |
|
40 { |
|
41 return PointRaw::x == other.x && PointRaw::y == other.y; |
|
42 } |
|
43 |
39 PointT operator -() const |
44 PointT operator -() const |
40 { |
45 { |
41 return PointT(-PointRaw::x, -PointRaw::y); |
46 return PointT(-PointRaw::x, -PointRaw::y); |
42 } |
47 } |
43 |
48 |
74 |
79 |
75 PointT& operator -=(const PointRaw &offset) |
80 PointT& operator -=(const PointRaw &offset) |
76 { |
81 { |
77 DoMove(-offset); |
82 DoMove(-offset); |
78 return *this; |
83 return *this; |
|
84 } |
|
85 |
|
86 PointT operator *(T coef) const |
|
87 { |
|
88 return PointT(PointRaw::x * coef, PointRaw::y * coef); |
|
89 } |
|
90 |
|
91 PointT operator /(T coef) const |
|
92 { |
|
93 return PointT(PointRaw::x / coef, PointRaw::y / coef); |
79 } |
94 } |
80 }; |
95 }; |
81 |
96 |
82 |
97 |
83 |
98 |
134 const PointT<T>& BottomRight() const |
149 const PointT<T>& BottomRight() const |
135 { |
150 { |
136 return bottom_right; |
151 return bottom_right; |
137 } |
152 } |
138 |
153 |
|
154 PointT<T> Size() const |
|
155 { |
|
156 return (bottom_right - top_left + PointT<T>(1, 1)); |
|
157 } |
|
158 |
|
159 PointT<T> CenterPt() const |
|
160 { |
|
161 return (top_left + bottom_right) / 2; |
|
162 } |
|
163 |
139 void SetLeft(T val) |
164 void SetLeft(T val) |
140 { |
165 { |
141 top_left.x = val; |
166 top_left.x = val; |
142 } |
167 } |
143 |
168 |
172 } |
197 } |
173 |
198 |
174 void SetBottomRight(const PointRaw &pt) |
199 void SetBottomRight(const PointRaw &pt) |
175 { |
200 { |
176 bottom_right = pt; |
201 bottom_right = pt; |
|
202 } |
|
203 |
|
204 void SetSize(const PointRaw &pt) |
|
205 { |
|
206 bottom_right = top_left + pt - PointT<T>(1, 1); |
177 } |
207 } |
178 |
208 |
179 bool PtInRect(const PointRaw &pt) const |
209 bool PtInRect(const PointRaw &pt) const |
180 { |
210 { |
181 return (top_left.x <= pt.x && pt.x <= bottom_right.x && top_left.y <= pt.y && pt.y <= bottom_right.y); |
211 return (top_left.x <= pt.x && pt.x <= bottom_right.x && top_left.y <= pt.y && pt.y <= bottom_right.y); |