diff --git a/displayer.py b/displayer.py index 9b5a8173..844948b8 100644 --- a/displayer.py +++ b/displayer.py @@ -60,8 +60,8 @@ def paint_mobjects(mobjects, image_array = None): ) flattener = np.array([[1], [width]], dtype = 'int') - indices = np.dot(points, flattener) - pixels[indices[:,0]] = (255*rgbs).astype(int) + indices = np.dot(points, flattener)[:,0] + pixels[indices] = (255*rgbs).astype('uint8') pixels = pixels.reshape((height, width, 3)).astype('uint8') return pixels @@ -71,24 +71,21 @@ def add_thickness(pixel_indices, rgbs, thickness, width, height): Imagine dragging each pixel around like a paintbrush in a square of pixels tickness x thickness big surrounding it """ - nudge_values = range(-thickness/2+1, thickness/2+1) original = np.array(pixel_indices) original_rgbs = np.array(rgbs) - for x, y in it.product(nudge_values, nudge_values): - if x == 0 and y == 0: - continue - pixel_indices = np.append( - pixel_indices, - original+[x, y], - axis = 0 - ) - rgbs = np.append(rgbs, original_rgbs, axis = 0) + for nudge in range(-thickness/2+1, thickness/2+1): + for x, y in [[nudge, 0], [0, nudge]]: + pixel_indices = np.append( + pixel_indices, + original+[x, y], + axis = 0 + ) + rgbs = np.append(rgbs, original_rgbs, axis = 0) admissibles = (pixel_indices[:,0] >= 0) & \ (pixel_indices[:,0] < width) & \ (pixel_indices[:,1] >= 0) & \ (pixel_indices[:,1] < height) return pixel_indices[admissibles], rgbs[admissibles] - def place_on_screen(points, rgbs, space_width, space_height): diff --git a/mobject/mobject.py b/mobject/mobject.py index 6aaff828..9a5e9b99 100644 --- a/mobject/mobject.py +++ b/mobject/mobject.py @@ -21,7 +21,7 @@ class Mobject(object): #Number of numbers used to describe a point (3 for pos, 3 for normal vector) DEFAULT_CONFIG = { "color" : "white", - "point_thickness" : 2, + "point_thickness" : 4, "name" : None, } DIM = 3 diff --git a/scene/scene.py b/scene/scene.py index d8565f7b..fe61ee03 100644 --- a/scene/scene.py +++ b/scene/scene.py @@ -165,9 +165,7 @@ class Scene(object): for animation in animations: animation.update((t-t0)/(t1 - t0)) index = int(t/self.frame_duration) - self.frames[index] = disp.paint_mobject( - CompoundMobject(*moving_mobjects), self.frames[index] - ) + self.frames[index] = disp.paint_mobjects(moving_mobjects, self.frames[index]) for animation in animations: animation.clean_up() return self