def arc.radii
gralha-svg-render@0.1.0.1 · svg.bend:383
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
383def arc.radii(+p: Path, +q: Point, +cmd: U32, +rx: F32, +ry: F32, +phi: F32,
384 +xp: F32, +yp: F32, +large: F32, +sweep: F32) -> Path:
385 +ratio = U.max(1.0, F32.sqrt((xp * xp / (rx * rx) + yp * yp / (ry * ry) : F32)))
386 +r = (rx * ratio : F32)
387 +s = (ry * ratio : F32)
388 +den = (r * r * yp * yp + s * s * xp * xp : F32)
389 +factor = F32.sqrt(U.max(0.0, ((r * r * s * s - den) / den : F32)))
390 arc.center(p, q, cmd, r, s, phi, xp, yp,
391 U.choose(F32, F32.is_eq(large, sweep), F32.neg(factor), factor), sweep)