summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-10-21 18:30:16 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-10-21 18:30:16 +0100
commit56100b1c4cb02db7608763dddd77f8052a533dae (patch)
treeea8322a78134e1eb9ecca3e34672313cb5740ad5 /game
parentRandomise for many trees, positions, rotations (diff)
downloadilt-56100b1c4cb02db7608763dddd77f8052a533dae.tar.bz2
ilt-56100b1c4cb02db7608763dddd77f8052a533dae.tar.xz
ilt-56100b1c4cb02db7608763dddd77f8052a533dae.zip
Further template maths functions
Diffstat (limited to 'game')
-rw-r--r--game/geoData.cpp2
-rw-r--r--game/network/link.cpp4
-rw-r--r--game/network/network.cpp8
-rw-r--r--game/network/rail.cpp8
4 files changed, 11 insertions, 11 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index 72aa056..d212651 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -559,7 +559,7 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const
const auto limit = std::ceil(arc.length() * 5.F / pi);
const auto inc = arc.length() / limit;
for (float step = 0; step <= limit; step += 1.F) {
- addExtrusionFor(sincosf(arc.first + (step * inc)));
+ addExtrusionFor(sincos(arc.first + (step * inc)));
}
}
else {
diff --git a/game/network/link.cpp b/game/network/link.cpp
index 745896c..79af92a 100644
--- a/game/network/link.cpp
+++ b/game/network/link.cpp
@@ -46,7 +46,7 @@ LinkCurve::positionAt(float dist, unsigned char start) const
const auto es {std::make_pair(ends[start].node.get(), ends[1 - start].node.get())};
const auto as {std::make_pair(arc[start], arc[1 - start])};
const auto ang {as.first + ((as.second - as.first) * frac)};
- const auto relPos {(sincosf(ang) || 0.F) * radius};
+ const auto relPos {(sincos(ang) || 0.F) * radius};
const auto relClimb {vehiclePositionOffset()
+ RelativePosition3D {0, 0,
static_cast<RelativeDistance>(es.first->pos.z - centreBase.z)
@@ -69,7 +69,7 @@ LinkCurve::intersectRay(const Ray<GlobalPosition3D> & ray) const
points.reserve(segCount);
for (std::remove_const_t<decltype(step)> swing = {arc.first, centreBase.z - e0p.z}; segCount;
swing += step, --segCount) {
- points.emplace_back(centreBase + ((sincosf(swing.x) * radius) || swing.y));
+ points.emplace_back(centreBase + ((sincos(swing.x) * radius) || swing.y));
}
return ray.passesCloseToEdges(points, 1.F);
}
diff --git a/game/network/network.cpp b/game/network/network.cpp
index fa86cb5..6ba3ed6 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 + (sincosf(startDir + half_pi) * radius);
- const auto c2 = flatEnd + (sincosf(endDir + half_pi) * radius);
+ const auto c1 = flatStart + (sincos(startDir + half_pi) * radius);
+ const auto c2 = flatEnd + (sincos(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 + (sincosf(startDir - half_pi) * radius);
- const auto c2 = flatEnd + (sincosf(endDir - half_pi) * radius);
+ const auto c1 = flatStart + (sincos(startDir - half_pi) * radius);
+ const auto c2 = flatEnd + (sincos(endDir - half_pi) * radius);
const auto mid = (c1 + c2) / 2;
const auto midh = mid || midheight(mid);
return {{midh, start, c1}, {midh, end, c2}};
diff --git a/game/network/rail.cpp b/game/network/rail.cpp
index c29217a..6f04070 100644
--- a/game/network/rail.cpp
+++ b/game/network/rail.cpp
@@ -45,8 +45,8 @@ RailLinks::addLinksBetween(GlobalPosition3D start, GlobalPosition3D end)
const float dir2 = pi + findNodeDirection(node2ins.first);
if (const auto radii = find_arcs_radius(flatStart, dir, flatEnd, dir2); radii.first < radii.second) {
const auto radius {radii.first};
- const auto c1 = flatStart + (sincosf(dir + half_pi) * radius);
- const auto c2 = flatEnd + (sincosf(dir2 + half_pi) * radius);
+ const auto c1 = flatStart + (sincos(dir + half_pi) * radius);
+ const auto c2 = flatEnd + (sincos(dir2 + half_pi) * radius);
const auto mid = (c1 + c2) / 2;
const auto midh = mid || midheight(mid);
addLink<RailLinkCurve>(start, midh, c1);
@@ -54,8 +54,8 @@ RailLinks::addLinksBetween(GlobalPosition3D start, GlobalPosition3D end)
}
else {
const auto radius {radii.second};
- const auto c1 = flatStart + (sincosf(dir - half_pi) * radius);
- const auto c2 = flatEnd + (sincosf(dir2 - half_pi) * radius);
+ const auto c1 = flatStart + (sincos(dir - half_pi) * radius);
+ const auto c2 = flatEnd + (sincos(dir2 - half_pi) * radius);
const auto mid = (c1 + c2) / 2;
const auto midh = mid || midheight(mid);
addLink<RailLinkCurve>(midh, start, c1);