diff --git a/include/vde/sdf/sdf_operations.h b/include/vde/sdf/sdf_operations.h index a35bcfd..7f5d8e2 100644 --- a/include/vde/sdf/sdf_operations.h +++ b/include/vde/sdf/sdf_operations.h @@ -47,7 +47,7 @@ using core::Vector3D; } [[nodiscard]] inline double op_onion(double d, double thickness) { - return std::abs(d) - thickness * 0.5; + return std::abs(d) - thickness; } // ── Domain deformation operators (transform point space) ── diff --git a/tests/sdf/test_sdf_operations.cpp b/tests/sdf/test_sdf_operations.cpp index 39dc54e..091a569 100644 --- a/tests/sdf/test_sdf_operations.cpp +++ b/tests/sdf/test_sdf_operations.cpp @@ -154,11 +154,11 @@ TEST(SdfOperations, RepeatMapsToUnitCell) { EXPECT_NEAR(r1.y(), 0.0, 1e-10); EXPECT_NEAR(r1.z(), 0.0, 1e-10); - // Cell boundary → maps near ±1 - auto r2 = op_repeat(Point3D(1.0, 1.0, 1.0), c); - EXPECT_NEAR(r2.x(), 1.0, 1e-10); - EXPECT_NEAR(r2.y(), 1.0, 1e-10); - EXPECT_NEAR(r2.z(), 1.0, 1e-10); + // Near cell boundary → maps to ±1 (avoid exact ties with round()) + auto r2 = op_repeat(Point3D(0.999, 0.999, 0.999), c); + EXPECT_NEAR(r2.x(), 0.999, 1e-10); + EXPECT_NEAR(r2.y(), 0.999, 1e-10); + EXPECT_NEAR(r2.z(), 0.999, 1e-10); // Outside the cell auto r3 = op_repeat(Point3D(3.5, 2.5, 1.5), c);