(defun ufb00005 ( u_p1 ;線分1の始点(無限線分) u_p2 ;線分1の終点(無限線分) u_p3 ;線分2の始点(有限線分) u_p4 ;線分2の終点(有限線分) u_eps ;許容誤差 u_epe ;許容誤差(規格化用) / pc ;交点 ; nil:交点が求まらない ; 始点と終点が同一点 pw xx yy ll m1 m2 ) ;無限線分と有限線分の交点を求める (setq pc nil) (setq pw (ufb00004 u_p1 u_p2 u_p3 u_p4 u_eps u_epe)) (if (/= pw nil) (progn (setq xx (- (car u_p4) (car u_p3))) (setq yy (- (cadr u_p4) (cadr u_p3))) (setq ll (sqrt (+ (* xx xx) (* yy yy)))) (setq xx (- (car u_p3) (car pw))) (setq yy (- (cadr u_p3) (cadr pw))) (setq m1 (sqrt (+ (* xx xx) (* yy yy)))) (setq xx (- (car u_p4) (car pw))) (setq yy (- (cadr u_p4) (cadr pw))) (setq m2 (sqrt (+ (* xx xx) (* yy yy)))) (setq lw (- (+ m1 m2) u_eps)) (if (> ll lw) (setq pc pw) ) ) ) pc )