Пример #1
0
 def get_number_mobjects(self, *numbers):
     #TODO, handle decimals
     if len(numbers) == 0:
         numbers = self.default_numbers_to_display()
     result = []
     for number in numbers:
         mob = TexMobject(str(int(number)))
         vert_scale = 2*self.tick_size/mob.get_height()
         hori_scale = self.tick_frequency*self.unit_length_to_spatial_width/mob.get_width()
         mob.scale(min(vert_scale, hori_scale))
         mob.shift(self.number_to_point(number))
         mob.shift(self.get_vertical_number_offset())
         result.append(mob)
     return result
Пример #2
0
 def get_coordinate_labels(self, x_vals = None, y_vals = None):
     result = []
     nudge = 0.1*(DOWN+RIGHT)
     if x_vals == None and y_vals == None:
         x_vals = range(-int(self.x_radius), int(self.x_radius))
         y_vals = range(-int(self.y_radius), int(self.y_radius))
     for index, vals in zip([0, 1], [x_vals, y_vals]):
         num_pair = [0, 0]
         for val in vals:
             num_pair[index] = val
             point = self.num_pair_to_point(num_pair)
             num = TexMobject(str(val))
             num.scale(self.number_scale_factor)
             num.shift(point-num.get_corner(UP+LEFT)+nudge)
             result.append(num)
     return result