def generate_points(self): start_angle = np.pi / 2 + self.arc_angle / 2 end_angle = np.pi / 2 - self.arc_angle / 2 self.add(Arc(start_angle=start_angle, angle=-self.arc_angle)) tick_angle_range = np.linspace(start_angle, end_angle, self.num_ticks) for index, angle in enumerate(tick_angle_range): vect = rotate_vector(RIGHT, angle) tick = Line((1 - self.tick_length) * vect, vect) label = TexMobject(str(10 * index)) label.scale_to_fit_height(self.tick_length) label.shift((1 + self.tick_length) * vect) self.add(tick, label) needle = Polygon(LEFT, UP, RIGHT, stroke_width=0, fill_opacity=1, fill_color=self.needle_color) needle.stretch_to_fit_width(self.needle_width) needle.stretch_to_fit_height(self.needle_height) needle.rotate(start_angle - np.pi / 2) self.add(needle) self.needle = needle self.center_offset = self.get_center()
def show_angles(self): words = TextMobject(""" Let's see what happens as we change the angle in this seed """) words.to_edge(UP) koch, sharper_koch, duller_koch = curves = [ CurveClass(order=1) for CurveClass in StraightKoch, SharperKoch, DullerKoch ] arcs = [ Arc(2 * (np.pi / 2 - curve.angle), radius=r, start_angle=np.pi + curve.angle).shift( curve.points[curve.get_num_points() / 2]) for curve, r in zip(curves, [0.6, 0.7, 0.4]) ] theta = TexMobject("\\theta") theta.shift(arcs[0].get_center() + 2.5 * DOWN) arrow = Arrow(theta, arcs[0]) self.add(words, koch) self.play(ShowCreation(arcs[0])) self.play(ShowCreation(arrow), ShimmerIn(theta)) self.wait(2) self.remove(theta, arrow) self.play( Transform(koch, duller_koch), Transform(arcs[0], arcs[2]), ) self.play( Transform(koch, sharper_koch), Transform(arcs[0], arcs[1]), ) self.clear()