This took a ridiculous amount of time to hack together, but here’s a Common Lisp function to decide the shortest angle between two other angles. It’s used in the example of seeking a point above. I can now add noise to this to make a more AARON-style pen.
(defun shortest-angle-difference (a1 a2)
"Find the shortest positive or negative distance between two angles."
;; This was slowly assembled from various online sources, none of which worked
;; Normalize angles to 0..2pi
(let ((from (mod a1 +radian+))
(to (mod a2 +radian+)))
;; If from and to are equal (0 = 2pi radians) the angle is zero
(if (or (= from to)
(= (+ from to) +radian+))
(let ((angle (- to from)))
(if (> (abs angle) pi)
;; Please simplify me
(* (- (signum angle)) (- +radian+ (abs angle)))
I’ve updated the Common Lisp version of draw-something to use modern technologies – Roswell, QuickLisp, ASDF 3, cl-cffi-gtk and the Plan testing library. The tests helped flush out bugs, changing my mis-uses of defmethod to defun silenced a lot of compiler warnings and that in turn helped find some more bugs. There’s now a bit of technical debt in the form of function and class names, I’ll address that later. Like the recent minara update, this is a bitrot update rather than a new feature release.