mirror of
https://github.com/NoelFB/blah.git
synced 2024-11-25 16:18:57 +08:00
added bool Rect::contains(Rect)
This commit is contained in:
parent
93a231db4d
commit
f06c38ff3e
|
@ -192,6 +192,7 @@ namespace Blah
|
|||
constexpr Line<T> bottom_line() const;
|
||||
|
||||
constexpr bool contains(const Vec2<T>& pt) const;
|
||||
constexpr bool contains(const Rect& rect) const;
|
||||
constexpr bool overlaps(const Rect& rect) const;
|
||||
constexpr Rect overlap_rect(const Rect& other) const;
|
||||
constexpr bool intersects(const Line<T>& line) const;
|
||||
|
@ -719,6 +720,10 @@ namespace Blah
|
|||
constexpr bool Rect<T>::contains(const Vec2<T>& pt) const {
|
||||
return pt.x >= x && pt.x < x + w && pt.y >= y && pt.y < y + h;
|
||||
}
|
||||
template<class T>
|
||||
constexpr bool Rect<T>::contains(const Rect& rect) const {
|
||||
return rect.x >= x && rect.x + rect.w < x + w && rect.y >= y && rect.y + rect.h < y + h;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
constexpr bool Rect<T>::overlaps(const Rect& rect) const {
|
||||
|
|
Loading…
Reference in New Issue
Block a user