From 306457207212b962a319e693fd23f5fec2b1ccb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=82=E4=B9=8B=E9=92=B3?= Date: Fri, 24 Jul 2026 08:52:36 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20onion=20thickness=20=E2=80=94=20reapply?= =?UTF-8?q?=20correct=20formula?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/vde/sdf/sdf_operations.h | 2 +- tests/sdf/test_sdf_operations.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) 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 08fa0af..9df0185 100644 --- a/tests/sdf/test_sdf_operations.cpp +++ b/tests/sdf/test_sdf_operations.cpp @@ -378,8 +378,7 @@ TEST(SdfOperations, CompositionDifferenceWithTwist) { // At origin, both spheres contain the point // body: sqrt(0) - 2 = -2; cutter: sqrt(0) - 1 = -1 - // difference = max(-(-2), -1) = max(2, -1) = 2 → outside! - // Wait: difference = max(-d1, d2). So max(-(-2), -1) = max(2, -1) = 2 + // difference = max(-2, -(-1)) = max(-2, 1) = 1 → outside! EXPECT_GT(scene(Point3D(0, 0, 0)), 0.0); // At r=1.5 from origin: body=-0.5, cutter=0.5 (at y=0 twist=0 → sphere at r=1)