def act.add
gralha-coverage@0.1.0.1 · cover.bend:288
import gralha-coverage@0.1.0.1/cover.bend as Cover
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
288
289
290def act.add(l: CovLine, +sy: F32, acc: List<&2, Act>) -> List<&2, Act>:
291 CovLine{x0, y0, x1, y1} = l
292 +ax = x0
293 +ay = y0
294 +bx = x1
295 +by = y1
296 +up = F32.is_lt(ay, by)
297 +bottom = U.max(ay, by)
298 act.keep(F32.is_lt(sy, bottom) && Bool.not(F32.is_eq(ay, by)), ax, ay, ((bx - ax) / (by - ay) : F32), bottom, U.choose(F32, up, 1.0, F32.neg(1.0)), sy, acc)