(defun ufb00004 ( u_p1 ;線分1の始点 u_p2 ;線分1の終点 u_p3 ;線分2の始点 u_p4 ;線分2の終点 u_eps ;許容誤差 u_epe ;許容誤差(規格化用) / pc ;交点 ; nil:交点が求まらない ; 始点と終点が同一点 abc1 abc2 a1 b1 c1 a2 b2 dd c2 xc yc ) ;無限線分と無限線分の交点を求める (setq pc nil) (setq abc1 (ufb00003 u_p1 u_p2 u_eps)) (setq abc2 (ufb00003 u_p3 u_p4 u_eps)) (if (and (/= abc1 nil) (/= abc2 nil)) (progn (setq a1 (car abc1)) (setq b1 (cadr abc1)) (setq c1 (caddr abc1)) (setq a2 (car abc2)) (setq b2 (cadr abc2)) (setq c2 (caddr abc2)) (setq dd (- (* a1 b2) (* b1 a2))) (if (> (abs dd) u_epe) (progn (setq xc (/ (- (* b2 c1) (* b1 c2)) dd)) (setq yc (/ (- (* a1 c2) (* a2 c1)) dd)) (setq pc (list xc yc 0.0)) ) ) ) ) pc )