Minor changes everywhere, incremental progress on WindingNumber

This commit is contained in:
Sridhar Ramesh
2018-02-06 12:44:38 -08:00
parent 5ea41c00ee
commit 6158ba6dcc
6 changed files with 133 additions and 58 deletions

View File

@ -99,7 +99,7 @@ class Camera(object):
def set_background(self, pixel_array, convert_from_floats = False):
self.background = self.convert_pixel_array(pixel_array, convert_from_floats)
def set_background_from_func(self, coords_to_colors_func):
def make_background_from_func(self, coords_to_colors_func):
"""
Sets background by using coords_to_colors_func to determine each pixel's color. Each input
to coords_to_colors_func is an (x, y) pair in space (in ordinary space coordinates; not
@ -114,9 +114,10 @@ class Camera(object):
2,
coords
)
self.set_background(new_background, convert_from_floats = True)
return self.convert_pixel_array(new_background, convert_from_floats = True)
print "Ending set_background_from_func"
def set_background_from_func(self, coords_to_colors_func):
self.set_background(self.make_background_from_func(coords_to_colors_func))
def reset(self):
self.set_pixel_array(self.background)
@ -500,7 +501,8 @@ class MovingCamera(Camera):
0 if self.aligned_dimension == "height" else 1
)
# TODO: Add an attribute to mobjects under which they can specify that they should just
# map their centers but remain otherwise undistorted (useful for labels, etc.)
class MappingCamera(Camera):
CONFIG = {
"mapping_func" : lambda p : p,