圆柱体

限定名称: 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

一个圆柱体,由其高度、半径和方向定义,

参数:
  • radius (浮点数) – 圆柱体的半径。

  • height (浮点数) – 圆柱体的高度。

  • direction (np.ndarray) – 圆柱体中心轴的方向。

  • v_range (浮点数序列) – 沿高度轴(由方向给定)的起始和结束高度。

  • show_ends (布尔值) – 是否显示两端盖。

  • resolution (整数序列) – Cylinder 的采样数量。可以使用元组分别为 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 (动画覆盖)

颜色

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))。

参数:
  • radius (浮点数)

  • 高度 (浮点数)

  • direction (ndarray)

  • v_range (浮点数序列)

  • show_ends (布尔值)

  • resolution (整数序列)

返回类型:

add_bases()[source]

添加圆柱体的两端盖。

返回类型:

func(u, v)[source]

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

参数:
  • u (浮点数) – 高度。

  • v (浮点数) – 方位角。

返回:

定义 Cylinder 的点。

返回类型:

numpy.ndarray

get_direction()[source]

返回 Cylinder 的中心轴方向。

返回:

directionCylinder 中心轴的方向。

返回类型:

numpy.array

set_direction(direction)[source]

设置 Cylinder 的中心轴方向。

参数:

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

返回类型: