Ejemplo n.º 1
0
 def get_leftmost_column(self):
     col = []
     for i in range(self.height):
         x = self.x % 20
         y = (self.y + i) % 15
         col.append(pf.to_pixel_no((x, y)))
     return col
Ejemplo n.º 2
0
 def get_rightermost_column(self):
     col = []
     for i in range(self.height):
         x = (self.x + self.width - 1) % 20
         y = (self.y + i) % 15
         col.append(pf.to_pixel_no((x, y)))
     return col
Ejemplo n.º 3
0
 def get_highest_row(self):
     row = []
     for i in range(self.width):
         x = (self.x + i) % 20
         y = (self.y + self.height - 1) % 15
         row.append(pf.to_pixel_no((x, y)))
     return row
Ejemplo n.º 4
0
 def get_lowest_row(self):
     row = []
     for i in range(self.width):
         x = (self.x + i) % 20
         y = self.y % 15
         row.append(pf.to_pixel_no((x, y)))
     return row
Ejemplo n.º 5
0
 def rotate(self, rotrad):
     cords = [pf.pixel_to_matrix_cord(p) for p in self.current_pixels]
     new_cords = [pf.rotate(c, (self.x, self.y), rotrad) for c in cords]
     new_pixels = [pf.to_pixel_no(c) for c in new_cords]
     old_pixels = set(new_pixels).difference(set(self.current_pixels))
     self.current_pixels = new_pixels
     self.redraw(old_pixels, True)
Ejemplo n.º 6
0
    def object_to_pixels(self):
        pixels = []
        for h in range(self.height):
            for w in range(self.width):
                x = (self.x + w) % self.vis.matrix_size[1]
                y = (self.y + h) % self.vis.matrix_size[0]
                pixels.append(pf.to_pixel_no((x, y)))

        return pixels
Ejemplo n.º 7
0
    def object_to_pixels(self):
        pixels = []

        for x in range(self.vis.matrix_size[1]):
            for y in range(self.vis.matrix_size[0]):
                if int((x - self.x)**2 +
                       (y - self.y)**2 - 0.5) < self.radius**2:
                    pixels.append(pf.to_pixel_no((x, y)))

        return pixels
Ejemplo n.º 8
0
    def show(self, coeffs):
        self.coeffs_max = max(self.coeffs_max,
                              np.ndarray.max(np.asarray(coeffs)))
        self.on_pixels = []

        for c in range(self.coeff_num):
            on_row = get_on_rows(self.matrix_size, coeffs[c], self.coeffs_max)
            for r in range(on_row):
                px = pxf.to_pixel_no((c, r))
                self.on_pixels.append(px)
                self.strip.setPixelColor(px, self.color)

        self.coeffs_max *= 0.98