From c99b75bc628469c860970ffdc8268a438740190e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 21 Dec 2024 13:38:51 +0000 Subject: Set height when reusing vertices during setHeights --- game/geoData.cpp | 5 +++-- 1 file 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 triangleStrip, const std::views::iota(fv_begin(face), fv_end(face)) | std::views::transform(vertexDistFrom(tsPoint)), {}, &std::pair::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 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::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); -- cgit v1.2.3