From 6767b42831b39d959411a80f5e13f7c9ccfeae33 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 12 Nov 2024 16:13:50 -0800 Subject: [PATCH 1/9] refactor --- src/impl.cpp | 96 ++++++++++++++++++++++++++-------------------------- src/impl.h | 1 + 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/src/impl.cpp b/src/impl.cpp index 1718bcb1e..3ffbc2359 100644 --- a/src/impl.cpp +++ b/src/impl.cpp @@ -192,18 +192,6 @@ int GetLabels(std::vector& components, return uf.connectedComponents(components); } - -void DedupePropVerts(manifold::Vec& triProp, - const Vec>& vert2vert) { - ZoneScoped; - std::vector vertLabels; - const int numLabels = GetLabels(vertLabels, vert2vert, vert2vert.size()); - - std::vector label2vert(numLabels); - for (size_t v = 0; v < vert2vert.size(); ++v) label2vert[vertLabels[v]] = v; - for (auto& prop : triProp) - for (int i : {0, 1, 2}) prop[i] = label2vert[vertLabels[prop[i]]]; -} } // namespace namespace manifold { @@ -319,44 +307,9 @@ void Manifold::Impl::InitializeOriginal(bool keepFaceID) { void Manifold::Impl::CreateFaces() { ZoneScoped; Vec> face2face(halfedge_.size(), {-1, -1}); - Vec> vert2vert(halfedge_.size(), {-1, -1}); Vec triArea(NumTri()); - const size_t numProp = NumProp(); - if (numProp > 0) { - for_each_n( - autoPolicy(halfedge_.size(), 1e4), countAt(0), halfedge_.size(), - [&vert2vert, numProp, this](const int edgeIdx) { - const Halfedge edge = halfedge_[edgeIdx]; - const Halfedge pair = halfedge_[edge.pairedHalfedge]; - const int edgeFace = edgeIdx / 3; - const int pairFace = edge.pairedHalfedge / 3; - - if (meshRelation_.triRef[edgeFace].meshID != - meshRelation_.triRef[pairFace].meshID) - return; - - const int baseNum = edgeIdx - 3 * edgeFace; - const int jointNum = edge.pairedHalfedge - 3 * pairFace; - - const int prop0 = meshRelation_.triProperties[edgeFace][baseNum]; - const int prop1 = - meshRelation_ - .triProperties[pairFace][jointNum == 2 ? 0 : jointNum + 1]; - bool propEqual = true; - for (size_t p = 0; p < numProp; ++p) { - if (meshRelation_.properties[numProp * prop0 + p] != - meshRelation_.properties[numProp * prop1 + p]) { - propEqual = false; - break; - } - } - if (propEqual) { - vert2vert[edgeIdx] = std::make_pair(prop0, prop1); - } - }); - DedupePropVerts(meshRelation_.triProperties, vert2vert); - } + DedupePropVerts(); for_each_n(autoPolicy(halfedge_.size(), 1e4), countAt(0), halfedge_.size(), CoplanarEdge({face2face, triArea, halfedge_, vertPos_, @@ -389,6 +342,53 @@ void Manifold::Impl::CreateFaces() { } } +void Manifold::Impl::DedupePropVerts() { + ZoneScoped; + const size_t numProp = NumProp(); + if (numProp == 0) return; + + Vec> vert2vert(halfedge_.size(), {-1, -1}); + for_each_n( + autoPolicy(halfedge_.size(), 1e4), countAt(0), halfedge_.size(), + [&vert2vert, numProp, this](const int edgeIdx) { + const Halfedge edge = halfedge_[edgeIdx]; + const Halfedge pair = halfedge_[edge.pairedHalfedge]; + const int edgeFace = edgeIdx / 3; + const int pairFace = edge.pairedHalfedge / 3; + + if (meshRelation_.triRef[edgeFace].meshID != + meshRelation_.triRef[pairFace].meshID) + return; + + const int baseNum = edgeIdx - 3 * edgeFace; + const int jointNum = edge.pairedHalfedge - 3 * pairFace; + + const int prop0 = meshRelation_.triProperties[edgeFace][baseNum]; + const int prop1 = + meshRelation_ + .triProperties[pairFace][jointNum == 2 ? 0 : jointNum + 1]; + bool propEqual = true; + for (size_t p = 0; p < numProp; ++p) { + if (meshRelation_.properties[numProp * prop0 + p] != + meshRelation_.properties[numProp * prop1 + p]) { + propEqual = false; + break; + } + } + if (propEqual) { + vert2vert[edgeIdx] = std::make_pair(prop0, prop1); + } + }); + + std::vector vertLabels; + const int numLabels = GetLabels(vertLabels, vert2vert, vert2vert.size()); + + std::vector label2vert(numLabels); + for (size_t v = 0; v < vert2vert.size(); ++v) label2vert[vertLabels[v]] = v; + for (auto& prop : meshRelation_.triProperties) + for (int i : {0, 1, 2}) prop[i] = label2vert[vertLabels[prop[i]]]; +} + /** * Create the halfedge_ data structure from an input triVerts array like Mesh. */ diff --git a/src/impl.h b/src/impl.h index 8f7d70009..b8ae52db2 100644 --- a/src/impl.h +++ b/src/impl.h @@ -246,6 +246,7 @@ struct Manifold::Impl { } void CreateFaces(); + void DedupePropVerts(); void RemoveUnreferencedVerts(); void InitializeOriginal(bool keepFaceID = false); void CreateHalfedges(const Vec& triVerts); From 63fb34194d1079c111f784b2c1c7f221296e4e7c Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 12 Nov 2024 16:18:24 -0800 Subject: [PATCH 2/9] separate propVert from createFaces --- src/impl.cpp | 2 -- src/impl.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/impl.cpp b/src/impl.cpp index 3ffbc2359..e41aaf924 100644 --- a/src/impl.cpp +++ b/src/impl.cpp @@ -309,8 +309,6 @@ void Manifold::Impl::CreateFaces() { Vec> face2face(halfedge_.size(), {-1, -1}); Vec triArea(NumTri()); - DedupePropVerts(); - for_each_n(autoPolicy(halfedge_.size(), 1e4), countAt(0), halfedge_.size(), CoplanarEdge({face2face, triArea, halfedge_, vertPos_, meshRelation_.triRef, meshRelation_.triProperties, diff --git a/src/impl.h b/src/impl.h index b8ae52db2..dc065ff96 100644 --- a/src/impl.h +++ b/src/impl.h @@ -212,6 +212,7 @@ struct Manifold::Impl { InitializeOriginal(); } + DedupePropVerts(); CreateFaces(); SimplifyTopology(); From 1c68d76aa0dc509d081dcc517834b0ebb8dc8c08 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 12 Nov 2024 18:00:49 -0800 Subject: [PATCH 3/9] working, but very slow --- src/impl.cpp | 167 +++++++++++---------------------------- test/properties_test.cpp | 4 +- 2 files changed, 48 insertions(+), 123 deletions(-) diff --git a/src/impl.cpp b/src/impl.cpp index e41aaf924..b9eea7db6 100644 --- a/src/impl.cpp +++ b/src/impl.cpp @@ -90,98 +90,6 @@ struct UpdateMeshID { void operator()(TriRef& ref) { ref.meshID = meshIDold2new[ref.meshID]; } }; -struct CoplanarEdge { - VecView> face2face; - VecView triArea; - VecView halfedge; - VecView vertPos; - VecView triRef; - VecView triProp; - const int numProp; - const double epsilon; - const double tolerance; - - void operator()(const int edgeIdx) { - const Halfedge edge = halfedge[edgeIdx]; - const Halfedge pair = halfedge[edge.pairedHalfedge]; - const int edgeFace = edgeIdx / 3; - const int pairFace = edge.pairedHalfedge / 3; - - if (triRef[edgeFace].meshID != triRef[pairFace].meshID) return; - - const vec3 base = vertPos[edge.startVert]; - const int baseNum = edgeIdx - 3 * edgeFace; - const int jointNum = edge.pairedHalfedge - 3 * pairFace; - - if (numProp > 0) { - if (triProp[edgeFace][baseNum] != triProp[pairFace][Next3(jointNum)] || - triProp[edgeFace][Next3(baseNum)] != triProp[pairFace][jointNum]) - return; - } - - if (!edge.IsForward()) return; - - const int edgeNum = baseNum == 0 ? 2 : baseNum - 1; - const int pairNum = jointNum == 0 ? 2 : jointNum - 1; - const vec3 jointVec = vertPos[pair.startVert] - base; - const vec3 edgeVec = - vertPos[halfedge[3 * edgeFace + edgeNum].startVert] - base; - const vec3 pairVec = - vertPos[halfedge[3 * pairFace + pairNum].startVert] - base; - - const double length = std::max(la::length(jointVec), la::length(edgeVec)); - const double lengthPair = - std::max(la::length(jointVec), la::length(pairVec)); - vec3 normal = la::cross(jointVec, edgeVec); - const double area = la::length(normal); - const double areaPair = la::length(la::cross(pairVec, jointVec)); - - // make sure we only write this once - if (edgeIdx % 3 == 0) triArea[edgeFace] = area; - // Don't link degenerate triangles - if (area < length * epsilon || areaPair < lengthPair * epsilon) return; - - const double volume = std::abs(la::dot(normal, pairVec)); - // Only operate on coplanar triangles - if (volume > std::max(area, areaPair) * tolerance) return; - - face2face[edgeIdx] = std::make_pair(edgeFace, pairFace); - } -}; - -struct CheckCoplanarity { - VecView comp2tri; - VecView halfedge; - VecView vertPos; - std::vector* components; - const double tolerance; - - void operator()(int tri) { - const int component = (*components)[tri]; - const int referenceTri = - reinterpret_cast*>(&comp2tri[component]) - ->load(std::memory_order_relaxed); - if (referenceTri < 0 || referenceTri == tri) return; - - const vec3 origin = vertPos[halfedge[3 * referenceTri].startVert]; - const vec3 normal = la::normalize( - la::cross(vertPos[halfedge[3 * referenceTri + 1].startVert] - origin, - vertPos[halfedge[3 * referenceTri + 2].startVert] - origin)); - - for (const int i : {0, 1, 2}) { - const vec3 vert = vertPos[halfedge[3 * tri + i].startVert]; - // If any component vertex is not coplanar with the component's reference - // triangle, unmark the entire component so that none of its triangles are - // marked coplanar. - if (std::abs(la::dot(normal, vert - origin)) > tolerance) { - reinterpret_cast*>(&comp2tri[component]) - ->store(-1, std::memory_order_relaxed); - break; - } - } - } -}; - int GetLabels(std::vector& components, const Vec>& edges, int numNodes) { UnionFind<> uf(numNodes); @@ -306,36 +214,53 @@ void Manifold::Impl::InitializeOriginal(bool keepFaceID) { void Manifold::Impl::CreateFaces() { ZoneScoped; - Vec> face2face(halfedge_.size(), {-1, -1}); - Vec triArea(NumTri()); - - for_each_n(autoPolicy(halfedge_.size(), 1e4), countAt(0), halfedge_.size(), - CoplanarEdge({face2face, triArea, halfedge_, vertPos_, - meshRelation_.triRef, meshRelation_.triProperties, - meshRelation_.numProp, epsilon_, tolerance_})); - - std::vector components; - const int numComponent = GetLabels(components, face2face, NumTri()); - - Vec comp2tri(numComponent, -1); - for (size_t tri = 0; tri < NumTri(); ++tri) { - const int comp = components[tri]; - const int current = comp2tri[comp]; - if (current < 0 || triArea[tri] > triArea[current]) { - comp2tri[comp] = tri; - triArea[comp] = triArea[tri]; - } - } - - for_each_n(autoPolicy(halfedge_.size(), 1e4), countAt(0), NumTri(), - CheckCoplanarity( - {comp2tri, halfedge_, vertPos_, &components, tolerance_})); + const int numTri = NumTri(); + struct TriPriority { + double area; + int tri; + }; + Vec triPriority(numTri); + for_each_n(autoPolicy(numTri), countAt(0), numTri, + [&triPriority, this](int tri) { + meshRelation_.triRef[tri].faceID = -1; + const vec3 v = vertPos_[halfedge_[3 * tri].startVert]; + triPriority[tri] = { + length(cross(vertPos_[halfedge_[3 * tri].endVert] - v, + vertPos_[halfedge_[3 * tri + 1].endVert] - v)), + tri}; + }); - Vec& triRef = meshRelation_.triRef; - for (size_t tri = 0; tri < NumTri(); ++tri) { - const int referenceTri = comp2tri[components[tri]]; - if (referenceTri >= 0) { - triRef[tri].faceID = referenceTri; + stable_sort(triPriority.begin(), triPriority.end(), + [](auto a, auto b) { return a.area > b.area; }); + + for (const auto tp : triPriority) { + if (meshRelation_.triRef[tp.tri].faceID >= 0) continue; + meshRelation_.triRef[tp.tri].faceID = tp.tri; + const vec3 base = vertPos_[halfedge_[3 * tp.tri].startVert]; + const vec3 normal = faceNormal_[tp.tri]; + std::deque interiorHalfedges = {3 * tp.tri, 3 * tp.tri + 1, + 3 * tp.tri + 2}; + while (!interiorHalfedges.empty()) { + const int h = + NextHalfedge(halfedge_[interiorHalfedges.back()].pairedHalfedge); + interiorHalfedges.pop_back(); + const vec3 v = vertPos_[halfedge_[h].endVert]; + if (abs(dot(v - base, normal)) < tolerance_) { + meshRelation_.triRef[h / 3].faceID = tp.tri; + if (!interiorHalfedges.empty() && + h == halfedge_[interiorHalfedges.back()].pairedHalfedge) { + interiorHalfedges.pop_back(); + } else { + interiorHalfedges.push_back(h); + } + const int hNext = NextHalfedge(h); + if (!interiorHalfedges.empty() && + hNext == halfedge_[interiorHalfedges.front()].pairedHalfedge) { + interiorHalfedges.pop_front(); + } else { + interiorHalfedges.push_back(hNext); + } + } } } } diff --git a/test/properties_test.cpp b/test/properties_test.cpp index b19aa0965..f2ded4fa1 100644 --- a/test/properties_test.cpp +++ b/test/properties_test.cpp @@ -60,8 +60,8 @@ TEST(Properties, Tolerance) { Manifold imperfect3(mesh); EXPECT_EQ(imperfect.NumTri(), 28); - EXPECT_EQ(imperfect2.NumTri(), 16); // TODO: should be 12 - EXPECT_EQ(imperfect3.NumTri(), 22); // TODO: should be 12 + EXPECT_EQ(imperfect2.NumTri(), 12); + EXPECT_EQ(imperfect3.NumTri(), 12); EXPECT_NEAR(imperfect.Volume(), imperfect2.Volume(), 0.01); EXPECT_NEAR(imperfect.SurfaceArea(), imperfect2.SurfaceArea(), 0.02); From 544696bbcb321cb2945512287d97df7c6a5c8b0a Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 12 Nov 2024 18:09:19 -0800 Subject: [PATCH 4/9] no longer slow --- src/impl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/impl.cpp b/src/impl.cpp index b9eea7db6..c6b626374 100644 --- a/src/impl.cpp +++ b/src/impl.cpp @@ -216,7 +216,7 @@ void Manifold::Impl::CreateFaces() { ZoneScoped; const int numTri = NumTri(); struct TriPriority { - double area; + double area2; int tri; }; Vec triPriority(numTri); @@ -225,16 +225,17 @@ void Manifold::Impl::CreateFaces() { meshRelation_.triRef[tri].faceID = -1; const vec3 v = vertPos_[halfedge_[3 * tri].startVert]; triPriority[tri] = { - length(cross(vertPos_[halfedge_[3 * tri].endVert] - v, - vertPos_[halfedge_[3 * tri + 1].endVert] - v)), + length2(cross(vertPos_[halfedge_[3 * tri].endVert] - v, + vertPos_[halfedge_[3 * tri + 1].endVert] - v)), tri}; }); stable_sort(triPriority.begin(), triPriority.end(), - [](auto a, auto b) { return a.area > b.area; }); + [](auto a, auto b) { return a.area2 > b.area2; }); for (const auto tp : triPriority) { if (meshRelation_.triRef[tp.tri].faceID >= 0) continue; + meshRelation_.triRef[tp.tri].faceID = tp.tri; const vec3 base = vertPos_[halfedge_[3 * tp.tri].startVert]; const vec3 normal = faceNormal_[tp.tri]; @@ -244,6 +245,8 @@ void Manifold::Impl::CreateFaces() { const int h = NextHalfedge(halfedge_[interiorHalfedges.back()].pairedHalfedge); interiorHalfedges.pop_back(); + if (meshRelation_.triRef[h / 3].faceID >= 0) continue; + const vec3 v = vertPos_[halfedge_[h].endVert]; if (abs(dot(v - base, normal)) < tolerance_) { meshRelation_.triRef[h / 3].faceID = tp.tri; From 2c627278e285d6d406ade8edc96ab91e6fc7a6c8 Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Wed, 13 Nov 2024 21:59:12 -0800 Subject: [PATCH 5/9] added test --- test/properties_test.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/properties_test.cpp b/test/properties_test.cpp index f2ded4fa1..3d3f96750 100644 --- a/test/properties_test.cpp +++ b/test/properties_test.cpp @@ -76,6 +76,20 @@ TEST(Properties, Tolerance) { #endif } +TEST(Properties, ToleranceSphere) { + const int n = 100; + Manifold sphere = Manifold::Sphere(1, 4 * n); + EXPECT_EQ(sphere.NumTri(), 8 * n * n); + + Manifold sphere2 = sphere.SetTolerance(0.01); + EXPECT_EQ(sphere2.NumTri(), 16786); + EXPECT_NEAR(sphere.Volume(), sphere2.Volume(), 0.02); + EXPECT_NEAR(sphere.SurfaceArea(), sphere2.SurfaceArea(), 0.01); +#ifdef MANIFOLD_EXPORT + if (options.exportModels) ExportMesh("sphere.glb", sphere2.GetMeshGL(), {}); +#endif +} + /** * Curvature is the inverse of the radius of curvature, and signed such that * positive is convex and negative is concave. There are two orthogonal From b6d8c8430db0d07f4f982d9d7aec129f79a8de8e Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Wed, 12 Feb 2025 21:25:04 +1300 Subject: [PATCH 6/9] loosen test --- test/properties_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/properties_test.cpp b/test/properties_test.cpp index 3d3f96750..fee715f90 100644 --- a/test/properties_test.cpp +++ b/test/properties_test.cpp @@ -82,7 +82,7 @@ TEST(Properties, ToleranceSphere) { EXPECT_EQ(sphere.NumTri(), 8 * n * n); Manifold sphere2 = sphere.SetTolerance(0.01); - EXPECT_EQ(sphere2.NumTri(), 16786); + EXPECT_LT(sphere2.NumTri(), 15000); EXPECT_NEAR(sphere.Volume(), sphere2.Volume(), 0.02); EXPECT_NEAR(sphere.SurfaceArea(), sphere2.SurfaceArea(), 0.01); #ifdef MANIFOLD_EXPORT From 026b478e96f07d78bc30405387b073bb667e420b Mon Sep 17 00:00:00 2001 From: Emmett Lalish Date: Tue, 3 Dec 2024 10:52:40 -0800 Subject: [PATCH 7/9] merging --- src/impl.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/impl.cpp b/src/impl.cpp index 43cdbc172..49919d862 100644 --- a/src/impl.cpp +++ b/src/impl.cpp @@ -229,8 +229,8 @@ void Manifold::Impl::CreateFaces() { meshRelation_.triRef[tp.tri].faceID = tp.tri; const vec3 base = vertPos_[halfedge_[3 * tp.tri].startVert]; const vec3 normal = faceNormal_[tp.tri]; - std::deque interiorHalfedges = {3 * tp.tri, 3 * tp.tri + 1, - 3 * tp.tri + 2}; + std::vector interiorHalfedges = {3 * tp.tri, 3 * tp.tri + 1, + 3 * tp.tri + 2}; while (!interiorHalfedges.empty()) { const int h = NextHalfedge(halfedge_[interiorHalfedges.back()].pairedHalfedge); @@ -240,19 +240,15 @@ void Manifold::Impl::CreateFaces() { const vec3 v = vertPos_[halfedge_[h].endVert]; if (abs(dot(v - base, normal)) < tolerance_) { meshRelation_.triRef[h / 3].faceID = tp.tri; - if (!interiorHalfedges.empty() && - h == halfedge_[interiorHalfedges.back()].pairedHalfedge) { - interiorHalfedges.pop_back(); - } else { + + if (interiorHalfedges.empty() || + h != halfedge_[interiorHalfedges.back()].pairedHalfedge) { interiorHalfedges.push_back(h); - } - const int hNext = NextHalfedge(h); - if (!interiorHalfedges.empty() && - hNext == halfedge_[interiorHalfedges.front()].pairedHalfedge) { - interiorHalfedges.pop_front(); } else { - interiorHalfedges.push_back(hNext); + interiorHalfedges.pop_back(); } + const int hNext = NextHalfedge(h); + interiorHalfedges.push_back(hNext); } } } From 11d66d492f50f4b88ba9a9ce4be795868d90d66b Mon Sep 17 00:00:00 2001 From: pca006132 Date: Wed, 12 Feb 2025 17:03:46 +0800 Subject: [PATCH 8/9] update nix actions --- .github/workflows/manifold.yml | 1 - flake.lock | 12 ++++++------ flake.nix | 28 ---------------------------- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/.github/workflows/manifold.yml b/.github/workflows/manifold.yml index 2630a0639..d7bdb7272 100644 --- a/.github/workflows/manifold.yml +++ b/.github/workflows/manifold.yml @@ -290,6 +290,5 @@ jobs: steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@main - - uses: DeterminateSystems/magic-nix-cache-action@main - run: nix build -L '.?submodules=1#${{matrix.variant}}' diff --git a/flake.lock b/flake.lock index da17620ff..7aac33f48 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "clipper2-src": { "flake": false, "locked": { - "lastModified": 1728932753, - "narHash": "sha256-m/uKGB3BHFRk0wrd71+/oURqxIR1/qQngm77No41la0=", + "lastModified": 1739063104, + "narHash": "sha256-HlqSh/b05pi1I5iS2QjBUagseUJcQ7ehEgfwJNx39NI=", "owner": "AngusJohnson", "repo": "Clipper2", - "rev": "ed98928c66707988d4eb2c49a31c41380a08931c", + "rev": "c86619cf4feb470a91464b06cfdaad0ca6012914", "type": "github" }, "original": { @@ -70,11 +70,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1731139594, - "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", + "lastModified": 1739214665, + "narHash": "sha256-26L8VAu3/1YRxS8MHgBOyOM8xALdo6N0I04PgorE7UM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", + "rev": "64e75cd44acf21c7933d61d7721e812eac1b5a0a", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index bcbebcaea..fb11decd6 100644 --- a/flake.nix +++ b/flake.nix @@ -38,34 +38,6 @@ version = clipper2-src.rev; src = clipper2-src; }); - # https://github.com/NixOS/nixpkgs/pull/343743#issuecomment-2424163602 - binaryen = - let - testsuite = final.fetchFromGitHub { - owner = "WebAssembly"; - repo = "testsuite"; - rev = "e05365077e13a1d86ffe77acfb1a835b7aa78422"; - hash = "sha256-yvZ5AZTPUA6nsD3xpFC0VLthiu2CxVto66RTXBXXeJM="; - }; - in - prev.binaryen.overrideAttrs (_: rec { - version = "119"; - src = pkgs.fetchFromGitHub { - owner = "WebAssembly"; - repo = "binaryen"; - rev = "version_${version}"; - hash = "sha256-JYXtN3CW4qm/nnjGRvv3GxQ0x9O9wHtNYQLqHIYTTOA="; - }; - preConfigure = '' - if [ $doCheck -eq 1 ]; then - sed -i '/googletest/d' third_party/CMakeLists.txt - rmdir test/spec/testsuite - ln -s ${testsuite} test/spec/testsuite - else - cmakeFlagsArray=($cmakeFlagsArray -DBUILD_TESTS=0) - fi - ''; - }); }) ]; }; From 34062e62ae6bbb860e09be87aaa630d12b1f31af Mon Sep 17 00:00:00 2001 From: pca006132 Date: Wed, 12 Feb 2025 20:59:05 +0800 Subject: [PATCH 9/9] fix --- src/impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/impl.cpp b/src/impl.cpp index 49919d862..c9c910e8a 100644 --- a/src/impl.cpp +++ b/src/impl.cpp @@ -238,7 +238,7 @@ void Manifold::Impl::CreateFaces() { if (meshRelation_.triRef[h / 3].faceID >= 0) continue; const vec3 v = vertPos_[halfedge_[h].endVert]; - if (abs(dot(v - base, normal)) < tolerance_) { + if (std::abs(dot(v - base, normal)) < tolerance_) { meshRelation_.triRef[h / 3].faceID = tp.tri; if (interiorHalfedges.empty() ||