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#
3.4 KB
Raw Blame
<!--
SPDX-License-Identifier: GPL-3.0-or-later
Copyright (C) 2026 Alexander Graef <[email protected]>

This file is part of WaveDude Next, a 2D wave simulator.

Based on the work of
  Jeroen Vleggaar (Huygens Optics), author of Wave Dude 2D, Copyright (C) 2026
    <https://www.youtube.com/@HuygensOptics>, <https://www.huygensoptics.com>
  0x23 (Diffraction Limited), author of WaveSimulator2D
    <https://www.youtube.com/@DiffractionLimited>, <https://github.com/0x23/WaveSimulator2D>

WaveDude Next is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or
<https://www.gnu.org/licenses/>.
-->

<UserControl x:Class="WaveDudeNext.WPF.Views.SimulationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:controls="clr-namespace:WaveDudeNext.WPF.Controls"
             xmlns:meta="clr-namespace:WaveDudeNext.WPF.Markup"
             xmlns:model="clr-namespace:WaveDudeNext.Model;assembly=WaveDudeNext">

	<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
		<StackPanel Margin="8">
			<Label Style="{StaticResource FormSection}" Content="{DynamicResource SectionRun}" />
			<controls:FormPanel>
				<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Simulation.Steps}" />
				<controls:NumberBox Text="{Binding Steps}" Minimum="1" Maximum="10000000" Increment="100" ToolTip="{meta:Hint model:Simulation.Steps}" />

				<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Simulation.VisualizeEvery}" />
				<controls:NumberBox Text="{Binding VisualizeEvery}" Minimum="1" Maximum="1000" ToolTip="{meta:Hint model:Simulation.VisualizeEvery}" />
			</controls:FormPanel>

			<Label Style="{StaticResource FormSection}" Content="{DynamicResource SectionSolver}" />
			<controls:FormPanel>
				<CheckBox controls:FormPanel.FullWidth="True" Content="{meta:Label model:Simulation.FourthOrderLaplacian}"
				          IsChecked="{Binding FourthOrderLaplacian}" ToolTip="{meta:Hint model:Simulation.FourthOrderLaplacian}" />

				<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Simulation.WaveSpeed}" />
				<controls:NumberBox Text="{Binding WaveSpeed}" Minimum="0.000001" Maximum="1000000" Increment="0.01" ToolTip="{meta:Hint model:Simulation.WaveSpeed}" />

				<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Simulation.TimeDecay}" />
				<controls:NumberBox Text="{Binding TimeDecay}" Minimum="1" Maximum="100" DragStep="0.1" Decimals="1" ToolTip="{meta:Hint model:Simulation.TimeDecay}" />

				<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Simulation.SourceFrequencyScale}" />
				<controls:NumberBox Text="{Binding SourceFrequencyScale}" Minimum="0" Maximum="1000" Increment="0.1" ToolTip="{meta:Hint model:Simulation.SourceFrequencyScale}" />

				<TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:Simulation.IntensityScale}" />
				<controls:NumberBox Text="{Binding IntensityScale}" Minimum="0.0000001" Maximum="1000000" Increment="0.1" ToolTip="{meta:Hint model:Simulation.IntensityScale}" />
			</controls:FormPanel>
		</StackPanel>
	</ScrollViewer>
</UserControl>