def outline.side

gralha-svg-render@0.1.0.1 · svg.bend:1565

import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base

1565# The left side of a polyline: each segment's offset endpoints with the
1566# joins between segments. `previous` carries the segment arriving at the
1567# first vertex (the last one, for a closed subpath).
1568def outline.side(xs: List<&2, Segment>, previous: Maybe<&2, Prev>, +closed: Bool, +r: F32, +js: Joins, +scale: F32, acc: List<&2, Point>) -> List<&2, Point>:
1569  match xs:
1570    case Nil{}: outline.side.end(previous, closed, acc)
1571    case Con{Segment{px, py, qx, qy, ux, uy, len, distance}, rest}:
1572      +u = {Point{ux, uy} : Point}
1573      +pp = {Point{px, py} : Point}
1574      +ln = len
1575      +n = point.scale(point.normal(u), r)
1576      outline.side(rest, Some{Prev{u, point.add(Point{qx, qy}, n), ln}}, closed, r, js, scale, outline.vertex(previous, pp, u, ln, point.add(pp, n), r, js, scale, acc))

Uses (13)

Used by (2)