summaryrefslogtreecommitdiff
path: root/game/geoData.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-07 13:23:27 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-07 13:23:27 +0000
commit108bf5b2424da06aa2e1735ffd10a2b713834db8 (patch)
treeaf0918a6a266aa7e6ee1d8129df6d5ef9fc4f8ab /game/geoData.cpp
parentRemove more use of legacy types and unnecessary pointers from selectable inte... (diff)
parentRemove Position3D from RailVehicle (diff)
downloadilt-108bf5b2424da06aa2e1735ffd10a2b713834db8.tar.bz2
ilt-108bf5b2424da06aa2e1735ffd10a2b713834db8.tar.xz
ilt-108bf5b2424da06aa2e1735ffd10a2b713834db8.zip
Merge branch 'template-types'
Diffstat (limited to 'game/geoData.cpp')
-rw-r--r--game/geoData.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index 97f4a26..b30a35b 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -161,7 +161,7 @@ namespace {
positionOnTriangle(const GlobalPosition2D point, const GeoData::Triangle<3> & t)
{
const CalcPosition3D a = t[1] - t[0], b = t[2] - t[0];
- const auto n = crossInt(a, b);
+ const auto n = crossProduct(a, b);
return {point, ((n.x * t[0].x) + (n.y * t[0].y) + (n.z * t[0].z) - (n.x * point.x) - (n.y * point.y)) / n.z};
}
@@ -194,23 +194,23 @@ GeoData::positionAt(const PointFace & p) const
}
[[nodiscard]] std::optional<GlobalPosition3D>
-GeoData::intersectRay(const Ray & ray) const
+GeoData::intersectRay(const Ray<GlobalPosition3D> & ray) const
{
return intersectRay(ray, findPoint(ray.start));
}
[[nodiscard]] std::optional<GlobalPosition3D>
-GeoData::intersectRay(const Ray & ray, FaceHandle face) const
+GeoData::intersectRay(const Ray<GlobalPosition3D> & ray, FaceHandle face) const
{
std::optional<GlobalPosition3D> out;
walkUntil(PointFace {ray.start, face},
- ray.start.xy() + (ray.direction.xy() * RelativePosition2D(upperExtent.xy() - lowerExtent.xy())),
+ ray.start.xy()
+ + GlobalPosition2D(ray.direction.xy() * RelativePosition2D(upperExtent.xy() - lowerExtent.xy())),
[&out, &ray, this](FaceHandle face) {
BaryPosition bari {};
- float dist {};
+ RelativeDistance dist {};
const auto t = triangle<3>(face);
- if (glm::intersectRayTriangle<RelativePosition3D::value_type, glm::defaultp>(
- ray.start, ray.direction, t[0], t[1], t[2], bari, dist)) {
+ if (ray.intersectTriangle(t.x, t.y, t.z, bari, dist)) {
out = t * bari;
return true;
}