def chunks(pos, endpos): last_cpos = None for x, y, z in bresenham(pos, endpos): cpos = int(x) >> 4, int(z) >> 4 if cpos != last_cpos: yield cpos last_cpos = cpos
def mouseDrag(self, event): p2 = self.hoverPosition(event) if p2: if len(self.dragPoints): p1 = self.dragPoints.pop(-1) points = list(bresenham.bresenham(p1, p2)) self.dragPoints.extend(points) else: self.dragPoints.append(p2)
def _renderBlocks(self, symbol_list): for cell1, cell2 in zip(symbol_list[:-1], symbol_list[1:]): if not isinstance(cell1, Cell): continue for p in bresenham.bresenham(cell1.origin, cell2.origin): yield p + (self.blockTypeButton.block, ) #xxx line
def renderBlocks(self): for x, y, z in bresenham.bresenham(self.p1, self.p2): yield x, y, z, self.blocktype
def renderBlocks(self): for x, y, z in bresenham(self.p1, self.p2): yield x, y, z, self.blocktype