ThreeDAxes¶
限定名称: manim.mobject.graphing.coordinate\_systems.ThreeDAxes
- class ThreeDAxes(x_range=(-6, 6, 1), y_range=(-5, 5, 1), z_range=(-4, 4, 1), x_length=10.5, y_length=10.5, z_length=6.5, z_axis_config=None, z_normal=array([0., -1., 0.]), num_axis_pieces=20, light_source=array([-7., -9., 10.]), depth=None, gloss=0.5, **kwargs)[source]¶
基类:
Axes
一个三维坐标系。
- 参数:
x_range (Sequence[float] | None) – x 轴的
[x_min, x_max, x_step]
值。y_range (Sequence[float] | None) – y 轴的
[y_min, y_max, y_step]
值。z_range (Sequence[float] | None) – z 轴的
[z_min, z_max, z_step]
值。x_length (float | None) – x 轴的长度。
y_length (float | None) – y轴的长度。
z_length (float | None) – z 轴的长度。
z_axis_config (dict[str, Any] | None) – 要传递给
NumberLine
的参数,用于影响 z 轴。z_normal (Vector3D) – 法线的方向。
num_axis_pieces (int) – 用于构建坐标轴的段数。
light_source (Sequence[float]) – 光源的方向。
depth – 当前无功能。
gloss – 当前无功能。
kwargs (dict[str, Any]) – 要传递给
Axes
的附加参数。
方法
为图形的 x 轴和 y 轴定义标签。
生成 y 轴标签。
生成 z 轴标签。
属性
animate (动画)
用于动画化
self
的任何方法的应用。animation_overrides (动画覆盖)
颜色
depth (深度)
mobject 的深度。
fill_color (填充颜色)
如果存在多种颜色(用于渐变),则返回第一种颜色
height (高度)
mobject 的高度。
n_points_per_curve (每条曲线的点数)
sheen_factor (光泽因子)
stroke_color (描边颜色)
width (宽度)
mobject 的宽度。
- _original__init__(x_range=(-6, 6, 1), y_range=(-5, 5, 1), z_range=(-4, 4, 1), x_length=10.5, y_length=10.5, z_length=6.5, z_axis_config=None, z_normal=array([0., -1., 0.]), num_axis_pieces=20, light_source=array([-7., -9., 10.]), depth=None, gloss=0.5, **kwargs)¶
初始化自身。有关准确签名,请参阅 help(type(self))。
- 参数:
x_range (Sequence[float] | None)
y_range (Sequence[float] | None)
z_range (Sequence[float] | None)
x_length (float | None)
y_length (float | None)
z_length (float | None)
z_axis_config (dict[str, Any] | None)
z_normal (Vector3D)
num_axis_pieces (int)
light_source (Sequence[float])
kwargs (dict[str, Any])
- 返回类型:
无
- get_axis_labels(x_label='x', y_label='y', z_label='z')[source]¶
为图形的 x 轴和 y 轴定义标签。
为了更好地控制标签位置,请使用
get_x_axis_label()
、get_y_axis_label()
和get_z_axis_label()
。- 参数:
- 返回:
一个包含 x 轴、y 轴和 z 轴标签的
VGroup
。- 返回类型:
示例
示例:GetAxisLabelsExample ¶
from manim import * class GetAxisLabelsExample(ThreeDScene): def construct(self): self.set_camera_orientation(phi=2*PI/5, theta=PI/5) axes = ThreeDAxes() labels = axes.get_axis_labels( Text("x-axis").scale(0.7), Text("y-axis").scale(0.45), Text("z-axis").scale(0.45) ) self.add(axes, labels)
class GetAxisLabelsExample(ThreeDScene): def construct(self): self.set_camera_orientation(phi=2*PI/5, theta=PI/5) axes = ThreeDAxes() labels = axes.get_axis_labels( Text("x-axis").scale(0.7), Text("y-axis").scale(0.45), Text("z-axis").scale(0.45) ) self.add(axes, labels)
- get_y_axis_label(label, edge=array([1., 1., 0.]), direction=array([1., 1., 0.]), buff=0.1, rotation=1.5707963267948966, rotation_axis=array([0., 0., 1.]), **kwargs)[source]¶
生成 y 轴标签。
- 参数:
- 返回:
定位后的标签。
- 返回类型:
示例
示例:GetYAxisLabelExample ¶
from manim import * class GetYAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_y_axis_label(Tex("$y$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)
class GetYAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_y_axis_label(Tex("$y$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)
- get_z_axis_label(label, edge=array([0., 0., 1.]), direction=array([1., 0., 0.]), buff=0.1, rotation=1.5707963267948966, rotation_axis=array([1., 0., 0.]), **kwargs)[source]¶
生成 z 轴标签。
- 参数:
- 返回:
定位后的标签。
- 返回类型:
示例
示例:GetZAxisLabelExample ¶
from manim import * class GetZAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_z_axis_label(Tex("$z$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)
class GetZAxisLabelExample(ThreeDScene): def construct(self): ax = ThreeDAxes() lab = ax.get_z_axis_label(Tex("$z$-label")) self.set_camera_orientation(phi=2*PI/5, theta=PI/5) self.add(ax, lab)