;; Tony Tanzillo. ;; (vector-side <origin> <direction> <point> ) ;; Returns an integer code indicating position of <point> ;; in relation to the directed vector whose endpoints are ;; <origin> and <direction>. ;; Result Meaning ;; -1 Point is to the right of vector. ;; 0 Point is on (colinear with) vector ;; 1 Point is to the left of vector. ;; usage : (vector-side (getpoint) (getpoint) (getpoint))
(defun VECTOR-SIDE (V1 V2 P / R) (setq R (- (* (- (car V2) (car V1)) (- (cadr P) (cadr V1))) (* (- (cadr V2) (cadr V1)) (- (car P) (car V1))) ) ) (cond ((equal R 0.0 1e-8) 0) (t (fix (/ (abs R) R))) ) )