def lines.clamp

gralha-coverage@0.1.0.1 · cover.bend:178

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

178# Pieces left of 0 or right of w become vertical lines on that boundary, which keeps
179# the winding of every cell inside [0, w) intact.
180def lines.clamp(xs: List<&2, CovLine>, +w: F32, acc: List<&2, CovLine>, +n: U32) -> List<&2, CovLine> & U32:
181  match xs:
182    case Nil{}: (acc, n)
183    case Con{CovLine{x0, y0, x1, y1}, rest}: lines.clamp(rest, w, Con{CovLine{U.clamp(x0, 0.0, w), y0, U.clamp(x1, 0.0, w), y1}, acc}, (n + 1 : U32))

Uses (8)

Used by (1)