aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmath/llrect.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmath/llrect.h')
-rw-r--r--linden/indra/llmath/llrect.h47
1 files changed, 14 insertions, 33 deletions
diff --git a/linden/indra/llmath/llrect.h b/linden/indra/llmath/llrect.h
index a17ab39..38a4983 100644
--- a/linden/indra/llmath/llrect.h
+++ b/linden/indra/llmath/llrect.h
@@ -213,47 +213,28 @@ public:
213 mBottom = llmin(mBottom, mTop); 213 mBottom = llmin(mBottom, mTop);
214 } 214 }
215 215
216 friend const LLRectBase& operator|=(LLRectBase &a, const LLRectBase &b) // Return rect including a & b 216 void unionWith(const LLRectBase &other)
217 { 217 {
218 a.mLeft = llmin(a.mLeft, b.mLeft); 218 mLeft = llmin(mLeft, other.mLeft);
219 a.mRight = llmax(a.mRight, b.mRight); 219 mRight = llmax(mRight, other.mRight);
220 a.mBottom = llmin(a.mBottom, b.mBottom); 220 mBottom = llmin(mBottom, other.mBottom);
221 a.mTop = llmax(a.mTop, b.mTop); 221 mTop = llmax(mTop, other.mTop);
222 return a;
223 } 222 }
224 223
225 friend LLRectBase operator|(const LLRectBase &a, const LLRectBase &b) // Return rect including a & b 224 void intersectWith(const LLRectBase &other)
226 { 225 {
227 LLRectBase<Type> result; 226 mLeft = llmax(mLeft, other.mLeft);
228 result.mLeft = llmin(a.mLeft, b.mLeft); 227 mRight = llmin(mRight, other.mRight);
229 result.mRight = llmax(a.mRight, b.mRight); 228 mBottom = llmax(mBottom, other.mBottom);
230 result.mBottom = llmin(a.mBottom, b.mBottom); 229 mTop = llmin(mTop, other.mTop);
231 result.mTop = llmax(a.mTop, b.mTop); 230 if (mLeft > mRight)
232 return result;
233 }
234
235 friend const LLRectBase& operator&=(LLRectBase &a, const LLRectBase &b) // set a to rect where a intersects b
236 {
237 a.mLeft = llmax(a.mLeft, b.mLeft);
238 a.mRight = llmin(a.mRight, b.mRight);
239 a.mBottom = llmax(a.mBottom, b.mBottom);
240 a.mTop = llmin(a.mTop, b.mTop);
241 if (a.mLeft > a.mRight)
242 { 231 {
243 a.mLeft = a.mRight; 232 mLeft = mRight;
244 } 233 }
245 if (a.mBottom > a.mTop) 234 if (mBottom > mTop)
246 { 235 {
247 a.mBottom = a.mTop; 236 mBottom = mTop;
248 } 237 }
249 return a;
250 }
251
252 friend LLRectBase operator&(const LLRectBase &a, const LLRectBase &b) // Return rect where a intersects b
253 {
254 LLRectBase result = a;
255 result &= b;
256 return result;
257 } 238 }
258 239
259 friend std::ostream &operator<<(std::ostream &s, const LLRectBase &rect) 240 friend std::ostream &operator<<(std::ostream &s, const LLRectBase &rect)