Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to specify open/closed overlap testing #14

Merged
merged 13 commits into from
May 29, 2021

Conversation

kip-hart
Copy link
Owner

Added the option to specify open vs closed overlap testing, per request in (#13). Default behavior remains unchanged if the closed flag is not set.

If closed is set to false, there must be a non-zero amount of overlap between boxes for there to be an intersection. This is the default behavior.

If closed is set to true, two boxes can be touching for there to be an intersection.

For example:

from aabbtree import AABB
from aabbtree import AABBTree
tree = AABBTree()
aabb1 = AABB([(0, 0)])
aabb2 = AABB([(-1, 0)])
tree.add(aabb1, 'box 1')
tree.add(aabb2, 'box 2')
# Open Boxes
v = tree.overlap_values(aabb2)
print(v)
>>> ['box 2']
# Closed Boxes
v = tree.overlap_values(aabb2, closed=True)
print(v)
>>> ['box 1', 'box 2']

@kip-hart kip-hart merged commit b07ee9e into master May 29, 2021
@kip-hart kip-hart deleted the open-close-overlap branch May 29, 2021 03:56
@kip-hart kip-hart linked an issue May 29, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An options for Boundary intersection detection
1 participant