mizchi/geom/vector does not have a README file

    Path

    pub struct Path {
    commands : Array[PathCommand]
    current_x : Double
    current_y : Double
    start_x : Double
    start_y : Double
    }

    Path::arc_to

    fn Path::arc_to(self : Path, cx : Double, cy : Double, r : Double, start_angle : Double, end_angle : Double, segments : Int) -> Unit

    Arc from current point around center (cx, cy) with radius r, from start_angle to end_angle (radians, counter-clockwise).

    Path::close

    fn Path::close(self : Path) -> Unit

    Path::command_count

    fn Path::command_count(self : Path) -> Int

    Path::cubic_to

    fn Path::cubic_to(self : Path, cp1x : Double, cp1y : Double, cp2x : Double, cp2y : Double, x : Double, y : Double) -> Unit

    Cubic bezier curve to (x, y) with control points (cp1x, cp1y) and (cp2x, cp2y).

    Path::flatten

    fn Path::flatten(self : Path, tolerance : Double) -> Array[Vec2]

    Flatten all curves into line segments with the given tolerance.

    Path::line_to

    fn Path::line_to(self : Path, x : Double, y : Double) -> Unit

    Path::move_to

    fn Path::move_to(self : Path, x : Double, y : Double) -> Unit

    Path::new

    fn Path::new() -> Path

    Path::quad_to

    fn Path::quad_to(self : Path, cpx : Double, cpy : Double, x : Double, y : Double) -> Unit

    Quadratic bezier curve to (x, y) with control point (cpx, cpy).

    PathCommand

    pub(all) enum PathCommand {
    MoveTo(Double, Double)
    LineTo(Double, Double)
    QuadTo(Double, Double, Double, Double)
    CubicTo(Double, Double, Double, Double, Double, Double)
    Close
    }

    Vec2

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

    impl Show for Vec2

    Vec2::add

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

    Vec2::angle

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

    Vec2::angle_between

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

    Vec2::approx_eq

    fn Vec2::approx_eq(self : Vec2, other : Vec2, epsilon : Double) -> Bool

    Vec2::clamp

    fn Vec2::clamp(self : Vec2, min : Vec2, max : Vec2) -> Vec2

    Vec2::cross

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

    2D cross product (returns scalar z-component).

    Vec2::distance

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

    Vec2::distance_squared

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

    Vec2::div

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

    Vec2::dot

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

    Vec2::length

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

    Vec2::length_squared

    fn Vec2::length_squared(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::mul

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

    Vec2::negate

    fn Vec2::negate(self : Vec2) -> Vec2

    Vec2::new

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

    Vec2::normalize

    fn Vec2::normalize(self : Vec2) -> Vec2

    Vec2::one

    fn Vec2::one() -> Vec2

    Vec2::output

    fn Vec2::output(self : Vec2, logger : &Logger) -> Unit

    Vec2::perpendicular

    fn Vec2::perpendicular(self : Vec2) -> Vec2

    Vec2::reflect

    fn Vec2::reflect(self : Vec2, normal : Vec2) -> Vec2

    Reflect vector around a normal.

    Vec2::rotate

    fn Vec2::rotate(self : Vec2, angle_rad : Double) -> Vec2

    Vec2::scale

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

    Vec2::sub

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

    Vec2::to_repr

    Vec2::to_string

    fn Vec2::to_string(self : Vec2) -> String

    Vec2::unit_x

    fn Vec2::unit_x() -> Vec2

    Vec2::unit_y

    fn Vec2::unit_y() -> Vec2

    Vec2::zero

    fn Vec2::zero() -> Vec2

    aabb_overlap

    fn aabb_overlap(ax : Double, ay : Double, aw : Double, ah : Double, bx : Double, by : Double, bw : Double, bh : Double) -> Bool

    Check if two axis-aligned bounding boxes overlap (top-left + size form).

    aabb_overlap_center

    fn aabb_overlap_center(ax : Double, ay : Double, ahw : Double, ahh : Double, bx : Double, by : Double, bhw : Double, bhh : Double) -> Bool

    Check if two axis-aligned bounding boxes overlap (center + half-size form).

    fill_path

    fn fill_path(points : Array[Vec2]) -> (Array[Double], Array[Int])

    Generate fill vertices from flattened path points using fan triangulation. Assumes the polygon is convex or simple (uses fan from first vertex). Returns (vertex_data, indices) where each vertex is [x, y, u, v].

    stroke_path

    fn stroke_path(points : Array[Vec2], width : Double) -> (Array[Double], Array[Int])

    Generate stroke (outline) vertices from flattened path points. Returns (vertex_data, indices) where each vertex is [x, y, u, v].

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io