diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-24 00:10:27 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-02-24 00:10:27 +0000 |
commit | 80529930ea3bc874c8da22c66343745ff6fdd45b (patch) | |
tree | 6441b090f24cf33638c5257e6b9eea4f14929503 /game/network/network.cpp | |
parent | Merge branch 'glcontainer-fix' (diff) | |
download | ilt-80529930ea3bc874c8da22c66343745ff6fdd45b.tar.bz2 ilt-80529930ea3bc874c8da22c66343745ff6fdd45b.tar.xz ilt-80529930ea3bc874c8da22c66343745ff6fdd45b.zip |
Simplify vector addition/subtraction with differnt types
Automatically applies correct rounding with float to int operations, adjusts test
expectations accordingly.
Diffstat (limited to 'game/network/network.cpp')
-rw-r--r-- | game/network/network.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/game/network/network.cpp b/game/network/network.cpp index b6c52b8..65b2a62 100644 --- a/game/network/network.cpp +++ b/game/network/network.cpp @@ -121,16 +121,16 @@ Network::genCurveDef(const GlobalPosition3D & start, const GlobalPosition3D & en }; if (const auto radii = find_arcs_radius(flatStart, startDir, flatEnd, endDir); radii.first < radii.second) { const auto radius {radii.first}; - const auto c1 = flatStart + GlobalPosition2D(sincosf(startDir + half_pi) * radius); - const auto c2 = flatEnd + GlobalPosition2D(sincosf(endDir + half_pi) * radius); + const auto c1 = flatStart + (sincosf(startDir + half_pi) * radius); + const auto c2 = flatEnd + (sincosf(endDir + half_pi) * radius); const auto mid = (c1 + c2) / 2; const auto midh = mid || midheight(mid); return {{start, midh, c1}, {end, midh, c2}}; } else { const auto radius {radii.second}; - const auto c1 = flatStart + GlobalPosition2D(sincosf(startDir - half_pi) * radius); - const auto c2 = flatEnd + GlobalPosition2D(sincosf(endDir - half_pi) * radius); + const auto c1 = flatStart + (sincosf(startDir - half_pi) * radius); + const auto c2 = flatEnd + (sincosf(endDir - half_pi) * radius); const auto mid = (c1 + c2) / 2; const auto midh = mid || midheight(mid); return {{midh, start, c1}, {midh, end, c2}}; |