Function: artist-find-octant
artist-find-octant is a byte-compiled function defined in
artist.el.gz.
Signature
(artist-find-octant X1 Y1 X2 Y2)
Documentation
Find octant for a line from X1,Y1 to X2,Y2.
Octant are numbered 1--8, anti-clockwise as:
\3|2/
4\|/1
---+---
5/|\8
/6|7\
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
;; Find octant from x1 y1 x2 y2 coordinates.
;;
(defun artist-find-octant (x1 y1 x2 y2)
"Find octant for a line from X1,Y1 to X2,Y2.
Octant are numbered 1--8, anti-clockwise as:
\\3|2/
4\\|/1
---+---
5/|\\8
/6|7\\"
(if (<= x1 x2) ; quadrant 1 or 4
(if (<= y1 y2) ; quadrant 1, octant 1 or 2
(if (>= (- x2 x1) (- y2 y1))
1
2)
(if (>= (- x2 x1) (- (- y2 y1))) ; quadrant 4, octant 7 or 8
8
7))
(if (<= y1 y2) ; quadrant 2 or 3
(if (>= (- (- x2 x1)) (- y2 y1)) ; quadrant 2, octant 3 or 4
4
3)
(if (>= (- (- x2 x1)) (- (- y2 y1))) ; quadrant 3, octant 5 or 6
5
6))))