@photivra/engine 1.5.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1078) hide show
  1. package/CHANGELOG.md +393 -6
  2. package/CITATION.cff +1 -1
  3. package/NODE_SUPPORT.md +64 -12
  4. package/README.md +301 -182
  5. package/SECURITY.md +37 -28
  6. package/THIRD_PARTY.md +148 -4
  7. package/dist/camera/equivalent-focal-length.d.ts +13 -14
  8. package/dist/camera/equivalent-focal-length.js +15 -13
  9. package/dist/camera/equivalent-focal-length.js.map +1 -1
  10. package/dist/camera/field-of-view.d.ts +30 -19
  11. package/dist/camera/field-of-view.js +67 -18
  12. package/dist/camera/field-of-view.js.map +1 -1
  13. package/dist/camera/lens-projection.d.ts +170 -0
  14. package/dist/camera/lens-projection.js +444 -0
  15. package/dist/camera/lens-projection.js.map +1 -0
  16. package/dist/camera/projected-object-size.d.ts +10 -11
  17. package/dist/camera/projected-object-size.js +12 -10
  18. package/dist/camera/projected-object-size.js.map +1 -1
  19. package/dist/capture/capture-export-metadata.d.ts +9 -10
  20. package/dist/capture/capture-export-metadata.js +8 -5
  21. package/dist/capture/capture-export-metadata.js.map +1 -1
  22. package/dist/capture/dng-import.d.ts +91 -0
  23. package/dist/capture/dng-import.js +343 -0
  24. package/dist/capture/dng-import.js.map +1 -0
  25. package/dist/capture/environment-raw-producer.d.ts +37 -17
  26. package/dist/capture/environment-raw-producer.js +43 -19
  27. package/dist/capture/environment-raw-producer.js.map +1 -1
  28. package/dist/capture/export-jpeg.d.ts +35 -4
  29. package/dist/capture/export-jpeg.js +133 -47
  30. package/dist/capture/export-jpeg.js.map +1 -1
  31. package/dist/capture/export-tiff.d.ts +48 -24
  32. package/dist/capture/export-tiff.js +91 -31
  33. package/dist/capture/export-tiff.js.map +1 -1
  34. package/dist/capture/focus-control.d.ts +42 -65
  35. package/dist/capture/focus-control.js +56 -75
  36. package/dist/capture/focus-control.js.map +1 -1
  37. package/dist/capture/host-yield-cadence.d.ts +25 -0
  38. package/dist/capture/host-yield-cadence.js +25 -0
  39. package/dist/capture/host-yield-cadence.js.map +1 -0
  40. package/dist/capture/linear-encoding.d.ts +14 -12
  41. package/dist/capture/linear-encoding.js +14 -13
  42. package/dist/capture/linear-encoding.js.map +1 -1
  43. package/dist/capture/lossless-jpeg.d.ts +27 -0
  44. package/dist/capture/lossless-jpeg.js +237 -0
  45. package/dist/capture/lossless-jpeg.js.map +1 -0
  46. package/dist/capture/native-environment-lean.d.ts +227 -0
  47. package/dist/capture/native-environment-lean.js +974 -0
  48. package/dist/capture/native-environment-lean.js.map +1 -0
  49. package/dist/capture/native-environment-optical-stage.d.ts +97 -0
  50. package/dist/capture/native-environment-optical-stage.js +340 -0
  51. package/dist/capture/native-environment-optical-stage.js.map +1 -0
  52. package/dist/capture/native-environment-raw.d.ts +140 -6
  53. package/dist/capture/native-environment-raw.js +435 -34
  54. package/dist/capture/native-environment-raw.js.map +1 -1
  55. package/dist/capture/native-raw-development.d.ts +116 -9
  56. package/dist/capture/native-raw-development.js +221 -62
  57. package/dist/capture/native-raw-development.js.map +1 -1
  58. package/dist/capture/native-raw-dng.d.ts +60 -0
  59. package/dist/capture/native-raw-dng.js +167 -0
  60. package/dist/capture/native-raw-dng.js.map +1 -0
  61. package/dist/capture/native-raw.d.ts +65 -12
  62. package/dist/capture/native-raw.js +81 -19
  63. package/dist/capture/native-raw.js.map +1 -1
  64. package/dist/capture/packed-sensor-raw.d.ts +160 -0
  65. package/dist/capture/packed-sensor-raw.js +221 -0
  66. package/dist/capture/packed-sensor-raw.js.map +1 -0
  67. package/dist/capture/photographic-export.d.ts +58 -35
  68. package/dist/capture/photographic-export.js +177 -70
  69. package/dist/capture/photographic-export.js.map +1 -1
  70. package/dist/capture/raw-development-kernel.d.ts +52 -0
  71. package/dist/capture/raw-development-kernel.js +88 -0
  72. package/dist/capture/raw-development-kernel.js.map +1 -0
  73. package/dist/capture/raw-frame-limits.d.ts +7 -7
  74. package/dist/capture/raw-frame-limits.js +7 -6
  75. package/dist/capture/raw-frame-limits.js.map +1 -1
  76. package/dist/capture/raw-frame-reconstruction.d.ts +8 -9
  77. package/dist/capture/raw-frame-reconstruction.js +9 -8
  78. package/dist/capture/raw-frame-reconstruction.js.map +1 -1
  79. package/dist/capture/raw-white-level.d.ts +55 -0
  80. package/dist/capture/raw-white-level.js +165 -0
  81. package/dist/capture/raw-white-level.js.map +1 -0
  82. package/dist/capture/release-sequence.d.ts +5 -7
  83. package/dist/capture/release-sequence.js +15 -13
  84. package/dist/capture/release-sequence.js.map +1 -1
  85. package/dist/capture/sensor-raw-frame.d.ts +5 -6
  86. package/dist/capture/sensor-raw-frame.js +26 -9
  87. package/dist/capture/sensor-raw-frame.js.map +1 -1
  88. package/dist/capture/sensor-raw-producer.d.ts +21 -13
  89. package/dist/capture/sensor-raw-producer.js +86 -25
  90. package/dist/capture/sensor-raw-producer.js.map +1 -1
  91. package/dist/capture/simulated-capture.d.ts +15 -16
  92. package/dist/capture/simulated-capture.js +22 -12
  93. package/dist/capture/simulated-capture.js.map +1 -1
  94. package/dist/color/camera-color-matrix.d.ts +69 -0
  95. package/dist/color/camera-color-matrix.js +132 -0
  96. package/dist/color/camera-color-matrix.js.map +1 -0
  97. package/dist/color/capture-color.d.ts +17 -10
  98. package/dist/color/capture-color.js +50 -17
  99. package/dist/color/capture-color.js.map +1 -1
  100. package/dist/color/chromatic-adaptation.d.ts +63 -0
  101. package/dist/color/chromatic-adaptation.js +91 -0
  102. package/dist/color/chromatic-adaptation.js.map +1 -0
  103. package/dist/color/color-difference.d.ts +104 -0
  104. package/dist/color/color-difference.js +205 -0
  105. package/dist/color/color-difference.js.map +1 -0
  106. package/dist/color/color-matching-functions.d.ts +168 -0
  107. package/dist/color/color-matching-functions.js +309 -0
  108. package/dist/color/color-matching-functions.js.map +1 -0
  109. package/dist/color/colorimetry-math.d.ts +52 -0
  110. package/dist/color/colorimetry-math.js +144 -0
  111. package/dist/color/colorimetry-math.js.map +1 -0
  112. package/dist/color/gamut-mapping.d.ts +54 -0
  113. package/dist/color/gamut-mapping.js +107 -0
  114. package/dist/color/gamut-mapping.js.map +1 -0
  115. package/dist/color/illuminants.d.ts +182 -0
  116. package/dist/color/illuminants.js +434 -0
  117. package/dist/color/illuminants.js.map +1 -0
  118. package/dist/color/rgb-color-spaces.d.ts +79 -0
  119. package/dist/color/rgb-color-spaces.js +115 -0
  120. package/dist/color/rgb-color-spaces.js.map +1 -0
  121. package/dist/color/sensor-color-development.d.ts +33 -11
  122. package/dist/color/sensor-color-development.js +104 -30
  123. package/dist/color/sensor-color-development.js.map +1 -1
  124. package/dist/color/srgb-icc.d.ts +9 -2
  125. package/dist/color/srgb-icc.js +16 -5
  126. package/dist/color/srgb-icc.js.map +1 -1
  127. package/dist/color/srgb-transfer.d.ts +1 -2
  128. package/dist/color/srgb-transfer.js +1 -1
  129. package/dist/color/srgb-transfer.js.map +1 -1
  130. package/dist/color/white-balance.d.ts +68 -19
  131. package/dist/color/white-balance.js +168 -35
  132. package/dist/color/white-balance.js.map +1 -1
  133. package/dist/composition/image-formation-plan.d.ts +152 -128
  134. package/dist/composition/image-formation-plan.js +292 -138
  135. package/dist/composition/image-formation-plan.js.map +1 -1
  136. package/dist/composition/plan-consumer.d.ts +6 -7
  137. package/dist/composition/plan-consumer.js +14 -11
  138. package/dist/composition/plan-consumer.js.map +1 -1
  139. package/dist/core/calculation-result.d.ts +21 -14
  140. package/dist/core/calculation-result.js +209 -11
  141. package/dist/core/calculation-result.js.map +1 -1
  142. package/dist/core/canonical-json.d.ts +13 -8
  143. package/dist/core/canonical-json.js +34 -15
  144. package/dist/core/canonical-json.js.map +1 -1
  145. package/dist/core/configuration-error.d.ts +5 -4
  146. package/dist/core/configuration-error.js +5 -3
  147. package/dist/core/configuration-error.js.map +1 -1
  148. package/dist/core/evidence-provenance.d.ts +12 -12
  149. package/dist/core/evidence-provenance.js +10 -9
  150. package/dist/core/evidence-provenance.js.map +1 -1
  151. package/dist/core/image-formation.d.ts +11 -10
  152. package/dist/core/image-formation.js +11 -9
  153. package/dist/core/image-formation.js.map +1 -1
  154. package/dist/core/owned-data.d.ts +9 -17
  155. package/dist/core/owned-data.js +9 -16
  156. package/dist/core/owned-data.js.map +1 -1
  157. package/dist/core/portable-math.d.ts +15 -0
  158. package/dist/core/portable-math.js +56 -0
  159. package/dist/core/portable-math.js.map +1 -0
  160. package/dist/core/record-validation.d.ts +48 -9
  161. package/dist/core/record-validation.js +93 -19
  162. package/dist/core/record-validation.js.map +1 -1
  163. package/dist/core/scientific-assurance.d.ts +16 -14
  164. package/dist/core/scientific-assurance.js +22 -18
  165. package/dist/core/scientific-assurance.js.map +1 -1
  166. package/dist/core/spectral-composition.d.ts +13 -14
  167. package/dist/core/spectral-composition.js +30 -27
  168. package/dist/core/spectral-composition.js.map +1 -1
  169. package/dist/core/spectral.d.ts +5 -6
  170. package/dist/core/spectral.js +9 -7
  171. package/dist/core/spectral.js.map +1 -1
  172. package/dist/core/validation.d.ts +3 -6
  173. package/dist/core/validation.js +3 -5
  174. package/dist/core/validation.js.map +1 -1
  175. package/dist/core/version.d.ts +6 -6
  176. package/dist/core/version.js +6 -5
  177. package/dist/core/version.js.map +1 -1
  178. package/dist/equipment/exposure-capabilities.d.ts +10 -10
  179. package/dist/equipment/exposure-capabilities.js +40 -30
  180. package/dist/equipment/exposure-capabilities.js.map +1 -1
  181. package/dist/equipment/generic-tier-assets.d.ts +13 -6
  182. package/dist/equipment/generic-tier-assets.js +34 -15
  183. package/dist/equipment/generic-tier-assets.js.map +1 -1
  184. package/dist/equipment/generic-tier-presets.d.ts +5 -6
  185. package/dist/equipment/generic-tier-presets.js +15 -13
  186. package/dist/equipment/generic-tier-presets.js.map +1 -1
  187. package/dist/equipment/iso-capabilities.d.ts +21 -22
  188. package/dist/equipment/iso-capabilities.js +49 -44
  189. package/dist/equipment/iso-capabilities.js.map +1 -1
  190. package/dist/equipment/metering-capabilities.d.ts +5 -6
  191. package/dist/equipment/metering-capabilities.js +22 -19
  192. package/dist/equipment/metering-capabilities.js.map +1 -1
  193. package/dist/equipment/release-capabilities.d.ts +3 -4
  194. package/dist/equipment/release-capabilities.js +18 -14
  195. package/dist/equipment/release-capabilities.js.map +1 -1
  196. package/dist/exposure/exposure-duration-control.d.ts +19 -17
  197. package/dist/exposure/exposure-duration-control.js +27 -23
  198. package/dist/exposure/exposure-duration-control.js.map +1 -1
  199. package/dist/exposure/exposure-mode-resolver.d.ts +42 -39
  200. package/dist/exposure/exposure-mode-resolver.js +127 -82
  201. package/dist/exposure/exposure-mode-resolver.js.map +1 -1
  202. package/dist/exposure/exposure.d.ts +17 -16
  203. package/dist/exposure/exposure.js +22 -15
  204. package/dist/exposure/exposure.js.map +1 -1
  205. package/dist/exposure/flash-ttl.d.ts +135 -0
  206. package/dist/exposure/flash-ttl.js +193 -0
  207. package/dist/exposure/flash-ttl.js.map +1 -0
  208. package/dist/exposure/flash.d.ts +144 -36
  209. package/dist/exposure/flash.js +259 -59
  210. package/dist/exposure/flash.js.map +1 -1
  211. package/dist/exposure/metering-scene-radiance.d.ts +10 -10
  212. package/dist/exposure/metering-scene-radiance.js +42 -23
  213. package/dist/exposure/metering-scene-radiance.js.map +1 -1
  214. package/dist/exposure/metering-target.d.ts +8 -8
  215. package/dist/exposure/metering-target.js +30 -20
  216. package/dist/exposure/metering-target.js.map +1 -1
  217. package/dist/exposure/metering-temporal.d.ts +16 -15
  218. package/dist/exposure/metering-temporal.js +41 -19
  219. package/dist/exposure/metering-temporal.js.map +1 -1
  220. package/dist/exposure/metering.d.ts +64 -17
  221. package/dist/exposure/metering.js +159 -30
  222. package/dist/exposure/metering.js.map +1 -1
  223. package/dist/exposure/program-line.d.ts +5 -5
  224. package/dist/exposure/program-line.js +20 -13
  225. package/dist/exposure/program-line.js.map +1 -1
  226. package/dist/facade/camera-preset.d.ts +8 -0
  227. package/dist/facade/camera-preset.js +102 -0
  228. package/dist/facade/camera-preset.js.map +1 -0
  229. package/dist/facade/chart-radiance-batch.d.ts +57 -0
  230. package/dist/facade/chart-radiance-batch.js +121 -0
  231. package/dist/facade/chart-radiance-batch.js.map +1 -0
  232. package/dist/facade/chart-scenes.d.ts +177 -0
  233. package/dist/facade/chart-scenes.js +232 -0
  234. package/dist/facade/chart-scenes.js.map +1 -0
  235. package/dist/facade/host-yield.d.ts +7 -0
  236. package/dist/facade/host-yield.js +23 -0
  237. package/dist/facade/host-yield.js.map +1 -0
  238. package/dist/facade/scene-radiance.d.ts +117 -0
  239. package/dist/facade/scene-radiance.js +205 -0
  240. package/dist/facade/scene-radiance.js.map +1 -0
  241. package/dist/facade/simulate-capture.d.ts +284 -0
  242. package/dist/facade/simulate-capture.js +1026 -0
  243. package/dist/facade/simulate-capture.js.map +1 -0
  244. package/dist/gpu/chart-radiance-gpu.d.ts +17 -0
  245. package/dist/gpu/chart-radiance-gpu.js +176 -0
  246. package/dist/gpu/chart-radiance-gpu.js.map +1 -0
  247. package/dist/gpu/image-kernel-accelerator.d.ts +132 -0
  248. package/dist/gpu/image-kernel-accelerator.js +720 -0
  249. package/dist/gpu/image-kernel-accelerator.js.map +1 -0
  250. package/dist/gpu/image-kernel-execution.d.ts +92 -0
  251. package/dist/gpu/image-kernel-execution.js +84 -0
  252. package/dist/gpu/image-kernel-execution.js.map +1 -0
  253. package/dist/gpu/sensor-stage-gpu.d.ts +44 -0
  254. package/dist/gpu/sensor-stage-gpu.js +317 -0
  255. package/dist/gpu/sensor-stage-gpu.js.map +1 -0
  256. package/dist/gpu/temporal-sum-gpu.d.ts +23 -0
  257. package/dist/gpu/temporal-sum-gpu.js +150 -0
  258. package/dist/gpu/temporal-sum-gpu.js.map +1 -0
  259. package/dist/gpu/webgpu-runtime.d.ts +63 -0
  260. package/dist/gpu/webgpu-runtime.js +215 -0
  261. package/dist/gpu/webgpu-runtime.js.map +1 -0
  262. package/dist/gpu/wgsl-chart-kernel.d.ts +30 -0
  263. package/dist/gpu/wgsl-chart-kernel.js +165 -0
  264. package/dist/gpu/wgsl-chart-kernel.js.map +1 -0
  265. package/dist/gpu/wgsl-kernels.d.ts +53 -0
  266. package/dist/gpu/wgsl-kernels.js +365 -0
  267. package/dist/gpu/wgsl-kernels.js.map +1 -0
  268. package/dist/gpu/wgsl-sensor-kernel.d.ts +64 -0
  269. package/dist/gpu/wgsl-sensor-kernel.js +409 -0
  270. package/dist/gpu/wgsl-sensor-kernel.js.map +1 -0
  271. package/dist/index.d.ts +89 -25
  272. package/dist/index.js +59 -15
  273. package/dist/index.js.map +1 -1
  274. package/dist/motion/camera-rotation.d.ts +92 -40
  275. package/dist/motion/camera-rotation.js +84 -47
  276. package/dist/motion/camera-rotation.js.map +1 -1
  277. package/dist/motion/capture-rotation-inverse-mapping.d.ts +37 -34
  278. package/dist/motion/capture-rotation-inverse-mapping.js +32 -24
  279. package/dist/motion/capture-rotation-inverse-mapping.js.map +1 -1
  280. package/dist/motion/capture-rotation-temporal-quadrature.d.ts +39 -35
  281. package/dist/motion/capture-rotation-temporal-quadrature.js +37 -28
  282. package/dist/motion/capture-rotation-temporal-quadrature.js.map +1 -1
  283. package/dist/motion/capture-rotation-trajectory.d.ts +32 -28
  284. package/dist/motion/capture-rotation-trajectory.js +36 -26
  285. package/dist/motion/capture-rotation-trajectory.js.map +1 -1
  286. package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts +23 -21
  287. package/dist/motion/capture-translation-parallax-temporal-quadrature.js +33 -14
  288. package/dist/motion/capture-translation-parallax-temporal-quadrature.js.map +1 -1
  289. package/dist/motion/extended-object-projection.d.ts +19 -16
  290. package/dist/motion/extended-object-projection.js +38 -18
  291. package/dist/motion/extended-object-projection.js.map +1 -1
  292. package/dist/motion/projected-motion.d.ts +18 -17
  293. package/dist/motion/projected-motion.js +25 -17
  294. package/dist/motion/projected-motion.js.map +1 -1
  295. package/dist/motion/temporal-exposure-sum.d.ts +55 -0
  296. package/dist/motion/temporal-exposure-sum.js +141 -0
  297. package/dist/motion/temporal-exposure-sum.js.map +1 -0
  298. package/dist/motion/video-sequence.d.ts +111 -0
  299. package/dist/motion/video-sequence.js +179 -0
  300. package/dist/motion/video-sequence.js.map +1 -0
  301. package/dist/optics/aperture.d.ts +14 -15
  302. package/dist/optics/aperture.js +13 -11
  303. package/dist/optics/aperture.js.map +1 -1
  304. package/dist/optics/atmospheric-haze.d.ts +83 -0
  305. package/dist/optics/atmospheric-haze.js +113 -0
  306. package/dist/optics/atmospheric-haze.js.map +1 -0
  307. package/dist/optics/brown-conrady-distortion.d.ts +116 -0
  308. package/dist/optics/brown-conrady-distortion.js +291 -0
  309. package/dist/optics/brown-conrady-distortion.js.map +1 -0
  310. package/dist/optics/circle-of-confusion.d.ts +10 -10
  311. package/dist/optics/circle-of-confusion.js +15 -11
  312. package/dist/optics/circle-of-confusion.js.map +1 -1
  313. package/dist/optics/complex-pupil-psf.d.ts +64 -33
  314. package/dist/optics/complex-pupil-psf.js +190 -98
  315. package/dist/optics/complex-pupil-psf.js.map +1 -1
  316. package/dist/optics/depth-of-field.d.ts +25 -15
  317. package/dist/optics/depth-of-field.js +67 -27
  318. package/dist/optics/depth-of-field.js.map +1 -1
  319. package/dist/optics/diffraction.d.ts +14 -13
  320. package/dist/optics/diffraction.js +14 -10
  321. package/dist/optics/diffraction.js.map +1 -1
  322. package/dist/optics/focus-breathing.d.ts +88 -27
  323. package/dist/optics/focus-breathing.js +114 -23
  324. package/dist/optics/focus-breathing.js.map +1 -1
  325. package/dist/optics/focus-state.d.ts +18 -18
  326. package/dist/optics/focus-state.js +21 -15
  327. package/dist/optics/focus-state.js.map +1 -1
  328. package/dist/optics/front-of-lens-filter.d.ts +45 -14
  329. package/dist/optics/front-of-lens-filter.js +259 -88
  330. package/dist/optics/front-of-lens-filter.js.map +1 -1
  331. package/dist/optics/illumination-vignetting.d.ts +16 -17
  332. package/dist/optics/illumination-vignetting.js +40 -17
  333. package/dist/optics/illumination-vignetting.js.map +1 -1
  334. package/dist/optics/irradiance-convolution.d.ts +59 -0
  335. package/dist/optics/irradiance-convolution.js +138 -0
  336. package/dist/optics/irradiance-convolution.js.map +1 -0
  337. package/dist/optics/lateral-chromatic-aberration.d.ts +33 -30
  338. package/dist/optics/lateral-chromatic-aberration.js +33 -23
  339. package/dist/optics/lateral-chromatic-aberration.js.map +1 -1
  340. package/dist/optics/lens-psf-kernels.d.ts +89 -0
  341. package/dist/optics/lens-psf-kernels.js +175 -0
  342. package/dist/optics/lens-psf-kernels.js.map +1 -0
  343. package/dist/optics/lens-psf-profile.d.ts +78 -46
  344. package/dist/optics/lens-psf-profile.js +335 -124
  345. package/dist/optics/lens-psf-profile.js.map +1 -1
  346. package/dist/optics/longitudinal-chromatic-aberration.d.ts +102 -0
  347. package/dist/optics/longitudinal-chromatic-aberration.js +210 -0
  348. package/dist/optics/longitudinal-chromatic-aberration.js.map +1 -0
  349. package/dist/optics/polygon-diffraction.d.ts +80 -23
  350. package/dist/optics/polygon-diffraction.js +130 -25
  351. package/dist/optics/polygon-diffraction.js.map +1 -1
  352. package/dist/optics/profile-contract.d.ts +5 -6
  353. package/dist/optics/profile-contract.js +14 -11
  354. package/dist/optics/profile-contract.js.map +1 -1
  355. package/dist/optics/psf-foundation.d.ts +23 -23
  356. package/dist/optics/psf-foundation.js +24 -21
  357. package/dist/optics/psf-foundation.js.map +1 -1
  358. package/dist/optics/pupil-vignetting.d.ts +118 -0
  359. package/dist/optics/pupil-vignetting.js +264 -0
  360. package/dist/optics/pupil-vignetting.js.map +1 -0
  361. package/dist/optics/radial-distortion.d.ts +34 -33
  362. package/dist/optics/radial-distortion.js +37 -30
  363. package/dist/optics/radial-distortion.js.map +1 -1
  364. package/dist/optics/scene-to-sensor-irradiance.d.ts +47 -33
  365. package/dist/optics/scene-to-sensor-irradiance.js +73 -45
  366. package/dist/optics/scene-to-sensor-irradiance.js.map +1 -1
  367. package/dist/optics/scene-to-sensor-quadrature.d.ts +23 -18
  368. package/dist/optics/scene-to-sensor-quadrature.js +16 -11
  369. package/dist/optics/scene-to-sensor-quadrature.js.map +1 -1
  370. package/dist/optics/sensor-aperture-rays.d.ts +20 -4
  371. package/dist/optics/sensor-aperture-rays.js +32 -14
  372. package/dist/optics/sensor-aperture-rays.js.map +1 -1
  373. package/dist/optics/sensor-environment-query.d.ts +81 -16
  374. package/dist/optics/sensor-environment-query.js +145 -12
  375. package/dist/optics/sensor-environment-query.js.map +1 -1
  376. package/dist/optics/sensor-psf-quadrature.d.ts +12 -10
  377. package/dist/optics/sensor-psf-quadrature.js +18 -11
  378. package/dist/optics/sensor-psf-quadrature.js.map +1 -1
  379. package/dist/optics/sensor-psf-support.d.ts +8 -6
  380. package/dist/optics/sensor-psf-support.js +8 -5
  381. package/dist/optics/sensor-psf-support.js.map +1 -1
  382. package/dist/optics/stray-light.d.ts +22 -19
  383. package/dist/optics/stray-light.js +18 -12
  384. package/dist/optics/stray-light.js.map +1 -1
  385. package/dist/optics/thin-lens.d.ts +10 -9
  386. package/dist/optics/thin-lens.js +12 -8
  387. package/dist/optics/thin-lens.js.map +1 -1
  388. package/dist/optics/zernike-wavefront.d.ts +154 -0
  389. package/dist/optics/zernike-wavefront.js +352 -0
  390. package/dist/optics/zernike-wavefront.js.map +1 -0
  391. package/dist/output/capture-corrected-sdr.d.ts +16 -8
  392. package/dist/output/capture-corrected-sdr.js +16 -8
  393. package/dist/output/capture-corrected-sdr.js.map +1 -1
  394. package/dist/output/capture-geometry.d.ts +34 -36
  395. package/dist/output/capture-geometry.js +52 -32
  396. package/dist/output/capture-geometry.js.map +1 -1
  397. package/dist/output/capture-sdr.d.ts +7 -6
  398. package/dist/output/capture-sdr.js +11 -8
  399. package/dist/output/capture-sdr.js.map +1 -1
  400. package/dist/output/crop.d.ts +22 -6
  401. package/dist/output/crop.js +40 -6
  402. package/dist/output/crop.js.map +1 -1
  403. package/dist/output/geometric-transforms.d.ts +60 -23
  404. package/dist/output/geometric-transforms.js +111 -24
  405. package/dist/output/geometric-transforms.js.map +1 -1
  406. package/dist/output/lens-corrections.d.ts +27 -19
  407. package/dist/output/lens-corrections.js +29 -13
  408. package/dist/output/lens-corrections.js.map +1 -1
  409. package/dist/output/native-capture-sdr.d.ts +71 -16
  410. package/dist/output/native-capture-sdr.js +190 -33
  411. package/dist/output/native-capture-sdr.js.map +1 -1
  412. package/dist/output/png-encoder.d.ts +65 -0
  413. package/dist/output/png-encoder.js +461 -0
  414. package/dist/output/png-encoder.js.map +1 -0
  415. package/dist/output/print-contrast-reference.d.ts +10 -9
  416. package/dist/output/print-contrast-reference.js +10 -8
  417. package/dist/output/print-contrast-reference.js.map +1 -1
  418. package/dist/output/print-detail.d.ts +18 -17
  419. package/dist/output/print-detail.js +12 -10
  420. package/dist/output/print-detail.js.map +1 -1
  421. package/dist/output/print-jpeg.d.ts +26 -5
  422. package/dist/output/print-jpeg.js +117 -50
  423. package/dist/output/print-jpeg.js.map +1 -1
  424. package/dist/output/print-plan.d.ts +19 -19
  425. package/dist/output/print-plan.js +11 -10
  426. package/dist/output/print-plan.js.map +1 -1
  427. package/dist/output/print-region-statistics.d.ts +14 -15
  428. package/dist/output/print-region-statistics.js +11 -11
  429. package/dist/output/print-region-statistics.js.map +1 -1
  430. package/dist/output/sdr-rendering.d.ts +48 -10
  431. package/dist/output/sdr-rendering.js +114 -25
  432. package/dist/output/sdr-rendering.js.map +1 -1
  433. package/dist/output/subject-framing-crop.d.ts +6 -10
  434. package/dist/output/subject-framing-crop.js +23 -13
  435. package/dist/output/subject-framing-crop.js.map +1 -1
  436. package/dist/processing/demosaic.d.ts +90 -0
  437. package/dist/processing/demosaic.js +275 -0
  438. package/dist/processing/demosaic.js.map +1 -0
  439. package/dist/processing/denoise.d.ts +68 -0
  440. package/dist/processing/denoise.js +214 -0
  441. package/dist/processing/denoise.js.map +1 -0
  442. package/dist/processing/focus-stacking.d.ts +17 -0
  443. package/dist/processing/focus-stacking.js +80 -0
  444. package/dist/processing/focus-stacking.js.map +1 -0
  445. package/dist/processing/hdr.d.ts +54 -0
  446. package/dist/processing/hdr.js +172 -0
  447. package/dist/processing/hdr.js.map +1 -0
  448. package/dist/processing/image-ops.d.ts +66 -0
  449. package/dist/processing/image-ops.js +192 -0
  450. package/dist/processing/image-ops.js.map +1 -0
  451. package/dist/processing/panorama.d.ts +51 -0
  452. package/dist/processing/panorama.js +305 -0
  453. package/dist/processing/panorama.js.map +1 -0
  454. package/dist/processing/processing-task.d.ts +85 -0
  455. package/dist/processing/processing-task.js +164 -0
  456. package/dist/processing/processing-task.js.map +1 -0
  457. package/dist/processing/tone-mapping.d.ts +69 -0
  458. package/dist/processing/tone-mapping.js +310 -0
  459. package/dist/processing/tone-mapping.js.map +1 -0
  460. package/dist/schema/camera.d.ts +5 -4
  461. package/dist/schema/illumination-spectral.d.ts +13 -19
  462. package/dist/schema/illumination-spectral.js +23 -19
  463. package/dist/schema/illumination-spectral.js.map +1 -1
  464. package/dist/schema/illumination-temporal.d.ts +12 -15
  465. package/dist/schema/illumination-temporal.js +43 -28
  466. package/dist/schema/illumination-temporal.js.map +1 -1
  467. package/dist/schema/illumination.d.ts +5 -4
  468. package/dist/schema/illumination.js +55 -20
  469. package/dist/schema/illumination.js.map +1 -1
  470. package/dist/schema/scene-radiance-temporal.d.ts +9 -11
  471. package/dist/schema/scene-radiance-temporal.js +26 -23
  472. package/dist/schema/scene-radiance-temporal.js.map +1 -1
  473. package/dist/schema/scene-radiance.d.ts +17 -17
  474. package/dist/schema/scene-radiance.js +56 -34
  475. package/dist/schema/scene-radiance.js.map +1 -1
  476. package/dist/schema/scene.d.ts +14 -13
  477. package/dist/schema/validation.d.ts +0 -1
  478. package/dist/schema/validation.js +17 -15
  479. package/dist/schema/validation.js.map +1 -1
  480. package/dist/sensor/accumulated-charge.d.ts +45 -64
  481. package/dist/sensor/accumulated-charge.js +41 -47
  482. package/dist/sensor/accumulated-charge.js.map +1 -1
  483. package/dist/sensor/architecture.d.ts +22 -25
  484. package/dist/sensor/architecture.js +17 -16
  485. package/dist/sensor/architecture.js.map +1 -1
  486. package/dist/sensor/camera-saturation-capacity.d.ts +21 -28
  487. package/dist/sensor/camera-saturation-capacity.js +36 -34
  488. package/dist/sensor/camera-saturation-capacity.js.map +1 -1
  489. package/dist/sensor/capture-color-sampling-binding.d.ts +46 -51
  490. package/dist/sensor/capture-color-sampling-binding.js +39 -41
  491. package/dist/sensor/capture-color-sampling-binding.js.map +1 -1
  492. package/dist/sensor/capture-mode-timing.d.ts +8 -9
  493. package/dist/sensor/capture-mode-timing.js +24 -21
  494. package/dist/sensor/capture-mode-timing.js.map +1 -1
  495. package/dist/sensor/capture-mode.d.ts +28 -30
  496. package/dist/sensor/capture-mode.js +33 -31
  497. package/dist/sensor/capture-mode.js.map +1 -1
  498. package/dist/sensor/color-sampling.d.ts +30 -33
  499. package/dist/sensor/color-sampling.js +32 -37
  500. package/dist/sensor/color-sampling.js.map +1 -1
  501. package/dist/sensor/constant-rate-temporal-integration.d.ts +19 -23
  502. package/dist/sensor/constant-rate-temporal-integration.js +28 -26
  503. package/dist/sensor/constant-rate-temporal-integration.js.map +1 -1
  504. package/dist/sensor/dark-current.d.ts +53 -49
  505. package/dist/sensor/dark-current.js +87 -46
  506. package/dist/sensor/dark-current.js.map +1 -1
  507. package/dist/sensor/environment-photo-signal.d.ts +71 -30
  508. package/dist/sensor/environment-photo-signal.js +127 -46
  509. package/dist/sensor/environment-photo-signal.js.map +1 -1
  510. package/dist/sensor/eqe-electron-rate.d.ts +14 -13
  511. package/dist/sensor/eqe-electron-rate.js +34 -14
  512. package/dist/sensor/eqe-electron-rate.js.map +1 -1
  513. package/dist/sensor/eqe-local-exposure.d.ts +24 -24
  514. package/dist/sensor/eqe-local-exposure.js +15 -11
  515. package/dist/sensor/eqe-local-exposure.js.map +1 -1
  516. package/dist/sensor/eqe-temporal-exposure.d.ts +11 -11
  517. package/dist/sensor/eqe-temporal-exposure.js +15 -10
  518. package/dist/sensor/eqe-temporal-exposure.js.map +1 -1
  519. package/dist/sensor/exposure-window.d.ts +48 -34
  520. package/dist/sensor/exposure-window.js +77 -36
  521. package/dist/sensor/exposure-window.js.map +1 -1
  522. package/dist/sensor/fixed-pattern-noise.d.ts +108 -0
  523. package/dist/sensor/fixed-pattern-noise.js +166 -0
  524. package/dist/sensor/fixed-pattern-noise.js.map +1 -0
  525. package/dist/sensor/iso-gain.d.ts +44 -0
  526. package/dist/sensor/iso-gain.js +119 -0
  527. package/dist/sensor/iso-gain.js.map +1 -0
  528. package/dist/sensor/iso-signal-chain.d.ts +25 -48
  529. package/dist/sensor/iso-signal-chain.js +52 -66
  530. package/dist/sensor/iso-signal-chain.js.map +1 -1
  531. package/dist/sensor/local-exposure-binding.d.ts +21 -21
  532. package/dist/sensor/local-exposure-binding.js +22 -18
  533. package/dist/sensor/local-exposure-binding.js.map +1 -1
  534. package/dist/sensor/optical-stack.d.ts +36 -40
  535. package/dist/sensor/optical-stack.js +34 -37
  536. package/dist/sensor/optical-stack.js.map +1 -1
  537. package/dist/sensor/photon-energy.d.ts +22 -28
  538. package/dist/sensor/photon-energy.js +42 -34
  539. package/dist/sensor/photon-energy.js.map +1 -1
  540. package/dist/sensor/physical-charge-capacity.d.ts +20 -30
  541. package/dist/sensor/physical-charge-capacity.js +35 -36
  542. package/dist/sensor/physical-charge-capacity.js.map +1 -1
  543. package/dist/sensor/pixel-pitch.d.ts +2 -3
  544. package/dist/sensor/pixel-pitch.js +4 -2
  545. package/dist/sensor/pixel-pitch.js.map +1 -1
  546. package/dist/sensor/radiometry-readiness.d.ts +13 -15
  547. package/dist/sensor/radiometry-readiness.js +20 -17
  548. package/dist/sensor/radiometry-readiness.js.map +1 -1
  549. package/dist/sensor/raw-readout.d.ts +173 -83
  550. package/dist/sensor/raw-readout.js +425 -160
  551. package/dist/sensor/raw-readout.js.map +1 -1
  552. package/dist/sensor/raw-reconstruction.d.ts +112 -44
  553. package/dist/sensor/raw-reconstruction.js +200 -47
  554. package/dist/sensor/raw-reconstruction.js.map +1 -1
  555. package/dist/sensor/readout-exposure-linkage.d.ts +103 -34
  556. package/dist/sensor/readout-exposure-linkage.js +125 -27
  557. package/dist/sensor/readout-exposure-linkage.js.map +1 -1
  558. package/dist/sensor/readout-timing.d.ts +43 -44
  559. package/dist/sensor/readout-timing.js +38 -30
  560. package/dist/sensor/readout-timing.js.map +1 -1
  561. package/dist/sensor/response-application-compatibility.d.ts +21 -28
  562. package/dist/sensor/response-application-compatibility.js +35 -34
  563. package/dist/sensor/response-application-compatibility.js.map +1 -1
  564. package/dist/sensor/response-operating-range.d.ts +26 -35
  565. package/dist/sensor/response-operating-range.js +40 -39
  566. package/dist/sensor/response-operating-range.js.map +1 -1
  567. package/dist/sensor/responsivity-photocurrent.d.ts +21 -29
  568. package/dist/sensor/responsivity-photocurrent.js +57 -40
  569. package/dist/sensor/responsivity-photocurrent.js.map +1 -1
  570. package/dist/sensor/sampling-aperture.d.ts +21 -25
  571. package/dist/sensor/sampling-aperture.js +29 -28
  572. package/dist/sensor/sampling-aperture.js.map +1 -1
  573. package/dist/sensor/scene-eqe-temporal-exposure.d.ts +14 -12
  574. package/dist/sensor/scene-eqe-temporal-exposure.js +13 -8
  575. package/dist/sensor/scene-eqe-temporal-exposure.js.map +1 -1
  576. package/dist/sensor/sensor-geometry.d.ts +28 -32
  577. package/dist/sensor/sensor-geometry.js +35 -20
  578. package/dist/sensor/sensor-geometry.js.map +1 -1
  579. package/dist/sensor/signal-noise.d.ts +14 -16
  580. package/dist/sensor/signal-noise.js +15 -13
  581. package/dist/sensor/signal-noise.js.map +1 -1
  582. package/dist/sensor/spatial-sample-reduction.d.ts +45 -60
  583. package/dist/sensor/spatial-sample-reduction.js +39 -48
  584. package/dist/sensor/spatial-sample-reduction.js.map +1 -1
  585. package/dist/sensor/spatial-sampling-quadrature.d.ts +46 -54
  586. package/dist/sensor/spatial-sampling-quadrature.js +31 -36
  587. package/dist/sensor/spatial-sampling-quadrature.js.map +1 -1
  588. package/dist/sensor/spatio-spectral-reduction.d.ts +32 -42
  589. package/dist/sensor/spatio-spectral-reduction.js +24 -29
  590. package/dist/sensor/spatio-spectral-reduction.js.map +1 -1
  591. package/dist/sensor/spectral-coverage.d.ts +6 -9
  592. package/dist/sensor/spectral-coverage.js +9 -6
  593. package/dist/sensor/spectral-coverage.js.map +1 -1
  594. package/dist/sensor/spectral-quadrature.d.ts +46 -60
  595. package/dist/sensor/spectral-quadrature.js +38 -48
  596. package/dist/sensor/spectral-quadrature.js.map +1 -1
  597. package/dist/sensor/spectral-response.d.ts +53 -41
  598. package/dist/sensor/spectral-response.js +80 -47
  599. package/dist/sensor/spectral-response.js.map +1 -1
  600. package/dist/sensor/stochastic-seed.d.ts +50 -0
  601. package/dist/sensor/stochastic-seed.js +123 -0
  602. package/dist/sensor/stochastic-seed.js.map +1 -0
  603. package/dist/sensor/temporal-eqe-sum.d.ts +2 -4
  604. package/dist/sensor/temporal-eqe-sum.js +5 -6
  605. package/dist/sensor/temporal-eqe-sum.js.map +1 -1
  606. package/dist/sensor/temporal-photo-signal.d.ts +5 -6
  607. package/dist/sensor/temporal-photo-signal.js +11 -10
  608. package/dist/sensor/temporal-photo-signal.js.map +1 -1
  609. package/dist/sensor/temporal-sample-binding.d.ts +1 -2
  610. package/dist/sensor/temporal-sample-binding.js +3 -3
  611. package/dist/sensor/temporal-sample-binding.js.map +1 -1
  612. package/dist/simulation/poc-simulation.d.ts +16 -16
  613. package/dist/simulation/poc-simulation.js +20 -15
  614. package/dist/simulation/poc-simulation.js.map +1 -1
  615. package/dist/stabilization/camera-shake.d.ts +42 -18
  616. package/dist/stabilization/camera-shake.js +43 -20
  617. package/dist/stabilization/camera-shake.js.map +1 -1
  618. package/dist/stabilization/system.d.ts +44 -41
  619. package/dist/stabilization/system.js +196 -108
  620. package/dist/stabilization/system.js.map +1 -1
  621. package/docs/AGENT_GUIDE.md +183 -0
  622. package/docs/API_REFERENCE.md +761 -2
  623. package/docs/QUICK_START.md +495 -0
  624. package/docs/USAGE.md +1719 -714
  625. package/docs/api/camera-equivalent-focal-length.md +6 -7
  626. package/docs/api/camera-field-of-view.md +16 -8
  627. package/docs/api/camera-lens-projection.md +246 -0
  628. package/docs/api/camera-projected-object-size.md +6 -5
  629. package/docs/api/capture-capture-export-metadata.md +10 -10
  630. package/docs/api/capture-dng-import.md +134 -0
  631. package/docs/api/capture-environment-raw-producer.md +17 -11
  632. package/docs/api/capture-export-jpeg.md +16 -0
  633. package/docs/api/capture-focus-control.md +25 -47
  634. package/docs/api/capture-linear-encoding.md +21 -12
  635. package/docs/api/capture-lossless-jpeg.md +49 -0
  636. package/docs/api/capture-native-environment-optical-stage.md +75 -0
  637. package/docs/api/capture-native-environment-raw.md +161 -4
  638. package/docs/api/capture-native-raw-development.md +69 -8
  639. package/docs/api/capture-native-raw-dng.md +84 -0
  640. package/docs/api/capture-native-raw.md +21 -10
  641. package/docs/api/capture-packed-sensor-raw.md +156 -0
  642. package/docs/api/capture-photographic-export.md +69 -31
  643. package/docs/api/capture-raw-frame-reconstruction.md +8 -8
  644. package/docs/api/capture-raw-white-level.md +37 -0
  645. package/docs/api/capture-release-sequence.md +6 -7
  646. package/docs/api/capture-sensor-raw-frame.md +6 -6
  647. package/docs/api/capture-sensor-raw-producer.md +17 -11
  648. package/docs/api/capture-simulated-capture.md +15 -15
  649. package/docs/api/color-camera-color-matrix.md +103 -0
  650. package/docs/api/color-capture-color.md +22 -11
  651. package/docs/api/color-chromatic-adaptation.md +82 -0
  652. package/docs/api/color-color-difference.md +134 -0
  653. package/docs/api/color-color-matching-functions.md +259 -0
  654. package/docs/api/color-colorimetry-math.md +54 -0
  655. package/docs/api/color-gamut-mapping.md +72 -0
  656. package/docs/api/color-illuminants.md +280 -0
  657. package/docs/api/color-rgb-color-spaces.md +151 -0
  658. package/docs/api/color-sensor-color-development.md +27 -0
  659. package/docs/api/color-srgb-icc.md +2 -4
  660. package/docs/api/color-white-balance.md +95 -19
  661. package/docs/api/composition-image-formation-plan.md +124 -95
  662. package/docs/api/composition-plan-consumer.md +7 -7
  663. package/docs/api/core-calculation-result.md +18 -14
  664. package/docs/api/core-configuration-error.md +1 -1
  665. package/docs/api/core-image-formation.md +7 -7
  666. package/docs/api/core-scientific-assurance.md +12 -10
  667. package/docs/api/core-spectral-composition.md +14 -14
  668. package/docs/api/core-spectral.md +6 -6
  669. package/docs/api/core-validation.md +3 -3
  670. package/docs/api/core-version.md +7 -6
  671. package/docs/api/equipment-exposure-capabilities.md +11 -10
  672. package/docs/api/equipment-generic-tier-assets.md +7 -2
  673. package/docs/api/equipment-generic-tier-presets.md +6 -6
  674. package/docs/api/equipment-iso-capabilities.md +18 -18
  675. package/docs/api/equipment-metering-capabilities.md +6 -6
  676. package/docs/api/equipment-release-capabilities.md +4 -4
  677. package/docs/api/exports.json +2213 -8
  678. package/docs/api/exposure-exposure-duration-control.md +9 -9
  679. package/docs/api/exposure-exposure-mode-resolver.md +35 -31
  680. package/docs/api/exposure-exposure.md +10 -10
  681. package/docs/api/exposure-flash-ttl.md +182 -0
  682. package/docs/api/exposure-flash.md +183 -28
  683. package/docs/api/exposure-metering-scene-radiance.md +11 -10
  684. package/docs/api/exposure-metering-target.md +9 -8
  685. package/docs/api/exposure-metering-temporal.md +8 -8
  686. package/docs/api/exposure-metering.md +69 -9
  687. package/docs/api/exposure-program-line.md +6 -5
  688. package/docs/api/facade-chart-radiance-batch.md +96 -0
  689. package/docs/api/facade-chart-scenes.md +240 -0
  690. package/docs/api/facade-scene-radiance.md +122 -0
  691. package/docs/api/facade-simulate-capture.md +324 -0
  692. package/docs/api/gpu-image-kernel-accelerator.md +157 -0
  693. package/docs/api/gpu-image-kernel-execution.md +152 -0
  694. package/docs/api/motion-camera-rotation.md +43 -26
  695. package/docs/api/motion-capture-rotation-inverse-mapping.md +24 -23
  696. package/docs/api/motion-capture-rotation-temporal-quadrature.md +22 -22
  697. package/docs/api/motion-capture-rotation-trajectory.md +15 -15
  698. package/docs/api/motion-capture-translation-parallax-temporal-quadrature.md +15 -14
  699. package/docs/api/motion-extended-object-projection.md +10 -8
  700. package/docs/api/motion-projected-motion.md +8 -8
  701. package/docs/api/motion-temporal-exposure-sum.md +98 -0
  702. package/docs/api/motion-video-sequence.md +159 -0
  703. package/docs/api/optics-aperture.md +8 -8
  704. package/docs/api/optics-atmospheric-haze.md +104 -0
  705. package/docs/api/optics-brown-conrady-distortion.md +123 -0
  706. package/docs/api/optics-circle-of-confusion.md +5 -4
  707. package/docs/api/optics-complex-pupil-psf.md +57 -16
  708. package/docs/api/optics-depth-of-field.md +12 -6
  709. package/docs/api/optics-diffraction.md +8 -7
  710. package/docs/api/optics-focus-breathing.md +104 -16
  711. package/docs/api/optics-focus-state.md +9 -10
  712. package/docs/api/optics-front-of-lens-filter.md +72 -14
  713. package/docs/api/optics-illumination-vignetting.md +10 -10
  714. package/docs/api/optics-irradiance-convolution.md +95 -0
  715. package/docs/api/optics-lateral-chromatic-aberration.md +22 -21
  716. package/docs/api/optics-lens-psf-kernels.md +72 -0
  717. package/docs/api/optics-lens-psf-profile.md +48 -26
  718. package/docs/api/optics-longitudinal-chromatic-aberration.md +128 -0
  719. package/docs/api/optics-polygon-diffraction.md +78 -13
  720. package/docs/api/optics-profile-contract.md +4 -4
  721. package/docs/api/optics-psf-foundation.md +12 -12
  722. package/docs/api/optics-pupil-vignetting.md +132 -0
  723. package/docs/api/optics-radial-distortion.md +12 -12
  724. package/docs/api/optics-scene-to-sensor-irradiance.md +25 -14
  725. package/docs/api/optics-scene-to-sensor-quadrature.md +15 -12
  726. package/docs/api/optics-sensor-aperture-rays.md +3 -2
  727. package/docs/api/optics-sensor-environment-query.md +52 -9
  728. package/docs/api/optics-sensor-psf-quadrature.md +13 -10
  729. package/docs/api/optics-stray-light.md +12 -11
  730. package/docs/api/optics-thin-lens.md +4 -3
  731. package/docs/api/optics-zernike-wavefront.md +229 -0
  732. package/docs/api/output-capture-corrected-sdr.md +10 -7
  733. package/docs/api/output-capture-geometry.md +35 -36
  734. package/docs/api/output-capture-sdr.md +4 -4
  735. package/docs/api/output-crop.md +7 -4
  736. package/docs/api/output-geometric-transforms.md +65 -19
  737. package/docs/api/output-lens-corrections.md +17 -15
  738. package/docs/api/output-native-capture-sdr.md +26 -13
  739. package/docs/api/output-png-encoder.md +105 -0
  740. package/docs/api/output-print-contrast-reference.md +8 -8
  741. package/docs/api/output-print-detail.md +14 -14
  742. package/docs/api/output-print-jpeg.md +22 -5
  743. package/docs/api/output-print-plan.md +18 -18
  744. package/docs/api/output-print-region-statistics.md +14 -14
  745. package/docs/api/output-sdr-rendering.md +52 -10
  746. package/docs/api/output-subject-framing-crop.md +5 -6
  747. package/docs/api/processing-demosaic.md +120 -0
  748. package/docs/api/processing-denoise.md +148 -0
  749. package/docs/api/processing-focus-stacking.md +41 -0
  750. package/docs/api/processing-hdr.md +113 -0
  751. package/docs/api/processing-panorama.md +82 -0
  752. package/docs/api/processing-processing-task.md +107 -0
  753. package/docs/api/processing-tone-mapping.md +142 -0
  754. package/docs/api/schema-camera.md +6 -4
  755. package/docs/api/schema-illumination-spectral.md +10 -11
  756. package/docs/api/schema-illumination-temporal.md +13 -15
  757. package/docs/api/schema-illumination.md +4 -4
  758. package/docs/api/schema-scene-radiance-temporal.md +10 -11
  759. package/docs/api/schema-scene-radiance.md +18 -17
  760. package/docs/api/schema-scene.md +9 -9
  761. package/docs/api/schema-validation.md +1 -1
  762. package/docs/api/sensor-accumulated-charge.md +12 -20
  763. package/docs/api/sensor-architecture.md +15 -16
  764. package/docs/api/sensor-camera-saturation-capacity.md +9 -11
  765. package/docs/api/sensor-capture-color-sampling-binding.md +47 -51
  766. package/docs/api/sensor-capture-mode-timing.md +9 -9
  767. package/docs/api/sensor-capture-mode.md +29 -30
  768. package/docs/api/sensor-color-sampling.md +31 -33
  769. package/docs/api/sensor-constant-rate-temporal-integration.md +10 -11
  770. package/docs/api/sensor-dark-current.md +30 -14
  771. package/docs/api/sensor-environment-photo-signal.md +13 -6
  772. package/docs/api/sensor-eqe-electron-rate.md +9 -8
  773. package/docs/api/sensor-eqe-local-exposure.md +18 -17
  774. package/docs/api/sensor-eqe-temporal-exposure.md +12 -11
  775. package/docs/api/sensor-exposure-window.md +24 -24
  776. package/docs/api/sensor-fixed-pattern-noise.md +104 -0
  777. package/docs/api/sensor-iso-gain.md +63 -0
  778. package/docs/api/sensor-iso-signal-chain.md +13 -22
  779. package/docs/api/sensor-local-exposure-binding.md +12 -13
  780. package/docs/api/sensor-optical-stack.md +37 -40
  781. package/docs/api/sensor-photon-energy.md +10 -11
  782. package/docs/api/sensor-physical-charge-capacity.md +8 -13
  783. package/docs/api/sensor-pixel-pitch.md +1 -1
  784. package/docs/api/sensor-radiometry-readiness.md +9 -9
  785. package/docs/api/sensor-raw-readout.md +118 -52
  786. package/docs/api/sensor-raw-reconstruction.md +97 -20
  787. package/docs/api/sensor-readout-exposure-linkage.md +120 -24
  788. package/docs/api/sensor-readout-timing.md +33 -35
  789. package/docs/api/sensor-response-application-compatibility.md +9 -11
  790. package/docs/api/sensor-response-operating-range.md +14 -18
  791. package/docs/api/sensor-responsivity-photocurrent.md +9 -12
  792. package/docs/api/sensor-sampling-aperture.md +22 -25
  793. package/docs/api/sensor-scene-eqe-temporal-exposure.md +9 -8
  794. package/docs/api/sensor-sensor-geometry.md +23 -24
  795. package/docs/api/sensor-signal-noise.md +10 -10
  796. package/docs/api/sensor-spatial-sample-reduction.md +27 -30
  797. package/docs/api/sensor-spatial-sampling-quadrature.md +37 -39
  798. package/docs/api/sensor-spatio-spectral-reduction.md +27 -29
  799. package/docs/api/sensor-spectral-coverage.md +5 -5
  800. package/docs/api/sensor-spectral-quadrature.md +33 -35
  801. package/docs/api/sensor-spectral-response.md +28 -16
  802. package/docs/api/sensor-temporal-photo-signal.md +6 -6
  803. package/docs/api/simulation-poc-simulation.md +17 -16
  804. package/docs/api/stabilization-camera-shake.md +29 -10
  805. package/docs/api/stabilization-system.md +25 -21
  806. package/docs/examples/production-request.json +3821 -2157
  807. package/docs/examples/simulate-capture.mjs +14 -0
  808. package/llms.txt +35 -0
  809. package/package.json +32 -12
  810. package/AGENTS.md +0 -674
  811. package/CONTRIBUTING.md +0 -76
  812. package/DCO +0 -33
  813. package/dist/camera/equivalent-focal-length.d.ts.map +0 -1
  814. package/dist/camera/field-of-view.d.ts.map +0 -1
  815. package/dist/camera/projected-object-size.d.ts.map +0 -1
  816. package/dist/capture/capture-export-metadata.d.ts.map +0 -1
  817. package/dist/capture/environment-raw-producer.d.ts.map +0 -1
  818. package/dist/capture/export-jpeg.d.ts.map +0 -1
  819. package/dist/capture/export-tiff.d.ts.map +0 -1
  820. package/dist/capture/focus-control.d.ts.map +0 -1
  821. package/dist/capture/linear-encoding.d.ts.map +0 -1
  822. package/dist/capture/native-environment-raw.d.ts.map +0 -1
  823. package/dist/capture/native-raw-development.d.ts.map +0 -1
  824. package/dist/capture/native-raw.d.ts.map +0 -1
  825. package/dist/capture/photographic-export.d.ts.map +0 -1
  826. package/dist/capture/raw-frame-limits.d.ts.map +0 -1
  827. package/dist/capture/raw-frame-reconstruction.d.ts.map +0 -1
  828. package/dist/capture/release-sequence.d.ts.map +0 -1
  829. package/dist/capture/sensor-raw-frame.d.ts.map +0 -1
  830. package/dist/capture/sensor-raw-producer.d.ts.map +0 -1
  831. package/dist/capture/simulated-capture.d.ts.map +0 -1
  832. package/dist/color/capture-color.d.ts.map +0 -1
  833. package/dist/color/sensor-color-development.d.ts.map +0 -1
  834. package/dist/color/srgb-icc.d.ts.map +0 -1
  835. package/dist/color/srgb-transfer.d.ts.map +0 -1
  836. package/dist/color/white-balance.d.ts.map +0 -1
  837. package/dist/composition/image-formation-plan.d.ts.map +0 -1
  838. package/dist/composition/plan-consumer.d.ts.map +0 -1
  839. package/dist/core/calculation-result.d.ts.map +0 -1
  840. package/dist/core/canonical-json.d.ts.map +0 -1
  841. package/dist/core/configuration-error.d.ts.map +0 -1
  842. package/dist/core/evidence-provenance.d.ts.map +0 -1
  843. package/dist/core/image-formation.d.ts.map +0 -1
  844. package/dist/core/owned-data.d.ts.map +0 -1
  845. package/dist/core/record-validation.d.ts.map +0 -1
  846. package/dist/core/scientific-assurance.d.ts.map +0 -1
  847. package/dist/core/spectral-composition.d.ts.map +0 -1
  848. package/dist/core/spectral.d.ts.map +0 -1
  849. package/dist/core/validation.d.ts.map +0 -1
  850. package/dist/core/version.d.ts.map +0 -1
  851. package/dist/equipment/exposure-capabilities.d.ts.map +0 -1
  852. package/dist/equipment/generic-tier-assets.d.ts.map +0 -1
  853. package/dist/equipment/generic-tier-presets.d.ts.map +0 -1
  854. package/dist/equipment/iso-capabilities.d.ts.map +0 -1
  855. package/dist/equipment/metering-capabilities.d.ts.map +0 -1
  856. package/dist/equipment/release-capabilities.d.ts.map +0 -1
  857. package/dist/exposure/exposure-duration-control.d.ts.map +0 -1
  858. package/dist/exposure/exposure-mode-resolver.d.ts.map +0 -1
  859. package/dist/exposure/exposure.d.ts.map +0 -1
  860. package/dist/exposure/flash.d.ts.map +0 -1
  861. package/dist/exposure/metering-scene-radiance.d.ts.map +0 -1
  862. package/dist/exposure/metering-target.d.ts.map +0 -1
  863. package/dist/exposure/metering-temporal.d.ts.map +0 -1
  864. package/dist/exposure/metering.d.ts.map +0 -1
  865. package/dist/exposure/program-line.d.ts.map +0 -1
  866. package/dist/index.d.ts.map +0 -1
  867. package/dist/motion/camera-rotation.d.ts.map +0 -1
  868. package/dist/motion/capture-rotation-inverse-mapping.d.ts.map +0 -1
  869. package/dist/motion/capture-rotation-temporal-quadrature.d.ts.map +0 -1
  870. package/dist/motion/capture-rotation-trajectory.d.ts.map +0 -1
  871. package/dist/motion/capture-translation-parallax-temporal-quadrature.d.ts.map +0 -1
  872. package/dist/motion/extended-object-projection.d.ts.map +0 -1
  873. package/dist/motion/projected-motion.d.ts.map +0 -1
  874. package/dist/optics/aperture.d.ts.map +0 -1
  875. package/dist/optics/circle-of-confusion.d.ts.map +0 -1
  876. package/dist/optics/complex-pupil-psf.d.ts.map +0 -1
  877. package/dist/optics/depth-of-field.d.ts.map +0 -1
  878. package/dist/optics/diffraction.d.ts.map +0 -1
  879. package/dist/optics/focus-breathing.d.ts.map +0 -1
  880. package/dist/optics/focus-state.d.ts.map +0 -1
  881. package/dist/optics/front-of-lens-filter.d.ts.map +0 -1
  882. package/dist/optics/illumination-vignetting.d.ts.map +0 -1
  883. package/dist/optics/lateral-chromatic-aberration.d.ts.map +0 -1
  884. package/dist/optics/lens-psf-profile.d.ts.map +0 -1
  885. package/dist/optics/polygon-diffraction.d.ts.map +0 -1
  886. package/dist/optics/profile-contract.d.ts.map +0 -1
  887. package/dist/optics/psf-foundation.d.ts.map +0 -1
  888. package/dist/optics/radial-distortion.d.ts.map +0 -1
  889. package/dist/optics/scene-to-sensor-irradiance.d.ts.map +0 -1
  890. package/dist/optics/scene-to-sensor-quadrature.d.ts.map +0 -1
  891. package/dist/optics/sensor-aperture-rays.d.ts.map +0 -1
  892. package/dist/optics/sensor-environment-query.d.ts.map +0 -1
  893. package/dist/optics/sensor-psf-quadrature.d.ts.map +0 -1
  894. package/dist/optics/sensor-psf-support.d.ts.map +0 -1
  895. package/dist/optics/stray-light.d.ts.map +0 -1
  896. package/dist/optics/thin-lens.d.ts.map +0 -1
  897. package/dist/output/capture-corrected-sdr.d.ts.map +0 -1
  898. package/dist/output/capture-geometry.d.ts.map +0 -1
  899. package/dist/output/capture-sdr.d.ts.map +0 -1
  900. package/dist/output/crop.d.ts.map +0 -1
  901. package/dist/output/geometric-transforms.d.ts.map +0 -1
  902. package/dist/output/lens-corrections.d.ts.map +0 -1
  903. package/dist/output/native-capture-sdr.d.ts.map +0 -1
  904. package/dist/output/print-contrast-reference.d.ts.map +0 -1
  905. package/dist/output/print-detail.d.ts.map +0 -1
  906. package/dist/output/print-jpeg.d.ts.map +0 -1
  907. package/dist/output/print-plan.d.ts.map +0 -1
  908. package/dist/output/print-region-statistics.d.ts.map +0 -1
  909. package/dist/output/sdr-rendering.d.ts.map +0 -1
  910. package/dist/output/subject-framing-crop.d.ts.map +0 -1
  911. package/dist/schema/camera.d.ts.map +0 -1
  912. package/dist/schema/camera.js +0 -3
  913. package/dist/schema/camera.js.map +0 -1
  914. package/dist/schema/illumination-spectral.d.ts.map +0 -1
  915. package/dist/schema/illumination-temporal.d.ts.map +0 -1
  916. package/dist/schema/illumination.d.ts.map +0 -1
  917. package/dist/schema/scene-radiance-temporal.d.ts.map +0 -1
  918. package/dist/schema/scene-radiance.d.ts.map +0 -1
  919. package/dist/schema/scene.d.ts.map +0 -1
  920. package/dist/schema/scene.js +0 -3
  921. package/dist/schema/scene.js.map +0 -1
  922. package/dist/schema/validation.d.ts.map +0 -1
  923. package/dist/sensor/accumulated-charge.d.ts.map +0 -1
  924. package/dist/sensor/architecture.d.ts.map +0 -1
  925. package/dist/sensor/camera-saturation-capacity.d.ts.map +0 -1
  926. package/dist/sensor/capture-color-sampling-binding.d.ts.map +0 -1
  927. package/dist/sensor/capture-mode-timing.d.ts.map +0 -1
  928. package/dist/sensor/capture-mode.d.ts.map +0 -1
  929. package/dist/sensor/color-sampling.d.ts.map +0 -1
  930. package/dist/sensor/constant-rate-temporal-integration.d.ts.map +0 -1
  931. package/dist/sensor/dark-current.d.ts.map +0 -1
  932. package/dist/sensor/environment-photo-signal.d.ts.map +0 -1
  933. package/dist/sensor/eqe-electron-rate.d.ts.map +0 -1
  934. package/dist/sensor/eqe-local-exposure.d.ts.map +0 -1
  935. package/dist/sensor/eqe-temporal-exposure.d.ts.map +0 -1
  936. package/dist/sensor/exposure-window.d.ts.map +0 -1
  937. package/dist/sensor/iso-signal-chain.d.ts.map +0 -1
  938. package/dist/sensor/local-exposure-binding.d.ts.map +0 -1
  939. package/dist/sensor/optical-stack.d.ts.map +0 -1
  940. package/dist/sensor/photon-energy.d.ts.map +0 -1
  941. package/dist/sensor/physical-charge-capacity.d.ts.map +0 -1
  942. package/dist/sensor/pixel-pitch.d.ts.map +0 -1
  943. package/dist/sensor/radiometry-readiness.d.ts.map +0 -1
  944. package/dist/sensor/raw-readout.d.ts.map +0 -1
  945. package/dist/sensor/raw-reconstruction.d.ts.map +0 -1
  946. package/dist/sensor/readout-exposure-linkage.d.ts.map +0 -1
  947. package/dist/sensor/readout-timing.d.ts.map +0 -1
  948. package/dist/sensor/response-application-compatibility.d.ts.map +0 -1
  949. package/dist/sensor/response-operating-range.d.ts.map +0 -1
  950. package/dist/sensor/responsivity-photocurrent.d.ts.map +0 -1
  951. package/dist/sensor/sampling-aperture.d.ts.map +0 -1
  952. package/dist/sensor/scene-eqe-temporal-exposure.d.ts.map +0 -1
  953. package/dist/sensor/sensor-geometry.d.ts.map +0 -1
  954. package/dist/sensor/signal-noise.d.ts.map +0 -1
  955. package/dist/sensor/spatial-sample-reduction.d.ts.map +0 -1
  956. package/dist/sensor/spatial-sampling-quadrature.d.ts.map +0 -1
  957. package/dist/sensor/spatio-spectral-reduction.d.ts.map +0 -1
  958. package/dist/sensor/spectral-coverage.d.ts.map +0 -1
  959. package/dist/sensor/spectral-quadrature.d.ts.map +0 -1
  960. package/dist/sensor/spectral-response.d.ts.map +0 -1
  961. package/dist/sensor/temporal-eqe-sum.d.ts.map +0 -1
  962. package/dist/sensor/temporal-photo-signal.d.ts.map +0 -1
  963. package/dist/sensor/temporal-sample-binding.d.ts.map +0 -1
  964. package/dist/simulation/poc-simulation.d.ts.map +0 -1
  965. package/dist/stabilization/camera-shake.d.ts.map +0 -1
  966. package/dist/stabilization/system.d.ts.map +0 -1
  967. package/docs/API_STYLE.md +0 -235
  968. package/docs/ARCHITECTURE.md +0 -356
  969. package/docs/AUTOMATION_COORDINATION.md +0 -190
  970. package/docs/CAPTURE_COLOR.md +0 -25
  971. package/docs/CAPTURE_CORRECTED_SDR.md +0 -25
  972. package/docs/CAPTURE_EXPORT_METADATA.md +0 -27
  973. package/docs/CAPTURE_SDR.md +0 -22
  974. package/docs/DENSE_PUPIL_QUALIFICATION.md +0 -121
  975. package/docs/DEVELOPERS.md +0 -68
  976. package/docs/DIGITAL_OPTICS_FOUNDATION.md +0 -69
  977. package/docs/ENVIRONMENT_RAW_CAPTURE.md +0 -208
  978. package/docs/EXPORT_ACCEPTANCE.md +0 -133
  979. package/docs/GENERIC_TIER_PRESETS.md +0 -269
  980. package/docs/GEOMETRIC_PREPARATION_REUSE.md +0 -141
  981. package/docs/IMAGE_FORMATION.md +0 -247
  982. package/docs/LINEAR_CAPTURE_ENCODING.md +0 -25
  983. package/docs/MOTION_AND_SIGNAL.md +0 -250
  984. package/docs/NATIVE_CAPTURE_SDR.md +0 -70
  985. package/docs/NATIVE_CAPTURE_SDR_REVIEW.md +0 -37
  986. package/docs/NATIVE_CAPTURE_SDR_VALIDATION.md +0 -34
  987. package/docs/NATIVE_RAW_AND_PRINT.md +0 -54
  988. package/docs/NUMERICAL_CORRECTNESS.md +0 -191
  989. package/docs/PERFORMANCE_BASELINE.md +0 -56
  990. package/docs/PHOTOGRAPHIC_EXPORT.md +0 -206
  991. package/docs/PHYSICS_FOUNDATION.md +0 -426
  992. package/docs/POC_API.md +0 -278
  993. package/docs/POC_PROJECTION_PLATFORM_REFERENCE.md +0 -12
  994. package/docs/POC_PROJECTION_REUSE.md +0 -124
  995. package/docs/PRINT_195_196_REVIEW.md +0 -93
  996. package/docs/PRINT_196_ENGINE_ACCEPTANCE.md +0 -45
  997. package/docs/PRINT_CONTRAST_REFERENCE.md +0 -43
  998. package/docs/PRINT_DETAIL_ASSESSMENT.md +0 -81
  999. package/docs/PRINT_DETAIL_JPEG_EVIDENCE.md +0 -36
  1000. package/docs/PRINT_DETAIL_SDR_EVIDENCE.md +0 -29
  1001. package/docs/PRINT_DETAIL_VALIDATION.md +0 -36
  1002. package/docs/PRINT_PLANNING.md +0 -75
  1003. package/docs/PRINT_REGION_STATISTICS.md +0 -38
  1004. package/docs/PROCESSED_OUTPUT.md +0 -157
  1005. package/docs/PRODUCTION_COMPOSITION.md +0 -373
  1006. package/docs/PRODUCTION_ENVIRONMENT_CAPTURE.md +0 -131
  1007. package/docs/PROVENANCE.md +0 -115
  1008. package/docs/PSF_FOUNDATION.md +0 -165
  1009. package/docs/RAW_FRAME_ENVELOPE.md +0 -56
  1010. package/docs/RAW_FRAME_RECONSTRUCTION.md +0 -30
  1011. package/docs/RELEASE_1_0.md +0 -66
  1012. package/docs/RELEASE_1_0_1.md +0 -61
  1013. package/docs/RELEASE_1_1_0.md +0 -25
  1014. package/docs/RELEASE_1_2_0.md +0 -51
  1015. package/docs/RELEASE_1_3_0.md +0 -15
  1016. package/docs/RELEASE_1_4_0.md +0 -23
  1017. package/docs/RELEASE_1_5_0.md +0 -105
  1018. package/docs/RELEASE_AUDIT.md +0 -39
  1019. package/docs/SCENE_RADIANCE_AND_ILLUMINATION.md +0 -298
  1020. package/docs/SCENE_SENSOR_QUADRATURE.md +0 -98
  1021. package/docs/SCENE_SENSOR_TEMPORAL_EXPOSURE.md +0 -86
  1022. package/docs/SCIENTIFIC_ASSURANCE.md +0 -280
  1023. package/docs/SCIENTIFIC_CONFORMANCE.md +0 -83
  1024. package/docs/SDR_RENDERING.md +0 -33
  1025. package/docs/SENSOR_APERTURE_RAYS.md +0 -23
  1026. package/docs/SENSOR_ENVIRONMENT_QUERY.md +0 -86
  1027. package/docs/SENSOR_EQE_LOCAL_EXPOSURE.md +0 -104
  1028. package/docs/SENSOR_EQE_TEMPORAL_EXPOSURE.md +0 -74
  1029. package/docs/SENSOR_PSF_QUADRATURE.md +0 -90
  1030. package/docs/SENSOR_RAW_FRAME.md +0 -20
  1031. package/docs/SENSOR_RAW_PRODUCER.md +0 -77
  1032. package/docs/SEPARABLE_EMISSION_DRAFT.md +0 -103
  1033. package/docs/SIGNAL_CONFORMANCE.md +0 -23
  1034. package/docs/SIMULATED_CAPTURE.md +0 -65
  1035. package/docs/STABILIZATION.md +0 -234
  1036. package/docs/TEMPORAL_PHOTO_RAW.md +0 -83
  1037. package/docs/TIER_ACCEPTANCE.md +0 -129
  1038. package/docs/TIER_PRESET_ACCEPTANCE.md +0 -59
  1039. package/docs/V1_COMPOSITION_MAP.md +0 -123
  1040. package/docs/V1_HELPER_REUSE_REVIEW.md +0 -60
  1041. package/docs/V1_PERFORMANCE_DISPOSITION.md +0 -88
  1042. package/docs/benchmarks/2026-10-01-main-baseline.json +0 -694
  1043. package/docs/benchmarks/2026-10-02-geometric-preparation-reuse.json +0 -2190
  1044. package/docs/benchmarks/2026-10-02-poc-projection-reuse.json +0 -2423
  1045. package/docs/benchmarks/2026-10-02-v1-environment-gc-profile.json +0 -210
  1046. package/docs/benchmarks/2026-10-02-v1-environment-ordinary.json +0 -187
  1047. package/docs/benchmarks/2026-10-02-v1-geometry-gc-profile.json +0 -756
  1048. package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-1.json +0 -711
  1049. package/docs/benchmarks/2026-10-02-v1-geometry-ordinary-2.json +0 -711
  1050. package/docs/benchmarks/2026-10-02-v1-poc-gc-profile.json +0 -885
  1051. package/docs/benchmarks/2026-10-02-v1-poc-ordinary-1.json +0 -868
  1052. package/docs/benchmarks/2026-10-02-v1-poc-ordinary-2.json +0 -868
  1053. package/docs/licenses/castleCSF-MIT.txt +0 -21
  1054. package/docs/validation/dense-pupil-2026-10-06/pilot.jsonl +0 -6
  1055. package/docs/validation/documentation-fragments.json +0 -212
  1056. package/docs/validation/native-capture-sdr-darwin-arm64-node26-review.jsonl +0 -4
  1057. package/docs/validation/native-capture-sdr-darwin-arm64.jsonl +0 -3
  1058. package/docs/validation/native-raw-print-2026-10-04/fractional-asymmetric-crop.jpg +0 -0
  1059. package/docs/validation/native-raw-print-2026-10-04/gray-ramp.jpg +0 -0
  1060. package/docs/validation/native-raw-print-2026-10-04/linear-area-checker.jpg +0 -0
  1061. package/docs/validation/native-raw-print-2026-10-04/manifest.json +0 -218
  1062. package/docs/validation/native-raw-print-2026-10-04/megapixel-native.jpg +0 -0
  1063. package/docs/validation/native-raw-print-2026-10-04/native-color.jpg +0 -0
  1064. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel-validation.json +0 -9
  1065. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json +0 -29
  1066. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.codes.u16le.gz +0 -0
  1067. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.jpg +0 -0
  1068. package/docs/validation/native-raw-print-2026-10-04/photivra-native-full-megapixel.json.rgb.gz +0 -0
  1069. package/docs/validation/native-raw-print-2026-10-04/srgb.icc +0 -0
  1070. package/docs/validation/native-raw-print-2026-10-04/validation.json +0 -41
  1071. package/docs/validation/print-196-candidate-capabilities.json +0 -28
  1072. package/docs/validation/print-196-candidate-evidence.json +0 -356
  1073. package/docs/validation/print-196-engine-acceptance.json +0 -81
  1074. package/docs/validation/print-detail-capabilities.json +0 -103
  1075. package/docs/validation/print-detail-jpeg-evidence.json +0 -116
  1076. package/docs/validation/print-detail-sdr-evidence.json +0 -81
  1077. package/docs/validation/release-audit-inventory.json +0 -1306
  1078. package/docs/validation/tier-acceptance-report-v1.json +0 -2538
