From 86e6d42a05c53c91f27b9c17d0d5380d20c6dc0d Mon Sep 17 00:00:00 2001 From: Peter Harman Date: Fri, 26 Apr 2024 10:32:19 +0100 Subject: [PATCH] Revert "Fix for #786 by setting numProps in GatherFaces method. Added test for Decompose with properties, and ExpectProperties function in test_main in order to check properties in a mesh match those set by SetProperties." This reverts commit 03848fac198851ad3617de35348513ebfdf00791. --- src/manifold/src/constructors.cpp | 1 + src/manifold/src/sort.cpp | 1 - test/manifold_test.cpp | 26 -------------------------- test/test.h | 3 --- test/test_main.cpp | 22 ---------------------- 5 files changed, 1 insertion(+), 52 deletions(-) diff --git a/src/manifold/src/constructors.cpp b/src/manifold/src/constructors.cpp index 035020166..6f99b7f3e 100644 --- a/src/manifold/src/constructors.cpp +++ b/src/manifold/src/constructors.cpp @@ -509,6 +509,7 @@ std::vector Manifold::Decompose() const { impl->GatherFaces(*pImpl_, faceNew2Old); impl->ReindexVerts(vertNew2Old, pImpl_->NumVert()); + impl->Finish(); meshes.push_back(Manifold(impl)); diff --git a/src/manifold/src/sort.cpp b/src/manifold/src/sort.cpp index a5dba9b3d..457d6f044 100644 --- a/src/manifold/src/sort.cpp +++ b/src/manifold/src/sort.cpp @@ -464,7 +464,6 @@ void Manifold::Impl::GatherFaces(const Impl& old, const Vec& faceNew2Old) { gather(policy, faceNew2Old.begin(), faceNew2Old.end(), old.meshRelation_.triProperties.begin(), meshRelation_.triProperties.begin()); - meshRelation_.numProp = old.meshRelation_.numProp; meshRelation_.properties = old.meshRelation_.properties; } diff --git a/test/manifold_test.cpp b/test/manifold_test.cpp index 4ec8f7bbd..8416214e6 100644 --- a/test/manifold_test.cpp +++ b/test/manifold_test.cpp @@ -160,32 +160,6 @@ TEST(Manifold, Decompose) { RelatedGL(manifolds, input); } -TEST(Manifold, DecomposeProps) { - auto posNorm = [](float* newProp, glm::vec3 pos, - const float* oldProp) { - newProp[0] = hypotf(hypotf(pos.x, pos.y), pos.z); - }; - std::vector manifoldList; - manifoldList.emplace_back(Manifold::Tetrahedron().SetProperties(1, posNorm)); - manifoldList.emplace_back(Manifold::Cube().SetProperties(1, posNorm)); - manifoldList.emplace_back(Manifold::Sphere(1, 4).SetProperties(1, posNorm)); - Manifold manifolds = Manifold::Compose(manifoldList); - - ExpectMeshes(manifolds, {{8, 12, 1}, {6, 8, 1}, {4, 4, 1}}); - ExpectProperties(manifolds.GetMeshGL(), 1, posNorm); - - std::vector input; - - for (const Manifold& manifold : manifoldList) { - EXPECT_GE(manifold.OriginalID(), 0); - auto mesh = manifold.GetMeshGL(); - input.emplace_back(mesh); - ExpectProperties(mesh, 1, posNorm); - } - - RelatedGL(manifolds, input); -} - /** * These tests check the various manifold constructors. */ diff --git a/test/test.h b/test/test.h index f8b58b2df..cbbd4e382 100644 --- a/test/test.h +++ b/test/test.h @@ -60,9 +60,6 @@ float GetMinProperty(const MeshGL& mesh, int channel); void Identical(const Mesh& mesh1, const Mesh& mesh2); void RelatedGL(const Manifold& out, const std::vector& originals, bool checkNormals = false, bool updateNormals = false); -void ExpectProperties(const MeshGL& mesh, int numProp, std::function - propFunc); void ExpectMeshes(const Manifold& manifold, const std::vector& meshSize); void CheckNormals(const Manifold& manifold); diff --git a/test/test_main.cpp b/test/test_main.cpp index b671683a6..2f105a4f6 100644 --- a/test/test_main.cpp +++ b/test/test_main.cpp @@ -404,28 +404,6 @@ void RelatedGL(const Manifold& out, const std::vector& originals, } } -void ExpectProperties(const MeshGL& mesh, int numProp, std::function - propFunc) { - EXPECT_EQ(mesh.numProp, 3+numProp); - auto* prop = new float[numProp]; - auto* propTarget = new float[numProp]; - glm::vec3 pos; - for(int i=0;i& meshSize) { EXPECT_FALSE(manifold.IsEmpty());