def add_T_label(self, x_val, side=RIGHT, label=None, color=WHITE, animated=False, **kwargs): triangle = RegularPolygon(n=3, start_angle=np.pi / 2) triangle.set_height(MED_SMALL_BUFF) triangle.move_to(self.coords_to_point(x_val, 0), UP) triangle.set_fill(color, 1) triangle.set_stroke(width=0) if label == None: T_label = TexMobject(self.variable_point_label, fill_color=color) else: T_label = TexMobject(label, fill_color=color) T_label.next_to(triangle, DOWN) v_line = self.get_vertical_line_to_graph( x_val, self.v_graph, color=YELLOW ) if animated: self.play( DrawBorderThenFill(triangle), ShowCreation(v_line), Write(T_label, run_time=1), **kwargs ) if np.all(side == LEFT): self.left_T_label_group = VGroup(T_label, triangle) self.left_v_line = v_line self.add(self.left_T_label_group, self.left_v_line) elif np.all(side == RIGHT): self.right_T_label_group = VGroup(T_label, triangle) self.right_v_line = v_line self.add(self.right_T_label_group, self.right_v_line)
def generate_symbol(self): symbol = RegularPolygon( n=3, stroke_width=0, fill_color=self.color, fill_opacity=1, ) symbol.set_height(self.inner_radius) return symbol
def generate_points(self): self.points = [] inner_tri = RegularPolygon(n=3, start_angle=np.pi / 2) outer_tri = RegularPolygon(n=3, start_angle=np.pi / 2) inner_tri.flip() inner_tri.set_height(self.inner_height, about_point=ORIGIN) outer_tri.set_height(self.outer_height, about_point=ORIGIN) self.points = outer_tri.points self.add_subpath(inner_tri.points)