API 参考:OpenGL 对象(opengl)

共 5 个类,按字母排序。每个类含中文说明、继承链、参数表与上手示例,API 文档由 autodoc 从 manim v0.21.0 源码自动生成;带完整中文精讲的类见 API 索引。

DotCloud

OpenGL 点云基类,GL 点图元整体绘制,需 OpenGL 渲染器。

继承关系

G OpenGLPMobject OpenGLPMobject DotCloud DotCloud OpenGLPMobject->DotCloud

参数

参数

默认值

color

ManimColor ('#FFFF00'),ParsableManimColor

stroke_width

2.0,float

radius

2.0,float

density

10,float

API 文档

class manim.DotCloud(color: ManimColor | int | str | NDArray[int64] | tuple[int, int, int] | NDArray[float64] | tuple[float, float, float] | tuple[int, int, int, int] | tuple[float, float, float, float] = ManimColor('#FFFF00'), stroke_width: float = 2.0, radius: float = 2.0, density: float = 10, **kwargs: Any)

基类:OpenGLPMobject

init_points() → Self

Initializes points and therefore the shape.

Gets called upon creation. This is an empty method that can be implemented by subclasses.

OpenGLPGroup

多个 OpenGLPMobject 的组合容器,需 OpenGL 渲染器。

继承关系

G OpenGLPMobject OpenGLPMobject OpenGLPGroup OpenGLPGroup OpenGLPMobject->OpenGLPGroup

API 文档

class manim.OpenGLPGroup(*pmobs, **kwargs)

基类:OpenGLPMobject

OpenGLPMPoint

单个 GL 点对象,需 OpenGL 渲染器。

继承关系

G OpenGLPMobject OpenGLPMobject OpenGLPMPoint OpenGLPMPoint OpenGLPMobject->OpenGLPMPoint

参数

参数

默认值

location

array([0., 0., 0.])

stroke_width

4.0

API 文档

class manim.OpenGLPMPoint(location=array([0., 0., 0.]), stroke_width=4.0, **kwargs)

基类:OpenGLPMobject

init_points() → Self

Initializes points and therefore the shape.

Gets called upon creation. This is an empty method that can be implemented by subclasses.

OpenGLPMobject

OpenGL 点集对象基类,stroke_width 控制点尺寸。

参数

参数

默认值

stroke_width

2.0,float

color

ManimColor ('#FFFF00'),ParsableManimColor

render_primitive

0,int

API 文档

class manim.OpenGLPMobject(stroke_width: float = 2.0, color: ManimColor | int | str | NDArray[int64] | tuple[int, int, int] | NDArray[float64] | tuple[float, float, float] | tuple[int, int, int, int] | tuple[float, float, float, float] = ManimColor('#FFFF00'), render_primitive: int = 0, **kwargs)

基类:OpenGLMobject

add_points(points: Point3DLike_Array, rgbas: FloatRGBALike_Array | None = None, color: ParsableManimColor | None = None, opacity: float | None = None) → Self

Add points.

Points must be a Nx3 numpy array. Rgbas must be a Nx4 numpy array if it is not None.

static get_mobject_type_class()

Return the base class of this mobject type.

pointwise_become_partial(pmobject, a, b) → Self

Set points in such a way as to become only part of mobject. Inputs 0 <= a < b <= 1 determine what portion of mobject to become.

Returns self to allow method chaining.

sort_points(function=<function OpenGLPMobject.<lambda>>) → Self

function is any map from R^3 to R

thin_out(factor=5) → Self

Removes all but every nth point for n = factor

TrueDot

OpenGL 标准圆点,任意半径无棱角,需 OpenGL 渲染器。

继承关系

G OpenGLPMobject OpenGLPMobject DotCloud DotCloud OpenGLPMobject->DotCloud TrueDot TrueDot DotCloud->TrueDot

参数

参数

默认值

center

array([0., 0., 0.]),Point3DLike

stroke_width

2.0,float

API 文档

class manim.TrueDot(center: NDArray[float64] | tuple[float, float, float] = array([0., 0., 0.]), stroke_width: float = 2.0, **kwargs: Any)

基类:DotCloud