Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def box_iter(self):
- # 1) from every dimension receive the range list like: [ (0, 1), (1, 2), ... ]
- # 2) product range lists like: [ ((0,1), (0,1)), ((1,2), (1,2)), ... ]
- # 3) recompound to min/max [ ([0,0], [1,1]), ([1,1], [2,2]), ... ]
- # 4) create vectors [ [Vector([0, 0]), Vector([1, 1])], [Vector([1,1]), Vector([2,2])], ... ]
- # 5) create boxes [ Box(Vector([0, 0], Vector[1, 1])), Box(Vector([1,1]), Vector([2,2])), ... ]
- def box(pair):
- return Box(Vector(pair[0]), Vector(pair[1]))
- return imap(box, imap(lambda a: zip(*a), product(*reversed(list(self)))))
Advertisement
Add Comment
Please, Sign In to add comment