diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-10 15:38:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-10 15:38:53 +0200 |
| commit | 6ab92464bc6356f3342c3efd1fc1bb1a5e4467d5 (patch) | |
| tree | 405a85e89e036e2240c74ee850121d912e21704b /core/math/geometry.h | |
| parent | 54b20a25b90c8c8d8dfd7f68d66d0ec57c71435f (diff) | |
| parent | 69de7ce38c40c57a1fabe12c9e5a3eab903a4035 (diff) | |
| download | redot-engine-6ab92464bc6356f3342c3efd1fc1bb1a5e4467d5.tar.gz | |
Merge pull request #38621 from akien-mga/stylé-comme-jamais
Style: clang-format: Disable if statements and case labels on single line
Diffstat (limited to 'core/math/geometry.h')
| -rw-r--r-- | core/math/geometry.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/core/math/geometry.h b/core/math/geometry.h index ea063a8a59..3bbd1911ee 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -113,10 +113,14 @@ public: real_t mub = (d_of(p1, q1, q2, q1) + mua * d_of(q2, q1, p2, p1)) / d_of(q2, q1, q2, q1); // Clip the value between [0..1] constraining the solution to lie on the original curves. - if (mua < 0) mua = 0; - if (mub < 0) mub = 0; - if (mua > 1) mua = 1; - if (mub > 1) mub = 1; + if (mua < 0) + mua = 0; + if (mub < 0) + mub = 0; + if (mua > 1) + mua = 1; + if (mub > 1) + mub = 1; c1 = p1.lerp(p2, mua); c2 = q1.lerp(q2, mub); } @@ -497,7 +501,8 @@ public: bool orientation = an.cross(bn) > 0; - if ((bn.cross(cn) > 0) != orientation) return false; + if ((bn.cross(cn) > 0) != orientation) + return false; return (cn.cross(an) > 0) == orientation; } @@ -683,7 +688,8 @@ public: // If the term we intend to square root is less than 0 then the answer won't be real, // so it definitely won't be t in the range 0 to 1. - if (sqrtterm < 0) return -1; + if (sqrtterm < 0) + return -1; // If we can assume that the line segment starts outside the circle (e.g. for continuous time collision detection) // then the following can be skipped and we can just return the equivalent of res1. @@ -691,8 +697,10 @@ public: real_t res1 = (-b - sqrtterm) / (2 * a); real_t res2 = (-b + sqrtterm) / (2 * a); - if (res1 >= 0 && res1 <= 1) return res1; - if (res2 >= 0 && res2 <= 1) return res2; + if (res1 >= 0 && res1 <= 1) + return res1; + if (res2 >= 0 && res2 <= 1) + return res2; return -1; } |
