From ee598b61e65e5af588f2cf577845f95f4fce9546 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 30 Mar 2024 13:47:54 +0000 Subject: Handle almost straight edges with a simple bisect --- game/geoData.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'game') diff --git a/game/geoData.cpp b/game/geoData.cpp index 544fae2..2339195 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -382,6 +382,7 @@ void GeoData::setHeights(const std::span triangleStrip) { static const RelativeDistance MAX_SLOPE = 1.5F; + static const RelativeDistance MIN_ARC = 0.01F; if (triangleStrip.size() < 3) { return; @@ -453,7 +454,10 @@ GeoData::setHeights(const std::span triangleStrip) doExtrusion(extrusionVertex, direction, p1, MAX_SLOPE)); assert(extrusionVertex.is_valid()); }; - if (const Arc arc {e0, e1}; arc.length() < pi) { + if (const Arc arc {e0, e1}; arc.length() < MIN_ARC) { + addExtrusionFor(normalize(e0 + e1) / cosf(arc.length() / 2.F)); + } + else if (arc.length() < pi) { // Previous half edge end to current half end start arc tangents const auto limit = std::ceil(arc.length() * 5.F / pi); const auto inc = arc.length() / limit; -- cgit v1.2.3