圆柱体¶
限定名称: 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]¶
基础类:
Surface一个圆柱体,由其高度、半径和方向定义,
- Parameters:
radius (float) – 圆柱体的半径。
height (float) – 圆柱体的高度。
direction (np.ndarray) – 圆柱体中心轴的方向。
v_range (Sequence[float]) – 沿高度轴(由方向指定)的起始和结束高度。
show_ends (bool) – 是否显示端盖。
分辨率 (序列[整数]) – 对
圆柱体进行采样的次数。可以使用元组来分别定义u和v的不同分辨率。
示例
示例: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)
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)方法
属性
animate用于动画化
self的任何方法的应用。animation_overridescolordepthmobject的深度。
fill_color如果有多种颜色(用于渐变),则返回第一个颜色
heightmobject的高度。
n_points_per_curvesheen_factorstroke_colorwidthmobject的宽度。
- _original__init__(radius=1, height=2, direction=array([0., 0., 1.]), v_range=[0, 6.283185307179586], show_ends=True, resolution=(24, 24), **kwargs)¶
初始化自身。有关准确的签名,请参阅 help(type(self))。
- Parameters:
radius (float)
高度 (浮点数)
方向 (ndarray)
v_range (序列[浮点数])
show_ends (bool)
分辨率 (序列[整数])
- Return type:
无
- func(u, v)[来源]¶
将圆柱坐标转换为笛卡尔坐标。
- Parameters:
u (float) – 高度。
v (float) – 方位角。
- Returns:
定义
Cylinder的点。- Return type:
numpy.ndarray