gralha-coverage Releases (1): 0.1.0.1 0xe732782c490292c188a9095f67f89d02 indexed https://jend.leeeet.dev/files.txt?path=gralha-coverage@0.1.0.1 Definitions (199, 1 to 100 shown): Cover.CovLine (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=CovLine) # A directed line in pixel coordinates of the target grid. type CovLine is Data: CovLine{x0: F32, y0: F32, x1: F32, y1: F32} Cover.CovTree (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=CovTree) # Coverage over a power-of-two square: uniform cells collapse to one leaf. type CovTree is Data: CovFlat{value: F32} CovQuad{a: CovTree, b: CovTree, c: CovTree, d: CovTree} Cover.Run (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Run) # A run of cells [x0, x1) of one nonzero coverage value in a row. type Run is Data: Run{x0: U32, x1: U32, value: F32} Cover.CovData (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=CovData) # A mask's coverage: rows of runs (top first, ascending runs), which a fill is # painted from directly, or the tree, which clip masks and sampled tiles need # for block and pixel queries. type CovData is Data: CovRows{rows: List<&2, List<&2, Run>>} CovTreed{tree: CovTree} Cover.CovMask (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=CovMask) # A mask placed at pixel (x, y) of its grid, size = 2^depth cells on a side. # w by h cells of it hold coverage; size = 2^depth is the tree's side. type CovMask is Data: CovMask{x: U32, y: U32, w: U32, h: U32, size: U32, depth: Nat, data: CovData, present: Bool} Cover.mask.none (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=mask.none) def mask.none() -> CovMask: Cover.runs.at (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=runs.at) # Coverage of a cell from rows of runs; a slow path for masks built without a tree. def runs.at(rs: List<&2, Run>, +x: U32) -> F32: Cover.rows.at (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=rows.at) def rows.at(rows: List<&2, List<&2, Run>>, +y: U32, +x: U32) -> F32: Cover.mask.present (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=mask.present) def mask.present(+m: CovMask) -> Bool: Cover.tree.at (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=tree.at) def tree.at(t: CovTree, +half: U32, +x: U32, +y: U32) -> F32: Cover.data.at (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=data.at) def data.at(d: CovData, +half: U32, +x: U32, +y: U32) -> F32: Cover.mask.at.in (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=mask.at.in) def mask.at.in(outside: Bool, d: CovData, +half: U32, +x: U32, +y: U32) -> F32: Cover.mask.at (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=mask.at) # Coverage of the pixel containing (px, py), in grid pixel coordinates; the # reads branch through matches, not lambdas, since they run once per pixel. def mask.at(+m: CovMask, +px: F32, +py: F32) -> F32: Cover.tree.same.as (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=tree.same.as) # Coverage over the cell rectangle [x0, x1) by [y0, y1) of a node's square at # (nx, ny) of side size, when every cell in it holds the same value; -1 otherwise. # acc is 2 before any cell is seen, -1 once cells disagree, else the value so far. def tree.same.as(+v: F32, +u: F32) -> F32: Cover.tree.overlaps (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=tree.overlaps) def tree.overlaps(+nx: U32, +ny: U32, +size: U32, +x0: U32, +y0: U32, +x1: U32, +y1: U32) -> Bool: Cover.tree.uniform (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=tree.uniform) def tree.uniform(t: CovTree, +nx: U32, +ny: U32, +size: U32, +x0: U32, +y0: U32, +x1: U32, +y1: U32, +acc: F32) -> F32: Cover.runs.over (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=runs.over) # The mask's coverage over the grid rectangle [x0, x1) by [y0, y1) when it is # uniform (2 means "unvisited", so an empty rectangle reads as uniform 0), else -1. # The uniform value of runs over the columns [x0, x1): a run covering them # all gives its value, none touching them gives 0, anything else -1. def runs.over(rs: List<&2, Run>, +x0: U32, +x1: U32, +acc: F32) -> F32: Cover.rows.over (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=rows.over) def rows.over(rows: List<&2, List<&2, Run>>, +y: U32, +x0: U32, +y0: U32, +x1: U32, +y1: U32, +acc: F32) -> F32: Cover.data.uniform (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=data.uniform) def data.uniform(d: CovData, +mx: U32, +my: U32, +sz: U32, +x0: U32, +y0: U32, +x1: U32, +y1: U32) -> F32: Cover.mask.uniform.in (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=mask.uniform.in) def mask.uniform.in(+m: CovMask, +x0: U32, +y0: U32, +x1: U32, +y1: U32) -> F32: Cover.mask.uniform (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=mask.uniform) def mask.uniform(+m: CovMask, +x0: U32, +y0: U32, +x1: U32, +y1: U32) -> F32: Cover.line.split (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=line.split) def line.split(l: CovLine, +at: F32) -> List<&2, CovLine>: Cover.lines.append (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.append) def lines.append(xs: List<&2, CovLine>, ys: List<&2, CovLine>) -> List<&2, CovLine>: Cover.lines.split (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.split) def lines.split(xs: List<&2, CovLine>, +at: F32) -> List<&2, CovLine>: Cover.lines.clamp (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.clamp) # Pieces left of 0 or right of w become vertical lines on that boundary, which keeps # the winding of every cell inside [0, w) intact. def lines.clamp(xs: List<&2, CovLine>, +w: F32, acc: List<&2, CovLine>, +n: U32) -> List<&2, CovLine> & U32: Cover.lines.clip (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.clip) # The clipped lines, in no particular order, with their count. def lines.clip(xs: List<&2, CovLine>, +w: F32) -> List<&2, CovLine> & U32: Cover.line.push (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=line.push) # One pass over the lines: shift by the mask's origin, split at the grid's # left and right edges and clamp the pieces to it, counting them. Pieces # left of 0 or right of w become vertical lines on that edge, which keeps # the winding of every cell inside intact. def line.push(+ax: F32, +ay: F32, +bx: F32, +by: F32, +w: F32, st: List<&2, CovLine> & U32) -> List<&2, CovLine> & U32: Cover.line.cut.at (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=line.cut.at) # Split at x = at when the line crosses it, pushing the piece before the # crossing; the rest continues. def line.cut.at(cross: Bool, +ax: F32, +ay: F32, +bx: F32, +by: F32, +at: F32, +w: F32, st: List<&2, CovLine> & U32) -> (List<&2, CovLine> & U32) & (F32 & F32): Cover.line.cut (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=line.cut) def line.cut(+ax: F32, +ay: F32, +bx: F32, +by: F32, +at: F32, +w: F32, st: List<&2, CovLine> & U32) -> (List<&2, CovLine> & U32) & (F32 & F32): Cover.line.prepare.last (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=line.prepare.last) def line.prepare.last(got: (List<&2, CovLine> & U32) & (F32 & F32), +bx: F32, +by: F32, +w: F32) -> List<&2, CovLine> & U32: Cover.line.prepare.right (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=line.prepare.right) def line.prepare.right(got: (List<&2, CovLine> & U32) & (F32 & F32), +bx: F32, +by: F32, +w: F32) -> List<&2, CovLine> & U32: Cover.lines.prepare (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.prepare) def lines.prepare(xs: List<&2, CovLine>, +dx: F32, +dy: F32, +w: F32, st: List<&2, CovLine> & U32) -> List<&2, CovLine> & U32: Cover.line.top (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=line.top) def line.top(+l: CovLine) -> F32: Cover.Act (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Act) # A line on the scanlines: x at the current one is cur; slope is dx/dy. type Act is Data: Act{cur: F32, x0: F32, y0: F32, slope: F32, bottom: F32, dir: F32} Cover.Ins (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Ins) # Insert into a list descending by cur, after the elements not below it. type Ins is Data: Placed{list: List<&2, Act>} Passed{h: Act, t: List<&2, Act>, a: Act} Cover.act.ins.pick (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=act.ins.pick) def act.ins.pick(hit: Bool, a: Act, h: Act, t: List<&2, Act>) -> Ins: Cover.act.insert.go (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=act.insert.go) def act.insert.go(i: Ins) -> List<&2, Act>: Cover.act.insert (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=act.insert) def act.insert(a: Act, xs: List<&2, Act>) -> List<&2, Act>: Cover.act.reverse (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=act.reverse) def act.reverse(xs: List<&2, Act>, acc: List<&2, Act>) -> List<&2, Act>: Cover.act.keep (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=act.keep) # The line as it will stand on scanline sy, placed into the descending list. def act.keep(keep: Bool, +x0: F32, +y0: F32, +slope: F32, +bottom: F32, +dir: F32, +sy: F32, acc: List<&2, Act>) -> List<&2, Act>: Cover.act.add (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=act.add) # A line covers [top, bottom) so a shared vertex counts once; a horizontal line # never crosses. Lines whose bottom the scanline has passed are dropped. def act.add(l: CovLine, +sy: F32, acc: List<&2, Act>) -> List<&2, Act>: Cover.Take (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Take) # Lines from the sorted pending list whose top the scanline sy has reached. type Take is Data: Take{done: Bool, pending: List<&2, CovLine>, acc: List<&2, Act>} Cover.take.pick (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=take.pick) def take.pick(hit: Bool, l: CovLine, rest: List<&2, CovLine>, +sy: F32, acc: List<&2, Act>) -> Take: Cover.take.go (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=take.go) def take.go(t: Take, +sy: F32) -> Take: Cover.CovEv (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=CovEv) type CovEv is Data: CovEv{cell: U32, direct: F32, delta: F32} Cover.ev.push.if (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=ev.push.if) def ev.push.if(skip: Bool, +cell: U32, +direct: F32, +delta: F32, acc: List<&2, CovEv>) -> List<&2, CovEv>: Cover.ev.push (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=ev.push) def ev.push(+cell: U32, +direct: F32, +delta: F32, acc: List<&2, CovEv>) -> List<&2, CovEv>: Cover.span.events.cells (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=span.events.cells) def span.events.cells(one: Bool, +ia: U32, +ib: U32, +xa: F32, +xb: F32, +w: F32, acc: List<&2, CovEv>) -> List<&2, CovEv>: Cover.span.events (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=span.events) # Events of the span [xa, xb) when it is inside; both ends lie within [0, width]. def span.events(inside: Bool, +xa: F32, +xb: F32, +w: F32, acc: List<&2, CovEv>) -> List<&2, CovEv>: Cover.winding.inside (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=winding.inside) def winding.inside(+wind: F32, +even: Bool) -> Bool: Cover.Step (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Step) # One scanline: walk the ascending list, emit the inside spans' events, and # build the descending list for the next scanline sy2. type Step is Data: Step{events: List<&2, CovEv>, next: List<&2, Act>} @unsafe Cover.step (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=step) def step(xs: List<&2, Act>, +sy2: F32, +wind: F32, +last: F32, +even: Bool, +weight: F32, evs: List<&2, CovEv>, acc: List<&2, Act>) -> Step: Cover.EvOrder (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=EvOrder) # Merge two descending event lists, larger cells first. type EvOrder is Data: EvOrder{first: CovEv, rest: List<&2, CovEv>, other: List<&2, CovEv>} Cover.ev.cell (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=ev.cell) def ev.cell(+e: CovEv) -> U32: Cover.ev.order.pick (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=ev.order.pick) def ev.order.pick(hit: Bool, x: CovEv, xt: List<&2, CovEv>, y: CovEv, yt: List<&2, CovEv>) -> EvOrder: Cover.ev.order (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=ev.order) def ev.order(x: CovEv, xt: List<&2, CovEv>, y: CovEv, yt: List<&2, CovEv>) -> EvOrder: Cover.ev.merge.go (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=ev.merge.go) def ev.merge.go(o: EvOrder) -> List<&2, CovEv>: Cover.ev.merge (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=ev.merge) def ev.merge(xs: List<&2, CovEv>, ys: List<&2, CovEv>) -> List<&2, CovEv>: Cover.run.snap (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=run.snap) # Sums of a weight's multiples cancel exactly for power-of-two sub counts and # to within rounding otherwise; noise below a millionth reads as empty. def run.snap(+v: F32) -> F32: Cover.runs.emit.join (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=runs.emit.join) def runs.emit.join(join: Bool, +x0: U32, +x1: U32, +v: F32, +b: U32, head: Run, rest: List<&2, Run>) -> List<&2, Run>: Cover.runs.emit.some (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=runs.emit.some) def runs.emit.some(skip: Bool, +x0: U32, +x1: U32, +v: F32, acc: List<&2, Run>) -> List<&2, Run>: Cover.runs.emit (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=runs.emit) # Prepend the run [x0, x1) of value v, extending the head when they meet with one value. def runs.emit(+x0: U32, +x1: U32, +v: F32, acc: List<&2, Run>) -> List<&2, Run>: Cover.Sweep (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Sweep) # Sweep state: sum is the total delta at cells >= upper, the runs so far cover # cells >= upper, and the open group collects the events of cell c. type Sweep is Data: Sweep{sum: F32, upper: U32, c: U32, direct: F32, delta: F32, acc: List<&2, Run>} Cover.sweep.flush (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=sweep.flush) # Close the group at c: the gap (c, upper) holds -sum, cell c adds its directs. def sweep.flush(+sum: F32, +upper: U32, +c: U32, +direct: F32, acc: List<&2, Run>) -> List<&2, Run>: Cover.sweep.step (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=sweep.step) def sweep.step(same: Bool, +cell: U32, +direct: F32, +delta: F32, +sum: F32, +upper: U32, +c: U32, +dsum: F32, +dlsum: F32, acc: List<&2, Run>) -> Sweep: Cover.sweep (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=sweep) def sweep(st: Sweep, evs: List<&2, CovEv>) -> List<&2, Run>: Cover.row.runs (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=row.runs) # The runs of a row of width w from its descending events. def row.runs(evs: List<&2, CovEv>, +w: U32) -> List<&2, Run>: Cover.LineOrder (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=LineOrder) type LineOrder is Data: LineOrder{first: CovLine, rest: List<&2, CovLine>, other: List<&2, CovLine>} Cover.lines.order.pick (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.order.pick) def lines.order.pick(hit: Bool, x: CovLine, xt: List<&2, CovLine>, y: CovLine, yt: List<&2, CovLine>) -> LineOrder: Cover.lines.order (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.order) def lines.order(x: CovLine, xt: List<&2, CovLine>, y: CovLine, yt: List<&2, CovLine>) -> LineOrder: Cover.lines.merge.go (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.merge.go) def lines.merge.go(o: LineOrder) -> List<&2, CovLine>: Cover.lines.merge (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.merge) def lines.merge(xs: List<&2, CovLine>, ys: List<&2, CovLine>) -> List<&2, CovLine>: Cover.LineSplit (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=LineSplit) type LineSplit is Data: LineSplit{left: List<&2, CovLine>, right: List<&2, CovLine>} Cover.lines.deal (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.deal) def lines.deal(xs: List<&2, CovLine>, left: List<&2, CovLine>, right: List<&2, CovLine>) -> LineSplit: Cover.lines.sort.go (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.sort.go) def lines.sort.go(s: LineSplit) -> List<&2, CovLine>: Cover.lines.sort (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=lines.sort) def lines.sort(xs: List<&2, CovLine>) -> List<&2, CovLine>: Cover.Subs (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Subs) type Subs is Data: Subs{active: List<&2, Act>, pending: List<&2, CovLine>, events: List<&2, CovEv>} Cover.subs.done (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=subs.done) def subs.done(t: Take, events: List<&2, CovEv>) -> Subs: Cover.subs.after (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=subs.after) def subs.after(s: Step, pending: List<&2, CovLine>, +sy2: F32, events: List<&2, CovEv>) -> Subs: Cover.subs.step (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=subs.step) def subs.step(st: Subs, +sy: F32, +dy: F32, +even: Bool, +weight: F32) -> Subs: Cover.scan.subs (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=scan.subs) def scan.subs(st: Subs, n: Nat, +sy: F32, +dy: F32, +even: Bool, +weight: F32) -> Subs: Cover.Scan (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Scan) type Scan is Data: Scan{rows: List<&2, List<&2, Run>>, active: List<&2, Act>, pending: List<&2, CovLine>} Cover.scan.row.done (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=scan.row.done) def scan.row.done(st: Subs, rows: List<&2, List<&2, Run>>, +w: U32) -> Scan: Cover.scan.row (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=scan.row) def scan.row(st: Scan, +y: U32, +sub: U32, +even: Bool, +w: U32) -> Scan: Cover.scan.rows.go (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=scan.rows.go) def scan.rows.go(st: Scan, n: Nat, +y: U32, +sub: U32, +even: Bool, +w: U32) -> Scan: Cover.rows.reverse (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=rows.reverse) def rows.reverse(rows: List<&2, List<&2, Run>>, acc: List<&2, List<&2, Run>>) -> List<&2, List<&2, Run>>: Cover.scan.done (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=scan.done) def scan.done(st: Scan) -> List<&2, List<&2, Run>>: Cover.scan.start (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=scan.start) def scan.start(t: Take) -> Scan: Cover.scan.rows (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=scan.rows) # The rows of runs (top first) of the lines, sorted by top, over a width by height grid. def scan.rows(+h: U32, +sub: U32, sorted: List<&2, CovLine>, +even: Bool, +w: U32) -> List<&2, List<&2, Run>>: Cover.depth.for (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=depth.for) def depth.for(+size: U32, +side: U32, +depth: Nat) -> Nat: Cover.Piece (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=Piece) # A line for the exact scan: x = x0 + (y - y0) * slope over [top, bottom). type Piece is Data: Piece{x0: F32, y0: F32, slope: F32, top: F32, bottom: F32, dir: F32} Cover.piece.of (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=piece.of) def piece.of(l: CovLine) -> Piece: Cover.piece.bottom (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=piece.bottom) def piece.bottom(+p: Piece) -> F32: Cover.buf.add.got (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=buf.add.got) def buf.add.got(got: Array & F32, +i: U32, +v: F32) -> Array: Cover.buf.add (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=buf.add) def buf.add(a: Array, +i: U32, +v: F32) -> Array: Cover.bits.set.got (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=bits.set.got) def bits.set.got(got: Array & U32, +i: U32, +bit: U32) -> Array: Cover.bits.set (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=bits.set) def bits.set(bm: Array, +c: U32) -> Array: Cover.buf.put (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=buf.put) # A cut's direct area goes to its cell (dropped at or past the width, which # lies outside the row) and its delta to the next cell, capped at the width # so every delta still counts in the sum. def buf.put(b: (Array & Array) & (U32 & U32), +cell: U32, +direct: F32, +delta: F32, +w: U32) -> (Array & Array) & (U32 & U32): Cover.buf.put.if (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=buf.put.if) def buf.put.if(skip: Bool, b: (Array & Array) & (U32 & U32), +cell: U32, +direct: F32, +delta: F32, +w: U32) -> (Array & Array) & (U32 & U32): Cover.piece.cuts (https://jend.leeeet.dev/definition.txt?path=gralha-coverage@0.1.0.1/cover.bend&name=piece.cuts) def piece.cuts(done: Bool, n: Nat, +xa: F32, +ya: F32, +xb: F32, +yb: F32, +dir: F32, +slope: F32, +w: U32, b: (Array & Array) & (U32 & U32)) -> (Array & Array) & (U32 & U32): More: https://jend.leeeet.dev/packages/gralha-coverage.txt?definitions_offset=100