From 5e647a783fd1ae23c97b6b64b10e8914e306a2d1 Mon Sep 17 00:00:00 2001 From: "K. S. Ernest (iFire) Lee" Date: Tue, 3 Dec 2024 15:16:16 -0800 Subject: [PATCH] Add a manifold test case for custom "revolve". --- test/manifold_test.cpp | 1037 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1037 insertions(+) diff --git a/test/manifold_test.cpp b/test/manifold_test.cpp index 3d561a1c8..6ed8c1d3c 100644 --- a/test/manifold_test.cpp +++ b/test/manifold_test.cpp @@ -586,6 +586,1043 @@ TEST(Manifold, PinchedVert) { EXPECT_EQ(touch.Genus(), 0); } +TEST(Manifold, MeshWithCustomProps) { + MeshGL complex; + complex.numProp = 7; + complex.runOriginalID = {9}; + complex.runIndex = {0, 144}; + + std::vector vertProps; + vertProps = {0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.716999232769012, + 1.01145005226135, + -0.71699923276901, + 0.0, + 0.0, + 0.125, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.0, + 0.716999232769012, + 1.01145005226135, + -0.71699923276901, + 0.0, + 0.0, + 0.125, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.01399004459381, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.0, + 0.16666667163372, + 1.01399004459381, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.0, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.333333343267441, + 0.716999232769012, + 1.01145005226135, + -0.71699923276901, + 0.0, + 0.0, + 0.125, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.333333343267441, + 1.01399004459381, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.0, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.0, + 0.0, + 1.01145005226135, + -1.01398992538452, + 0.0, + 0.0, + 0.25, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.0, + 0.0, + 1.01145005226135, + -1.01398992538452, + 0.0, + 0.0, + 0.25, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.0, + 0.716999232769012, + 1.01145005226135, + -0.71699923276901, + 0.0, + 0.0, + 0.125, + 0.16666667163372, + 0.716999232769012, + 1.01145005226135, + -0.71699923276901, + 0.0, + 0.0, + 0.125, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.333333343267441, + 0.0, + 1.01145005226135, + -1.01398992538452, + 0.0, + 0.0, + 0.25, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.333333343267441, + 0.716999232769012, + 1.01145005226135, + -0.71699923276901, + 0.0, + 0.0, + 0.125, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.125, + 0.5, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.0, + -0.71699917316437, + 1.01145005226135, + -0.71699917316437, + 0.0, + 0.0, + 0.375, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.0, + -0.71699917316437, + 1.01145005226135, + -0.71699917316437, + 0.0, + 0.0, + 0.375, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.0, + 0.0, + 1.01145005226135, + -1.01398992538452, + 0.0, + 0.0, + 0.25, + 0.16666667163372, + 0.0, + 1.01145005226135, + -1.01398992538452, + 0.0, + 0.0, + 0.25, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.333333343267441, + -0.71699917316437, + 1.01145005226135, + -0.71699917316437, + 0.0, + 0.0, + 0.375, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.333333343267441, + 0.0, + 1.01145005226135, + -1.01398992538452, + 0.0, + 0.0, + 0.25, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.25, + 0.5, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.0, + -1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.5, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.0, + -1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.5, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.0, + -0.71699917316437, + 1.01145005226135, + -0.71699917316437, + 0.0, + 0.0, + 0.375, + 0.16666667163372, + -0.71699917316437, + 1.01145005226135, + -0.71699917316437, + 0.0, + 0.0, + 0.375, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.333333343267441, + -1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.5, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.333333343267441, + -0.71699917316437, + 1.01145005226135, + -0.71699917316437, + 0.0, + 0.0, + 0.375, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.375, + 0.5, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.0, + -0.71699917316437, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.625, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.0, + -0.71699917316437, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.625, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.0, + -1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.5, + 0.16666667163372, + -1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.5, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.333333343267441, + -0.71699917316437, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.625, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.333333343267441, + -1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 0.5, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.5, + 0.5, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.0, + 0.0, + 1.01145005226135, + 1.01398992538452, + 0.0, + 0.0, + 0.75, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.0, + 0.0, + 1.01145005226135, + 1.01398992538452, + 0.0, + 0.0, + 0.75, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.0, + -0.71699917316437, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.625, + 0.16666667163372, + -0.71699917316437, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.625, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.333333343267441, + 0.0, + 1.01145005226135, + 1.01398992538452, + 0.0, + 0.0, + 0.75, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.333333343267441, + -0.71699917316437, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.625, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.625, + 0.5, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.0, + 0.716999173164368, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.875, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.0, + 0.716999173164368, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.875, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.0, + 0.0, + 1.01145005226135, + 1.01398992538452, + 0.0, + 0.0, + 0.75, + 0.16666667163372, + 0.0, + 1.01145005226135, + 1.01398992538452, + 0.0, + 0.0, + 0.75, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.333333343267441, + 0.716999173164368, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.875, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.333333343267441, + 0.0, + 1.01145005226135, + 1.01398992538452, + 0.0, + 0.0, + 0.75, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.75, + 0.5, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.0, + 1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 1.0, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 1.0, + 0.16666667163372, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.0, + 0.716999173164368, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.875, + 0.16666667163372, + 0.716999173164368, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.875, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.333333343267441, + 1.01398992538452, + 1.01145005226135, + 0.0, + 0.0, + 0.0, + 1.0, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.333333343267441, + 0.716999173164368, + 1.01145005226135, + 0.716999173164368, + 0.0, + 0.0, + 0.875, + 0.16666667163372, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.333333343267441, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 1.0, + 0.5, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.333333343267441, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.875, + 0.5}; + complex.vertProperties = vertProps; + + std::vector triVerts; + for (int i = 0; i < 144; i++) { + triVerts.push_back(i); + } + complex.triVerts = triVerts; + complex.Merge(); +#ifdef MANIFOLD_EXPORT + if (options.exportModels) { + ExportOptions options2; + ExportMesh("complex.glb", complex, options2); + } +#endif + Manifold manifold(complex); + EXPECT_FALSE(manifold.IsEmpty()); + EXPECT_EQ(manifold.Status(), Manifold::Error::NoError); + EXPECT_EQ(manifold.NumTri(), 16); + EXPECT_EQ(manifold.GetMeshGL().numProp, 7); + EXPECT_EQ(manifold.GetMeshGL().runOriginalID[0], 9); +} + TEST(Manifold, FaceIDRoundTrip) { const Manifold cube = Manifold::Cube(); ASSERT_GE(cube.OriginalID(), 0);