diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-12-21 13:38:51 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-12-21 13:38:51 +0000 |
commit | c99b75bc628469c860970ffdc8268a438740190e (patch) | |
tree | 3c27424d686db633bd113494693e84d1c1e7abdc | |
parent | Fix calculating radius and length of curved links (diff) | |
download | ilt-c99b75bc628469c860970ffdc8268a438740190e.tar.bz2 ilt-c99b75bc628469c860970ffdc8268a438740190e.tar.xz ilt-c99b75bc628469c860970ffdc8268a438740190e.zip |
Set height when reusing vertices during setHeights
-rw-r--r-- | game/geoData.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp index eef5dc7..d15a51b 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -451,6 +451,7 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const std::views::iota(fv_begin(face), fv_end(face)) | std::views::transform(vertexDistFrom(tsPoint)), {}, &std::pair<VertexHandle, float>::second); nearest.second < opts.nearNodeTolerance) { + point(nearest.first).z = tsPoint.z; return nearest.first; } // Check edges @@ -512,16 +513,16 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const if (linesCross(startPoint, endPoint, nextPoints.front().second, nextPoints.back().second)) { if (const auto intersection = linesIntersectAt(startPoint.xy(), endPoint.xy(), nextPoints.front().second.xy(), nextPoints.back().second.xy())) { - const auto newPosition = positionOnTriangle(*intersection, triangle); if (const auto nextDist = std::ranges::min(nexts | std::views::transform(vertexDistFrom(*intersection)), {}, &std::pair<VertexHandle, float>::second); nextDist.second < opts.nearNodeTolerance) { + point(nextDist.first).z = positionOnTriangle(point(nextDist.first), triangle).z; start = nextDist.first; return true; } else { - start = split(edge_handle(next), newPosition); + start = split(edge_handle(next), positionOnTriangle(*intersection, triangle)); } addVertexForNormalUpdate(start); boundaryTriangles.emplace(start, &triangle); |