Handle reflex angles in CylinderSector (#3303)

This commit is contained in:
Paul Romano 2025-02-21 17:44:09 -06:00 committed by GitHub
parent 6ae2001400
commit fefe825e65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 8 deletions

View file

@ -207,6 +207,19 @@ def test_cylinder_sector(axis, indices, center):
assert point_neg[indices] in -s
assert point_neg[indices] not in +s
# Check __contains__ for sector with reflex angle
s_reflex = openmc.model.CylinderSector(
r1, r2, 0., 270., center=center, axis=axis.lower())
points = [
np.array([c1 + r1 + d, c2 + 0.01, 0.]),
np.array([c1, c2 + r1 + d, 0.]),
np.array([c1 - r1 - d, c2, 0.]),
np.array([c1 - 0.01, c2 - r1 - d, 0.])
]
for point_neg in points:
assert point_neg[indices] in -s_reflex
assert point_neg[indices] not in +s_reflex
# translate method
t = uniform(-5.0, 5.0)
s_t = s.translate((t, t, t))