LING71671/moon-egui/src/math does not have a README file

    Rect

    pub struct Rect {
    x : Double
    y : Double
    w : Double
    h : Double
    } derive(Default, Eq,
    Debug
    )

    Rect::center

    fn Rect::center(self : Rect) -> Vec2

    Rect::contains

    fn Rect::contains(self : Rect, pt : Vec2) -> Bool

    Rect::expand

    fn Rect::expand(self : Rect, margin : Double) -> Rect

    Rect::from_min_max

    fn Rect::from_min_max(min : Vec2, max : Vec2) -> Rect

    Rect::intersect

    fn Rect::intersect(self : Rect, other : Rect) -> Rect

    Rect::intersects

    fn Rect::intersects(self : Rect, other : Rect) -> Bool

    Rect::max

    fn Rect::max(self : Rect) -> Vec2

    Rect::min

    fn Rect::min(self : Rect) -> Vec2

    Rect::new

    fn Rect::new(x : Double, y : Double, w : Double, h : Double) -> Rect

    Rect::shrink

    fn Rect::shrink(self : Rect, margin : Double) -> Rect

    Rect::size

    fn Rect::size(self : Rect) -> Vec2

    Rect::translate

    fn Rect::translate(self : Rect, offset : Vec2) -> Rect

    Spring

    pub struct Spring {
    config : SpringConfig
    current : Double
    target : Double
    velocity : Double
    } derive(Eq,
    Debug
    )

    Single-degree-of-freedom spring simulation state.

    Spring::is_settled

    fn Spring::is_settled(self : Spring, tolerance? : Double, velocity_tolerance? : Double) -> Bool

    Spring::new

    fn Spring::new(initial_val : Double, config? : SpringConfig) -> Spring

    Spring::reset

    fn Spring::reset(self : Spring, value : Double) -> Unit

    Spring::set_target

    fn Spring::set_target(self : Spring, target : Double) -> Unit

    Spring::step

    fn Spring::step(self : Spring, dt : Double) -> Unit

    Advances the spring simulation by dt seconds using semi-implicit Euler integration with adaptive sub-stepping to prevent numerical instability.

    Spring::target_value

    fn Spring::target_value(self : Spring) -> Double

    Spring::value

    fn Spring::value(self : Spring) -> Double

    Spring::velocity_value

    fn Spring::velocity_value(self : Spring) -> Double

    Spring2D

    pub struct Spring2D {
    x : Spring
    y : Spring
    } derive(Eq,
    Debug
    )

    Two-dimensional spring simulation for positions and coordinates.

    Spring2D::is_settled

    fn Spring2D::is_settled(self : Spring2D, tolerance? : Double, velocity_tolerance? : Double) -> Bool

    Spring2D::new

    fn Spring2D::new(initial_pos : Vec2, config? : SpringConfig) -> Spring2D

    Spring2D::reset

    fn Spring2D::reset(self : Spring2D, pos : Vec2) -> Unit

    Spring2D::set_target

    fn Spring2D::set_target(self : Spring2D, target : Vec2) -> Unit

    Spring2D::step

    fn Spring2D::step(self : Spring2D, dt : Double) -> Unit

    Spring2D::target_value

    fn Spring2D::target_value(self : Spring2D) -> Vec2

    Spring2D::value

    fn Spring2D::value(self : Spring2D) -> Vec2

    SpringConfig

    pub struct SpringConfig {
    stiffness : Double
    damping : Double
    mass : Double
    } derive(Default, Eq,
    Debug
    )

    Physical spring configuration parameters governing harmonic oscillation and damping.

    SpringConfig::bouncy

    fn SpringConfig::bouncy() -> SpringConfig

    Bouncy spring with lower damping for noticeable recoil.

    SpringConfig::default_spring

    fn SpringConfig::default_spring() -> SpringConfig

    Default balanced spring (critically damped feel for interactive UI).

    SpringConfig::gentle

    fn SpringConfig::gentle() -> SpringConfig

    Gentle spring for smooth transitions and subtle deceleration.

    SpringConfig::new

    fn SpringConfig::new(stiffness : Double, damping : Double, mass? : Double) -> SpringConfig

    SpringConfig::stiff

    fn SpringConfig::stiff() -> SpringConfig

    Stiff spring with high responsiveness and minimal overshoot.

    Vec2

    pub struct Vec2 {
    x : Double
    y : Double
    } derive(Default, Eq,
    Debug
    )

    Vec2::add

    fn Vec2::add(self : Vec2, other : Vec2) -> Vec2

    Vec2::dot

    fn Vec2::dot(self : Vec2, other : Vec2) -> Double

    Vec2::from_polar

    fn Vec2::from_polar(radius : Double, angle_rad : Double) -> Vec2

    Vec2::length_sq

    fn Vec2::length_sq(self : Vec2) -> Double

    Vec2::lerp

    fn Vec2::lerp(self : Vec2, other : Vec2, t : Double) -> Vec2

    Vec2::max

    fn Vec2::max(self : Vec2, other : Vec2) -> Vec2

    Vec2::min

    fn Vec2::min(self : Vec2, other : Vec2) -> Vec2

    Vec2::new

    fn Vec2::new(x : Double, y : Double) -> Vec2

    Vec2::scale

    fn Vec2::scale(self : Vec2, factor : Double) -> Vec2

    Vec2::sub

    fn Vec2::sub(self : Vec2, other : Vec2) -> Vec2

    Vec2::zero

    fn Vec2::zero() -> Vec2

    cos

    fn cos(rad : Double) -> Double

    let pi : Double

    sin

    fn sin(rad : Double) -> Double

    Source Files