Torus#

Qualified name: manim.mobject.three\_d.three\_dimensions.Torus

class Torus(major_radius=3, minor_radius=1, u_range=(0, 6.283185307179586), v_range=(0, 6.283185307179586), resolution=None, **kwargs)[source]#

Bases: Surface

A torus.

Parameters
  • major_radius (float) – Distance from the center of the tube to the center of the torus.

  • minor_radius (float) – Radius of the tube.

  • u_range (Sequence[float]) – The range of the u variable: (u_min, u_max).

  • v_range (Sequence[float]) – The range of the v variable: (v_min, v_max).

  • resolution (Sequence[int]) – The number of samples taken of the Torus. A tuple can be used to define different resolutions for u and v respectively.

Examples

Example: ExampleTorus

../_images/ExampleTorus-1.png
from manim import *

class ExampleTorus(ThreeDScene):
    def construct(self):
        axes = ThreeDAxes()
        torus = Torus()
        self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
        self.add(axes, torus)

Methods

func

The z values defining the Torus being plotted.

Attributes

animate

Used to animate the application of any method of self.

animation_overrides

color

depth

The depth of the mobject.

fill_color

If there are multiple colors (for gradient) this returns the first one

height

The height of the mobject.

n_points_per_curve

sheen_factor

stroke_color

width

The width of the mobject.

func(u, v)[source]#

The z values defining the Torus being plotted.

Returns

The z values defining the Torus.

Return type

numpy.ndarray

Parameters
  • u (float) –

  • v (float) –