;; | ---------------------------------------------------------------------------- ;; | GE_GetFarthestPoints ;; | ---------------------------------------------------------------------------- ;; | Function : From a given list of points IN A STRAIGHT LINE, return the two ;; | most farthest points ;; | Arguments: 'vlist' - List of points ;; | Returns : List of two points which are geometrically the farthest. The ;; | first point is to the left of the second. ;; | Updated : September 24, 2001 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ---------------------------------------------------------------------------- (defun GE_GetFarthestPoints ( vlist / len MinX MaxX vlist1 pt pt1 pt2 FUZZ ) (setq FUZZ 0.0001 pt1 nil pt2 nil vlist (GE_DistWeed vlist FUZZ "Horiz") ) (if vlist (progn (setq vlist (car vlist) len (length vlist) ) (if (>= len 2) (progn (setq pt1 (nth 0 vlist) pt2 (nth 1 vlist) ) (if (MI_3PUCS pt1 pt2 nil) (progn (setq vlist1 (mapcar '(lambda (x) (trans x 0 1)) vlist) MinX 1E20 MaxX -1E20 pt1 nil pt2 nil ) (foreach pt vlist1 (if (< (car pt) MinX) (setq MinX (car pt) pt1 pt ) ) (if (> (car pt) MaxX) (setq MaxX (car pt) pt2 pt ) ) ) (setq pt1 (trans pt1 1 0) pt2 (trans pt2 1 0) ) (command "._Ucs" "_Previous") ) (setq pt1 nil pt2 nil )) )) )) (if (and pt1 pt2) (list pt1 pt2) nil ) )