复平面

限定名称:manim.mobject.graphing.coordinate\_systems.ComplexPlane

class ComplexPlane(**kwargs)[source]

基类:NumberPlane

一个专门用于复数的NumberPlane

示例

示例:ComplexPlaneExample

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

class ComplexPlaneExample(Scene):
    def construct(self):
        plane = ComplexPlane().add_coordinates()
        self.add(plane)
        d1 = Dot(plane.n2p(2 + 1j), color=YELLOW)
        d2 = Dot(plane.n2p(-3 - 2j), color=YELLOW)
        label1 = MathTex("2+i").next_to(d1, UR, 0.1)
        label2 = MathTex("-3-2i").next_to(d2, UR, 0.1)
        self.add(
            d1,
            label1,
            d2,
            label2,
        )
class ComplexPlaneExample(Scene):
    def construct(self):
        plane = ComplexPlane().add_coordinates()
        self.add(plane)
        d1 = Dot(plane.n2p(2 + 1j), color=YELLOW)
        d2 = Dot(plane.n2p(-3 - 2j), color=YELLOW)
        label1 = MathTex("2+i").next_to(d1, UR, 0.1)
        label2 = MathTex("-3-2i").next_to(d2, UR, 0.1)
        self.add(
            d1,
            label1,
            d2,
            label2,
        )

参考:Dot MathTex

方法

add_coordinates

get_coordinate_labels() 生成的标签添加到平面。

get_coordinate_labels

生成平面坐标的DecimalNumber mobject。

n2p

number_to_point() 的缩写。

number_to_point

接受一个浮点数/复数,并返回平面上的等效点。

p2n

point_to_number() 的缩写。

point_to_number

接受一个点,并返回平面上与该点等效的复数。

属性

animate (动画)

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

animation_overrides (动画覆盖)

颜色

depth (深度)

mobject 的深度。

fill_color (填充颜色)

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

height (高度)

mobject 的高度。

n_points_per_curve (每条曲线的点数)

sheen_factor (光泽因子)

stroke_color (描边颜色)

width (宽度)

mobject 的宽度。

参数:

kwargs (Any)

_get_default_coordinate_values()[source]

生成一个包含平面标签数值的列表。

返回:

一个浮点数列表表示 x 轴,复数列表表示 y 轴。

返回类型:

List[float | complex]

_original__init__(**kwargs)

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

参数:

kwargs (Any)

返回类型:

add_coordinates(*numbers, **kwargs)[source]

get_coordinate_labels() 生成的标签添加到平面。

参数:
  • numbers (Iterable[float | complex]) – 一个浮点数/复数的可迭代对象。浮点数沿 x 轴定位,复数沿 y 轴定位。

  • kwargs (Any) – 要传递给get_number_mobject() 的额外参数,即DecimalNumber

返回类型:

自身

get_coordinate_labels(*numbers, **kwargs)[source]

生成平面坐标的DecimalNumber mobject。

参数:
  • numbers (Iterable[float | complex]) – 一个浮点数/复数的可迭代对象。浮点数沿 x 轴定位,复数沿 y 轴定位。

  • kwargs (Any) – 要传递给get_number_mobject() 的额外参数,即DecimalNumber

返回:

一个包含已定位标签 mobject 的VGroup

返回类型:

VGroup

n2p(number)[source]

number_to_point() 的缩写。

参数:

number (float | complex)

返回类型:

ndarray

number_to_point(number)[source]

接受一个浮点数/复数,并返回平面上的等效点。

参数:

number (float | complex) – 该数字。可以是浮点数或复数。

返回:

平面上的点。

返回类型:

np.ndarray

p2n(point)[source]

point_to_number() 的缩写。

参数:

point (Point3DLike)

返回类型:

complex

point_to_number(point)[source]

接受一个点,并返回平面上与该点等效的复数。

参数:

point (Point3DLike) – Manim 坐标系中的点

返回:

一个由实部和虚部组成的复数。

返回类型:

complex