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,
- Parameters
radius (float) – The radius of the cylinder.
height (float) – The height of the cylinder.
direction (np.ndarray) – 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.
resolution (Sequence[int]) – The number of samples taken of the
Cylinder
. A tuple can be used to define different resolutions foru
andv
respectively.
Examples
Example: ExampleCylinder ¶
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)
Methods
Adds the end caps of the cylinder.
Converts from cylindrical coordinates to cartesian.
Returns the direction of the central axis of the
Cylinder
.Sets the direction of the central axis of the
Cylinder
.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]#
Converts from cylindrical coordinates to cartesian.
- Parameters
u (float) – The height.
v (float) – The azimuthal angle.
- Returns
Points defining the
Cylinder
.- Return type
numpy.ndarray