Creating a Circle Using Parametric Equations With Manim

Below is the Python code, calling the Manim library, for creating a circle using parametric equations. The circle is parallel to the xy-plane and has a radius of 4 units . It is located 2 units above the xy-plane.

from manimlib.imports import *

class PlaneCircle(ThreeDScene):
    def construct(self):
        xyz = ThreeDAxes()
        Circ = ParametricSurface(
            self.CircleParam,
            u_min=0,
            u_max=TAU,
            v_min=0,
            v_max=np.arctan(2),
            resolution=(60,20)
        ).set_fill(opacity=0.8)

        self.set_camera_orientation(phi=75 * DEGREES)
        self.begin_ambient_camera_rotation(rate=0.2)

        self.play(ShowCreation(xyz), run_time=1.5)
        self.play(Write(Circ), run_time=3)
        self.wait(8)
    
    def CircleParam(self, u, v):
        return [ 
            2*np.tan(v)*np.sin(u),
            2*np.tan(v)*np.cos(u),
            2
        ]

Output video:

Category