Unified display location (but not yet the code behind) labels in NumberPlane and ComplexPlane

This commit is contained in:
Sridhar Ramesh
2018-02-07 17:24:31 -08:00
parent d1640ab1b2
commit e38ac24382

View File

@ -193,6 +193,8 @@ class ComplexPlane(NumberPlane):
return complex(x, y) return complex(x, y)
def get_coordinate_labels(self, *numbers): def get_coordinate_labels(self, *numbers):
# TODO: Should merge this with the code from NumberPlane.get_coordinate_labels
result = VGroup() result = VGroup()
nudge = 0.1*(DOWN+RIGHT) nudge = 0.1*(DOWN+RIGHT)
if len(numbers) == 0: if len(numbers) == 0:
@ -211,10 +213,7 @@ class ComplexPlane(NumberPlane):
num_mob = TexMobject(num_str) num_mob = TexMobject(num_str)
num_mob.add_background_rectangle() num_mob.add_background_rectangle()
num_mob.scale(self.number_scale_factor) num_mob.scale(self.number_scale_factor)
if complex(number).imag != 0: vect = DOWN + LEFT
vect = DOWN+RIGHT
else:
vect = DOWN+RIGHT
num_mob.next_to(point, vect, SMALL_BUFF) num_mob.next_to(point, vect, SMALL_BUFF)
result.add(num_mob) result.add(num_mob)
return result return result
@ -224,6 +223,8 @@ class ComplexPlane(NumberPlane):
return self return self
def add_spider_web(self, circle_freq = 1, angle_freq = np.pi/6): def add_spider_web(self, circle_freq = 1, angle_freq = np.pi/6):
# This code no longer works because it has this reference to self.fade_factor
# which is never initialized. Shall we delete this little-used function entirely?
self.fade(self.fade_factor) self.fade(self.fade_factor)
config = { config = {
"color" : self.color, "color" : self.color,