def piece.line

gralha-coverage@0.1.0.1 · cover.bend:716

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

716# A piece as a line shifted so the row starts at zero, for the sub-scanline
717# scan of a row whose exact areas showed an overlap.
718def piece.line(+p: Piece, +y: F32) -> CovLine:
719  Piece{x0, y0, slope, top, bottom, dir} = p
720  +xx0 = x0
721  +yy0 = y0
722  +s = slope
723  +t = top
724  +b = bottom
725  +xt = (xx0 + (t - yy0) * s : F32)
726  +xb = (xx0 + (b - yy0) * s : F32)
727  U.choose(CovLine, F32.is_gt(dir, 0.0), CovLine{xt, (t - y : F32), xb, (b - y : F32)}, CovLine{xb, (b - y : F32), xt, (t - y : F32)})

Uses (8)

Used by (1)