From d6d236845cce99a394f0a8311c12d0f072e1beb7 Mon Sep 17 00:00:00 2001 From: crackalamoo Date: Wed, 21 Aug 2024 23:57:06 -0400 Subject: [PATCH] [tests] add unit tests for geometry intersection --- tests/commit/geom/test_geom.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/commit/geom/test_geom.py b/tests/commit/geom/test_geom.py index 3b27deeaf..e43cfe118 100644 --- a/tests/commit/geom/test_geom.py +++ b/tests/commit/geom/test_geom.py @@ -54,3 +54,14 @@ def test_union(self): self.assertEqual(channel(vector='x,y'), u.shape['vector']) math.assert_close(1 + 3.1415927, u.volume) math.assert_close(True, u.lies_inside(vec(x=0, y=0))) + + def test_intersection(self): + u = geom.intersection(Box(x=1, y=1), Sphere(x=0, y=0, radius=1)) + print(u) + math.assert_close(vec(x=0.5, y=0.5), u.center) + self.assertEqual(2, u.spatial_rank) + self.assertEqual(channel(vector='x,y'), u.shape['vector']) + math.assert_close(1, u.volume) + math.assert_close(False, u.lies_inside(vec(x=0.5, y=-0.5))) + math.assert_close(True, u.lies_inside(vec(x=0.5, y=0.5))) + math.assert_close(False, u.lies_inside(vec(x=0.9, y=0.9))) \ No newline at end of file