summaryrefslogtreecommitdiff
path: root/game/geoData.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/geoData.cpp')
-rw-r--r--game/geoData.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index bf9aee0..f84f4e2 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -510,24 +510,22 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const
= [this, &boundaryTriangles](VertexHandle start, VertexHandle end, const Triangle<3> & triangle) {
boundaryTriangles.emplace(start, &triangle);
const auto endPoint = point(end);
- while (std::any_of(voh_begin(start), voh_end(start), [&](const auto & outHalf) {
- const auto next = next_halfedge_handle(outHalf);
- if (next == end) {
- return false;
- }
- const auto startPoint = point(start);
- const auto nextStartPoint = point(from_vertex_handle(next));
- const auto nextEndPoint = point(to_vertex_handle(next));
- if (linesCross(startPoint, endPoint, nextStartPoint, nextEndPoint)) {
- if (const auto intersection = linesIntersectAt(
- startPoint.xy(), endPoint.xy(), nextStartPoint.xy(), nextEndPoint.xy())) {
- start = split(edge_handle(next), positionOnTriangle(*intersection, triangle));
- boundaryTriangles.emplace(start, &triangle);
- return true;
- }
- }
- return false;
- })) { }
+ while (!std::ranges::contains(vv_range(start), end)
+ && std::ranges::any_of(voh_range(start), [&](const auto & outHalf) {
+ const auto next = next_halfedge_handle(outHalf);
+ const auto startPoint = point(start);
+ const auto nextStartPoint = point(from_vertex_handle(next));
+ const auto nextEndPoint = point(to_vertex_handle(next));
+ if (linesCross(startPoint, endPoint, nextStartPoint, nextEndPoint)) {
+ if (const auto intersection = linesIntersectAt(startPoint.xy(), endPoint.xy(),
+ nextStartPoint.xy(), nextEndPoint.xy())) {
+ start = split(edge_handle(next), positionOnTriangle(*intersection, triangle));
+ boundaryTriangles.emplace(start, &triangle);
+ return true;
+ }
+ }
+ return false;
+ })) { }
};
auto doBoundary = [&doBoundaryPart, triangle = strip.begin()](const auto & verts) mutable {
const auto & [a, b, c] = verts;