From 4ebce7b23845c7e238da2a30efcf525e49d5e608 Mon Sep 17 00:00:00 2001 From: routersys Date: Mon, 12 Oct 2026 01:08:52 +0900 Subject: [PATCH] =?UTF-8?q?=E7=AD=89=E8=89=B2=E9=96=A2=E6=95=B0=E3=81=AE?= =?UTF-8?q?=E8=A8=88=E7=AE=97=E3=82=92=E5=8F=96=E3=82=8A=E5=87=BA=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpectrumColorShift/Spectrum.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SpectrumColorShift/Spectrum.cs b/SpectrumColorShift/Spectrum.cs index 83cda86..a7a200e 100644 --- a/SpectrumColorShift/Spectrum.cs +++ b/SpectrumColorShift/Spectrum.cs @@ -16,7 +16,7 @@ namespace SpectrumColorShift public static float ClampReference(float wavelength) => float.IsNaN(wavelength) ? DefaultReferenceWavelength : Math.Clamp(wavelength, ShortestWavelength, LongestWavelength); - public static Vector3 Weights(double wavelength) + public static (double X, double Y, double Z) ColorMatching(double wavelength) { var x = 0.362 * Lobe(wavelength, 442.0, 0.0624, 0.0374) + 1.056 * Lobe(wavelength, 599.8, 0.0264, 0.0323) @@ -26,6 +26,13 @@ namespace SpectrumColorShift var z = 1.217 * Lobe(wavelength, 437.0, 0.0845, 0.0278) + 0.681 * Lobe(wavelength, 459.0, 0.0385, 0.0725); + return (x, y, z); + } + + public static Vector3 Weights(double wavelength) + { + var (x, y, z) = ColorMatching(wavelength); + return new Vector3( (float)Math.Max(3.2404542 * x - 1.5371385 * y - 0.4985314 * z, 0.0), (float)Math.Max(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z, 0.0),