给定 2 个点和一个带符号的凸度因子(弧线从第一个点到第二个点的连接方式是 CW 还是 CCW),计算弧的中心点。
(define (solver x1 y1 x2 y2 bulge)
(let* ((arc-angle (* 4 (atan bulge)))
(chord-length (/ (sqrt (+ (expt (abs (- x1 x2)) 2) (expt (abs (- y1 y2)) 2))) 2))
(radius (/ chord-length (cos (/ (- pi arc-angle) 2)))))
(list arc-angle chord-length radius)))
> (solver 3 10 10 5 0.592)
'(2.1380655244738884 4.301162633521313 4.905882850266661)
with the equations (x-3)^2 + (y-10)^2 = 4.05^2
(x-10)^2 + (y-5)^2 = 4.05^2
solve to find x, y.