summaryrefslogtreecommitdiff
path: root/core/math/rect2.h
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2020-12-19 21:32:14 +0100
committerGitHub <noreply@github.com>2020-12-19 21:32:14 +0100
commite9d12f9e4ea30a6c3f2cf179f104a153d668c2a3 (patch)
treef1d12e916b17a749335ef2e39151863e7d56280c /core/math/rect2.h
parent93acaca8ca0ae0cd369aa2ffa1a8f1128a08e42b (diff)
parent2df9a8ccadf3e7f99d767456eedb0e559c96572c (diff)
Merge pull request #44521 from madmiraal/rename-rect2-clip
Rename Rect2 and Rect2i clip() to intersection()
Diffstat (limited to 'core/math/rect2.h')
-rw-r--r--core/math/rect2.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h
index b1fe865ba5..f36084ec74 100644
--- a/core/math/rect2.h
+++ b/core/math/rect2.h
@@ -123,8 +123,9 @@ struct Rect2 {
_FORCE_INLINE_ bool has_no_area() const {
return (size.x <= 0 || size.y <= 0);
}
- inline Rect2 clip(const Rect2 &p_rect) const { /// return a clipped rect
+ // Returns the instersection between two Rect2s or an empty Rect2 if there is no intersection
+ inline Rect2 intersection(const Rect2 &p_rect) const {
Rect2 new_rect = p_rect;
if (!intersects(new_rect)) {
@@ -365,8 +366,9 @@ struct Rect2i {
_FORCE_INLINE_ bool has_no_area() const {
return (size.x <= 0 || size.y <= 0);
}
- inline Rect2i clip(const Rect2i &p_rect) const { /// return a clipped rect
+ // Returns the instersection between two Rect2is or an empty Rect2i if there is no intersection
+ inline Rect2i intersection(const Rect2i &p_rect) const {
Rect2i new_rect = p_rect;
if (!intersects(new_rect)) {