Skip to content

Commit c0a5182

Browse files
committed
Added corners property to AABB (#4) and bumped version
1 parent 4d45dbe commit c0a5182

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

aabbtree.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,21 @@ def volume(self):
160160
vol *= ub - lb
161161
return vol
162162

163+
@property
164+
def corners(self):
165+
"""list: corner points of AABB"""
166+
167+
n_dim = len(self.limits)
168+
f = '{:0' + str(n_dim) + 'b}'
169+
170+
n_corners = 2 ** n_dim
171+
corners = []
172+
for i in range(n_corners):
173+
inds = [int(s) for s in f.format(i)] # convert i to binary list
174+
corner = [self.limits[d][ind] for d, ind in enumerate(inds)]
175+
corners.append(corner)
176+
return corners
177+
163178
def overlaps(self, aabb):
164179
"""Determine if two AABBs overlap
165180

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def read(fname):
1515

1616
setup(
1717
name='aabbtree',
18-
version='2.3.1',
18+
version='2.4.0',
1919
license='MIT',
2020
description='Pure Python implementation of d-dimensional AABB tree.',
2121
long_description=read('README.rst'),
@@ -45,6 +45,7 @@ def read(fname):
4545
'Programming Language :: Python :: 3.5',
4646
'Programming Language :: Python :: 3.6',
4747
'Programming Language :: Python :: 3.7',
48+
'Programming Language :: Python :: 3.8',
4849
'Topic :: Scientific/Engineering',
4950
'Topic :: Scientific/Engineering :: Mathematics',
5051
],

0 commit comments

Comments
 (0)