(defun ufb00012 ( u_p1 ;線分の始点 u_p2 ;線分の終点 u_pc ;円の中心 u_rr ;円の半径 u_eps ;許容誤差 / pout ;交点座標 ; nil:交点がないまたは求めることができない ; ((x y) nil) 交点が重解 ; ((x y) (x y)) 2つの交点がある xw yw pw p1 p2 yy xx p3 p4 p3w p4w ) ;無限線分と円の交点を求める (setq pout nil) (if (> u_rr u_eps) (progn (setq xw (+ (car u_pc) (- (car u_p2) (car u_p1)))) (setq yw (+ (cadr u_pc) (- (cadr u_p2) (cadr u_p1)))) (setq pw (list xw yw 0.0)) (setq p1 (ufb00010 u_pc pw u_p1 u_eps)) (setq p2 (ufb00010 u_pc pw u_p2 u_eps)) (if (and (/= p1 nil) (/= p2 nil)) (progn (setq yy (/ (+ (cadr p1) (cadr p2)) 2.0)) (setq xw (- (* u_rr u_rr) (* yy yy))) (if (> (+ xw u_eps) 0.0) (progn (if (<= xw u_eps) (setq xw 0.0) ) (setq xx (sqrt xw)) (if (> xx u_eps) (progn (setq p3 (list (- 0.0 xx) yy 0.0)) (setq p4 (list xx yy 0.0)) (setq p3w (ufb00011 u_pc pw p3 u_eps)) (setq p4w (ufb00011 u_pc pw p4 u_eps)) (if (and (/= p3w nil) (/= p4w nil)) (setq pout (list p3w p4w)) ) ) (progn (setq xx 0.0) (if (> yy 0.0) (setq yy u_rr) (setq yy (- 0.0 u_rr)) ) (setq p3 (list xx yy 0.0)) (setq p3w (ufb00011 u_pc pw p3 u_eps)) (if (/= p3w nil) (setq pout (list p3w nil)) ) ) ) ) ) ) ) ) ) pout )