Skip to main content

Position

Trait Position 

Source
pub trait Position: Sized {
    // Required methods
    fn bbox(&self) -> Option<Rect>;
    fn transform(self, a: Affine) -> Self;

    // Provided methods
    fn next_to(self, other: &impl Position, dir: Vec2, buff: f64) -> Self { ... }
    fn align_to(self, other: &impl Position, dir: Vec2) -> Self { ... }
    fn to_edge(self, dir: Vec2) -> Self { ... }
}
Expand description

Something that can be placed relative to other things by its bounding box. Empty things (no bounding box) are left where they are.

Required Methods§

Source

fn bbox(&self) -> Option<Rect>

Tight bounding box, or None if empty.

Source

fn transform(self, a: Affine) -> Self

Applies an affine transform to the geometry.

Provided Methods§

Source

fn next_to(self, other: &impl Position, dir: Vec2, buff: f64) -> Self

Places this buff units from other in direction dir, centered on it along the other axis, manim’s next_to (e.g. label.next_to(&dot, UP, DEFAULT_BUFF)). A diagonal dir places it off a corner.

Source

fn align_to(self, other: &impl Position, dir: Vec2) -> Self

Lines up this edge in direction dir with the same edge of other, moving only along the axes where dir is nonzero, manim’s align_to (e.g. LEFT aligns left edges).

Source

fn to_edge(self, dir: Vec2) -> Self

Moves against the frame edge in direction dir (e.g. UP, or UP + LEFT for a corner), leaving manim’s 0.5-unit gap.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Position for Rect

Source§

fn bbox(&self) -> Option<Rect>

Source§

fn transform(self, a: Affine) -> Self

Implementors§