Find the intersection of two lines: Difference between revisions
m
Add error message to emacs lisp
(Add emacs lisp) |
m (Add error message to emacs lisp) |
||
Line 966:
(defun calculate-intersection (line1 line2)
(
(progn (error "The two lines don't have any intersection.") nil)
(setq int-x (/ (- (plist-get line2 'b) (plist-get line1 'b))▼
(progn
(- (plist-get line1 'a) (plist-get line2 'a))))▼
(let (int-x int-y)
(setq int-x
(list 'x int-x 'y int-y) ) ) ) )
(let ((p1 '(x 4.0 y 0.0)) (p2 '(x 6.0 y 10.0))
Line 976 ⟶ 979:
(let ((line1 (line-prop p1 p2))
(line2 (line-prop p3 p4)))
(message "%s" (calculate-intersection line1 line2)
)
</syntaxhighlight>
|