Merge pull request #103 from eric-wieser/patch-1

Added `box.positions`, to complement `box.chunkPositions`.
This commit is contained in:
Tyler Kennedy 2012-08-07 01:07:44 -07:00
commit 16afdaffb8

9
box.py
View File

@ -142,6 +142,15 @@ class BoundingBox (object):
#iterate through all of the chunk positions within this selection box
return itertools.product(xrange(self.mincx, self.maxcx), xrange(self.mincz, self.maxcz))
@property
def positions(self):
"""iterate through all of the positions within this selection box"""
return itertools.product(
xrange(self.minx, self.maxx),
xrange(self.miny, self.maxy),
xrange(self.minz, self.maxz)
)
@property
def chunkCount(self):
return (self.maxcx - self.mincx) * (self.maxcz - self.mincz)