def arc.angles

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

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

362def arc.angles(+p: Path, +q: Point, +cmd: U32, +rx: F32, +ry: F32, +phi: F32,
363  +xp: F32, +yp: F32, +cx: F32, +cy: F32, +center: Point, sweep: F32) -> Path:
364  +ux = ((xp - cx) / rx : F32)
365  +uy = ((yp - cy) / ry : F32)
366  +vx = ((0.0 - xp - cx) / rx : F32)
367  +vy = ((0.0 - yp - cy) / ry : F32)
368  +delta = F32.atan2((ux * vy - uy * vx : F32), (ux * vx + uy * vy : F32))
369  +sw = F32.is_gt(sweep, 0.0)
370  arc.draw(p, q, cmd, rx, ry, phi, center, F32.atan2(uy, ux),
371    U.choose(F32, sw && F32.is_lt(delta, 0.0), (delta + 6.283185307179586 : F32),
372      U.choose(F32, Bool.not(sw) && F32.is_gt(delta, 0.0), (delta - 6.283185307179586 : F32), delta)))

Uses (15)

Used by (1)