def radial.parameter
gralha-svg-render@0.1.0.1 · svg.bend:2209
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
2209def radial.parameter(+p: Point, +start: Point, +end: Point, +r: F32, +fr: F32) -> Parameter:
2210 +q = point.sub(p, start)
2211 +d = point.sub(end, start)
2212 +dr = (r - fr : F32)
2213 +a = (point.dot(d, d) - dr * dr : F32)
2214 +b = (0.0 - 2.0 * (point.dot(q, d) + fr * dr) : F32)
2215 +c = (point.dot(q, q) - fr * fr : F32)
2216 U.branch(Parameter, F32.is_lt(r, 0.0000001), _ => Parameter{1.0, True{}},
2217 _ => U.branch(Parameter, F32.is_lt(F32.abs(a), 0.0000001),
2218 _ => Parameter{(0.0 - c / b : F32), F32.is_gt(F32.abs(b), 0.0000001)},
2219 _ => radial.roots(a, b, c, fr, dr)))