API 参考:OpenGL 对象(opengl)

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

DotCloud

大量点组成的点云:PMobject 的高效批量渲染版,可视化散点/粒子。

继承关系

digraph G { graph [rankdir=LR, bgcolor="transparent", splines=spline, concentrate=true, nodesep="0.15", ranksep="0.3"]; node [shape=box, penwidth=0, width=0.05, height=0.05, margin=0.05]; edge [penwidth=1]; "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

OpenGL 渲染下 PMobject 的分组容器(实验性)。

继承关系

digraph G { graph [rankdir=LR, bgcolor="transparent", splines=spline, concentrate=true, nodesep="0.15", ranksep="0.3"]; node [shape=box, penwidth=0, width=0.05, height=0.05, margin=0.05]; edge [penwidth=1]; "OpenGLPMobject" -> "OpenGLPGroup"; }

API 文档

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

基类:OpenGLPMobject

OpenGLPMPoint

OpenGL 渲染下的单点对象(实验性)。

继承关系

digraph G { graph [rankdir=LR, bgcolor="transparent", splines=spline, concentrate=true, nodesep="0.15", ranksep="0.3"]; node [shape=box, penwidth=0, width=0.05, height=0.05, margin=0.05]; edge [penwidth=1]; "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 渲染管线的点集基类(实验性),与 cairo 版的 PMobject 平行。

参数

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

严格按点渲染的 Dot:无最小尺寸限制,配合 DotCloud 做精确散点。

继承关系

digraph G { graph [rankdir=LR, bgcolor="transparent", splines=spline, concentrate=true, nodesep="0.15", ranksep="0.3"]; node [shape=box, penwidth=0, width=0.05, height=0.05, margin=0.05]; edge [penwidth=1]; "OpenGLPMobject" -> "DotCloud"; "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