arrow

class janim.items.geometry.arrow.CenterAnchor(*values)

基类:StrEnum

箭头原点所处位置的选项

图形示意:

.-----
|        -----
|               -----
[Back]  [Center]  [Front]
|               -----
|        -----
.-----
Back = 'back'
Center = 'center'
Front = 'front'
class janim.items.geometry.arrow.ArrowTip(body_length: float = 0.2, back_width: float = 0.2, angle: float = 0, scale: float = 1, *, center_anchor: CenterAnchor | Literal['back', 'center', 'front'] = CenterAnchor.Back, rotation: float | None = None, fill_alpha: float = 1.0, stroke_radius: float = 0.005, **kwargs)

基类:VItem

箭头标志

  • body_length: 箭头的宽度

  • back_width: 箭头的长度

  • center_anchor: 原点所处的位置,请参考 CenterAnchor

  • rotation: 绕方向轴转动的角度,一般用于 3D 中

get_center_anchor() ndarray

根据设定的 center_anchor 得到原点位置, 请参考 ArrowTip.CenterAnchor

property direction: ndarray

得到箭头的方向(单位向量)

property body_length: float

得到箭头的长度

property back_width: float

得到箭头的宽度

rotate_about_anchor(angle: float) Self

相对于原点位置进行旋转

move_anchor_to(pos: ndarray) Self

将原点移动到指定位置

class janim.items.geometry.arrow.Cmpt_VPoints_ArrowImpl(*args, **kwargs)

基类:Cmpt_VPoints_LineImpl, Generic

put_start_and_end_on(start: Vect, end: Vect) Self

通过旋转和缩放,使得物件的起点和终点被置于 startend

class janim.items.geometry.arrow.Arrow(start: Vect | Points = array([-1., 0., 0.]), end: Vect | Points = array([1., 0., 0.]), *, buff: float = 0.25, max_length_to_tip_length_ratio: float | None = 0.3, tip_kwargs: dict = {}, **kwargs)

基类:Line

带箭头的线段,箭头大小自动

  • buff: 箭头首尾的空余量,默认为 0.25

  • max_length_to_tip_length_ratio: 箭头长度和直线长度最大比例

points
init_tips(tip_kwargs: dict) None
copy(*, root_only=False) Self

复制物件

place_tip() Self
create_text(text: str, place: float = 0.5, *, use_typst_text: bool = False, under: bool = False, buff: float = 0.25, d_place: float = 1e-06, **kwargs)

创建文字并与箭头对齐

其中 under 参数的含义是:

under=False

      文字
----------------->

under=True

----------------->
      文字
class janim.items.geometry.arrow.Vector(direction: ndarray = array([1., 0., 0.]), *, buff: float = 0, tip_kwargs: dict = {}, **kwargs)

基类:Arrow

起点为 ORIGIN 的箭头,终点为 direction

  • buff 默认设为了 0

class janim.items.geometry.arrow.DoubleArrow(*args, tip_kwargs: dict = {}, **kwargs)

基类:Arrow

双向箭头

参数请参考 Arrow

init_tips(tip_kwargs: dict) None
copy(*, root_only=False) Self

复制物件

place_tip() Self