from manim import *
class TorusVRange(ThreeDScene):
    """2.2 限制 v_range 得到「半管」环面。
    v 是绕管道截面转一圈的参数，(0, PI/2) 只画四分之一圈截面，
    所以环面看起来更薄、更少一层外壳。
    """
    def construct(self):
        self.set_camera_orientation(phi=65 * DEGREES, theta=-45 * DEGREES)
        title = Text("v_range=(0, π/2)  限制管道截面", font="STLiti", font_size=32).to_edge(UP)
        self.add_fixed_in_frame_mobjects(title)
        torus = Torus(major_radius=2.5, minor_radius=0.5, resolution=(30, 30),
                      v_range=(0, PI / 2), checkerboard_colors=[TEAL_D, TEAL_E])
        self.play(FadeIn(title), run_time=0.6)
        self.play(FadeIn(torus), run_time=1.8)
        note = Text("v 方向只取 1/4 圈，管道外壳被削去，视觉上更扁平",
                    font="STLiti", font_size=22, color=YELLOW).to_edge(DOWN)
        self.add_fixed_in_frame_mobjects(note)
        self.play(FadeIn(note), run_time=0.6)
        self.wait(3.2)