@@ -0,0 +1,434 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ /**
3
+ * Illuminant spectra and correlated-colour-temperature (CCT) helpers.
4
+ *
5
+ * - Planckian radiator: exact Planck law (BIPM Mise en pratique for the kelvin, Absolute Primary
6
+ * Radiometry 2018, Eq. 1, free) with the exact SI defining constants (h, c, k; BIPM SI Brochure
7
+ * 9th ed. 2019), so c₂ = hc/k = 1.438776877…e-2 m·K (NIST CODATA 2022). Wavelength is the vacuum
8
+ * wavelength.
9
+ * - CIE standard illuminant A: Planck's law relative to 560 nm with the CIE's defining constants
10
+ * c₂ = 1.435e-2 m·K and T = 2848 K (also CIE 15:2018 Eq. 4.1 / ISO/CIE 11664-2, paid):
11
+ * S_A(λ) = 100 (560/λ)^5 (exp(1.435e7/(2848·560)) − 1)/(exp(1.435e7/(2848 λ)) − 1)
12
+ * (≈ 2856 K with the exact c₂). Computed from the formula, not a copied table; it reproduces the
13
+ * free CIE 1 nm table (DOI 10.25039/CIE.DS.8jsxjrsn) to its six significant digits.
14
+ * - CIE daylight: the CIE daylight-locus chromaticity polynomial and the M₁/M₂ weights (CIE 15:2018,
15
+ * paid; no free text of the formulas found). With three-decimal rounding they reproduce the free
16
+ * CIE D55 and D65 tables. The S₀/S₁/S₂ basis is a CIE dataset (CC BY-SA 4.0, not bundled);
17
+ * callers supply it.
18
+ * - Planckian locus: the chromaticity of a Planckian radiator at T, computed by integrating Planck's
19
+ * law against colour-matching functions. The default uses the engine's analytic CIE 1931 fit with
20
+ * 1 nm nodes from 360 to 830 nm (so it inherits that fit's approximation); callers may select
21
+ * tabulated CMFs and their own nodes. Valid 1000–100000 K.
22
+ * - CCT from chromaticity: McCamy (1992) cubic (approximation), or a nearest-point
23
+ * search on the Planckian locus in the CIE 1960 UCS (CCT and signed Duv as defined in Smet et al.,
24
+ * LEUKOS 2023, free archival copy from the US DOE; also CIE 15:2018). Duv sign: positive above the
25
+ * locus (toward green), negative below (toward magenta), following Ohno, "Calculation of CCT and Duv
26
+ * and Practical Conversion Formulae", CORM 2011 slides (free), slide 5; the engine documents and
27
+ * tests it.
28
+ * @see docs/COLORIMETRY.md for equations, coordinate/unit conventions and limits.
29
+ */
30
+ import { approximationResult, calculatedResult } from "../core/calculation-result.js";
31
+ import { InvalidScientificInputError } from "../core/validation.js";
32
+ import { COLORIMETRY_MODEL_VERSION, integrateSampledXyz, prepareColorMatchingFunctions, prepareColorimetricSpectrum, sampleColorimetricBasis } from "./color-matching-functions.js";
33
+ import { chromaticityOfUv, chromaticityOfXyz, parseChromaticity, requireFiniteNumber, requirePositiveNumber, requireRecordValue, uvOfChromaticity } from "./colorimetry-math.js";
34
+ import { rejectUnknownFields, requireInputKeys } from "../core/record-validation.js";
35
+ import { InvalidConfigurationError } from "../core/configuration-error.js";
36
+ /** Exact SI defining constants (BIPM SI Brochure, 9th edition, 2019). */
37
+ export const PLANCK_CONSTANT_JOULE_SECONDS = 6.62607015e-34;
38
+ export const SPEED_OF_LIGHT_METERS_PER_SECOND = 299_792_458;
39
+ export const BOLTZMANN_CONSTANT_JOULES_PER_KELVIN = 1.380649e-23;
40
+ /** Second radiation constant c₂ = hc/k in m·K (derived from the exact constants). */
41
+ export const SECOND_RADIATION_CONSTANT_METER_KELVIN = (PLANCK_CONSTANT_JOULE_SECONDS * SPEED_OF_LIGHT_METERS_PER_SECOND) / BOLTZMANN_CONSTANT_JOULES_PER_KELVIN;
42
+ const FIRST_RADIATION_CONSTANT_RADIANCE = 2 * PLANCK_CONSTANT_JOULE_SECONDS * SPEED_OF_LIGHT_METERS_PER_SECOND ** 2;
43
+ /** Temperature range of the Planckian-locus models, K. */
44
+ export const PLANCKIAN_LOCUS_RANGE_KELVIN = Object.freeze({ minimum: 1000, maximum: 100000 });
45
+ /** CIE daylight-locus validity, K. */
46
+ export const CIE_DAYLIGHT_LOCUS_RANGE_KELVIN = Object.freeze({ minimum: 4000, maximum: 25000 });
47
+ /**
48
+ * Engine limit: no CCT beyond |Duv| = 0.05, the range over which Smet et al. (2023, free) evaluate CCT
49
+ * methods for nominally white light (CIE 15:2018 §9.5, paid, gives the same limit).
50
+ */
51
+ export const MAX_CORRELATED_COLOR_TEMPERATURE_DUV = 0.05;
52
+ /**
53
+ * Planck's law for blackbody spectral radiance per unit (vacuum) wavelength:
54
+ * L(λ, T) = 2hc² / λ⁵ / (exp(hc/(λkT)) − 1). Returns W·m⁻²·sr⁻¹·nm⁻¹.
55
+ */
56
+ export function calculatePlanckianSpectralRadiance(input) {
57
+ requireInputKeys(input, "calculatePlanckianSpectralRadiance", ["temperatureKelvin", "wavelengthNanometers"]);
58
+ const t = requirePositiveNumber(input.temperatureKelvin, "temperatureKelvin");
59
+ const nm = requirePositiveNumber(input.wavelengthNanometers, "wavelengthNanometers");
60
+ const lambda = nm * 1e-9;
61
+ const exponent = SECOND_RADIATION_CONSTANT_METER_KELVIN / (lambda * t);
62
+ // expm1 keeps precision in the Rayleigh–Jeans limit; overflow gives radiance 0.
63
+ const radiancePerMeter = FIRST_RADIATION_CONSTANT_RADIANCE / lambda ** 5 / Math.expm1(exponent);
64
+ return radiancePerMeter * 1e-9;
65
+ }
66
+ /** Planckian spectral radiance (W·m⁻²·sr⁻¹·nm⁻¹) as a function spectrum over the given range. */
67
+ export function createPlanckianSpectrum(input) {
68
+ requireInputKeys(input, "createPlanckianSpectrum", ["temperatureKelvin", "wavelengthRangeNanometers"]);
69
+ const temperatureKelvin = requirePositiveNumber(input.temperatureKelvin, "temperatureKelvin");
70
+ const range = requireRecordValue(input.wavelengthRangeNanometers, "wavelengthRangeNanometers");
71
+ rejectUnknownFields(range, ["minimum", "maximum"], "wavelengthRangeNanometers");
72
+ const spectrum = {
73
+ kind: "function",
74
+ wavelengthRangeNanometers: { minimum: range.minimum, maximum: range.maximum },
75
+ evaluate: (wavelengthNanometers) => calculatePlanckianSpectralRadiance({ temperatureKelvin, wavelengthNanometers })
76
+ };
77
+ prepareColorimetricSpectrum(spectrum, "planckianSpectrum");
78
+ return spectrum;
79
+ }
80
+ /** CIE illuminant A defining range (nm). */
81
+ export const CIE_ILLUMINANT_A_RANGE_NANOMETERS = Object.freeze({ minimum: 300, maximum: 830 });
82
+ /**
83
+ * CIE standard illuminant A relative SPD from its defining formula (100 at 560 nm),
84
+ * with c₂ = 1.435e-2 m·K and T = 2848 K as in the standard (≈ 2856 K with the
85
+ * current c₂). Valid 300–830 nm.
86
+ */
87
+ export function calculateCieIlluminantARelativeSpectralPower(wavelengthNanometers) {
88
+ const nm = requireFiniteNumber(wavelengthNanometers, "wavelengthNanometers");
89
+ if (nm < CIE_ILLUMINANT_A_RANGE_NANOMETERS.minimum || nm > CIE_ILLUMINANT_A_RANGE_NANOMETERS.maximum) {
90
+ throw new InvalidScientificInputError("CIE illuminant A is defined from 300 nm to 830 nm.");
91
+ }
92
+ const c = 1.435e7 / 2848; // nm·K / K
93
+ return 100 * (560 / nm) ** 5 * (Math.expm1(c / 560) / Math.expm1(c / nm));
94
+ }
95
+ /** CIE illuminant A as a function spectrum over its defining range. */
96
+ export function createCieIlluminantASpectrum() {
97
+ return { kind: "function", wavelengthRangeNanometers: { ...CIE_ILLUMINANT_A_RANGE_NANOMETERS }, evaluate: calculateCieIlluminantARelativeSpectralPower };
98
+ }
99
+ function requireTemperatureIn(t, range, what) {
100
+ const value = requirePositiveNumber(t, what);
101
+ if (value < range.minimum || value > range.maximum) {
102
+ throw new InvalidScientificInputError(what + " must lie in [" + range.minimum + ", " + range.maximum + "] K.");
103
+ }
104
+ return value;
105
+ }
106
+ function daylightChromaticity(t) {
107
+ const x = t <= 7000
108
+ ? -4.6070e9 / t ** 3 + 2.9678e6 / t ** 2 + 0.09911e3 / t + 0.244063
109
+ : -2.0064e9 / t ** 3 + 1.9018e6 / t ** 2 + 0.24748e3 / t + 0.237040;
110
+ return { x, y: -3.000 * x * x + 2.870 * x - 0.275 };
111
+ }
112
+ /**
113
+ * CIE daylight-locus chromaticity and S₁/S₂ weights for a CCT in 4000–25000 K
114
+ * (CIE 15:2018 §4.1.2, paid; no free text of the formulas found). M₁, M₂ rounded to three decimals
115
+ * reproduce the free CIE D55 and D65 tables (DOI 10.25039/CIE.DS.qewfb3kp, 10.25039/CIE.DS.hjfjmt59)
116
+ * to their rounding; `coefficientRounding` makes that rounding explicit.
117
+ * The temperature is used as given: D65's nominal 6500 K corresponds to 6504 K here.
118
+ */
119
+ export function calculateCieDaylightComponentWeights(input) {
120
+ requireInputKeys(input, "calculateCieDaylightComponentWeights", ["correlatedColorTemperatureKelvin", "coefficientRounding"]);
121
+ const t = requireTemperatureIn(input.correlatedColorTemperatureKelvin, CIE_DAYLIGHT_LOCUS_RANGE_KELVIN, "correlatedColorTemperatureKelvin");
122
+ if (input.coefficientRounding !== "none" && input.coefficientRounding !== "cie-three-decimals") {
123
+ throw new InvalidConfigurationError("coefficientRounding must be \"none\" or \"cie-three-decimals\".");
124
+ }
125
+ const xy = daylightChromaticity(t);
126
+ const m = 0.0241 + 0.2562 * xy.x - 0.7341 * xy.y;
127
+ let m1 = (-1.3515 - 1.7703 * xy.x + 5.9114 * xy.y) / m;
128
+ let m2 = (0.0300 - 31.4424 * xy.x + 30.0717 * xy.y) / m;
129
+ if (input.coefficientRounding === "cie-three-decimals") {
130
+ m1 = Math.round(m1 * 1000) / 1000;
131
+ m2 = Math.round(m2 * 1000) / 1000;
132
+ }
133
+ return calculatedResult({ correlatedColorTemperatureKelvin: t, chromaticity: xy, m1, m2, coefficientRounding: input.coefficientRounding }, "cie-daylight-locus", COLORIMETRY_MODEL_VERSION, ["CIE daylight-locus polynomial and M1/M2 weights, checked against the free CIE D55 and D65 datasets (no free formula text found); valid 4000–25000 K"]);
134
+ }
135
+ /**
136
+ * Builds a CIE D-series relative SPD S(λ) = S₀ + M₁S₁ + M₂S₂ on the S₀ wavelengths from
137
+ * caller-supplied basis tables (S₁, S₂ linearly interpolated; fail closed outside range).
138
+ */
139
+ export function createCieDaylightSpectrum(input) {
140
+ requireInputKeys(input, "createCieDaylightSpectrum", ["correlatedColorTemperatureKelvin", "coefficientRounding", "basis"]);
141
+ const weights = calculateCieDaylightComponentWeights({
142
+ correlatedColorTemperatureKelvin: input.correlatedColorTemperatureKelvin,
143
+ coefficientRounding: input.coefficientRounding
144
+ }).value;
145
+ const basis = requireRecordValue(input.basis, "basis");
146
+ rejectUnknownFields(basis, ["s0", "s1", "s2", "datasetId"], "basis");
147
+ if (typeof basis.datasetId !== "string" || basis.datasetId.trim().length === 0) {
148
+ throw new InvalidConfigurationError("basis.datasetId must be a non-empty string.");
149
+ }
150
+ const s0 = prepareColorimetricSpectrum({ kind: "tabulated", samples: input.basis.s0 }, "basis.s0");
151
+ const s1 = prepareColorimetricSpectrum({ kind: "tabulated", samples: input.basis.s1 }, "basis.s1");
152
+ const s2 = prepareColorimetricSpectrum({ kind: "tabulated", samples: input.basis.s2 }, "basis.s2");
153
+ const samples = input.basis.s0.map((sample) => {
154
+ const w = sample.wavelengthNanometers;
155
+ return { wavelengthNanometers: w, value: s0.evaluate(w) + weights.m1 * s1.evaluate(w) + weights.m2 * s2.evaluate(w) };
156
+ });
157
+ return { kind: "tabulated", samples };
158
+ }
159
+ /** Number of intervals of the coarse reciprocal-temperature scan that brackets the CCT search. */
160
+ const CCT_SCAN_STEPS = 200;
161
+ /**
162
+ * Convergence tolerance of the CCT root-find: it stops once a Newton (or bisection) step changes T by
163
+ * at most this fraction of T (1e-6 K at 10000 K).
164
+ */
165
+ const CCT_RELATIVE_TOLERANCE = 1e-10;
166
+ /**
167
+ * Prepares a Planck-integration locus: the CMF values and 1/λ⁵ factors are sampled once, so each
168
+ * temperature costs one exponential per node. Planck's constant factor 2hc² cancels in chromaticity.
169
+ *
170
+ * Derivatives: with x = 1/T, aᵢ = c₂/λᵢ and rᵢ = 1/(exp(aᵢx) − 1), Planck's law is proportional to
171
+ * λᵢ⁻⁵ rᵢ, and exactly dr/dx = −a(r + r²) and d²r/dx² = a²(r + 3r² + 2r³) (differentiate
172
+ * r = 1/(E − 1), E = exp(ax), and use E = 1 + 1/r). They are summed in the same quadrature as X, Y, Z.
173
+ */
174
+ function preparePlanckIntegrationLocus(cmfSource, quadratureNodes, model) {
175
+ const cmf = prepareColorMatchingFunctions(cmfSource);
176
+ const unit = prepareColorimetricSpectrum({ kind: "function", wavelengthRangeNanometers: cmf.wavelengthRangeNanometers, evaluate: () => 1 });
177
+ const basis = sampleColorimetricBasis(quadratureNodes, unit, cmf);
178
+ const n = basis.nodes.length;
179
+ const exponentPerKelvin = new Float64Array(n), inverseFifth = new Float64Array(n);
180
+ // Per-node constants of the derivative sums: weight × CMF × λ⁻⁵ for X, Y and Z.
181
+ const wx = new Float64Array(n), wy = new Float64Array(n), wz = new Float64Array(n);
182
+ for (let i = 0; i < n; i++) {
183
+ const lambda = basis.nodes[i].wavelengthNanometers * 1e-9;
184
+ exponentPerKelvin[i] = SECOND_RADIATION_CONSTANT_METER_KELVIN / lambda;
185
+ inverseFifth[i] = 1 / lambda ** 5;
186
+ const w = basis.weights[i] * inverseFifth[i];
187
+ wx[i] = w * basis.xBar[i];
188
+ wy[i] = w * basis.yBar[i];
189
+ wz[i] = w * basis.zBar[i];
190
+ }
191
+ const factor = new Float64Array(n);
192
+ const range = PLANCKIAN_LOCUS_RANGE_KELVIN;
193
+ let scanCache;
194
+ const locus = {
195
+ range,
196
+ approximation: cmf.scientificStatus === "approximation",
197
+ model,
198
+ chromaticity(t) {
199
+ // expm1 keeps precision at long wavelengths; overflow at short ones gives 0, as in Planck's law.
200
+ for (let i = 0; i < n; i++)
201
+ factor[i] = inverseFifth[i] / Math.expm1(exponentPerKelvin[i] / t);
202
+ return chromaticityOfXyz(integrateSampledXyz(basis, factor));
203
+ },
204
+ sample(x) {
205
+ let sx = 0, sy = 0, sz = 0, sx1 = 0, sy1 = 0, sz1 = 0, sx2 = 0, sy2 = 0, sz2 = 0;
206
+ for (let i = 0; i < n; i++) {
207
+ const a = exponentPerKelvin[i];
208
+ // An overflowing expm1 gives r = 0 and zero derivatives, the exact limit.
209
+ const r = 1 / Math.expm1(a * x), r2 = r * r;
210
+ const q1 = r + r2, k1 = -a * q1, k2 = a * a * (q1 + 2 * r2 * (1 + r));
211
+ const cx = wx[i], cy = wy[i], cz = wz[i];
212
+ sx += cx * r;
213
+ sy += cy * r;
214
+ sz += cz * r;
215
+ sx1 += cx * k1;
216
+ sy1 += cy * k1;
217
+ sz1 += cz * k1;
218
+ sx2 += cx * k2;
219
+ sy2 += cy * k2;
220
+ sz2 += cz * k2;
221
+ }
222
+ // u = 4X/d, v = 6Y/d, d = X + 15Y + 3Z; quotient rule: q' = (N' − q d')/d, q'' = (N'' − 2q'd' − q d'')/d.
223
+ const d = sx + 15 * sy + 3 * sz, d1 = sx1 + 15 * sy1 + 3 * sz1, d2 = sx2 + 15 * sy2 + 3 * sz2;
224
+ if (!(d > 0) || !Number.isFinite(d))
225
+ throw new InvalidScientificInputError("Chromaticity requires X + Y + Z > 0.");
226
+ const u = (4 * sx) / d, v = (6 * sy) / d;
227
+ const du = (4 * sx1 - u * d1) / d, dv = (6 * sy1 - v * d1) / d;
228
+ return { u, v, du, dv, d2u: (4 * sx2 - 2 * du * d1 - u * d2) / d, d2v: (6 * sy2 - 2 * dv * d1 - v * d2) / d };
229
+ },
230
+ scan() {
231
+ if (scanCache === undefined) {
232
+ const lo = 1e6 / range.maximum, hi = 1e6 / range.minimum;
233
+ scanCache = Array.from({ length: CCT_SCAN_STEPS + 1 }, (_, i) => uvOfChromaticity(locus.chromaticity(1e6 / (lo + ((hi - lo) * i) / CCT_SCAN_STEPS))));
234
+ }
235
+ return scanCache;
236
+ }
237
+ };
238
+ return locus;
239
+ }
240
+ /** 1 nm nodes at 360, 361, …, 830 nm with Δλ = 1 nm (the CIE 15 summation convention). */
241
+ const DEFAULT_LOCUS_NODES = Object.freeze(Array.from({ length: 471 }, (_, i) => Object.freeze({ wavelengthNanometers: 360 + i, wavelengthMeasureNanometers: 1 })));
242
+ let defaultLocus;
243
+ /** The default locus, prepared on first use and shared (its scan cache is computed once). */
244
+ function analyticCmfLocus() {
245
+ defaultLocus ??= preparePlanckIntegrationLocus({ kind: "analytic-cie-1931-multi-lobe-fit" }, DEFAULT_LOCUS_NODES, "planck-analytic-cmf");
246
+ return defaultLocus;
247
+ }
248
+ /**
249
+ * Planckian-locus chromaticity at T (1000–100000 K): Planck's law integrated against the engine's
250
+ * analytic CIE 1931 CMFs with 1 nm nodes from 360 to 830 nm. An approximation, because the CMFs are
251
+ * an analytic fit; with tabulated CMFs use {@link calculatePlanckianChromaticity}.
252
+ */
253
+ export function estimatePlanckianLocusChromaticity(input) {
254
+ requireInputKeys(input, "estimatePlanckianLocusChromaticity", ["temperatureKelvin"]);
255
+ const t = requireTemperatureIn(input.temperatureKelvin, PLANCKIAN_LOCUS_RANGE_KELVIN, "temperatureKelvin");
256
+ return approximationResult(analyticCmfLocus().chromaticity(t), "planckian-locus-planck-analytic-cmf", COLORIMETRY_MODEL_VERSION, ["Planck's law integrated against the engine's analytic CIE 1931 CMF fit, 1 nm nodes 360–830 nm; valid 1000–100000 K"]);
257
+ }
258
+ function prepareLocus(model) {
259
+ const record = requireRecordValue(model, "locus");
260
+ if (record.kind === "planck-analytic-cmf") {
261
+ rejectUnknownFields(record, ["kind"], "locus");
262
+ return analyticCmfLocus();
263
+ }
264
+ if (record.kind !== "planck-integration")
265
+ throw new InvalidConfigurationError("locus.kind is not supported.");
266
+ rejectUnknownFields(record, ["kind", "colorMatchingFunctions", "quadratureNodes"], "locus");
267
+ const m = model;
268
+ const cmf = prepareColorMatchingFunctions(m.colorMatchingFunctions);
269
+ return preparePlanckIntegrationLocus(m.colorMatchingFunctions, m.quadratureNodes, "planck-integration-" + cmf.sourceKind);
270
+ }
271
+ /** Planckian chromaticity at T using either locus model. */
272
+ export function calculatePlanckianChromaticity(input) {
273
+ requireInputKeys(input, "calculatePlanckianChromaticity", ["temperatureKelvin", "locus"]);
274
+ const locus = prepareLocus(input.locus);
275
+ const t = requireTemperatureIn(input.temperatureKelvin, locus.range, "temperatureKelvin");
276
+ const value = locus.chromaticity(t);
277
+ const assumptions = ["Planckian locus model: " + locus.model];
278
+ return locus.approximation
279
+ ? approximationResult(value, "planckian-chromaticity", COLORIMETRY_MODEL_VERSION, assumptions)
280
+ : calculatedResult(value, "planckian-chromaticity", COLORIMETRY_MODEL_VERSION, assumptions);
281
+ }
282
+ /**
283
+ * McCamy (1992) cubic estimate of CCT from CIE 1931 xy:
284
+ * n = (x − 0.3320)/(0.1858 − y), CCT = 449 n³ + 3525 n² + 6823.3 n + 5520.33.
285
+ * An approximation that carries no Duv. Measured for this engine (October 17, 2026) on points of a
286
+ * Planckian locus integrated from the CIE 1931 2° 1 nm table (360–830 nm, exact c₂): it deviates by up
287
+ * to 10 K over 2856–6504 K (largest near 3500 K), 19 K at 2000 K, 17 K at 8000 K, 118 K at 10000 K
288
+ * and 442 K at 12500 K. See docs/COLORIMETRY.md.
289
+ */
290
+ export function estimateCorrelatedColorTemperatureMcCamy(input) {
291
+ requireInputKeys(input, "estimateCorrelatedColorTemperatureMcCamy", ["chromaticity"]);
292
+ const xy = parseChromaticity(input.chromaticity, "chromaticity");
293
+ const n = (xy.x - 0.3320) / (0.1858 - xy.y);
294
+ const cct = 449 * n ** 3 + 3525 * n ** 2 + 6823.3 * n + 5520.33;
295
+ if (!Number.isFinite(cct) || cct <= 0)
296
+ throw new InvalidScientificInputError("Chromaticity is outside the McCamy approximation domain.");
297
+ return approximationResult({ correlatedColorTemperatureKelvin: cct }, "cct-mccamy-1992", COLORIMETRY_MODEL_VERSION, ["McCamy (1992) cubic; intended for chromaticities near the Planckian locus, about 2000–12500 K"]);
298
+ }
299
+ /** The "above-locus" unit normal at a sample: the increasing-T unit tangent (−du/dx, −dv/dx) turned by −90°. */
300
+ function locusNormal(s) {
301
+ const len = Math.hypot(s.du, s.dv);
302
+ const tangent = { u: -s.du / len, v: -s.dv / len };
303
+ // u decreases as T rises, so turning the tangent by −90° points toward larger v (above the locus).
304
+ return { u: tangent.v, v: -tangent.u };
305
+ }
306
+ /**
307
+ * Nearest locus point to `target` in CIE 1960 uv: the root of the derivative of the squared distance
308
+ * F = (u − u₀)² + (v − v₀)². Roots of dF/dT and of dF/dx (x = 1/T) coincide, since dx/dT = −1/T² ≠ 0;
309
+ * the root-find runs in x with g = ½ dF/dx = (u − u₀)u′ + (v − v₀)v′ and
310
+ * g′ = u′² + v′² + (u − u₀)u″ + (v − v₀)v″ (analytic, see {@link preparePlanckIntegrationLocus}).
311
+ * The cached coarse scan brackets the minimum; a Newton step falls back to bisection whenever it would
312
+ * leave the bracket. Returns the root and the locus sample there, or undefined when the nearest point
313
+ * lies beyond the model's range (by more than the tolerance).
314
+ */
315
+ function nearestLocusPoint(locus, target) {
316
+ const steps = CCT_SCAN_STEPS;
317
+ const lo = 1e6 / locus.range.maximum, hi = 1e6 / locus.range.minimum, step = (hi - lo) / steps;
318
+ const gridX = (i) => (lo + step * i) * 1e-6;
319
+ const scan = locus.scan();
320
+ const f = (i) => (scan[i].u - target.u) ** 2 + (scan[i].v - target.v) ** 2;
321
+ let best = 0, bestValue = Infinity;
322
+ for (let i = 0; i <= steps; i++) {
323
+ const value = f(i);
324
+ if (value < bestValue) {
325
+ bestValue = value;
326
+ best = i;
327
+ }
328
+ }
329
+ const tolerance = (x) => CCT_RELATIVE_TOLERANCE * x;
330
+ const derivatives = (s) => {
331
+ const eu = s.u - target.u, ev = s.v - target.v;
332
+ return { g: eu * s.du + ev * s.dv, gp: s.du * s.du + s.dv * s.dv + eu * s.d2u + ev * s.d2v };
333
+ };
334
+ let a, b, x;
335
+ if (best === 0 || best === steps) {
336
+ // The scan minimum is a range limit: the nearest point is inside only if F still falls inward.
337
+ x = gridX(best);
338
+ const s = locus.sample(x), { g, gp } = derivatives(s);
339
+ if (best === 0 ? g >= 0 : g <= 0) {
340
+ // At the limit within the tolerance (one Newton step estimates the distance), or beyond it.
341
+ return g === 0 || (gp > 0 && Math.abs(g / gp) <= tolerance(x)) ? { x, sample: s } : undefined;
342
+ }
343
+ a = best === 0 ? x : gridX(steps - 1);
344
+ b = best === 0 ? gridX(1) : x;
345
+ }
346
+ else {
347
+ // A discrete minimum between its neighbours brackets a local minimum; start at the parabola vertex.
348
+ a = gridX(best - 1);
349
+ b = gridX(best + 1);
350
+ const fm = f(best - 1), fp = f(best + 1), curvature = fm - 2 * bestValue + fp;
351
+ x = gridX(best) + (curvature > 0 ? (step * 1e-6 * (fm - fp)) / (2 * curvature) : 0);
352
+ }
353
+ let s = locus.sample(x);
354
+ for (let i = 0; i < 100; i++) {
355
+ const { g, gp } = derivatives(s);
356
+ if (g === 0)
357
+ break;
358
+ if (g < 0)
359
+ a = x;
360
+ else
361
+ b = x;
362
+ let next = x - g / gp;
363
+ if (!(gp > 0) || !(next > a && next < b))
364
+ next = 0.5 * (a + b);
365
+ const converged = Math.abs(next - x) <= tolerance(next) || b - a <= tolerance(next);
366
+ x = next;
367
+ s = locus.sample(x);
368
+ if (converged)
369
+ break;
370
+ }
371
+ return { x, sample: s };
372
+ }
373
+ /**
374
+ * CCT and Duv of a chromaticity as the nearest point of the Planckian locus in the CIE
375
+ * 1960 UCS (Smet et al. 2023; also CIE 15:2018). Finds the root of the analytic temperature derivative
376
+ * of the squared uv distance (safeguarded Newton with bisection fallback, bracketed by a cached coarse
377
+ * scan in reciprocal temperature), converged until a step changes T by at most 1e-10 of T. Throws
378
+ * (fails closed) when the nearest point lies beyond the model's range, or when |Duv| > 0.05 (see
379
+ * {@link MAX_CORRELATED_COLOR_TEMPERATURE_DUV}). Duv is positive above the locus (toward green) and
380
+ * negative below it, the engine's documented sign convention.
381
+ */
382
+ export function calculateCorrelatedColorTemperature(input) {
383
+ requireInputKeys(input, "calculateCorrelatedColorTemperature", ["chromaticity", "locus"]);
384
+ const xy = parseChromaticity(input.chromaticity, "chromaticity");
385
+ const locus = prepareLocus(input.locus);
386
+ const target = uvOfChromaticity(xy);
387
+ const nearest = nearestLocusPoint(locus, target);
388
+ if (nearest === undefined)
389
+ throw new InvalidScientificInputError("Chromaticity's nearest Planckian point lies outside the locus model range.");
390
+ const t = Math.min(locus.range.maximum, Math.max(locus.range.minimum, 1 / nearest.x));
391
+ const point = nearest.sample, normal = locusNormal(point);
392
+ const duv = (target.u - point.u) * normal.u + (target.v - point.v) * normal.v;
393
+ if (Math.abs(duv) > MAX_CORRELATED_COLOR_TEMPERATURE_DUV) {
394
+ throw new InvalidScientificInputError("|Duv| exceeds 0.05; no CCT is reported this far from the Planckian locus (the range evaluated by Smet et al. 2023).");
395
+ }
396
+ const value = { correlatedColorTemperatureKelvin: t, duv };
397
+ const assumptions = ["Nearest point on the Planckian locus in CIE 1960 uv; locus model: " + locus.model, "Duv sign: positive above the locus (toward green), negative below (engine convention)"];
398
+ return locus.approximation
399
+ ? approximationResult(value, "cct-duv-locus-search", COLORIMETRY_MODEL_VERSION, assumptions)
400
+ : calculatedResult(value, "cct-duv-locus-search", COLORIMETRY_MODEL_VERSION, assumptions);
401
+ }
402
+ /**
403
+ * Chromaticity for CCT and Duv: the locus point (Planckian or CIE daylight) offset by
404
+ * Duv along the unit normal of the Planckian locus at the same temperature in the CIE
405
+ * 1960 UCS. For `cie-daylight`, Duv = 0 returns the daylight-locus point itself.
406
+ * Throws InvalidScientificInputError when the offset point is not a physical chromaticity
407
+ * (x ≥ 0, y > 0, x + y ≤ 1), for example 2000 K with Duv +0.02 (x + y ≈ 1.06).
408
+ */
409
+ export function calculateChromaticityFromCorrelatedColorTemperature(input) {
410
+ requireInputKeys(input, "calculateChromaticityFromCorrelatedColorTemperature", ["correlatedColorTemperatureKelvin", "duv", "whiteLocus", "locus"]);
411
+ const locus = prepareLocus(input.locus);
412
+ const duv = requireFiniteNumber(input.duv, "duv");
413
+ if (Math.abs(duv) > MAX_CORRELATED_COLOR_TEMPERATURE_DUV)
414
+ throw new InvalidScientificInputError("|duv| must not exceed 0.05.");
415
+ if (input.whiteLocus !== "planckian" && input.whiteLocus !== "cie-daylight")
416
+ throw new InvalidConfigurationError("whiteLocus is not supported.");
417
+ const range = input.whiteLocus === "cie-daylight"
418
+ ? { minimum: Math.max(locus.range.minimum, CIE_DAYLIGHT_LOCUS_RANGE_KELVIN.minimum), maximum: Math.min(locus.range.maximum, CIE_DAYLIGHT_LOCUS_RANGE_KELVIN.maximum) }
419
+ : locus.range;
420
+ const t = requireTemperatureIn(input.correlatedColorTemperatureKelvin, range, "correlatedColorTemperatureKelvin");
421
+ const normal = locusNormal(locus.sample(1 / t));
422
+ const base = uvOfChromaticity(input.whiteLocus === "cie-daylight" ? daylightChromaticity(t) : locus.chromaticity(t));
423
+ const value = chromaticityOfUv({ u: base.u + duv * normal.u, v: base.v + duv * normal.v });
424
+ // The same domain parseChromaticity enforces on input, so every result can be passed back in.
425
+ if (!(value.x >= 0) || !(value.y > 0) || !(value.x + value.y <= 1)) {
426
+ throw new InvalidScientificInputError("correlatedColorTemperatureKelvin and duv give a chromaticity outside x >= 0, y > 0, x + y <= 1.");
427
+ }
428
+ const assumptions = ["White locus: " + input.whiteLocus + "; Duv offset along the Planckian-locus normal (" + locus.model + ") in CIE 1960 uv"];
429
+ const exactDaylightPoint = input.whiteLocus === "cie-daylight" && duv === 0;
430
+ return locus.approximation && !exactDaylightPoint
431
+ ? approximationResult(value, "chromaticity-from-cct-duv", COLORIMETRY_MODEL_VERSION, assumptions)
432
+ : calculatedResult(value, "chromaticity-from-cct-duv", COLORIMETRY_MODEL_VERSION, assumptions);
433
+ }
434
+ //# sourceMappingURL=illuminants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"illuminants.js","sourceRoot":"","sources":["../../src/color/illuminants.ts"],"names":[],"mappings":"AAAA,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAA0B,MAAM,+BAA+B,CAAC;AAE9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,6BAA6B,EAC7B,2BAA2B,EAC3B,uBAAuB,EAKxB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAGjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,yEAAyE;AACzE,MAAM,CAAC,MAAM,6BAA6B,GAAG,cAAc,CAAC;AAC5D,MAAM,CAAC,MAAM,gCAAgC,GAAG,WAAW,CAAC;AAC5D,MAAM,CAAC,MAAM,oCAAoC,GAAG,YAAY,CAAC;AACjE,qFAAqF;AACrF,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,6BAA6B,GAAG,gCAAgC,CAAC,GAAG,oCAAoC,CAAC;AAChK,MAAM,iCAAiC,GAAG,CAAC,GAAG,6BAA6B,GAAG,gCAAgC,IAAI,CAAC,CAAC;AAEpH,0D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AC,CAAC;IAC3I,CAAC;IACD,MAAM,WAAW,GAAG,CAAC,eAAe,GAAG,KAAK,CAAC,UAAU,GAAG,iDAAiD,GAAG,KAAK,CAAC,KAAK,GAAG,kBAAkB,CAAC,CAAC;IAChJ,MAAM,kBAAkB,GAAG,KAAK,CAAC,UAAU,KAAK,cAAc,IAAI,GAAG,KAAK,CAAC,CAAC;IAC5E,OAAO,KAAK,CAAC,aAAa,IAAI,CAAC,kBAAkB;QAC/C,CAAC,CAAC,mBAAmB,CAAC,KAAK,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,WAAW,CAAC;QACjG,CAAC,CAAC,gBAAgB,CAAC,KAAK,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,WAAW,CAAC,CAAC;AACnG,CAAC","sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Illuminant spectra and correlated-colour-temperature (CCT) helpers.\n *\n * - Planckian radiator: exact Planck law (BIPM Mise en pratique for the kelvin, Absolute Primary\n * Radiometry 2018, Eq. 1, free) with the exact SI defining constants (h, c, k; BIPM SI Brochure\n * 9th ed. 2019), so c₂ = hc/k = 1.438776877…e-2 m·K (NIST CODATA 2022). Wavelength is the vacuum\n * wavelength.\n * - CIE standard illuminant A: Planck's law relative to 560 nm with the CIE's defining constants\n * c₂ = 1.435e-2 m·K and T = 2848 K (also CIE 15:2018 Eq. 4.1 / ISO/CIE 11664-2, paid):\n * S_A(λ) = 100 (560/λ)^5 (exp(1.435e7/(2848·560)) − 1)/(exp(1.435e7/(2848 λ)) − 1)\n * (≈ 2856 K with the exact c₂). Computed from the formula, not a copied table; it reproduces the\n * free CIE 1 nm table (DOI 10.25039/CIE.DS.8jsxjrsn) to its six significant digits.\n * - CIE daylight: the CIE daylight-locus chromaticity polynomial and the M₁/M₂ weights (CIE 15:2018,\n * paid; no free text of the formulas found). With three-decimal rounding they reproduce the free\n * CIE D55 and D65 tables. The S₀/S₁/S₂ basis is a CIE dataset (CC BY-SA 4.0, not bundled);\n * callers supply it.\n * - Planckian locus: the chromaticity of a Planckian radiator at T, computed by integrating Planck's\n * law against colour-matching functions. The default uses the engine's analytic CIE 1931 fit with\n * 1 nm nodes from 360 to 830 nm (so it inherits that fit's approximation); callers may select\n * tabulated CMFs and their own nodes. Valid 1000–100000 K.\n * - CCT from chromaticity: McCamy (1992) cubic (approximation), or a nearest-point\n * search on the Planckian locus in the CIE 1960 UCS (CCT and signed Duv as defined in Smet et al.,\n * LEUKOS 2023, free archival copy from the US DOE; also CIE 15:2018). Duv sign: positive above the\n * locus (toward green), negative below (toward magenta), following Ohno, \"Calculation of CCT and Duv\n * and Practical Conversion Formulae\", CORM 2011 slides (free), slide 5; the engine documents and\n * tests it.\n * @see docs/COLORIMETRY.md for equations, coordinate/unit conventions and limits.\n */\n\nimport { approximationResult, calculatedResult, type CalculationResult } from \"../core/calculation-result.js\";\nimport type { SpectralWavelengthRangeNanometers } from \"../core/spectral.js\";\nimport { InvalidScientificInputError } from \"../core/validation.js\";\nimport {\n COLORIMETRY_MODEL_VERSION,\n integrateSampledXyz,\n prepareColorMatchingFunctions,\n prepareColorimetricSpectrum,\n sampleColorimetricBasis,\n type ColorMatchingFunctionsSource,\n type ColorimetricQuadratureNode,\n type ColorimetricSpectralSample,\n type ColorimetricSpectrum\n} from \"./color-matching-functions.js\";\nimport {\n chromaticityOfUv,\n chromaticityOfXyz,\n parseChromaticity,\n requireFiniteNumber,\n requirePositiveNumber,\n requireRecordValue,\n uvOfChromaticity,\n type Cie1960UvChromaticity,\n type CieXyChromaticity\n} from \"./colorimetry-math.js\";\nimport { rejectUnknownFields, requireInputKeys } from \"../core/record-validation.js\";\nimport { InvalidConfigurationError } from \"../core/configuration-error.js\";\n\n/** Exact SI defining constants (BIPM SI Brochure, 9th edition, 2019). */\nexport const PLANCK_CONSTANT_JOULE_SECONDS = 6.62607015e-34;\nexport const SPEED_OF_LIGHT_METERS_PER_SECOND = 299_792_458;\nexport const BOLTZMANN_CONSTANT_JOULES_PER_KELVIN = 1.380649e-23;\n/** Second radiation constant c₂ = hc/k in m·K (derived from the exact constants). */\nexport const SECOND_RADIATION_CONSTANT_METER_KELVIN = (PLANCK_CONSTANT_JOULE_SECONDS * SPEED_OF_LIGHT_METERS_PER_SECOND) / BOLTZMANN_CONSTANT_JOULES_PER_KELVIN;\nconst FIRST_RADIATION_CONSTANT_RADIANCE = 2 * PLANCK_CONSTANT_JOULE_SECONDS * SPEED_OF_LIGHT_METERS_PER_SECOND ** 2;\n\n/** Temperature range of the Planckian-locus models, K. */\nexport const PLANCKIAN_LOCUS_RANGE_KELVIN = Object.freeze({ minimum: 1000, maximum: 100000 });\n/** CIE daylight-locus validity, K. */\nexport const CIE_DAYLIGHT_LOCUS_RANGE_KELVIN = Object.freeze({ minimum: 4000, maximum: 25000 });\n/**\n * Engine limit: no CCT beyond |Duv| = 0.05, the range over which Smet et al. (2023, free) evaluate CCT\n * methods for nominally white light (CIE 15:2018 §9.5, paid, gives the same limit).\n */\nexport const MAX_CORRELATED_COLOR_TEMPERATURE_DUV = 0.05;\n\n/**\n * Planck's law for blackbody spectral radiance per unit (vacuum) wavelength:\n * L(λ, T) = 2hc² / λ⁵ / (exp(hc/(λkT)) − 1). Returns W·m⁻²·sr⁻¹·nm⁻¹.\n */\nexport function calculatePlanckianSpectralRadiance(input: { temperatureKelvin: number; wavelengthNanometers: number }): number {\n requireInputKeys(input, \"calculatePlanckianSpectralRadiance\", [\"temperatureKelvin\", \"wavelengthNanometers\"]);\n const t = requirePositiveNumber(input.temperatureKelvin, \"temperatureKelvin\");\n const nm = requirePositiveNumber(input.wavelengthNanometers, \"wavelengthNanometers\");\n const lambda = nm * 1e-9;\n const exponent = SECOND_RADIATION_CONSTANT_METER_KELVIN / (lambda * t);\n // expm1 keeps precision in the Rayleigh–Jeans limit; overflow gives radiance 0.\n const radiancePerMeter = FIRST_RADIATION_CONSTANT_RADIANCE / lambda ** 5 / Math.expm1(exponent);\n return radiancePerMeter * 1e-9;\n}\n\n/** Planckian spectral radiance (W·m⁻²·sr⁻¹·nm⁻¹) as a function spectrum over the given range. */\nexport function createPlanckianSpectrum(input: { temperatureKelvin: number; wavelengthRangeNanometers: SpectralWavelengthRangeNanometers }): ColorimetricSpectrum {\n requireInputKeys(input, \"createPlanckianSpectrum\", [\"temperatureKelvin\", \"wavelengthRangeNanometers\"]);\n const temperatureKelvin = requirePositiveNumber(input.temperatureKelvin, \"temperatureKelvin\");\n const range = requireRecordValue(input.wavelengthRangeNanometers, \"wavelengthRangeNanometers\");\n rejectUnknownFields(range, [\"minimum\", \"maximum\"], \"wavelengthRangeNanometers\");\n const spectrum: ColorimetricSpectrum = {\n kind: \"function\",\n wavelengthRangeNanometers: { minimum: range.minimum as number, maximum: range.maximum as number },\n evaluate: (wavelengthNanometers) => calculatePlanckianSpectralRadiance({ temperatureKelvin, wavelengthNanometers })\n };\n prepareColorimetricSpectrum(spectrum, \"planckianSpectrum\");\n return spectrum;\n}\n\n/** CIE illuminant A defining range (nm). */\nexport const CIE_ILLUMINANT_A_RANGE_NANOMETERS = Object.freeze({ minimum: 300, maximum: 830 });\n\n/**\n * CIE standard illuminant A relative SPD from its defining formula (100 at 560 nm),\n * with c₂ = 1.435e-2 m·K and T = 2848 K as in the standard (≈ 2856 K with the\n * current c₂). Valid 300–830 nm.\n */\nexport function calculateCieIlluminantARelativeSpectralPower(wavelengthNanometers: number): number {\n const nm = requireFiniteNumber(wavelengthNanometers, \"wavelengthNanometers\");\n if (nm < CIE_ILLUMINANT_A_RANGE_NANOMETERS.minimum || nm > CIE_ILLUMINANT_A_RANGE_NANOMETERS.maximum) {\n throw new InvalidScientificInputError(\"CIE illuminant A is defined from 300 nm to 830 nm.\");\n }\n const c = 1.435e7 / 2848; // nm·K / K\n return 100 * (560 / nm) ** 5 * (Math.expm1(c / 560) / Math.expm1(c / nm));\n}\n\n/** CIE illuminant A as a function spectrum over its defining range. */\nexport function createCieIlluminantASpectrum(): ColorimetricSpectrum {\n return { kind: \"function\", wavelengthRangeNanometers: { ...CIE_ILLUMINANT_A_RANGE_NANOMETERS }, evaluate: calculateCieIlluminantARelativeSpectralPower };\n}\n\nfunction requireTemperatureIn(t: unknown, range: { minimum: number; maximum: number }, what: string): number {\n const value = requirePositiveNumber(t, what);\n if (value < range.minimum || value > range.maximum) {\n throw new InvalidScientificInputError(what + \" must lie in [\" + range.minimum + \", \" + range.maximum + \"] K.\");\n }\n return value;\n}\n\nfunction daylightChromaticity(t: number): CieXyChromaticity {\n const x = t <= 7000\n ? -4.6070e9 / t ** 3 + 2.9678e6 / t ** 2 + 0.09911e3 / t + 0.244063\n : -2.0064e9 / t ** 3 + 1.9018e6 / t ** 2 + 0.24748e3 / t + 0.237040;\n return { x, y: -3.000 * x * x + 2.870 * x - 0.275 };\n}\n\nexport interface CieDaylightComponentWeights {\n correlatedColorTemperatureKelvin: number;\n chromaticity: CieXyChromaticity;\n m1: number;\n m2: number;\n coefficientRounding: \"none\" | \"cie-three-decimals\";\n}\n\n/**\n * CIE daylight-locus chromaticity and S₁/S₂ weights for a CCT in 4000–25000 K\n * (CIE 15:2018 §4.1.2, paid; no free text of the formulas found). M₁, M₂ rounded to three decimals\n * reproduce the free CIE D55 and D65 tables (DOI 10.25039/CIE.DS.qewfb3kp, 10.25039/CIE.DS.hjfjmt59)\n * to their rounding; `coefficientRounding` makes that rounding explicit.\n * The temperature is used as given: D65's nominal 6500 K corresponds to 6504 K here.\n */\nexport function calculateCieDaylightComponentWeights(input: {\n correlatedColorTemperatureKelvin: number;\n coefficientRounding: \"none\" | \"cie-three-decimals\";\n}): CalculationResult<CieDaylightComponentWeights> {\n requireInputKeys(input, \"calculateCieDaylightComponentWeights\", [\"correlatedColorTemperatureKelvin\", \"coefficientRounding\"]);\n const t = requireTemperatureIn(input.correlatedColorTemperatureKelvin, CIE_DAYLIGHT_LOCUS_RANGE_KELVIN, \"correlatedColorTemperatureKelvin\");\n if (input.coefficientRounding !== \"none\" && input.coefficientRounding !== \"cie-three-decimals\") {\n throw new InvalidConfigurationError(\"coefficientRounding must be \\\"none\\\" or \\\"cie-three-decimals\\\".\");\n }\n const xy = daylightChromaticity(t);\n const m = 0.0241 + 0.2562 * xy.x - 0.7341 * xy.y;\n let m1 = (-1.3515 - 1.7703 * xy.x + 5.9114 * xy.y) / m;\n let m2 = (0.0300 - 31.4424 * xy.x + 30.0717 * xy.y) / m;\n if (input.coefficientRounding === \"cie-three-decimals\") {\n m1 = Math.round(m1 * 1000) / 1000;\n m2 = Math.round(m2 * 1000) / 1000;\n }\n return calculatedResult({ correlatedColorTemperatureKelvin: t, chromaticity: xy, m1, m2, coefficientRounding: input.coefficientRounding },\n \"cie-daylight-locus\", COLORIMETRY_MODEL_VERSION, [\"CIE daylight-locus polynomial and M1/M2 weights, checked against the free CIE D55 and D65 datasets (no free formula text found); valid 4000–25000 K\"]);\n}\n\n/** Caller-supplied CIE daylight basis S₀, S₁, S₂ (tabulated; CIE dataset not bundled). */\nexport interface CieDaylightBasis {\n s0: readonly ColorimetricSpectralSample[];\n s1: readonly ColorimetricSpectralSample[];\n s2: readonly ColorimetricSpectralSample[];\n /** Caller identity of the basis dataset (for example a DOI). */\n datasetId: string;\n}\n\n/**\n * Builds a CIE D-series relative SPD S(λ) = S₀ + M₁S₁ + M₂S₂ on the S₀ wavelengths from\n * caller-supplied basis tables (S₁, S₂ linearly interpolated; fail closed outside range).\n */\nexport function createCieDaylightSpectrum(input: {\n correlatedColorTemperatureKelvin: number;\n coefficientRounding: \"none\" | \"cie-three-decimals\";\n basis: CieDaylightBasis;\n}): ColorimetricSpectrum {\n requireInputKeys(input, \"createCieDaylightSpectrum\", [\"correlatedColorTemperatureKelvin\", \"coefficientRounding\", \"basis\"]);\n const weights = calculateCieDaylightComponentWeights({\n correlatedColorTemperatureKelvin: input.correlatedColorTemperatureKelvin,\n coefficientRounding: input.coefficientRounding\n }).value;\n const basis = requireRecordValue(input.basis, \"basis\");\n rejectUnknownFields(basis, [\"s0\", \"s1\", \"s2\", \"datasetId\"], \"basis\");\n if (typeof basis.datasetId !== \"string\" || basis.datasetId.trim().length === 0) {\n throw new InvalidConfigurationError(\"basis.datasetId must be a non-empty string.\");\n }\n const s0 = prepareColorimetricSpectrum({ kind: \"tabulated\", samples: input.basis.s0 }, \"basis.s0\");\n const s1 = prepareColorimetricSpectrum({ kind: \"tabulated\", samples: input.basis.s1 }, \"basis.s1\");\n const s2 = prepareColorimetricSpectrum({ kind: \"tabulated\", samples: input.basis.s2 }, \"basis.s2\");\n const samples = input.basis.s0.map((sample) => {\n const w = sample.wavelengthNanometers;\n return { wavelengthNanometers: w, value: s0.evaluate(w) + weights.m1 * s1.evaluate(w) + weights.m2 * s2.evaluate(w) };\n });\n return { kind: \"tabulated\", samples };\n}\n\n/** Selects how the Planckian locus is evaluated. */\nexport type PlanckianLocusModel =\n | {\n /** Planck's law integrated against the engine's analytic CIE 1931 CMFs, 1 nm nodes 360–830 nm (the default). */\n kind: \"planck-analytic-cmf\";\n }\n | {\n kind: \"planck-integration\";\n colorMatchingFunctions: ColorMatchingFunctionsSource;\n quadratureNodes: readonly ColorimetricQuadratureNode[];\n };\n\n/** Number of intervals of the coarse reciprocal-temperature scan that brackets the CCT search. */\nconst CCT_SCAN_STEPS = 200;\n/**\n * Convergence tolerance of the CCT root-find: it stops once a Newton (or bisection) step changes T by\n * at most this fraction of T (1e-6 K at 10000 K).\n */\nconst CCT_RELATIVE_TOLERANCE = 1e-10;\n\n/**\n * Locus uv and its first and second derivatives with respect to the reciprocal temperature x = 1/T\n * (K⁻¹), from the analytic derivatives of Planck's law integrated in the locus quadrature.\n */\ninterface LocusSample {\n u: number;\n v: number;\n du: number;\n dv: number;\n d2u: number;\n d2v: number;\n}\n\ninterface PreparedLocus {\n range: { minimum: number; maximum: number };\n approximation: boolean;\n model: string;\n chromaticity(t: number): CieXyChromaticity;\n /** uv and its x = 1/T derivatives at reciprocal temperature x. */\n sample(x: number): LocusSample;\n /** CIE 1960 uv at the coarse scan temperatures; computed once per prepared locus. */\n scan(): readonly Cie1960UvChromaticity[];\n}\n\n/**\n * Prepares a Planck-integration locus: the CMF values and 1/λ⁵ factors are sampled once, so each\n * temperature costs one exponential per node. Planck's constant factor 2hc² cancels in chromaticity.\n *\n * Derivatives: with x = 1/T, aᵢ = c₂/λᵢ and rᵢ = 1/(exp(aᵢx) − 1), Planck's law is proportional to\n * λᵢ⁻⁵ rᵢ, and exactly dr/dx = −a(r + r²) and d²r/dx² = a²(r + 3r² + 2r³) (differentiate\n * r = 1/(E − 1), E = exp(ax), and use E = 1 + 1/r). They are summed in the same quadrature as X, Y, Z.\n */\nfunction preparePlanckIntegrationLocus(cmfSource: ColorMatchingFunctionsSource, quadratureNodes: readonly ColorimetricQuadratureNode[], model: string): PreparedLocus {\n const cmf = prepareColorMatchingFunctions(cmfSource);\n const unit = prepareColorimetricSpectrum({ kind: \"function\", wavelengthRangeNanometers: cmf.wavelengthRangeNanometers, evaluate: () => 1 });\n const basis = sampleColorimetricBasis(quadratureNodes, unit, cmf);\n const n = basis.nodes.length;\n const exponentPerKelvin = new Float64Array(n), inverseFifth = new Float64Array(n);\n // Per-node constants of the derivative sums: weight × CMF × λ⁻⁵ for X, Y and Z.\n const wx = new Float64Array(n), wy = new Float64Array(n), wz = new Float64Array(n);\n for (let i = 0; i < n; i++) {\n const lambda = basis.nodes[i]!.wavelengthNanometers * 1e-9;\n exponentPerKelvin[i] = SECOND_RADIATION_CONSTANT_METER_KELVIN / lambda;\n inverseFifth[i] = 1 / lambda ** 5;\n const w = basis.weights[i]! * inverseFifth[i]!;\n wx[i] = w * basis.xBar[i]!; wy[i] = w * basis.yBar[i]!; wz[i] = w * basis.zBar[i]!;\n }\n const factor = new Float64Array(n);\n const range = PLANCKIAN_LOCUS_RANGE_KELVIN;\n let scanCache: readonly Cie1960UvChromaticity[] | undefined;\n const locus: PreparedLocus = {\n range,\n approximation: cmf.scientificStatus === \"approximation\",\n model,\n chromaticity(t: number): CieXyChromaticity {\n // expm1 keeps precision at long wavelengths; overflow at short ones gives 0, as in Planck's law.\n for (let i = 0; i < n; i++) factor[i] = inverseFifth[i]! / Math.expm1(exponentPerKelvin[i]! / t);\n return chromaticityOfXyz(integrateSampledXyz(basis, factor));\n },\n sample(x: number): LocusSample {\n let sx = 0, sy = 0, sz = 0, sx1 = 0, sy1 = 0, sz1 = 0, sx2 = 0, sy2 = 0, sz2 = 0;\n for (let i = 0; i < n; i++) {\n const a = exponentPerKelvin[i]!;\n // An overflowing expm1 gives r = 0 and zero derivatives, the exact limit.\n const r = 1 / Math.expm1(a * x), r2 = r * r;\n const q1 = r + r2, k1 = -a * q1, k2 = a * a * (q1 + 2 * r2 * (1 + r));\n const cx = wx[i]!, cy = wy[i]!, cz = wz[i]!;\n sx += cx * r; sy += cy * r; sz += cz * r;\n sx1 += cx * k1; sy1 += cy * k1; sz1 += cz * k1;\n sx2 += cx * k2; sy2 += cy * k2; sz2 += cz * k2;\n }\n // u = 4X/d, v = 6Y/d, d = X + 15Y + 3Z; quotient rule: q' = (N' − q d')/d, q'' = (N'' − 2q'd' − q d'')/d.\n const d = sx + 15 * sy + 3 * sz, d1 = sx1 + 15 * sy1 + 3 * sz1, d2 = sx2 + 15 * sy2 + 3 * sz2;\n if (!(d > 0) || !Number.isFinite(d)) throw new InvalidScientificInputError(\"Chromaticity requires X + Y + Z > 0.\");\n const u = (4 * sx) / d, v = (6 * sy) / d;\n const du = (4 * sx1 - u * d1) / d, dv = (6 * sy1 - v * d1) / d;\n return { u, v, du, dv, d2u: (4 * sx2 - 2 * du * d1 - u * d2) / d, d2v: (6 * sy2 - 2 * dv * d1 - v * d2) / d };\n },\n scan(): readonly Cie1960UvChromaticity[] {\n if (scanCache === undefined) {\n const lo = 1e6 / range.maximum, hi = 1e6 / range.minimum;\n scanCache = Array.from({ length: CCT_SCAN_STEPS + 1 }, (_, i) => uvOfChromaticity(locus.chromaticity(1e6 / (lo + ((hi - lo) * i) / CCT_SCAN_STEPS))));\n }\n return scanCache;\n }\n };\n return locus;\n}\n\n/** 1 nm nodes at 360, 361, …, 830 nm with Δλ = 1 nm (the CIE 15 summation convention). */\nconst DEFAULT_LOCUS_NODES: readonly ColorimetricQuadratureNode[] = Object.freeze(\n Array.from({ length: 471 }, (_, i) => Object.freeze({ wavelengthNanometers: 360 + i, wavelengthMeasureNanometers: 1 }))\n);\nlet defaultLocus: PreparedLocus | undefined;\n\n/** The default locus, prepared on first use and shared (its scan cache is computed once). */\nfunction analyticCmfLocus(): PreparedLocus {\n defaultLocus ??= preparePlanckIntegrationLocus({ kind: \"analytic-cie-1931-multi-lobe-fit\" }, DEFAULT_LOCUS_NODES, \"planck-analytic-cmf\");\n return defaultLocus;\n}\n\n/**\n * Planckian-locus chromaticity at T (1000–100000 K): Planck's law integrated against the engine's\n * analytic CIE 1931 CMFs with 1 nm nodes from 360 to 830 nm. An approximation, because the CMFs are\n * an analytic fit; with tabulated CMFs use {@link calculatePlanckianChromaticity}.\n */\nexport function estimatePlanckianLocusChromaticity(input: { temperatureKelvin: number }): CalculationResult<CieXyChromaticity> {\n requireInputKeys(input, \"estimatePlanckianLocusChromaticity\", [\"temperatureKelvin\"]);\n const t = requireTemperatureIn(input.temperatureKelvin, PLANCKIAN_LOCUS_RANGE_KELVIN, \"temperatureKelvin\");\n return approximationResult(analyticCmfLocus().chromaticity(t), \"planckian-locus-planck-analytic-cmf\", COLORIMETRY_MODEL_VERSION,\n [\"Planck's law integrated against the engine's analytic CIE 1931 CMF fit, 1 nm nodes 360–830 nm; valid 1000–100000 K\"]);\n}\n\nfunction prepareLocus(model: PlanckianLocusModel): PreparedLocus {\n const record = requireRecordValue(model, \"locus\");\n if (record.kind === \"planck-analytic-cmf\") {\n rejectUnknownFields(record, [\"kind\"], \"locus\");\n return analyticCmfLocus();\n }\n if (record.kind !== \"planck-integration\") throw new InvalidConfigurationError(\"locus.kind is not supported.\");\n rejectUnknownFields(record, [\"kind\", \"colorMatchingFunctions\", \"quadratureNodes\"], \"locus\");\n const m = model as Extract<PlanckianLocusModel, { kind: \"planck-integration\" }>;\n const cmf = prepareColorMatchingFunctions(m.colorMatchingFunctions);\n return preparePlanckIntegrationLocus(m.colorMatchingFunctions, m.quadratureNodes, \"planck-integration-\" + cmf.sourceKind);\n}\n\n/** Planckian chromaticity at T using either locus model. */\nexport function calculatePlanckianChromaticity(input: { temperatureKelvin: number; locus: PlanckianLocusModel }): CalculationResult<CieXyChromaticity> {\n requireInputKeys(input, \"calculatePlanckianChromaticity\", [\"temperatureKelvin\", \"locus\"]);\n const locus = prepareLocus(input.locus);\n const t = requireTemperatureIn(input.temperatureKelvin, locus.range, \"temperatureKelvin\");\n const value = locus.chromaticity(t);\n const assumptions = [\"Planckian locus model: \" + locus.model];\n return locus.approximation\n ? approximationResult(value, \"planckian-chromaticity\", COLORIMETRY_MODEL_VERSION, assumptions)\n : calculatedResult(value, \"planckian-chromaticity\", COLORIMETRY_MODEL_VERSION, assumptions);\n}\n\n/**\n * McCamy (1992) cubic estimate of CCT from CIE 1931 xy:\n * n = (x − 0.3320)/(0.1858 − y), CCT = 449 n³ + 3525 n² + 6823.3 n + 5520.33.\n * An approximation that carries no Duv. Measured for this engine (October 17, 2026) on points of a\n * Planckian locus integrated from the CIE 1931 2° 1 nm table (360–830 nm, exact c₂): it deviates by up\n * to 10 K over 2856–6504 K (largest near 3500 K), 19 K at 2000 K, 17 K at 8000 K, 118 K at 10000 K\n * and 442 K at 12500 K. See docs/COLORIMETRY.md.\n */\nexport function estimateCorrelatedColorTemperatureMcCamy(input: { chromaticity: CieXyChromaticity }): CalculationResult<{ correlatedColorTemperatureKelvin: number }> {\n requireInputKeys(input, \"estimateCorrelatedColorTemperatureMcCamy\", [\"chromaticity\"]);\n const xy = parseChromaticity(input.chromaticity, \"chromaticity\");\n const n = (xy.x - 0.3320) / (0.1858 - xy.y);\n const cct = 449 * n ** 3 + 3525 * n ** 2 + 6823.3 * n + 5520.33;\n if (!Number.isFinite(cct) || cct <= 0) throw new InvalidScientificInputError(\"Chromaticity is outside the McCamy approximation domain.\");\n return approximationResult({ correlatedColorTemperatureKelvin: cct }, \"cct-mccamy-1992\", COLORIMETRY_MODEL_VERSION,\n [\"McCamy (1992) cubic; intended for chromaticities near the Planckian locus, about 2000–12500 K\"]);\n}\n\n/** The \"above-locus\" unit normal at a sample: the increasing-T unit tangent (−du/dx, −dv/dx) turned by −90°. */\nfunction locusNormal(s: LocusSample): Cie1960UvChromaticity {\n const len = Math.hypot(s.du, s.dv);\n const tangent = { u: -s.du / len, v: -s.dv / len };\n // u decreases as T rises, so turning the tangent by −90° points toward larger v (above the locus).\n return { u: tangent.v, v: -tangent.u };\n}\n\n/**\n * Nearest locus point to `target` in CIE 1960 uv: the root of the derivative of the squared distance\n * F = (u − u₀)² + (v − v₀)². Roots of dF/dT and of dF/dx (x = 1/T) coincide, since dx/dT = −1/T² ≠ 0;\n * the root-find runs in x with g = ½ dF/dx = (u − u₀)u′ + (v − v₀)v′ and\n * g′ = u′² + v′² + (u − u₀)u″ + (v − v₀)v″ (analytic, see {@link preparePlanckIntegrationLocus}).\n * The cached coarse scan brackets the minimum; a Newton step falls back to bisection whenever it would\n * leave the bracket. Returns the root and the locus sample there, or undefined when the nearest point\n * lies beyond the model's range (by more than the tolerance).\n */\nfunction nearestLocusPoint(locus: PreparedLocus, target: Cie1960UvChromaticity): { x: number; sample: LocusSample } | undefined {\n const steps = CCT_SCAN_STEPS;\n const lo = 1e6 / locus.range.maximum, hi = 1e6 / locus.range.minimum, step = (hi - lo) / steps;\n const gridX = (i: number): number => (lo + step * i) * 1e-6;\n const scan = locus.scan();\n const f = (i: number): number => (scan[i]!.u - target.u) ** 2 + (scan[i]!.v - target.v) ** 2;\n let best = 0, bestValue = Infinity;\n for (let i = 0; i <= steps; i++) {\n const value = f(i);\n if (value < bestValue) { bestValue = value; best = i; }\n }\n const tolerance = (x: number): number => CCT_RELATIVE_TOLERANCE * x;\n const derivatives = (s: LocusSample): { g: number; gp: number } => {\n const eu = s.u - target.u, ev = s.v - target.v;\n return { g: eu * s.du + ev * s.dv, gp: s.du * s.du + s.dv * s.dv + eu * s.d2u + ev * s.d2v };\n };\n let a: number, b: number, x: number;\n if (best === 0 || best === steps) {\n // The scan minimum is a range limit: the nearest point is inside only if F still falls inward.\n x = gridX(best);\n const s = locus.sample(x), { g, gp } = derivatives(s);\n if (best === 0 ? g >= 0 : g <= 0) {\n // At the limit within the tolerance (one Newton step estimates the distance), or beyond it.\n return g === 0 || (gp > 0 && Math.abs(g / gp) <= tolerance(x)) ? { x, sample: s } : undefined;\n }\n a = best === 0 ? x : gridX(steps - 1);\n b = best === 0 ? gridX(1) : x;\n } else {\n // A discrete minimum between its neighbours brackets a local minimum; start at the parabola vertex.\n a = gridX(best - 1); b = gridX(best + 1);\n const fm = f(best - 1), fp = f(best + 1), curvature = fm - 2 * bestValue + fp;\n x = gridX(best) + (curvature > 0 ? (step * 1e-6 * (fm - fp)) / (2 * curvature) : 0);\n }\n let s = locus.sample(x);\n for (let i = 0; i < 100; i++) {\n const { g, gp } = derivatives(s);\n if (g === 0) break;\n if (g < 0) a = x; else b = x;\n let next = x - g / gp;\n if (!(gp > 0) || !(next > a && next < b)) next = 0.5 * (a + b);\n const converged = Math.abs(next - x) <= tolerance(next) || b - a <= tolerance(next);\n x = next;\n s = locus.sample(x);\n if (converged) break;\n }\n return { x, sample: s };\n}\n\nexport interface CorrelatedColorTemperatureResult {\n correlatedColorTemperatureKelvin: number;\n /** Signed CIE 1960 uv distance from the locus; positive above (greenish), negative below (the engine's convention). */\n duv: number;\n}\n\n/**\n * CCT and Duv of a chromaticity as the nearest point of the Planckian locus in the CIE\n * 1960 UCS (Smet et al. 2023; also CIE 15:2018). Finds the root of the analytic temperature derivative\n * of the squared uv distance (safeguarded Newton with bisection fallback, bracketed by a cached coarse\n * scan in reciprocal temperature), converged until a step changes T by at most 1e-10 of T. Throws\n * (fails closed) when the nearest point lies beyond the model's range, or when |Duv| > 0.05 (see\n * {@link MAX_CORRELATED_COLOR_TEMPERATURE_DUV}). Duv is positive above the locus (toward green) and\n * negative below it, the engine's documented sign convention.\n */\nexport function calculateCorrelatedColorTemperature(input: { chromaticity: CieXyChromaticity; locus: PlanckianLocusModel }): CalculationResult<CorrelatedColorTemperatureResult> {\n requireInputKeys(input, \"calculateCorrelatedColorTemperature\", [\"chromaticity\", \"locus\"]);\n const xy = parseChromaticity(input.chromaticity, \"chromaticity\");\n const locus = prepareLocus(input.locus);\n const target = uvOfChromaticity(xy);\n const nearest = nearestLocusPoint(locus, target);\n if (nearest === undefined) throw new InvalidScientificInputError(\"Chromaticity's nearest Planckian point lies outside the locus model range.\");\n const t = Math.min(locus.range.maximum, Math.max(locus.range.minimum, 1 / nearest.x));\n const point = nearest.sample, normal = locusNormal(point);\n const duv = (target.u - point.u) * normal.u + (target.v - point.v) * normal.v;\n if (Math.abs(duv) > MAX_CORRELATED_COLOR_TEMPERATURE_DUV) {\n throw new InvalidScientificInputError(\"|Duv| exceeds 0.05; no CCT is reported this far from the Planckian locus (the range evaluated by Smet et al. 2023).\");\n }\n const value = { correlatedColorTemperatureKelvin: t, duv };\n const assumptions = [\"Nearest point on the Planckian locus in CIE 1960 uv; locus model: \" + locus.model, \"Duv sign: positive above the locus (toward green), negative below (engine convention)\"];\n return locus.approximation\n ? approximationResult(value, \"cct-duv-locus-search\", COLORIMETRY_MODEL_VERSION, assumptions)\n : calculatedResult(value, \"cct-duv-locus-search\", COLORIMETRY_MODEL_VERSION, assumptions);\n}\n\n/** Locus whose temperature defines a white for CCT + Duv. */\nexport type WhiteLocus = \"planckian\" | \"cie-daylight\";\n\n/**\n * Chromaticity for CCT and Duv: the locus point (Planckian or CIE daylight) offset by\n * Duv along the unit normal of the Planckian locus at the same temperature in the CIE\n * 1960 UCS. For `cie-daylight`, Duv = 0 returns the daylight-locus point itself.\n * Throws InvalidScientificInputError when the offset point is not a physical chromaticity\n * (x ≥ 0, y > 0, x + y ≤ 1), for example 2000 K with Duv +0.02 (x + y ≈ 1.06).\n */\nexport function calculateChromaticityFromCorrelatedColorTemperature(input: {\n correlatedColorTemperatureKelvin: number;\n duv: number;\n whiteLocus: WhiteLocus;\n locus: PlanckianLocusModel;\n}): CalculationResult<CieXyChromaticity> {\n requireInputKeys(input, \"calculateChromaticityFromCorrelatedColorTemperature\", [\"correlatedColorTemperatureKelvin\", \"duv\", \"whiteLocus\", \"locus\"]);\n const locus = prepareLocus(input.locus);\n const duv = requireFiniteNumber(input.duv, \"duv\");\n if (Math.abs(duv) > MAX_CORRELATED_COLOR_TEMPERATURE_DUV) throw new InvalidScientificInputError(\"|duv| must not exceed 0.05.\");\n if (input.whiteLocus !== \"planckian\" && input.whiteLocus !== \"cie-daylight\") throw new InvalidConfigurationError(\"whiteLocus is not supported.\");\n const range = input.whiteLocus === \"cie-daylight\"\n ? { minimum: Math.max(locus.range.minimum, CIE_DAYLIGHT_LOCUS_RANGE_KELVIN.minimum), maximum: Math.min(locus.range.maximum, CIE_DAYLIGHT_LOCUS_RANGE_KELVIN.maximum) }\n : locus.range;\n const t = requireTemperatureIn(input.correlatedColorTemperatureKelvin, range, \"correlatedColorTemperatureKelvin\");\n const normal = locusNormal(locus.sample(1 / t));\n const base = uvOfChromaticity(input.whiteLocus === \"cie-daylight\" ? daylightChromaticity(t) : locus.chromaticity(t));\n const value = chromaticityOfUv({ u: base.u + duv * normal.u, v: base.v + duv * normal.v });\n // The same domain parseChromaticity enforces on input, so every result can be passed back in.\n if (!(value.x >= 0) || !(value.y > 0) || !(value.x + value.y <= 1)) {\n throw new InvalidScientificInputError(\"correlatedColorTemperatureKelvin and duv give a chromaticity outside x >= 0, y > 0, x + y <= 1.\");\n }\n const assumptions = [\"White locus: \" + input.whiteLocus + \"; Duv offset along the Planckian-locus normal (\" + locus.model + \") in CIE 1960 uv\"];\n const exactDaylightPoint = input.whiteLocus === \"cie-daylight\" && duv === 0;\n return locus.approximation && !exactDaylightPoint\n ? approximationResult(value, \"chromaticity-from-cct-duv\", COLORIMETRY_MODEL_VERSION, assumptions)\n : calculatedResult(value, \"chromaticity-from-cct-duv\", COLORIMETRY_MODEL_VERSION, assumptions);\n}\n"]}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Wide-gamut output primitives (standalone; output wiring belongs to the SDR/export stages):
3
+ * - RGB ↔ XYZ matrices derived numerically from primary and white chromaticities: RGB (1, 1, 1)
4
+ * is the white (W3C CSS Color 4 §2, free), never copied matrices. They equal the CSS Color 4
5
+ * sample-code matrices to about 1e-15 (test/colorimetry-output-and-camera.test.ts).
6
+ * sRGB / BT.709: ITU-R BT.709-6 and W3C CSS Color 4 `srgb` (also IEC 61966-2-1:1999); Display P3:
7
+ * P3 primaries with D65 white as specified for `display-p3` in W3C CSS Color 4 (also SMPTE EG 432-1:2010);
8
+ * BT.2020: ITU-R BT.2020-2. All use D65 (0.3127, 0.3290).
9
+ * - Transfer functions: sRGB (W3C CSS Color 4; also IEC 61966-2-1; also Display P3), BT.709 OETF, BT.1886 EOTF
10
+ * (ITU-R BT.1886). The BT.2100 PQ and HLG transfer functions are not part of 2.0 (owner decision,
11
+ * 2026-10-17: their patent holders offer only licence-on-request declarations; see THIRD_PARTY.md).
12
+ * Constants are the published values of those standards.
13
+ * @see docs/COLORIMETRY.md for equations, coordinate/unit conventions and limits.
14
+ */
15
+ import { type CalculationResult } from "../core/calculation-result.js";
16
+ import { type CieXyChromaticity, type CieXyzTristimulus, type ColorMatrix3x3 } from "./colorimetry-math.js";
17
+ /** RGB primaries as CIE 1931 xy chromaticities. */
18
+ export interface RgbPrimaryChromaticities {
19
+ red: CieXyChromaticity;
20
+ green: CieXyChromaticity;
21
+ blue: CieXyChromaticity;
22
+ }
23
+ export interface RgbToXyzMatrices {
24
+ /** Linear RGB (white = 1, 1, 1) → XYZ with white Y = 1. */
25
+ rgbToXyz: ColorMatrix3x3;
26
+ xyzToRgb: ColorMatrix3x3;
27
+ whiteXyz: CieXyzTristimulus;
28
+ }
29
+ /** Internal: derivation from primaries and white (see {@link calculateRgbToXyzMatrices}) without an envelope. */
30
+ export declare function rgbToXyzMatrices(primaries: RgbPrimaryChromaticities, white: CieXyChromaticity): RgbToXyzMatrices;
31
+ /**
32
+ * Derives RGB ↔ XYZ matrices from primaries and white chromaticity: columns are the primaries'
33
+ * XYZ (Y = 1) scaled so that RGB (1, 1, 1) maps to the white (W3C CSS Color 4, free; also SMPTE
34
+ * RP 177). The derivation is written out in docs/COLORIMETRY.md.
35
+ */
36
+ export declare function calculateRgbToXyzMatrices(input: {
37
+ primaries: RgbPrimaryChromaticities;
38
+ whiteChromaticity: CieXyChromaticity;
39
+ }): CalculationResult<RgbToXyzMatrices>;
40
+ export type RgbColorSpaceId = "srgb" | "display-p3" | "rec709" | "rec2020";
41
+ export type RgbTransferFunctionId = "srgb" | "bt709-oetf-bt1886-eotf" | "bt2020-oetf";
42
+ export interface RgbColorSpaceDefinition extends RgbToXyzMatrices {
43
+ id: RgbColorSpaceId;
44
+ primaries: RgbPrimaryChromaticities;
45
+ whiteChromaticity: CieXyChromaticity;
46
+ /** Conventional non-linear (SDR) encoding of this space. */
47
+ transferFunction: RgbTransferFunctionId;
48
+ sources: readonly string[];
49
+ }
50
+ /** Resolves a named RGB colour space with numerically derived matrices (all D65). */
51
+ export declare function resolveRgbColorSpace(id: RgbColorSpaceId): CalculationResult<RgbColorSpaceDefinition>;
52
+ /** sRGB / Display P3 encoding (W3C CSS Color 4; also IEC 61966-2-1) of one linear component; negative values use the linear segment. */
53
+ export declare function evaluateSrgbEncoding(linear: number): number;
54
+ /** sRGB / Display P3 decoding of one non-linear component. */
55
+ export declare function evaluateSrgbDecoding(encoded: number): number;
56
+ /**
57
+ * ITU-R BT.709-6 / BT.2020-2 (10-bit) OETF: V = 4.5 L for L < 0.018, otherwise
58
+ * 1.099 L^0.45 − 0.099. Scene-referred camera encoding, not a display EOTF.
59
+ */
60
+ export declare function evaluateBt709Oetf(sceneLinear: number): number;
61
+ /** Inverse of the BT.709 OETF: L = V/4.5 for V < 0.081, otherwise ((V + 0.099)/1.099)^(1/0.45). */
62
+ export declare function evaluateBt709InverseOetf(encoded: number): number;
63
+ export interface Bt1886Eotf {
64
+ whiteLuminanceCdPerSquareMeter: number;
65
+ blackLuminanceCdPerSquareMeter: number;
66
+ /** a = (Lw^(1/γ) − Lb^(1/γ))^γ */
67
+ a: number;
68
+ /** b = Lb^(1/γ) / (Lw^(1/γ) − Lb^(1/γ)) */
69
+ b: number;
70
+ /** L = a · max(V + b, 0)^2.4 in cd/m². */
71
+ decode(signal: number): number;
72
+ /** Inverse: V = (L/a)^(1/2.4) − b. */
73
+ encode(luminanceCdPerSquareMeter: number): number;
74
+ }
75
+ /** Prepares the ITU-R BT.1886 reference EOTF (γ = 2.4) for a display's white and black luminance. */
76
+ export declare function prepareBt1886Eotf(input: {
77
+ whiteLuminanceCdPerSquareMeter: number;
78
+ blackLuminanceCdPerSquareMeter: number;
79
+ }): Bt1886Eotf;