棱柱

限定名称:manim.mobject.three\_d.three\_dimensions.Prism

class Prism(dimensions=[3, 2, 1], **kwargs)[源代码]

基类:Cube

一个直角长方棱柱(或长方体)。通过每个边的长度定义,格式为[x, y, z]

参数:

dimensions (tuple[float, float, float] | np.ndarray) – Prism 的尺寸,格式为[x, y, z]

示例

示例:ExamplePrism

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

class ExamplePrism(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=60 * DEGREES, theta=150 * DEGREES)
        prismSmall = Prism(dimensions=[1, 2, 3]).rotate(PI / 2)
        prismLarge = Prism(dimensions=[1.5, 3, 4.5]).move_to([2, 0, 0])
        self.add(prismSmall, prismLarge)
class ExamplePrism(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(phi=60 * DEGREES, theta=150 * DEGREES)
        prismSmall = Prism(dimensions=[1, 2, 3]).rotate(PI / 2)
        prismLarge = Prism(dimensions=[1.5, 3, 4.5]).move_to([2, 0, 0])
        self.add(prismSmall, prismLarge)

方法

generate_points (生成点)

创建 Prism 的侧面。

属性

animate (动画)

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

animation_overrides (动画覆盖)

颜色

depth (深度)

mobject 的深度。

fill_color (填充颜色)

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

height (高度)

mobject 的高度。

n_points_per_curve (每条曲线的点数)

sheen_factor (光泽因子)

stroke_color (描边颜色)

width (宽度)

mobject 的宽度。

_original__init__(dimensions=[3, 2, 1], **kwargs)

初始化自身。有关准确签名,请参阅 help(type(self))。

参数:

dimensions (tuple[float, float, float] | ndarray)

返回类型:

generate_points()[源代码]

创建 Prism 的侧面。

返回类型: