from manim import *
class AngleFromThreePoints(Scene):
    """2. Angle.from_three_points(A, B, C) 以 B 为顶点，从 A 转到 C 生成角度标记。
    默认取逆时针的大角（288.43 度）；加 other_angle=True 才取小角（71.57 度）。
    返回的 Angle 还能用 get_lines() 取两条构成线、get_value() 读角度值。
    """
    def construct(self):
        title = Text("三点定角 from_three_points", font="STLiti", font_size=32).to_edge(UP)
        A, B, C = RIGHT + 3 * UP, ORIGIN, RIGHT
        line1 = Line(B, A, color=BLUE)
        line2 = Line(B, C, color=YELLOW)
        angle = Angle.from_three_points(A, B, C, other_angle=True,
                                        radius=0.9, color=GREEN)
        dots = VGroup(Dot(A, color=BLUE), Dot(B, color=WHITE), Dot(C, color=YELLOW))
        labels = VGroup(
            Text("A", font="STLiti", font_size=26).next_to(A, RIGHT),
            Text("B", font="STLiti", font_size=26).next_to(B, DL),
            Text("C", font="STLiti", font_size=26).next_to(C, DOWN),
        )
        group = VGroup(line1, line2, angle, dots, labels).scale(0.9).shift(2 * LEFT)
        note = Text("B 是顶点，从 A 转到 C", font="STLiti", font_size=26).to_edge(DOWN)
        self.play(Write(title), run_time=0.8)
        self.play(Create(line1), Create(line2), run_time=1.0)
        self.play(Create(angle), FadeIn(dots), FadeIn(labels), run_time=1.0)
        self.play(FadeIn(note), run_time=0.6)
        self.wait(2.8)
