環の色が太陽の色で白く保たれる試験を追加する
このコミットが含まれているのは:
2ファイル変更
+20
-1
検索条件に一致するファイルはありません
@@ -178,6 +178,23 @@ public sealed class HaloTableTests
|
||||
Assert.True(HaloTable.ComposeRing(-1.0, 1.0, 1.0).AsSpan().SequenceEqual(HaloTable.ComposeRing(0.0, 1.0, 1.0)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ALightColoredLikeTheSunStaysWhiteInTheRingColors()
|
||||
{
|
||||
var white = SolarSpectrum.White;
|
||||
var profile = new double[HaloSettings.RingTableWidth * HaloSettings.ColorChannels];
|
||||
for (var index = 0; index < HaloSettings.RingTableWidth; index++)
|
||||
{
|
||||
profile[index * HaloSettings.ColorChannels] = 2.0 * white.X;
|
||||
profile[index * HaloSettings.ColorChannels + 1] = 2.0 * white.Y;
|
||||
profile[index * HaloSettings.ColorChannels + 2] = 2.0 * white.Z;
|
||||
}
|
||||
|
||||
var colors = HaloTable.RingColors(1.0, profile);
|
||||
|
||||
Assert.All(Enumerable.Range(0, colors.Length), index => Assert.Equal(2.0, colors[index], 1e-9));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheRingTableIsTheSameForTheSameInput()
|
||||
{
|
||||
|
||||
+3
-1
@@ -57,10 +57,12 @@ internal static class HaloTable
|
||||
}
|
||||
|
||||
private static double[] RingColors(double sunDiameterDegrees)
|
||||
=> RingColors(sunDiameterDegrees, RingProfile.Radiance);
|
||||
|
||||
public static double[] RingColors(double sunDiameterDegrees, double[] profile)
|
||||
{
|
||||
var width = HaloSettings.RingTableWidth;
|
||||
var channels = HaloSettings.ColorChannels;
|
||||
var profile = RingProfile.Radiance;
|
||||
var kernel = SunKernel(sunDiameterDegrees);
|
||||
var half = kernel.Length / 2;
|
||||
var (whiteRed, whiteGreen, whiteBlue) = SolarSpectrum.ToLinearSrgb(SolarSpectrum.White);
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする