diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-29 10:16:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-29 10:16:46 +0200 |
commit | 18e88c85631adb0b83114687f8c20d9b210a88bf (patch) | |
tree | 28d1817600fb497215008d08045ed4e20a8cba95 /core/math/geometry.h | |
parent | 90cc1d3c1d2e77ca72c5949b21a5c40738abcd81 (diff) | |
parent | b659e1eb2b732ebc836614735438ca0bcdc8a32d (diff) |
Merge pull request #18992 from aaronfranke/mono-equal-approx
[Core] [Mono] Improve and use approximate equality methods
Diffstat (limited to 'core/math/geometry.h')
-rw-r--r-- | core/math/geometry.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/math/geometry.h b/core/math/geometry.h index 7347cb742a..f3a671aa9a 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -181,8 +181,8 @@ public: } } // finally do the division to get sc and tc - sc = (Math::abs(sN) < CMP_EPSILON ? 0.0 : sN / sD); - tc = (Math::abs(tN) < CMP_EPSILON ? 0.0 : tN / tD); + sc = (Math::is_zero_approx(sN) ? 0.0 : sN / sD); + tc = (Math::is_zero_approx(tN) ? 0.0 : tN / tD); // get the difference of the two closest points Vector3 dP = w + (sc * u) - (tc * v); // = S1(sc) - S2(tc) @@ -195,7 +195,7 @@ public: Vector3 e2 = p_v2 - p_v0; Vector3 h = p_dir.cross(e2); real_t a = e1.dot(h); - if (a > -CMP_EPSILON && a < CMP_EPSILON) // parallel test + if (Math::is_zero_approx(a)) // parallel test return false; real_t f = 1.0 / a; @@ -233,7 +233,7 @@ public: Vector3 e2 = p_v2 - p_v0; Vector3 h = rel.cross(e2); real_t a = e1.dot(h); - if (a > -CMP_EPSILON && a < CMP_EPSILON) // parallel test + if (Math::is_zero_approx(a)) // parallel test return false; real_t f = 1.0 / a; @@ -535,7 +535,7 @@ public: // see http://paulbourke.net/geometry/pointlineplane/ const real_t denom = p_dir_b.y * p_dir_a.x - p_dir_b.x * p_dir_a.y; - if (Math::abs(denom) < CMP_EPSILON) { // parallel? + if (Math::is_zero_approx(denom)) { // parallel? return false; } |