等色関数の計算を取り出す

このコミットが含まれているのは:
routersys committed 2026-10-12 01:09:24 +09:00
1 親 ea6300042e
コミット 4ebce7b238
1ファイル変更
+8 -1
+8 -1
ファイルの表示
@@ -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),