From 68ce224227c3d08f652819ca920a8ec99c4d308f Mon Sep 17 00:00:00 2001 From: routersys Date: Fri, 9 Oct 2026 08:12:25 +0900 Subject: [PATCH] =?UTF-8?q?=E5=A5=A5=E8=A1=8C=E3=81=8D=E3=81=AE=E8=A8=88?= =?UTF-8?q?=E7=AE=97=E3=81=AE=E5=9F=BA=E6=BA=96=E3=81=AE=E6=B3=A2=E9=95=B7?= =?UTF-8?q?=E3=82=92=E8=89=B2=E3=81=AE=E6=89=B1=E3=81=84=E3=81=8B=E3=82=89?= =?UTF-8?q?=E6=B1=BA=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WaveOptics.Tests/WaveOpticsDepthTests.cs | 15 +++++++++++++++ WaveOptics/Effects/WaveOpticsDepth.cs | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/WaveOptics.Tests/WaveOpticsDepthTests.cs b/WaveOptics.Tests/WaveOpticsDepthTests.cs index 09efee8..577f391 100644 --- a/WaveOptics.Tests/WaveOpticsDepthTests.cs +++ b/WaveOptics.Tests/WaveOpticsDepthTests.cs @@ -161,6 +161,21 @@ public sealed class WaveOpticsDepthTests } } + [Theory] + [InlineData(380d)] + [InlineData(550d)] + [InlineData(650d)] + public void AMonochromeWaveCountIsMeasuredInTheChosenWavelength(double wavelength) + => Assert.Equal(wavelength, WaveOpticsDepth.ReferenceWavelength(WaveOpticsColorMode.Monochrome, wavelength)); + + [Theory] + [InlineData(WaveOpticsColorMode.Primaries, 380d)] + [InlineData(WaveOpticsColorMode.Primaries, 650d)] + [InlineData(WaveOpticsColorMode.Broadband, 380d)] + [InlineData(WaveOpticsColorMode.Broadband, 780d)] + public void APrimariesOrBroadbandWaveCountIsMeasuredIn550Nanometres(WaveOpticsColorMode colorMode, double wavelength) + => Assert.Equal(550d, WaveOpticsDepth.ReferenceWavelength(colorMode, wavelength)); + [Fact] public void TheDefocusIsZeroAtTheFocusDistance() => Assert.Equal(0d, WaveOpticsDepth.DefocusWaves(50d, 8d, 1500d, 1500d, Wavelength)); diff --git a/WaveOptics/Effects/WaveOpticsDepth.cs b/WaveOptics/Effects/WaveOpticsDepth.cs index 60423be..e6de8f7 100644 --- a/WaveOptics/Effects/WaveOpticsDepth.cs +++ b/WaveOptics/Effects/WaveOpticsDepth.cs @@ -1,4 +1,5 @@ using System.Numerics; +using WaveOptics.Optics; using YukkuriMovieMaker.Player.Video; namespace WaveOptics.Effects; @@ -27,6 +28,9 @@ internal static class WaveOpticsDepth return true; } + public static double ReferenceWavelength(WaveOpticsColorMode colorMode, double wavelength) + => colorMode == WaveOpticsColorMode.Monochrome ? wavelength : SpectralPlan.ReferenceWavelength; + public static double DefocusWaves(double focalLength, double fNumber, double focusDistance, double distance, double wavelength) { var minimum = focalLength * MinimumDistanceRatio;