Skip to content

Commit b9749f2

Browse files
committed
Minor refactor
1 parent 03cfd67 commit b9749f2

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

coloraide/spaces/cam02_jmh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ def cam_to_xyz(
139139
h_rad = math.radians(h % 360)
140140
elif H is not None:
141141
h_rad = math.radians(inv_hue_quadrature(H))
142-
cos_h = math.cos(h_rad)
143-
sin_h = math.sin(h_rad)
144142

145143
# Calculate `J_root` from one of the lightness derived coordinates.
146144
J_root = 0.0
@@ -166,6 +164,8 @@ def cam_to_xyz(
166164
A = env.a_w * alg.spow(J_root, 2 / env.c / env.z)
167165

168166
# Calculate red-green and yellow-blue components from hue
167+
cos_h = math.cos(h_rad)
168+
sin_h = math.sin(h_rad)
169169
p1 = 5e4 / 13 * env.nc * env.ncb * et
170170
p2 = A / env.nbb
171171
r = 23 * (p2 + 0.305) * alg.zdiv(t, 23 * p1 + t * (11 * cos_h + 108 * sin_h))

coloraide/spaces/cam16_jmh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ def cam_to_xyz(
246246
h_rad = math.radians(h % 360)
247247
elif H is not None:
248248
h_rad = math.radians(inv_hue_quadrature(H))
249-
cos_h = math.cos(h_rad)
250-
sin_h = math.sin(h_rad)
251249

252250
# Calculate `J_root` from one of the lightness derived coordinates.
253251
J_root = 0.0
@@ -273,6 +271,8 @@ def cam_to_xyz(
273271
A = env.a_w * alg.spow(J_root, 2 / env.c / env.z)
274272

275273
# Calculate red-green and yellow-blue components
274+
cos_h = math.cos(h_rad)
275+
sin_h = math.sin(h_rad)
276276
p1 = 5e4 / 13 * env.nc * env.ncb * et
277277
p2 = A / env.nbb
278278
r = 23 * (p2 + 0.305) * alg.zdiv(t, 23 * p1 + t * (11 * cos_h + 108 * sin_h))

coloraide/spaces/hellwig_jmh.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ def cam_to_xyz(
156156
h_rad = math.radians(h % 360)
157157
elif H is not None:
158158
h_rad = math.radians(inv_hue_quadrature(H))
159-
cos_h = math.cos(h_rad)
160-
sin_h = math.sin(h_rad)
161159

162160
# Calculate `J_root` from one of the lightness derived coordinates.
163161
if M is not None:
@@ -188,6 +186,8 @@ def cam_to_xyz(
188186
A = env.a_w * alg.nth_root(J / 100, env.c * env.z) # type: ignore[operator]
189187

190188
# Calculate red-green and yellow-blue components
189+
cos_h = math.cos(h_rad)
190+
sin_h = math.sin(h_rad)
191191
p1 = 43 * env.nc * et
192192
p2 = A
193193
r = M / p1 # type: ignore[operator]

0 commit comments

Comments
 (0)