March Docs

Arcade.CameraFit

Types

typeFitGridFitGrid = { first : Float, stride : Float, count : Int }#

count values first, first + stride, first + 2 stride, ... Each value is first + i stride (not a running sum), so a grid is exact per index.

typeFitTargetFitTarget = { spot : Vec3, want_y : Float, weight : Float }#

A point that should land at screen height want_y (a fraction, y down), with its squared miss counted weight times.

typeLensFamilyLensFamily = PerspectiveFamily | OrthographicFamily#

Which lens the lens grid holds: fields of view in degrees, or orthographic extents in world units.

typeFitPlanFitPlan = {#

The whole search. Each lens value also costs lens_weight times itself, so of two equal fits the narrower lens wins.

typeFitBestFitBest = { err : Float, li : Int, ai : Int, bi : Int, ci : Int }#

The best candidate so far and its grid indices. Ties go to the earliest in lexicographic (lens, a, b, c) order, whatever order the walk visits.

Functions

fnfitfit(cx : c, n : Arcade.Numerics.Numerics, pose_at : c -> Float -> Float -> Float -> Pose, plan : FitPlan, ts : List(FitTarget)) : Rig needs ()#

The fitted rig: pose_at(cx, a, b, c) gives the pose for one point of the three pose grids, and the lens comes from the lens grid.

fnfit_bestfit_best(cx : c, n : Arcade.Numerics.Numerics, pose_at : c -> Float -> Float -> Float -> Pose, plan : FitPlan, ts : List(FitTarget)) : FitBest needs ()#
fngridgrid(first : Float, stride : Float, count : Int) : FitGrid needs ()#
fngrid_atgrid_at(g : FitGrid, i : Int) : Float needs ()#
fntargettarget(spot : Vec3, want_y : Float, weight : Float) : FitTarget needs ()#