r8073: add def-cached-vector
[kmrcl.git] / color.lisp
index 11f809eb33094e3e341acb9c329342fd3129d2a3..d674886165f061ffa5424ad2f037305339bfd65c 100644 (file)
     (when (<= (abs (- v1 v2)) value-range)\r
       t))\r
    (t\r
-    (when (and (<= (hue-difference-fixnum h1 h2) hue-range)\r
+    (when (and (<= (abs (hue-difference-fixnum h1 h2)) hue-range)\r
                (<= (abs (- v1 v2)) value-range)\r
                (<= (abs (- s1 s2)) saturation-range))\r
       t))))\r
    \r
 (defun hue-difference (h1 h2)\r
   "Return difference between two hues around 360 degree circle"\r
-  (when (and h1 h2)\r
+  (cond\r
+   ((and (null h1) (null h2))\r
+    t)\r
+   ((or (null h1) (null h2))\r
+    360)\r
+   (t\r
     (let ((diff (- h2 h1)))\r
       (cond\r
        ((< diff -180)\r
        ((> diff 180)\r
         (- (- 360 diff)))\r
        (t\r
-        diff)))))\r
+        diff))))))\r
  \r
   \r
 (defun hue-difference-fixnum (h1 h2)\r
   "Return difference between two hues around 360 degree circle"\r
-  (when (and h1 h2)\r
+  (cond\r
+   ((and (null h1) (null h2))\r
+    t)\r
+   ((or (null h1) (null h2))\r
+    360)\r
+   (t\r
     (locally (declare (type fixnum h1 h2))\r
       (let ((diff (- h2 h1)))\r
         (cond\r
          ((> diff 180)\r
           (- (- 360 diff)))\r
          (t\r
-          diff))))))\r
\ No newline at end of file
+          diff)))))))\r
\r