fix: onion thickness, repeat boundary tie
This commit is contained in:
@@ -47,7 +47,7 @@ using core::Vector3D;
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] inline double op_onion(double d, double thickness) {
|
[[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) ──
|
// ── Domain deformation operators (transform point space) ──
|
||||||
|
|||||||
@@ -154,11 +154,11 @@ TEST(SdfOperations, RepeatMapsToUnitCell) {
|
|||||||
EXPECT_NEAR(r1.y(), 0.0, 1e-10);
|
EXPECT_NEAR(r1.y(), 0.0, 1e-10);
|
||||||
EXPECT_NEAR(r1.z(), 0.0, 1e-10);
|
EXPECT_NEAR(r1.z(), 0.0, 1e-10);
|
||||||
|
|
||||||
// Cell boundary → maps near ±1
|
// Near cell boundary → maps to ±1 (avoid exact ties with round())
|
||||||
auto r2 = op_repeat(Point3D(1.0, 1.0, 1.0), c);
|
auto r2 = op_repeat(Point3D(0.999, 0.999, 0.999), c);
|
||||||
EXPECT_NEAR(r2.x(), 1.0, 1e-10);
|
EXPECT_NEAR(r2.x(), 0.999, 1e-10);
|
||||||
EXPECT_NEAR(r2.y(), 1.0, 1e-10);
|
EXPECT_NEAR(r2.y(), 0.999, 1e-10);
|
||||||
EXPECT_NEAR(r2.z(), 1.0, 1e-10);
|
EXPECT_NEAR(r2.z(), 0.999, 1e-10);
|
||||||
|
|
||||||
// Outside the cell
|
// Outside the cell
|
||||||
auto r3 = op_repeat(Point3D(3.5, 2.5, 1.5), c);
|
auto r3 = op_repeat(Point3D(3.5, 2.5, 1.5), c);
|
||||||
|
|||||||
Reference in New Issue
Block a user