--- /dev/null
+(define-module (dungeon-master geom)
+ #:use-module (dungeon-master geom point)
+ #:export (angle-sign))
+
+
+(define (angle-sign center a b)
+ "Return the sign of (- (atan (- a center))
+ (atan (- b center)))"
+ (let ((x1 (- (point-x a) (point-x center)))
+ (y1 (- (point-y a) (point-y center)))
+ (x2 (- (point-x b) (point-x center)))
+ (y2 (- (point-y b) (point-y center))))
+ (cond ((and (>= x1 0) (< x2 0))
+ 1)
+ ((and (>= x2 0) (< x1 0))
+ -1)
+ ((and (= x1 0) (= x2 0))
+ (if (> y2 y1) 1 -1))
+ (else
+ (if (> (- (* x2 y1) (* x1 y2)) 0) 1 -1)))))