coordinate_systems

class janim.items.coordinate.coordinate_systems.CoordinateSystem(*args, num_sampled_graph_points_per_tick, **kwargs)

基类:object

static create_axis(range: RangeSpecifier, axis_config: dict, length: float | None) NumberLine
abstractmethod get_axes() list[NumberLine]

得到由各方向 NumberLine 所组成的列表

get_origin() ndarray
coords_to_point(*coords: float) ndarray

传入坐标得到对应的位置

例如 c2p(1, 3) 得到 (1,3) 的位置

coords_array_to_points(coords_array: VectArray) ndarray

传入一组坐标得到对应的一组位置

例如 c2p([[1, 3], [2, 1], [-1, -1]]) 得到对应的三个位置

c2p(*coords: float) ndarray

coords_to_point() 的缩写

point_to_coords3d(point: Vect | Iterable[Vect]) ndarray

传入位置得到对应的坐标(但是会扩张为三维坐标;对于二维坐标系来说,第三个分量则表示距离二维平面的距离)

也可以传入一组位置得到一组对应的坐标

p2c3d(point: Vect | Iterable[Vect]) ndarray

point_to_coords3d() 的简写

point_to_coords(point: Vect | Iterable[Vect]) ndarray

传入位置得到对应坐标

也可以传入一组位置得到一组对应的坐标

p2c(point: Vect | Iterable[Vect]) ndarray

point_to_coords() 的缩写

number_to_point(number: complex | float) ndarray

传入复数得到对应位置

n2p(number: complex | float) ndarray

number_to_point() 的缩写

point_to_number(point: Vect) complex

传入位置得到对应复数

p2n(point: Vect) complex

point_to_number() 的缩写

class janim.items.coordinate.coordinate_systems.Axes(x_range: RangeSpecifier = (-8.0, 8.0, 1.0), y_range: RangeSpecifier = (-4.0, 4.0, 1.0), *, num_sampled_graph_points_per_tick: int = 5, axis_config: dict = {}, x_axis_config: dict = {}, y_axis_config: dict = {}, x_length: float | None = None, y_length: float | None = None, height: float | None = None, width: float | None = None, unit_size: float = 1.0, **kwargs)

基类:CoordinateSystem, MarkedItem, Group

axis_config_d = {'numbers_to_exclude': [0]}
x_axis_config_d = {}
y_axis_config_d = {'line_to_number_direction': array([0., 1., 0.])}
get_axes() list[NumberLine]

得到由各方向 NumberLine 所组成的列表

get_graph(function: Callable[[float], float], x_range: RangeSpecifier | None = None, bind: bool = True, **kwargs) ParametricCurve

基于坐标轴的坐标构造函数曲线,使用 ParametricCurve

  • function: 用于构造曲线的函数

  • x_range: 图像定义域

  • bind: 在默认情况下为 True,会使得函数曲线自动同步应用于坐标系上的变换,也可同步动画,详见 基础样例 中的 NumberPlaneExample

警告

bind=True 时,请勿将函数曲线与坐标系放在同一个 Group 中进行坐标变换

因为会导致变换效果被重复作用,(一次由 Group 导致的作用,另一次由 bind=True 导致的作用)

如果你有放在同一个 Group 里的需求,请传入 bind=False 以避免该情况

get_parametric_curve(function: Callable[[float], Vect], bind: bool = True, **kwargs)

基于坐标轴的坐标构造参数曲线,即 ParametricCurve

  • function: 将值映射为坐标系上的一个点的参数函数

  • bind: 在默认情况下为 True,会使得参数曲线自动同步应用于坐标系上的变换,也可同步动画,详见 基础样例 中的 NumberPlaneExample

警告

bind=True 时,请勿将参数曲线与坐标系放在同一个 Group 中进行坐标变换

因为会导致变换效果被重复作用,(一次由 Group 导致的作用,另一次由 bind=True 导致的作用)

如果你有放在同一个 Group 里的需求,请传入 bind=False 以避免该情况

get_area(graph: ParametricCurve, x_range: tuple[float, float] | None = None, color: JAnimColor = '#58C4DD', alpha: float = 0.3, stroke_alpha: float | None = None, fill_alpha: float | None = None, bounded_graph: ParametricCurve = None, **kwargs) Polygon

构造 x_range 区间内,graph 与坐标轴所围成的区域,使用 Polygon 表示

  • graph: 函数曲线,另见 get_graph()

  • x_range: x 区间的最小值与最大值,x_range = [x_min, x_max]

  • bounded_graph: 如果指定该参数,那么将会构造 graphbounded_graph 所围成的区域,而非与坐标轴

get_axis_labels(x_label: str | Points = 'x', y_label: str | Points = 'y', x_kwargs: dict = {}, y_kwargs: dict = {}, **kwargs) Group[TypstMath | Points]

详见 get_axis_label()

如果设置 ensure_on_screen=True,坐标轴标签会自动调整位置移动到默认屏幕区域内

get_x_axis_label(label: str | Points = 'x', **kwargs) TypstMath | Points

详见 get_axis_label()

如果设置 ensure_on_screen=True,坐标轴标签会自动调整位置移动到默认屏幕区域内

get_y_axis_label(label: str | Points = 'y', **kwargs) TypstMath | Points

详见 get_axis_label()

如果设置 ensure_on_screen=True,坐标轴标签会自动调整位置移动到默认屏幕区域内

class janim.items.coordinate.coordinate_systems.ThreeDAxes(x_range: RangeSpecifier = (-6, 6, 1), y_range: RangeSpecifier = (-5, 5, 1), z_range: RangeSpecifier = (-4, 4, 1), *, axis_config: dict = {}, z_length: float | None = None, z_axis_config: dict = {}, z_normal: Vect = array([0., -1., 0.]), **kwargs)

基类:Axes

z_axis_config_d = {}
get_axes() list[NumberLine]

得到由各方向 NumberLine 所组成的列表

class janim.items.coordinate.coordinate_systems.CmptVPoints_NumberPlaneImpl(*args, **kwargs)

基类:Cmpt_VPoints

prepare_for_nonlinear_transform(num_inserted_curves: int = 50, *, root_only=False) Self
class janim.items.coordinate.coordinate_systems.NumberPlane(x_range: RangeSpecifier = (-8.0, 8.0, 1.0), y_range: RangeSpecifier = (-4.0, 4.0, 1.0), background_line_style: dict = {}, faded_line_style: dict = {}, faded_line_ratio: int = 4, **kwargs)

基类:Axes

points
background_line_style_d = {'stroke_color': '#29ABCA', 'stroke_radius': 0.01}
axis_config_d = {'include_ticks': False, 'include_tip': False, 'line_to_number_buff': 0.1, 'line_to_number_direction': array([-1., -1.,  0.]), 'stroke_color': '#FFFFFF', 'stroke_radius': 0.01}
y_axis_config_d = {'line_to_number_direction': array([-1., -1.,  0.])}
get_lines_parallel_to_axis(axis1: NumberLine, axis2: NumberLine) tuple[Group, Group]