diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2021-02-01 00:10:52 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-06-03 12:05:20 -0400 |
commit | 2e13e3ed4a0f94e5f868cc827d1ba6ad4bed8b35 (patch) | |
tree | 8967b0fcf1f1e44732b0f5c28e09dfaa728fdabd /core/math/vector2.h | |
parent | 94bc0bd9193d5e361bbe657d59a492467f129721 (diff) |
Allow clamping vectors and colors
Diffstat (limited to 'core/math/vector2.h')
-rw-r--r-- | core/math/vector2.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/math/vector2.h b/core/math/vector2.h index 2a540bd8aa..b0d2049f55 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -162,6 +162,7 @@ struct Vector2 { Vector2 ceil() const; Vector2 round() const; Vector2 snapped(const Vector2 &p_by) const; + Vector2 clamp(const Vector2 &p_min, const Vector2 &p_max) const; real_t aspect() const { return width / height; } operator String() const { return String::num(x) + ", " + String::num(y); } @@ -337,6 +338,7 @@ struct Vector2i { real_t aspect() const { return width / (real_t)height; } Vector2i sign() const { return Vector2i(SGN(x), SGN(y)); } Vector2i abs() const { return Vector2i(ABS(x), ABS(y)); } + Vector2i clamp(const Vector2i &p_min, const Vector2i &p_max) const; operator String() const { return String::num(x) + ", " + String::num(y); } |