(defun ufb00006 ( 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 (ufb00005 u_p1 u_p2 u_p3 u_p4 u_eps u_epe)) (if (/= pw nil) (progn (setq xx (- (car u_p2) (car u_p1))) (setq yy (- (cadr u_p2) (cadr u_p1))) (setq ll (sqrt (+ (* xx xx) (* yy yy)))) (setq xx (- (car u_p1) (car pw))) (setq yy (- (cadr u_p1) (cadr pw))) (setq m1 (sqrt (+ (* xx xx) (* yy yy)))) (setq xx (- (car u_p2) (car pw))) (setq yy (- (cadr u_p2) (cadr pw))) (setq m2 (sqrt (+ (* xx xx) (* yy yy)))) (setq lw (- (+ m1 m2) u_eps)) (if (> ll lw) (setq pc pw) ) ) ) pc )