Skip to content

Commit

Permalink
[tests] add unit tests for geometry intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
crackalamoo authored and holl- committed Aug 24, 2024
1 parent 7f4cca8 commit d6d2368
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/commit/geom/test_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

0 comments on commit d6d2368

Please sign in to comment.