- (destructuring-bind (L₁ a₁ b₁) color1
- (destructuring-bind (L₂ a₂ b₂) color2
- (let* ((kL (or kL 1))
- (kC (or kC 1))
- (kH (or kH 1))
- (C₁ (sqrt (+ (expt a₁ 2.0) (expt b₁ 2.0))))
- (C₂ (sqrt (+ (expt a₂ 2.0) (expt b₂ 2.0))))
- (C̄ (/ (+ C₁ C₂) 2.0))
- (G (* 0.5 (- 1 (sqrt (/ (expt C̄ 7.0) (+ (expt C̄ 7.0) (expt 25 7.0)))))))
- (a′₁ (* (+ 1 G) a₁))
- (a′₂ (* (+ 1 G) a₂))
- (C′₁ (sqrt (+ (expt a′₁ 2.0) (expt b₁ 2.0))))
- (C′₂ (sqrt (+ (expt a′₂ 2.0) (expt b₂ 2.0))))
- (h′₁ (if (and (= b₁ 0) (= a′₁ 0))
- 0
- (let ((v (atan b₁ a′₁)))
- (if (< v 0)
- (+ v (* 2 float-pi))
- v))))
- (h′₂ (if (and (= b₂ 0) (= a′₂ 0))
- 0
- (let ((v (atan b₂ a′₂)))
- (if (< v 0)
- (+ v (* 2 float-pi))
- v))))
- (ΔL′ (- L₂ L₁))
- (ΔC′ (- C′₂ C′₁))
- (Δh′ (cond ((= (* C′₁ C′₂) 0)
- 0)
- ((<= (abs (- h′₂ h′₁)) float-pi)
- (- h′₂ h′₁))
- ((> (- h′₂ h′₁) float-pi)
- (- (- h′₂ h′₁) (* 2 float-pi)))
- ((< (- h′₂ h′₁) (- float-pi))
- (+ (- h′₂ h′₁) (* 2 float-pi)))))
- (ΔH′ (* 2 (sqrt (* C′₁ C′₂)) (sin (/ Δh′ 2.0))))
- (L̄′ (/ (+ L₁ L₂) 2.0))
- (C̄′ (/ (+ C′₁ C′₂) 2.0))
- (h̄′ (cond ((= (* C′₁ C′₂) 0)
- (+ h′₁ h′₂))
- ((<= (abs (- h′₁ h′₂)) float-pi)
- (/ (+ h′₁ h′₂) 2.0))
- ((< (+ h′₁ h′₂) (* 2 float-pi))
- (/ (+ h′₁ h′₂ (* 2 float-pi)) 2.0))
- ((>= (+ h′₁ h′₂) (* 2 float-pi))
- (/ (+ h′₁ h′₂ (* -2 float-pi)) 2.0))))
- (T (+ 1
- (- (* 0.17 (cos (- h̄′ (degrees-to-radians 30)))))
- (* 0.24 (cos (* h̄′ 2)))
- (* 0.32 (cos (+ (* h̄′ 3) (degrees-to-radians 6))))
- (- (* 0.20 (cos (- (* h̄′ 4) (degrees-to-radians 63)))))))
- (Δθ (* (degrees-to-radians 30) (exp (- (expt (/ (- h̄′ (degrees-to-radians 275)) (degrees-to-radians 25)) 2.0)))))
- (Rc (* 2 (sqrt (/ (expt C̄′ 7.0) (+ (expt C̄′ 7.0) (expt 25.0 7.0))))))
- (Sl (+ 1 (/ (* 0.015 (expt (- L̄′ 50) 2.0)) (sqrt (+ 20 (expt (- L̄′ 50) 2.0))))))
- (Sc (+ 1 (* C̄′ 0.045)))
- (Sh (+ 1 (* 0.015 C̄′ T)))
- (Rt (- (* (sin (* Δθ 2)) Rc))))
+ (pcase-let*
+ ((`(,L₁ ,a₁ ,b₁) color1)
+ (`(,L₂ ,a₂ ,b₂) color2)
+ (kL (or kL 1))
+ (kC (or kC 1))
+ (kH (or kH 1))
+ (C₁ (sqrt (+ (expt a₁ 2.0) (expt b₁ 2.0))))
+ (C₂ (sqrt (+ (expt a₂ 2.0) (expt b₂ 2.0))))
+ (C̄ (/ (+ C₁ C₂) 2.0))
+ (G (* 0.5 (- 1 (sqrt (/ (expt C̄ 7.0)
+ (+ (expt C̄ 7.0) (expt 25 7.0)))))))
+ (a′₁ (* (+ 1 G) a₁))
+ (a′₂ (* (+ 1 G) a₂))
+ (C′₁ (sqrt (+ (expt a′₁ 2.0) (expt b₁ 2.0))))
+ (C′₂ (sqrt (+ (expt a′₂ 2.0) (expt b₂ 2.0))))
+ (h′₁ (if (and (= b₁ 0) (= a′₁ 0))
+ 0
+ (let ((v (atan b₁ a′₁)))
+ (if (< v 0)
+ (+ v (* 2 float-pi))
+ v))))
+ (h′₂ (if (and (= b₂ 0) (= a′₂ 0))
+ 0
+ (let ((v (atan b₂ a′₂)))
+ (if (< v 0)
+ (+ v (* 2 float-pi))
+ v))))
+ (ΔL′ (- L₂ L₁))
+ (ΔC′ (- C′₂ C′₁))
+ (Δh′ (cond ((= (* C′₁ C′₂) 0)
+ 0)
+ ((<= (abs (- h′₂ h′₁)) float-pi)
+ (- h′₂ h′₁))
+ ((> (- h′₂ h′₁) float-pi)
+ (- (- h′₂ h′₁) (* 2 float-pi)))
+ ((< (- h′₂ h′₁) (- float-pi))
+ (+ (- h′₂ h′₁) (* 2 float-pi)))))
+ (ΔH′ (* 2 (sqrt (* C′₁ C′₂)) (sin (/ Δh′ 2.0))))
+ (L̄′ (/ (+ L₁ L₂) 2.0))
+ (C̄′ (/ (+ C′₁ C′₂) 2.0))
+ (h̄′ (cond ((= (* C′₁ C′₂) 0)
+ (+ h′₁ h′₂))
+ ((<= (abs (- h′₁ h′₂)) float-pi)
+ (/ (+ h′₁ h′₂) 2.0))
+ ((< (+ h′₁ h′₂) (* 2 float-pi))
+ (/ (+ h′₁ h′₂ (* 2 float-pi)) 2.0))
+ ((>= (+ h′₁ h′₂) (* 2 float-pi))
+ (/ (+ h′₁ h′₂ (* -2 float-pi)) 2.0))))
+ (T (+ 1
+ (- (* 0.17 (cos (- h̄′ (degrees-to-radians 30)))))
+ (* 0.24 (cos (* h̄′ 2)))
+ (* 0.32 (cos (+ (* h̄′ 3) (degrees-to-radians 6))))
+ (- (* 0.20 (cos (- (* h̄′ 4) (degrees-to-radians 63)))))))
+ (Δθ (* (degrees-to-radians 30)
+ (exp (- (expt (/ (- h̄′ (degrees-to-radians 275))
+ (degrees-to-radians 25)) 2.0)))))
+ (Rc (* 2 (sqrt (/ (expt C̄′ 7.0) (+ (expt C̄′ 7.0) (expt 25.0 7.0))))))
+ (Sl (+ 1 (/ (* 0.015 (expt (- L̄′ 50) 2.0))
+ (sqrt (+ 20 (expt (- L̄′ 50) 2.0))))))
+ (Sc (+ 1 (* C̄′ 0.045)))
+ (Sh (+ 1 (* 0.015 C̄′ T)))
+ (Rt (- (* (sin (* Δθ 2)) Rc))))