aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Geometry.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Geometry.h')
-rw-r--r--src/Geometry.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Geometry.h b/src/Geometry.h
index 354f3ea25..4e4fe95d9 100644
--- a/src/Geometry.h
+++ b/src/Geometry.h
@@ -66,6 +66,9 @@ public:
constexpr bool Intersects(Interval other) const noexcept {
return (right > other.left) && (left < other.right);
}
+ constexpr Interval Offset(XYPOSITION offset) const noexcept {
+ return {left + offset, right + offset};
+ }
};
/**
@@ -112,6 +115,10 @@ public:
return (right > other.left) && (left < other.right) &&
(bottom > other.top) && (top < other.bottom);
}
+ constexpr bool Intersects(Interval horizontalBounds) const noexcept {
+ return (right > horizontalBounds.left) && (left < horizontalBounds.right);
+ }
+
void Move(XYPOSITION xDelta, XYPOSITION yDelta) noexcept {
left += xDelta;
top += yDelta;
@@ -119,6 +126,10 @@ public:
bottom += yDelta;
}
+ PRectangle WithHorizontalBounds(Interval horizontal) const noexcept {
+ return PRectangle(horizontal.left, top, horizontal.right, bottom);
+ }
+
constexpr PRectangle Inset(XYPOSITION delta) const noexcept {
return PRectangle(left + delta, top + delta, right - delta, bottom - delta);
}