Use is_zero_approx for zero-checking

This commit is contained in:
Sch1nken 2024-08-05 12:09:41 +02:00
parent 6f95462fb8
commit cd968348db
1 changed files with 5 additions and 5 deletions

View File

@ -1072,10 +1072,10 @@ Vector2 Curve2D::get_closest_point(const Vector2 &p_to_point) const {
for (int i = 0; i < pc - 1; i++) {
real_t interval = baked_dist_cache[i + 1] - baked_dist_cache[i];
if (Math::is_equal_approx(interval, (real_t)0.0)) {
if (Math::is_zero_approx(interval)) {
interval = 1.0;
}
Vector2 origin = r[i];
Vector2 direction = (r[i + 1] - origin) / interval;
@ -1118,7 +1118,7 @@ real_t Curve2D::get_closest_offset(const Vector2 &p_to_point) const {
offset = baked_dist_cache[i];
real_t interval = baked_dist_cache[i + 1] - baked_dist_cache[i];
if (Math::is_equal_approx(interval, (real_t)0.0)) {
if (Math::is_zero_approx(interval)) {
interval = 1.0;
}
@ -2020,7 +2020,7 @@ Vector3 Curve3D::get_closest_point(const Vector3 &p_to_point) const {
for (int i = 0; i < pc - 1; i++) {
real_t interval = baked_dist_cache[i + 1] - baked_dist_cache[i];
if (Math::is_equal_approx(interval, (real_t)0.0)) {
if (Math::is_zero_approx(interval)) {
interval = 1.0;
}
@ -2070,7 +2070,7 @@ real_t Curve3D::get_closest_offset(const Vector3 &p_to_point) const {
offset = baked_dist_cache[i];
real_t interval = baked_dist_cache[i + 1] - baked_dist_cache[i];
if (Math::is_equal_approx(interval, (real_t)0.0)) {
if (Math::is_zero_approx(interval)) {
interval = 1.0;
}