diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-12 10:01:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 10:01:48 +0100 |
commit | daf9729b925ea13d77312bb3ce18198e158c03a8 (patch) | |
tree | 44dba39a46237db559a8ab82189328f171492edd /core/math/rect2.h | |
parent | 7a7fabe4f6d66ffb0c0fbbaf1696e67456c383d7 (diff) | |
parent | 5298e16e80e032a7ff0c6a661b826859e5aeccd0 (diff) |
Merge pull request #57703 from lawnjelly/float_literals_math_funcs
Diffstat (limited to 'core/math/rect2.h')
-rw-r--r-- | core/math/rect2.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h index 6ecc02336c..679af933c2 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -49,7 +49,7 @@ struct _NO_DISCARD_ Rect2 { real_t get_area() const { return size.width * size.height; } - _FORCE_INLINE_ Vector2 get_center() const { return position + (size * 0.5); } + _FORCE_INLINE_ Vector2 get_center() const { return position + (size * 0.5f); } inline bool intersects(const Rect2 &p_rect, const bool p_include_borders = false) const { #ifdef MATH_CHECKS @@ -285,7 +285,7 @@ struct _NO_DISCARD_ Rect2 { } Vector2 get_support(const Vector2 &p_normal) const { - Vector2 half_extents = size * 0.5; + Vector2 half_extents = size * 0.5f; Vector2 ofs = position + half_extents; return Vector2( (p_normal.x > 0) ? -half_extents.x : half_extents.x, @@ -307,14 +307,14 @@ struct _NO_DISCARD_ Rect2 { Vector2 r = (b - a); float l = r.length(); - if (l == 0.0) { + if (l == 0.0f) { continue; } //check inside Vector2 tg = r.orthogonal(); float s = tg.dot(center) - tg.dot(a); - if (s < 0.0) { + if (s < 0.0f) { side_plus++; } else { side_minus++; @@ -322,7 +322,7 @@ struct _NO_DISCARD_ Rect2 { //check ray box r /= l; - Vector2 ir(1.0 / r.x, 1.0 / r.y); + Vector2 ir(1.0f / r.x, 1.0f / r.y); // lb is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner // r.org is origin of ray |