;; | ---------------------------------------------------------------------------- ;; | GE_SegInters ;; | ---------------------------------------------------------------------------- ;; | Function : Checks if a given segment intersects a given list of segments ;; | Arguments: 'pt1' - First point on segment to check for intersection ;; | 'pt2' - Second point on segment to check for intersection ;; | 'SegPts' - Segments points list pairs forming the boundary ;; | against which to check for intersection. ;; | 'Extend' - Extended check flag, if True, intersection will ;; | be true only if there is an extension of segment. ;; | Returns : 'IPtLst' or 'nil' - Returns the intersection point(s) list if ;; | there is atleast one or more intersection, nil otherwise. ;; | 'IPtLst' when returned is a nested list of all intersection points ;; | along with the segment number where the intersections occur ;; | The segment number is counted from the start as 1. ;; | Updated : June 14, 1999 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun GE_SegInters( pt1 pt2 SegPts Extend / IPt IPtLst IPtSegLst Seg _pt1 _pt2 tmpPt1 tmpPt2 SegNum ) (setq IPtLst '() IPtSegLst '() SegNum 1 ) (foreach Seg SegPts (setq _pt1 (car Seg) _pt2 (cadr Seg) IPt (inters _pt1 _pt2 pt1 pt2) ) (if IPt (progn (if Extend (progn (if (or (equal _pt1 pt1 0.001) (equal _pt1 pt2 0.001) (equal _pt2 pt1 0.001) (equal _pt2 pt2 0.001) ) (setq IPt nil) ) )) (if IPt (setq IPtLst (cons IPt IptLst) IPtSegLst (cons SegNum IPtSegLst) ) ) )) (setq SegNum (1+ SegNum)) ) (if IPtLst (list (reverse IPtLst) (reverse IPtSegLst)) nil) )