Skip to content

Interactive 2D wave optics simulator. Turn any image into a refractive scene, add sources, watch waves refract, diffract and interfere. Probes, intensity maps, video export.

C#

The examples: three renamed, two reworked, a fibre cross-over coupler added; the export harness follows

Alexander Graef492341e52483
diff --git a/Examples/Example01_Simple_source.wdproj b/Examples/Example01_Simple_source.wdproj
deleted file mode 100644
index a3191a6..0000000
--- a/Examples/Example01_Simple_source.wdproj
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project Version="3" Seed="763629701">
- <Description>Simple omnidirectional pulsed source with a smoothed square intensity profile.</Description>
- <Scene DampingEdge="-64" />
- <Simulation TimeDecay="13" />
- <Display>
- <Field ColorScheme="Ice and fire" Brightness="70" BlackLevel="-0.05" />
- <Intensity ColorScheme="Default intensity" Brightness="50" />
- <Video Quality="70" />
- </Display>
- <Source Name="Source 1" X="943" Y="507" Frequency="50" Mode="Pulsed" PulseShape="SmoothedSquare" />
-</Project>
\ No newline at end of file
diff --git a/Examples/Example01_Source_Mirror_Probe.wdproj b/Examples/Example01_Source_Mirror_Probe.wdproj
new file mode 100644
index 0000000..12abe65
--- /dev/null
+++ b/Examples/Example01_Source_Mirror_Probe.wdproj
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Version="3" Seed="763629701">
+ <Description>Simple omnidirectional pulsed source with a smoothed square intensity profile, reflecting of simple mirror surface. A probe measures the intensity profile near the surface.</Description>
+ <Scene Width="960" Height="540" DampingEdge="-64" />
+ <Simulation TimeDecay="13" />
+ <Display ExportFrom="10">
+ <Field ColorScheme="Ice and fire" Brightness="70" BlackLevel="-0.05" />
+ <Intensity ColorScheme="Default intensity" Brightness="50" />
+ <Video Quality="70" />
+ </Display>
+ <Source Name="Source 1" X="115" Y="245" Mode="Pulsed" PulseShape="SmoothedSquare" />
+ <Rectangle Name="Rectangle 1" X="553" Y="138" Angle="18" Mirror="true" Length="52" Width="238" />
+ <Probe Name="Probe 1" Layer="Intensity" Measurement="Value" Kind="Line" AX="435" AY="175" BX="530" BY="144" BoxX="552" BoxY="328" AutoScaleY="false" YMin="0" YMax="5E-05" />
+</Project>
\ No newline at end of file
diff --git a/Examples/Example02_Coherent_source.wdproj b/Examples/Example02_Coherent_source_gaussian_beam.wdproj
similarity index 93%
rename from Examples/Example02_Coherent_source.wdproj
rename to Examples/Example02_Coherent_source_gaussian_beam.wdproj
index be31046..40415f0 100644
--- a/Examples/Example02_Coherent_source.wdproj
+++ b/Examples/Example02_Coherent_source_gaussian_beam.wdproj
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Version="3" Seed="1798021273">
- <Description>Featuring a 21 x 7 composite source that emits a continuous gaussian wave beam</Description>
+ <Description>Featuring a 21 x 7 composite source that emits a continuous gaussian beam</Description>
<Scene DampingEdge="-64" />
<Display>
<Field ColorScheme="Default field" Brightness="6" BlackLevel="-0.05" />
diff --git a/Examples/Example04_3_frequencies.wdproj b/Examples/Example04_3_sources_3_frequencies.wdproj
similarity index 85%
rename from Examples/Example04_3_frequencies.wdproj
rename to Examples/Example04_3_sources_3_frequencies.wdproj
index fe426e0..a4d277d 100644
--- a/Examples/Example04_3_frequencies.wdproj
+++ b/Examples/Example04_3_sources_3_frequencies.wdproj
@@ -10,5 +10,5 @@
<Source Name="Source 1" X="525" Y="440" Frequency="95" />
<Source Name="Source 2" X="525" Y="500" />
<Source Name="Source 3" X="525" Y="560" Frequency="97" />
- <Probe Name="Probe 1" Layer="Intensity" Measurement="Value" Kind="Line" AX="1024" AY="156" BX="1024" BY="851" BoxX="680" BoxY="880" />
+ <Probe Name="Probe 1" Layer="Intensity" Measurement="Value" Kind="Line" AX="1024" AY="156" BX="1024" BY="851" BoxSize="Large" BoxX="34" BoxY="774" />
</Project>
\ No newline at end of file
diff --git a/Examples/Example06_Large_incoherent_source.wdproj b/Examples/Example06_Large_incoherent_source.wdproj
index ce07245..98b4997 100644
--- a/Examples/Example06_Large_incoherent_source.wdproj
+++ b/Examples/Example06_Large_incoherent_source.wdproj
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Version="3" Seed="1529591424">
- <Description>Featuring a large (900+ composite) source that creates both spatially- as well as temporally incoherent wave emission</Description>
- <Scene Width="2500" Height="1500" DampingEdge="-64" />
- <Simulation Steps="10000" />
+ <Description>Featuring a large (450+ composite) source that creates both spatially- as well as temporally incoherent wave emission. The probes show that even though the intensity variations are large for an incoherent source, they eventually average out over time. Probe 2 shows the 1/r relationship. where r= distance to the source.</Description>
+ <Scene Width="1400" Height="800" DampingEdge="-64" />
+ <Simulation Steps="5000" />
<Display>
- <Field ColorScheme="Default field" Brightness="50" BlackLevel="-0.05" />
- <Intensity ColorScheme="Hot orange" Brightness="50" />
+ <Field ColorScheme="Default field" Brightness="50" BlackLevel="-0.05" Preview="false" />
+ <Intensity ColorScheme="Hot orange" />
<Video Quality="70" />
</Display>
- <Source Name="Source 1" X="1221" Y="707" Frequency="150" Mode="Pulsed" PulseWidth="8" OffWidth="1000">
- <Array SizeX="31" SizeY="31" SpacingX="6" SpacingY="6" RandomFrequency="30" RandomPhase="180" RandomOffWidth="998" RandomPosition="3" />
+ <Source Name="Source 1" X="682" Y="574" Frequency="150" Mode="Pulsed" PulseWidth="8" OffWidth="80">
+ <Array SizeX="15" SizeY="15" SpacingX="6" SpacingY="6" RandomFrequency="30" RandomPhase="180" RandomOffWidth="998" RandomPosition="3" />
</Source>
- <Probe Name="Probe 1" Layer="Intensity" Measurement="IntegratedValue" Kind="Line" AX="1521" AY="700" BX="2427" BY="700" BoxSize="Large" BoxX="1847" BoxY="346" StartAfter="1250" />
- <Probe Name="Probe 2" Layer="Intensity" Measurement="IntegratedValue" Kind="Line" AX="639" AY="462" BX="644" BY="984" BoxSize="ExtraLarge" BoxX="280" BoxY="29" />
+ <Probe Name="Probe 2" Layer="Intensity" Measurement="IntegratedValue" Kind="Line" AX="810" AY="579" BX="1360" BY="583" BoxSize="Custom" BoxX="746" BoxY="5" BoxWidth="649" BoxHeight="312" StartAfter="1000" />
+ <Probe Name="Probe 1" Layer="Intensity" Measurement="IntegratedValue" Kind="Line" AX="124" AY="374" BX="123" BY="785" BoxSize="Custom" BoxY="5" BoxWidth="600" BoxHeight="312" />
</Project>
\ No newline at end of file
diff --git a/Examples/Example14_Resonant_roundabout.wdproj b/Examples/Example14_Resonant_roundabout.wdproj
index 22963b7..6f97a4c 100644
--- a/Examples/Example14_Resonant_roundabout.wdproj
+++ b/Examples/Example14_Resonant_roundabout.wdproj
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Version="3" Seed="314604207">
- <Description>Resonant roundabout with two sources and two exits. If you change the phase of one of the sources, waves will take the other exit.</Description>
+ <Description>Resonant roundabout with two sources and two exits. If you change the phase of one of the sources by 180 degrees, waves will take the other exit.</Description>
<Scene Width="1080" DampingEdge="31" />
<Simulation Steps="5000" TimeDecay="1" />
<Display>
diff --git a/Examples/Example24_Fiber_cross_over.wdproj b/Examples/Example24_Fiber_cross_over.wdproj
new file mode 100644
index 0000000..416e88c
--- /dev/null
+++ b/Examples/Example24_Fiber_cross_over.wdproj
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Version="3" Seed="47427475">
+ <Description>Two single-mode fibres side by side, their cores a dozen pixels apart: the evanescent field of one reaches into the other, so light launched into fibre A crosses over into fibre B and back along the length, a directional coupler. The probe along A shows the beating, the cross-fibre probe the field across both cores. Switch source A off and B on to launch from the other fibre.</Description>
+ <Scene Height="800" DampingEdge="-115" RefractiveIndex="1.23" />
+ <Simulation Steps="5000" TimeDecay="33.1" />
+ <Display>
+ <Field ColorScheme="Ice and fire" Brightness="3.08" BlackLevel="-0.13" />
+ <Intensity ColorScheme="Default intensity" Brightness="3" />
+ </Display>
+ <Source Name="Source A" X="109" Y="149" Frequency="10" />
+ <Source Name="Source B" Enabled="false" X="107" Y="212" Frequency="10" />
+ <Rectangle Name="Reflector" X="102" Y="181" Mirror="true" Length="156" Width="310" />
+ <Rectangle Name="Absorber" X="1827" Y="181" Absorption="93" AbsorptionRamp="90" Length="110" Width="262" />
+ <Fiber Name="Fiber A" X="186" Y="150" CoreIndex="1.98" CoreDiameter="50" CladdingIndex="1.4" CladdingThickness="0">
+ <Node X="-109" Y="0" OutX="67" />
+ <Node X="1603" Y="1" InX="-55" OutX="67" />
+ </Fiber>
+ <Fiber Name="Fiber B" X="185" Y="213" CoreIndex="1.98" CoreDiameter="50" CladdingIndex="1.4" CladdingThickness="0">
+ <Node X="-109" Y="0" OutX="67" />
+ <Node X="1602" Y="4" InX="-55" OutX="67" />
+ </Fiber>
+ <Probe Name="Probe along A" Layer="Intensity" Measurement="Value" Kind="Line" AX="198" AY="151" BX="1747" BY="151" BoxSize="ExtraLarge" BoxX="237" BoxY="298" AutoScaleY="false" YMin="0" YMax="0.06" />
+ <Probe Name="Probe along B" Active="false" Layer="Intensity" Measurement="Value" Kind="Line" AX="196" AY="212" BX="1749" BY="215" BoxSize="ExtraLarge" BoxX="1005" BoxY="297" AutoScaleY="false" YMin="0" YMax="0.06" />
+ <Probe Name="Cross-fiber evanescent field" Layer="Intensity" Measurement="Value" Kind="Line" AX="1011" AY="92" BX="1010" BY="268" BoxSize="ExtraLarge" BoxX="1006" BoxY="296" />
+</Project>
\ No newline at end of file
diff --git a/_tools/ui_check/ExportCheck.ps1 b/_tools/ui_check/ExportCheck.ps1
index 151d6b6..f830180 100644
--- a/_tools/ui_check/ExportCheck.ps1
+++ b/_tools/ui_check/ExportCheck.ps1
@@ -137,9 +137,9 @@ try {
Check "'Examples' sits below Recent in the File menu" ((PopupFocusedId) -eq "MenuExamples") (PopupFocusedId)
Step "Right" $VK_RIGHT 300
Check "the list opens on the first example" ((PopupFocusedId) -eq "MenuExample01") (PopupFocusedId)
- Check "whose entry reads '1. Simple source'" (PopupItemVisible "1. Simple source")
+ Check "whose entry reads '1. Source Mirror Probe'" (PopupItemVisible "1. Source Mirror Probe")
Step "Enter" $VK_RETURN 500
- Check "the example replaces the project: frames 0 to 1249, its file name in the title (2026-10-29)" ((WaitFor { (Frame) -like "* / 1249" } 5000) -and ($win.Current.Name -like "*Example01_Simple_source.wdproj")) ("{0}; title '{1}'" -f (Frame), $win.Current.Name)
+ Check "the example replaces the project: frames 0 to 1249, its file name in the title (2026-10-29)" ((WaitFor { (Frame) -like "* / 1249" } 5000) -and ($win.Current.Name -like "*Example01_Source_Mirror_Probe.wdproj")) ("{0}; title '{1}'" -f (Frame), $win.Current.Name)
Check "the app never took the foreground" ((Foreground) -ne "APP") (Foreground)
}
finally {