Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RectF::RectF(float in_left, float in_right, float in_top, float in_bottom)
- {
- left = in_left;
- right = in_right;
- top = in_top;
- bottom = in_bottom;
- }
- RectF::RectF(const Vec2 & topLeft, const Vec2 & bottomRight)
- {
- RectF(topLeft.x, bottomRight.x, topLeft.y, bottomRight.y);
- }
- RectF::RectF(const Vec2 & topLeft, float width, float height)
- {
- RectF(topLeft, topLeft + Vec2(width, height));
- }
- bool RectF::IsOverlappingWith(const RectF & other_object)
- {
- return right > other_object.left && left < other_object.right
- && bottom > other_object.top && top < other_object.bottom;
- }
- RectF RectF::FromCenter(const Vec2 & center, float halfWidth, float halfHeight)
- {
- const Vec2 half(halfWidth, halfHeight);
- return RectF(center - half, center + half);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement