Use a cross product to test if each point of the line
are on the segment.
You could use the following test twice, however it means
that you need to do it for every segment of your poly.
Smarter way would be to locate the segment on which the point
lies and test only that segment with the second point of the line.
;; ;
;; online_p by ymg ;
;; ;
;; Returns t if point is strictly on line v1-> v2 ;
;; ;
;; Arguments: p, Point on line to be tested ;
;; v1, First point of Polyline Segment ;
;; v2, Second point of Polyline Segment v1->v2 ;
;; ;
(defun online_p (p v1 v2 / xp yp)
(setq xp (car p) yp (cadr p))
(zerop
(- (* (- (cadr v1) yp) (- (car v2) xp)) (* (- (car v1) xp) (- (cadr v2) yp)))
)
)