Function: artist-eight-point
artist-eight-point is a byte-compiled function defined in
artist.el.gz.
Signature
(artist-eight-point X1 Y1 X2 Y2)
Documentation
Run the eight-point algorithm to get a list of coords from X1,Y1 to X2,Y2.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
;; Calculate list of points using eight point algorithm
;; return a list of coords
;;
(defun artist-eight-point (x1 y1 x2 y2)
"Run the eight-point algorithm to get a list of coords from X1,Y1 to X2,Y2."
(let* ((point-list nil)
(octant (artist-find-octant x1 y1 x2 y2))
(dfdx-coeff (artist-get-dfdx-init-coeff octant))
(dfdy-coeff (artist-get-dfdy-init-coeff octant))
(x-step-q>=0 (artist-get-x-step-q>=0 octant))
(y-step-q>=0 (artist-get-y-step-q>=0 octant))
(x-step-q<0 (artist-get-x-step-q<0 octant))
(y-step-q<0 (artist-get-y-step-q<0 octant))
(dfdx (- (- y2 y1)))
(dfdy (- x2 x1))
(x x1)
(y y1)
(f 0)
(q (+ (* 2 f)
(* dfdx-coeff dfdx)
(* dfdy-coeff dfdy))))
(artist-put-pixel point-list x y)
(while (or (not (eq x x2)) (not (eq y y2)))
(if (>= q 0)
(progn
(setq x (+ x x-step-q>=0))
(setq y (+ y y-step-q>=0))
(setq f (+ f (* x-step-q>=0 dfdx) (* y-step-q>=0 dfdy))))
(progn
(setq x (+ x x-step-q<0))
(setq y (+ y y-step-q<0))
(setq f (+ f (* x-step-q<0 dfdx) (* y-step-q<0 dfdy)))))
(setq q (+ (* 2 f) (* dfdx-coeff dfdx) (* dfdy-coeff dfdy)))
(artist-put-pixel point-list x y))
point-list))