Skip to content

Commit 2984626

Browse files
authored
Add test for Simplify adding cracks (#1263)
* Add test CurvedWallSimplify * Change code formatting to appease check_format * Fix two remaining format issues * Move CurvedWallSimplify to boolean_test and call it DISABLED_SimplifyCracks
1 parent 551e1a1 commit 2984626

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/boolean_test.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,23 @@ TEST(Boolean, Simplify) {
161161
EXPECT_EQ(result2.NumTri(), 20);
162162
}
163163

164+
TEST(Boolean, DISABLED_SimplifyCracks) {
165+
Manifold cylinder =
166+
Manifold::Cylinder(2, 50, 50, 180)
167+
.Rotate(
168+
-89.999999999999) // Rotating by -90 makes the result too perfect
169+
.Translate(vec3(50, 0, 50));
170+
Manifold cube = Manifold::Cube(vec3(100, 2, 50));
171+
Manifold refined = (cylinder + cube).RefineToLength(0.13071895424836602);
172+
Manifold deformed =
173+
refined.Warp([](vec3& p) { p.y += p.x - (p.x * p.x) / 100.0; });
174+
Manifold simplified = deformed.Simplify(0.005);
175+
176+
// If Simplify adds cracks, volume decreases and surface area increases
177+
EXPECT_NEAR(simplified.Volume(), 17848, 1);
178+
EXPECT_NEAR(simplified.SurfaceArea(), 20930, 1);
179+
}
180+
164181
TEST(Boolean, NoRetainedVerts) {
165182
Manifold cube = Manifold::Cube(vec3(1), true);
166183
Manifold oct = Manifold::Sphere(1, 4);

0 commit comments

Comments
 (0)