圆柱体

限定名称: 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) – 是否显示端盖。

  • 分辨率 (序列[整数]) – 对圆柱体进行采样的次数。可以使用元组来分别定义uv的不同分辨率。

示例

示例: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)
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)

方法

add_bases

添加圆柱体的端盖。

func

将圆柱坐标转换为笛卡尔坐标。

get_direction

返回Cylinder中心轴的方向。

set_direction

设置Cylinder中心轴的方向。

属性

animate

用于动画化self的任何方法的应用。

animation_overrides

color

depth

mobject的深度。

fill_color

如果有多种颜色(用于渐变),则返回第一个颜色

height

mobject的高度。

n_points_per_curve

sheen_factor

stroke_color

width

mobject的宽度。

_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:

add_bases()[source]

添加圆柱体的端盖。

Return type:

func(u, v)[来源]

将圆柱坐标转换为笛卡尔坐标。

Parameters:
  • u (float) – 高度。

  • v (float) – 方位角。

Returns:

定义Cylinder的点。

Return type:

numpy.ndarray

get_direction()[来源]

返回Cylinder中心轴的方向。

Returns:

directionCylinder 中心轴的方向。

Return type:

numpy.array

set_direction(direction)[source]

设置Cylinder中心轴的方向。

Parameters:

direction (numpy.array) – Cylinder中心轴的方向。

Return type: