diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-02-24 00:10:07 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-02-24 00:10:07 +0000 |
commit | 7c04c368fe0694b38e2ab46aca078d921c7d44b1 (patch) | |
tree | c62c4f0f61ad5caf41ad0a91154cb04e8f099f30 | |
parent | Improve number of segments in LinkCurve bases (diff) | |
download | ilt-7c04c368fe0694b38e2ab46aca078d921c7d44b1.tar.bz2 ilt-7c04c368fe0694b38e2ab46aca078d921c7d44b1.tar.xz ilt-7c04c368fe0694b38e2ab46aca078d921c7d44b1.zip |
Don't rely on triangle centroid not already having a surface
-rw-r--r-- | game/geoData.cpp | 12 | ||||
-rw-r--r-- | game/geoData.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp index d577392..4291a64 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -319,7 +319,7 @@ GeoData::setPoint(GlobalPosition3D tsPoint, const RelativeDistance nearNodeToler return split_copy(face, tsPoint); }; -std::vector<GeoData::FaceHandle> +std::set<GeoData::FaceHandle> GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const SetHeightsOpts & opts) { if (triangleStrip.size() < 3) { @@ -532,14 +532,14 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const } } - std::vector<FaceHandle> + std::set<FaceHandle> setSurface(const Surface * surface) { - std::vector<FaceHandle> out; + std::set<FaceHandle> out; auto surfaceStripWalk = [this, surface, &out](const auto & surfaceStripWalk, const auto & face) -> void { - if (!geoData->property(geoData->surface, face)) { + if (!out.contains(face)) { geoData->property(geoData->surface, face) = surface; - out.emplace_back(face); + out.emplace(face); std::ranges::for_each( geoData->ff_range(face), [this, &surfaceStripWalk](const auto & adjacentFaceHandle) { if (getTriangle(geoData->triangle<2>(adjacentFaceHandle).centroid())) { @@ -554,7 +554,7 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip, const return out; } - std::vector<GeoData::FaceHandle> + std::set<GeoData::FaceHandle> run(const SetHeightsOpts & opts) { const std::vector<VertexHandle> newVerts = createVerticesForStrip(opts.nearNodeTolerance); diff --git a/game/geoData.h b/game/geoData.h index 586b48d..b2a75bd 100644 --- a/game/geoData.h +++ b/game/geoData.h @@ -55,7 +55,7 @@ public: RelativeDistance maxSlope = DEFAULT_MAX_SLOPE; }; - std::vector<FaceHandle> setHeights(std::span<const GlobalPosition3D> triangleStrip, const SetHeightsOpts &); + std::set<FaceHandle> setHeights(std::span<const GlobalPosition3D> triangleStrip, const SetHeightsOpts &); [[nodiscard]] auto getExtents() const |