CoordinateSystems¶
声明
坐标系在新版中改动幅度较大,整体用法基本不变,一些参数定义更加规范化
坐标轴上的数(TODO)
CoordinateSystem¶
-
class
manimlib.mobject.coordinate_systems.CoordinateSystem(**kwargs)¶ Axes 和 NumberPlane 的抽象基类
x_range和y_range控制坐标轴范围和分割精度,格式为x_range=[x_min, x_max, dx]width和height控制坐标轴的宽度和高度
-
angle_of_tangent(x: float, graph: manimlib.mobject.functions.ParametricCurve, dx: float = 1e-08) → float¶ 获取横坐标为 x 的点处切线的倾斜角
-
c2p(*coords: float)¶ coords_to_point的简写
-
abstract
coords_to_point(*coords: float) → numpy.ndarray¶ 输入坐标轴上的二维坐标,返回场景的绝对坐标,(x, y) -> array[x’, y’, 0]
-
get_axis(index: int) → manimlib.mobject.number_line.NumberLine¶ 获取坐标轴 Mobject
-
get_axis_labels(x_label_tex: str = 'x', y_label_tex: str = 'y') → manimlib.mobject.types.vectorized_mobject.VGroup¶ 获取 x 轴和 y 轴上的标志(一个 VGroup)
-
get_graph(function: Callable[[float], float], x_range: Sequence[float] | None = None, **kwargs) → ParametricCurve¶ 绘制函数图像,并且自动移动到坐标轴的相对位置,使用
ParametricCurvex_range=[x_min, x_max, dx]: 图像定义域
-
get_graph_label(graph: ParametricCurve, label: str | Mobject = 'f(x)', x: float | None = None, direction: np.ndarray = array([1., 0., 0.]), buff: float = 0.25, color: ManimColor | None = None) → Tex | Mobject¶ 给函数图像标上文本标签
-
get_h_line(point: numpy.ndarray, **kwargs)¶ 传入一个点,过该点作水平线
-
get_h_line_to_graph(x: float, graph: manimlib.mobject.functions.ParametricCurve, **kwargs)¶ 以 x 为纵坐标~~(为什么不用 y 呢)~~作水平线并与函数图像相交
-
get_origin() → numpy.ndarray¶ 获取坐标原点的绝对坐标
-
get_parametric_curve(function: Callable[[float], np.ndarray], **kwargs) → ParametricCurve¶ 传入一个参数方程,绘制一条参数曲线
-
get_riemann_rectangles(graph: ParametricCurve, x_range: Sequence[float] = None, dx: float | None = None, input_sample_type: str = 'left', stroke_width: float = 1, stroke_color: ManimColor = '#000000', fill_opacity: float = 1, colors: Iterable[ManimColor] = ('#58C4DD', '#83C167'), stroke_background: bool = True, show_signed_area: bool = True) → VGroup¶ 绘制一系列黎曼矩形填充图像下方的区域
x_range = [x_min, x_max, dx]可以指定范围,其中dx为分割精度input_sample_type指定矩形的左上角、上边缘中心、右上角抵在图像上
-
get_tangent_line(x: float, graph: ParametricCurve, length: float = 5, line_func: Type[T] = <class 'manimlib.mobject.geometry.Line'>) → T¶ 绘制横坐标为 x 的点处的切线,返回一个 Line Mobject
-
get_v_line(point: numpy.ndarray, **kwargs)¶ 传入一个点,过该点作铅垂线
-
get_v_line_to_graph(x: float, graph: manimlib.mobject.functions.ParametricCurve, **kwargs)¶ 以 x 为横坐标作铅垂线并与函数图像相交
-
i2gp(x: float, graph: manimlib.mobject.functions.ParametricCurve) → numpy.ndarray | None¶ input_to_graph_point的简写
-
input_to_graph_point(x: float, graph: manimlib.mobject.functions.ParametricCurve) → numpy.ndarray | None¶ 传入一个 x 和一条参数曲线,返回图像上以该 x 为横坐标的点的绝对坐标
-
p2c(point: numpy.ndarray)¶ point_to_coords的简写
-
abstract
point_to_coords(point: numpy.ndarray) → tuple¶ 输入场景的绝对坐标,返回坐标轴上的二维坐标,array[x, y, 0] -> (x’, y’)
-
slope_of_tangent(x: float, graph: manimlib.mobject.functions.ParametricCurve, **kwargs) → float¶ 获取横坐标为 x 的点处切线的斜率
Axes¶
-
class
manimlib.mobject.coordinate_systems.Axes(x_range: Sequence[float] | None = None, y_range: Sequence[float] | None = None, **kwargs)¶ xOy 二维坐标系,由两条
NumberLine组成x_axis_config中放入 x 轴的参数,注意每一个坐标轴都是一个NumberLine,所以其中的参数列表详见NumberLiney_axis_config中放入 y 轴的参数,同上axis_configinclude_tip是否包含箭头numbers_to_exclude在给坐标轴标上数字时,在这个列表中的数字会被排除
另外,给坐标轴设置颜色最好使用
set_color方法,因为color参数需要在x_axis_config和y_axis_config中给出才有效x_range和y_range控制坐标轴范围和分割精度 格式为x_range=[x_min, x_max, dx]width和height控制坐标轴的宽度和高度
-
add_coordinate_labels(x_values: Iterable[float] | None = None, y_values: Iterable[float] | None = None, **kwargs) → VGroup¶ 给坐标轴标上数字
-
coords_to_point(*coords: float) → numpy.ndarray¶ 输入坐标轴上的二维坐标,返回场景的绝对坐标,(x, y) -> array([x’, y’, 0])
-
get_all_ranges() → list[Sequence[float]]¶ 获取 x 和 y 的范围
-
get_axes() → manimlib.mobject.types.vectorized_mobject.VGroup¶ 获取坐标系
-
point_to_coords(point: numpy.ndarray) → tuple¶ 输入场景的绝对坐标,返回坐标轴上的二维坐标,array([x, y, 0]) -> (x’, y’)
ThreeDAxes¶
-
class
manimlib.mobject.coordinate_systems.ThreeDAxes(x_range: Sequence[float] | None = None, y_range: Sequence[float] | None = None, z_range: Sequence[float] | None = None, **kwargs)¶ 继承于
Axes的三维坐标系,包含 xyzx_range,y_range,z_range控制坐标轴范围和分割精度,格式为x_range=[x_min, x_max, dx]width,height,depth控制坐标轴的宽度、高度、深度
-
get_all_ranges() → list[Sequence[float]]¶ 获取 x 和 y 的范围
NumberPlane¶
-
class
manimlib.mobject.coordinate_systems.NumberPlane(x_range: Sequence[float] | None = None, y_range: Sequence[float] | None = None, **kwargs)¶ 带有网格线的二维坐标系
x_range和y_range控制坐标轴范围和分割精度 格式为x_range=[x_min, x_max, dx]width和height控制坐标轴的宽度和高度
-
get_axes() → manimlib.mobject.types.vectorized_mobject.VGroup¶ 获取坐标系
-
get_vector(coords: Iterable[float], **kwargs) → Arrow¶ 输入一个二维坐标,绘制一个【从坐标轴原点到该点的向量】
-
prepare_for_nonlinear_transform(num_inserted_curves: int = 50)¶ 将坐标系的每一条线进行分割,以适配即将施加的非线性变换
ComplexPlane¶
-
class
manimlib.mobject.coordinate_systems.ComplexPlane(x_range: Sequence[float] | None = None, y_range: Sequence[float] | None = None, **kwargs)¶ 复平面坐标系
x_range和y_range控制坐标轴范围和分割精度 格式为x_range=[x_min, x_max, dx]width和height控制坐标轴的宽度和高度
-
add_coordinate_labels(numbers: Optional[list, None] = None, skip_first: bool = True, **kwargs)¶ 给坐标轴加上数字
-
n2p(number: complex | float) → numpy.ndarray¶ number_to_point 的简写
-
number_to_point(number: complex | float) → numpy.ndarray¶ 输入一个复数,返回该数对应的点的绝对坐标
-
p2n(point: numpy.ndarray) → complex¶ point_to_number 的简写
-
point_to_number(point: numpy.ndarray) → complex¶ 输入一个绝对坐标,返回复平面上该点对应的复数