;; | ---------------------------------------------------------------------------- ;; | GE_GetPtInPoly ;; | ---------------------------------------------------------------------------- ;; | Function : Return a point which is truly and physically inside the polygon ;; | Arguments: ;; | 'vlist' - Polygon List ;; | Return : 'pt' - Lies inside the polygon ;; | Updated : April 27, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun GE_GetPtInPoly(vlist / len cnt ang CenPt tmpPt Found dX Lst ) (setq len (length vlist) tmpPt (last vlist) ) (if (not (equal (car vlist) tmpPt 0.01)) (setq vlist (append vlist (list tmpPt))) ) (setq CenPt (GE_AvgPt vlist) Lst (GE_Extents vlist) dX (* 0.01 (- (car (nth 1 Lst)) (car (nth 0 Lst)))) tmpPt CenPt Found nil ang 0.0 cnt 0 ) (while (not Found) (if (GE_PtInPoly CenPt vlist nil) (setq Found T) (progn (setq CenPt (polar CenPt ang dX) cnt (1+ cnt) ) (cond ((= cnt 750) (setq ang (* 0.5 pi) CenPt tmpPt ) ) ((= cnt 1500) (setq ang pi CenPt tmpPt ) ) ((= cnt 2000) (setq ang (* 1.5 pi) CenPt tmpPt ) ) ((> cnt 2500) (setq Found T CenPt nil ) ) ) )) ) CenPt )