Cylinder#

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

class Cylinder(radius=1, height=2, direction=array([0., 0., 1.]), v_range=[0, 6.283185307179586], show_ends=True, resolution=(24, 24), **kwargs)[source]#

Bases: Surface

A cylinder, defined by its height, radius and direction,

Examples

Example: ExampleCylinder

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

class ExampleCylinder(ThreeDScene):
    def construct(self):
        axes = ThreeDAxes()
        cylinder = Cylinder(radius=2, height=3)
        self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
        self.add(axes, cylinder)
Parameters
  • radius (float) – The radius of the cylinder.

  • height (float) – The height of the cylinder.

  • direction (numpy.array) – The direction of the central axis of the cylinder.

  • v_range (Sequence[float]) – The height along the height axis (given by direction) to start and end on.

  • show_ends (bool) – Whether to show the end caps or not.

Methods

add_bases

Adds the end caps of the cylinder.

func

Converts from cylindrical coordinates to cartesian.

get_direction

Returns the direction of the central axis of the cylinder.

set_direction

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.

sheen_factor

stroke_color

width

The width of the mobject.

add_bases()[source]#

Adds the end caps of the cylinder.

func(u, v)[source]#

Converts from cylindrical coordinates to cartesian. :param u: The height. :type u: float :param v: The azimuthal angle. :type v: float

get_direction()[source]#

Returns the direction of the central axis of the cylinder.