def line.cut.at

gralha-coverage@0.1.0.1 · cover.bend:197

import gralha-coverage@0.1.0.1/cover.bend as Cover
import Base

197# Split at x = at when the line crosses it, pushing the piece before the
198# crossing; the rest continues.
199def 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):
200  match cross:
201    case False{}: (st, (ax, ay))
202    case True{}:
203      +my = (ay + (by - ay) * ((at - ax) / (bx - ax)) : F32)
204      (line.push(ax, ay, at, my, w, st), (at, my))

Uses (12)

Used by (1)