diff options
Diffstat (limited to 'core/math/vector2.cpp')
-rw-r--r-- | core/math/vector2.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index df8c804243..198fd85d20 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -37,7 +37,7 @@ real_t Vector2::angle() const { return Math::atan2(y, x); } -Vector2 Vector2::from_angle(const real_t p_angle) { +Vector2 Vector2::from_angle(real_t p_angle) { return Vector2(Math::cos(p_angle), Math::sin(p_angle)); } @@ -109,7 +109,7 @@ Vector2 Vector2::round() const { return Vector2(Math::round(x), Math::round(y)); } -Vector2 Vector2::rotated(const real_t p_by) const { +Vector2 Vector2::rotated(real_t p_by) const { real_t sine = Math::sin(p_by); real_t cosi = Math::cos(p_by); return Vector2( @@ -117,7 +117,7 @@ Vector2 Vector2::rotated(const real_t p_by) const { x * sine + y * cosi); } -Vector2 Vector2::posmod(const real_t p_mod) const { +Vector2 Vector2::posmod(real_t p_mod) const { return Vector2(Math::fposmod(x, p_mod), Math::fposmod(y, p_mod)); } @@ -141,7 +141,7 @@ Vector2 Vector2::snapped(const Vector2 &p_step) const { Math::snapped(y, p_step.y)); } -Vector2 Vector2::limit_length(const real_t p_len) const { +Vector2 Vector2::limit_length(real_t p_len) const { const real_t l = length(); Vector2 v = *this; if (l > 0 && p_len < l) { @@ -152,7 +152,7 @@ Vector2 Vector2::limit_length(const real_t p_len) const { return v; } -Vector2 Vector2::move_toward(const Vector2 &p_to, const real_t p_delta) const { +Vector2 Vector2::move_toward(const Vector2 &p_to, real_t p_delta) const { Vector2 v = *this; Vector2 vd = p_to - v; real_t len = vd.length(); @@ -162,9 +162,9 @@ Vector2 Vector2::move_toward(const Vector2 &p_to, const real_t p_delta) const { // slide returns the component of the vector along the given plane, specified by its normal vector. Vector2 Vector2::slide(const Vector2 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 must be normalized."); + ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 " + p_normal.operator String() + "must be normalized."); #endif - return *this - p_normal * this->dot(p_normal); + return *this - p_normal * dot(p_normal); } Vector2 Vector2::bounce(const Vector2 &p_normal) const { @@ -173,9 +173,9 @@ Vector2 Vector2::bounce(const Vector2 &p_normal) const { Vector2 Vector2::reflect(const Vector2 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 must be normalized."); + ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 " + p_normal.operator String() + "must be normalized."); #endif - return 2.0f * p_normal * this->dot(p_normal) - *this; + return 2.0f * p_normal * dot(p_normal) - *this; } bool Vector2::is_equal_approx(const Vector2 &p_v) const { |