From 6d3f8fc8b3958d7e69ba9fd4d88269c1ae7b9607 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 07:02:52 +0000 Subject: [PATCH] fix(sdf): use GE/LE instead of GT/LT for smooth blend bounds When d1==d2, smooth blend exactly hits k/4 bound at h=0.5, so EXPECT_GE/EXPECT_LE are correct instead of EXPECT_GT/EXPECT_LT. --- tests/sdf/test_sdf_operations.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/sdf/test_sdf_operations.cpp b/tests/sdf/test_sdf_operations.cpp index e252495..083ef6b 100644 --- a/tests/sdf/test_sdf_operations.cpp +++ b/tests/sdf/test_sdf_operations.cpp @@ -75,8 +75,8 @@ TEST(SdfOperations, SmoothUnionBlending) { // With k > 0, result should be less than min(d1,d2) (blend digs in) double k = 0.1; double result = op_smooth_union(1.0, 1.0, k); - EXPECT_LT(result, 1.0); // blend reduces distance - EXPECT_GT(result, 1.0 - k * 0.25); // bound: max reduction is k/4 at h=0.5 + EXPECT_LT(result, 1.0); // blend reduces distance + EXPECT_GE(result, 1.0 - k * 0.25); // bound: max reduction is k/4 at h=0.5 // Far apart — should approach sharp union double far_result = op_smooth_union(1.0, 10.0, 0.1); @@ -91,8 +91,8 @@ TEST(SdfOperations, SmoothIntersectionFallsBackToSharp) { TEST(SdfOperations, SmoothIntersectionBlending) { double k = 0.1; double result = op_smooth_intersection(1.0, 1.0, k); - EXPECT_GT(result, 1.0); // blend increases distance - EXPECT_LT(result, 1.0 + k * 0.25); + EXPECT_GT(result, 1.0); // blend increases distance + EXPECT_LE(result, 1.0 + k * 0.25); // bound: max increase is k/4 at h=0.5 } TEST(SdfOperations, SmoothDifferenceFallsBackToSharp) {