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#

Add the author's original VB.NET source (2D_wave_sim_V01)

Alexander Graefb609298a9a53
diff --git a/2D_wave_sim_V01/2D_wave_sim_V01.vbproj b/2D_wave_sim_V01/2D_wave_sim_V01.vbproj
new file mode 100644
index 0000000..b4d8b65
--- /dev/null
+++ b/2D_wave_sim_V01/2D_wave_sim_V01.vbproj
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{BF62C6CF-8723-482A-A1E9-784946CFD426}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <StartupObject>_2D_wave_sim_V01.My.MyApplication</StartupObject>
+ <RootNamespace>_2D_wave_sim_V01</RootNamespace>
+ <AssemblyName>Wave_Dude_2D</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <MyType>WindowsForms</MyType>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ <Deterministic>true</Deterministic>
+ <ApplicationIcon>AppIcon.ico</ApplicationIcon>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <PublishUrl>C:\Users\jeroen\Desktop\2D_wave_sim_install_V0.29\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>18</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <PublishWizardCompleted>true</PublishWizardCompleted>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <DefineDebug>false</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionExplicit>On</OptionExplicit>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionCompare>Binary</OptionCompare>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionStrict>Off</OptionStrict>
+ </PropertyGroup>
+ <PropertyGroup>
+ <OptionInfer>On</OptionInfer>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ <DebugSymbols>true</DebugSymbols>
+ <DefineDebug>true</DefineDebug>
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\x64\Debug\</OutputPath>
+ <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ <DefineTrace>true</DefineTrace>
+ <OutputPath>bin\x64\Release\</OutputPath>
+ <DocumentationFile>2D_wave_sim_V01.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ManifestCertificateThumbprint>6634F0CF201CA929A2D7FF58A91110314D7C750F</ManifestCertificateThumbprint>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ManifestKeyFile>2D_wave_sim_V01_TemporaryKey.pfx</ManifestKeyFile>
+ </PropertyGroup>
+ <PropertyGroup>
+ <GenerateManifests>true</GenerateManifests>
+ </PropertyGroup>
+ <PropertyGroup>
+ <SignManifests>true</SignManifests>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Web.Extensions" />
+ </ItemGroup>
+ <ItemGroup>
+ <Import Include="Microsoft.VisualBasic" />
+ <Import Include="System" />
+ <Import Include="System.Collections" />
+ <Import Include="System.Collections.Generic" />
+ <Import Include="System.Data" />
+ <Import Include="System.Drawing" />
+ <Import Include="System.Diagnostics" />
+ <Import Include="System.Windows.Forms" />
+ <Import Include="System.Linq" />
+ <Import Include="System.Xml.Linq" />
+ <Import Include="System.Threading.Tasks" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Form1.vb">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Form1.Designer.vb">
+ <DependentUpon>Form1.vb</DependentUpon>
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Form1.Probes.vb">
+ <DependentUpon>Form1.vb</DependentUpon>
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Form1.Source.vb">
+ <DependentUpon>Form1.vb</DependentUpon>
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="HelpForm.vb">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="HelpForm.Designer.vb">
+ <DependentUpon>HelpForm.vb</DependentUpon>
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="AboutForm.vb">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="AboutForm.Designer.vb">
+ <DependentUpon>AboutForm.vb</DependentUpon>
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="ColorSchemes\ColorScheme.vb" />
+ <Compile Include="ColorSchemes\ColorSchemeStore.vb" />
+ <Compile Include="ColorSchemes\ColorLut.vb" />
+ <Compile Include="ColorSchemes\ColorPickerControl.vb" />
+ <Compile Include="Projects\AppSettings.vb" />
+ <Compile Include="frmDescription.Designer.vb">
+ <DependentUpon>frmDescription.vb</DependentUpon>
+ </Compile>
+ <Compile Include="frmDescription.vb">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Projects\Project.vb" />
+ <Compile Include="Projects\ProjectConfig.vb" />
+ <Compile Include="Projects\ProjectStore.vb" />
+ <Compile Include="Projects\SceneSettings.vb" />
+ <Compile Include="Simulation\SimulationSettings.vb" />
+ <Compile Include="Simulation\SceneData.vb" />
+ <Compile Include="Simulation\IWaveEngine.vb" />
+ <Compile Include="Simulation\WaveSimulator.vb" />
+ <Compile Include="Simulation\OpenClApi.vb" />
+ <Compile Include="Simulation\GpuWaveSimulator.vb" />
+ <Compile Include="Simulation\FrameRenderer.vb" />
+ <Compile Include="Simulation\AviMjpegWriter.vb" />
+ <Compile Include="Simulation\FrameSink.vb" />
+ <Compile Include="Simulation\MfVideoWriter.vb" />
+ <Compile Include="Simulation\ProbeSettings.vb" />
+ <Compile Include="Simulation\ProbeSampling.vb" />
+ <Compile Include="Simulation\ProbeGraphPainter.vb" />
+ <Compile Include="Simulation\SourceSettings.vb" />
+ <Compile Include="Simulation\SimulationRunner.vb" />
+ <Compile Include="My Project\AssemblyInfo.vb" />
+ <Compile Include="My Project\Application.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Application.myapp</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\Resources.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="My Project\Settings.Designer.vb">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="AboutForm.resx">
+ <DependentUpon>AboutForm.vb</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Form1.resx">
+ <DependentUpon>Form1.vb</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="frmDescription.resx">
+ <DependentUpon>frmDescription.vb</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="HelpForm.resx">
+ <DependentUpon>HelpForm.vb</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="My Project\Resources.resx">
+ <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.vb</LastGenOutput>
+ <CustomToolNamespace>My.Resources</CustomToolNamespace>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="AppIcon.ico" />
+ <None Include="2D_wave_sim_V01_TemporaryKey.pfx" />
+ <None Include="My Project\Application.myapp">
+ <Generator>MyApplicationCodeGenerator</Generator>
+ <LastGenOutput>Application.Designer.vb</LastGenOutput>
+ </None>
+ <None Include="My Project\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <CustomToolNamespace>My</CustomToolNamespace>
+ <LastGenOutput>Settings.Designer.vb</LastGenOutput>
+ </None>
+ <None Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
+ <Visible>False</Visible>
+ <ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="ColorSchemeList\*.json">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Projects\inages\QR-code.png" />
+ <None Include="Resources\QR-code.png" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
+</Project>
\ No newline at end of file
diff --git a/2D_wave_sim_V01/2D_wave_sim_V01_TemporaryKey.pfx b/2D_wave_sim_V01/2D_wave_sim_V01_TemporaryKey.pfx
new file mode 100644
index 0000000..9cb213c
Binary files /dev/null and b/2D_wave_sim_V01/2D_wave_sim_V01_TemporaryKey.pfx differ
diff --git a/2D_wave_sim_V01/AboutForm.Designer.vb b/2D_wave_sim_V01/AboutForm.Designer.vb
new file mode 100644
index 0000000..319a49b
--- /dev/null
+++ b/2D_wave_sim_V01/AboutForm.Designer.vb
@@ -0,0 +1,201 @@
+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
+Partial Class AboutForm
+ Inherits System.Windows.Forms.Form
+
+ 'Form overrides dispose to clean up the component list.
+ <System.Diagnostics.DebuggerNonUserCode()> _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+ <System.Diagnostics.DebuggerStepThrough()> _
+ Private Sub InitializeComponent()
+ Me.picIcon = New System.Windows.Forms.PictureBox()
+ Me.lblTitle = New System.Windows.Forms.Label()
+ Me.lblVersion = New System.Windows.Forms.Label()
+ Me.lblDescription = New System.Windows.Forms.Label()
+ Me.lblCopyright = New System.Windows.Forms.Label()
+ Me.btnClose = New System.Windows.Forms.Button()
+ Me.Label1 = New System.Windows.Forms.Label()
+ Me.Label2 = New System.Windows.Forms.Label()
+ Me.Label3 = New System.Windows.Forms.Label()
+ Me.Label4 = New System.Windows.Forms.Label()
+ Me.picPaypallQR = New System.Windows.Forms.PictureBox()
+ Me.Label5 = New System.Windows.Forms.Label()
+ CType(Me.picIcon, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.picPaypallQR, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.SuspendLayout()
+ '
+ 'picIcon
+ '
+ Me.picIcon.Location = New System.Drawing.Point(20, 20)
+ Me.picIcon.Name = "picIcon"
+ Me.picIcon.Size = New System.Drawing.Size(48, 48)
+ Me.picIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
+ Me.picIcon.TabIndex = 0
+ Me.picIcon.TabStop = False
+ '
+ 'lblTitle
+ '
+ Me.lblTitle.AutoSize = True
+ Me.lblTitle.Font = New System.Drawing.Font("Segoe UI", 14.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblTitle.Location = New System.Drawing.Point(82, 18)
+ Me.lblTitle.Name = "lblTitle"
+ Me.lblTitle.Size = New System.Drawing.Size(143, 25)
+ Me.lblTitle.TabIndex = 1
+ Me.lblTitle.Text = "Wave Dude 2D"
+ '
+ 'lblVersion
+ '
+ Me.lblVersion.AutoSize = True
+ Me.lblVersion.Location = New System.Drawing.Point(84, 54)
+ Me.lblVersion.Name = "lblVersion"
+ Me.lblVersion.Size = New System.Drawing.Size(90, 18)
+ Me.lblVersion.TabIndex = 2
+ Me.lblVersion.Text = "Version 0.29"
+ '
+ 'lblDescription
+ '
+ Me.lblDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblDescription.Location = New System.Drawing.Point(15, 90)
+ Me.lblDescription.Name = "lblDescription"
+ Me.lblDescription.Size = New System.Drawing.Size(461, 28)
+ Me.lblDescription.TabIndex = 3
+ Me.lblDescription.Text = "Build a scene and watch waves do their thing!"
+ '
+ 'lblCopyright
+ '
+ Me.lblCopyright.AutoSize = True
+ Me.lblCopyright.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblCopyright.Location = New System.Drawing.Point(15, 507)
+ Me.lblCopyright.Name = "lblCopyright"
+ Me.lblCopyright.Size = New System.Drawing.Size(71, 18)
+ Me.lblCopyright.TabIndex = 4
+ Me.lblCopyright.Text = "Copyright"
+ '
+ 'btnClose
+ '
+ Me.btnClose.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
+ Me.btnClose.DialogResult = System.Windows.Forms.DialogResult.OK
+ Me.btnClose.Location = New System.Drawing.Point(319, 495)
+ Me.btnClose.Name = "btnClose"
+ Me.btnClose.Size = New System.Drawing.Size(90, 30)
+ Me.btnClose.TabIndex = 5
+ Me.btnClose.Text = "OK"
+ Me.btnClose.UseVisualStyleBackColor = True
+ '
+ 'Label1
+ '
+ Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label1.Location = New System.Drawing.Point(13, 254)
+ Me.Label1.Name = "Label1"
+ Me.Label1.Size = New System.Drawing.Size(392, 68)
+ Me.Label1.TabIndex = 3
+ Me.Label1.Text = "If you use this software and found it useful, consider making a donation to suppo" &
+ "rt future projects." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10)
+ '
+ 'Label2
+ '
+ Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label2.Location = New System.Drawing.Point(15, 128)
+ Me.Label2.Name = "Label2"
+ Me.Label2.Size = New System.Drawing.Size(394, 58)
+ Me.Label2.TabIndex = 3
+ Me.Label2.Text = "Developed by Huygens Optics / JJM Vleggaar with support of Claude Sonnet 5 (meani" &
+ "ng Claude did most of the heavy lifting and I get the credits). "
+ '
+ 'Label3
+ '
+ Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label3.Location = New System.Drawing.Point(12, 301)
+ Me.Label3.Name = "Label3"
+ Me.Label3.Size = New System.Drawing.Size(387, 46)
+ Me.Label3.TabIndex = 3
+ Me.Label3.Text = "Patreon: www.patreon.com/c/huygens_optics"
+ '
+ 'Label4
+ '
+ Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label4.Location = New System.Drawing.Point(16, 341)
+ Me.Label4.Name = "Label4"
+ Me.Label4.Size = New System.Drawing.Size(81, 46)
+ Me.Label4.TabIndex = 3
+ Me.Label4.Text = "Paypal:"
+ '
+ 'picPaypallQR
+ '
+ Me.picPaypallQR.Image = Global._2D_wave_sim_V01.My.Resources.Resources.QR_code
+ Me.picPaypallQR.Location = New System.Drawing.Point(121, 341)
+ Me.picPaypallQR.Name = "picPaypallQR"
+ Me.picPaypallQR.Size = New System.Drawing.Size(139, 135)
+ Me.picPaypallQR.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
+ Me.picPaypallQR.TabIndex = 6
+ Me.picPaypallQR.TabStop = False
+ '
+ 'Label5
+ '
+ Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label5.Location = New System.Drawing.Point(15, 199)
+ Me.Label5.Name = "Label5"
+ Me.Label5.Size = New System.Drawing.Size(392, 42)
+ Me.Label5.TabIndex = 3
+ Me.Label5.Text = "Send bugs or suggestions for improvement to : [email protected]"
+ '
+ 'AboutForm
+ '
+ Me.AcceptButton = Me.btnClose
+ Me.CancelButton = Me.btnClose
+ Me.ClientSize = New System.Drawing.Size(429, 545)
+ Me.Controls.Add(Me.picPaypallQR)
+ Me.Controls.Add(Me.btnClose)
+ Me.Controls.Add(Me.lblCopyright)
+ Me.Controls.Add(Me.Label2)
+ Me.Controls.Add(Me.Label4)
+ Me.Controls.Add(Me.Label3)
+ Me.Controls.Add(Me.Label5)
+ Me.Controls.Add(Me.Label1)
+ Me.Controls.Add(Me.lblDescription)
+ Me.Controls.Add(Me.lblVersion)
+ Me.Controls.Add(Me.lblTitle)
+ Me.Controls.Add(Me.picIcon)
+ Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
+ Me.MaximizeBox = False
+ Me.MinimizeBox = False
+ Me.Name = "AboutForm"
+ Me.ShowIcon = False
+ Me.ShowInTaskbar = False
+ Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
+ Me.Text = "About 2D Wave Dude "
+ CType(Me.picIcon, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.picPaypallQR, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+
+ Friend WithEvents picIcon As System.Windows.Forms.PictureBox
+ Friend WithEvents lblTitle As System.Windows.Forms.Label
+ Friend WithEvents lblVersion As System.Windows.Forms.Label
+ Friend WithEvents lblDescription As System.Windows.Forms.Label
+ Friend WithEvents lblCopyright As System.Windows.Forms.Label
+ Friend WithEvents btnClose As System.Windows.Forms.Button
+ Friend WithEvents Label1 As Label
+ Friend WithEvents Label2 As Label
+ Friend WithEvents Label3 As Label
+ Friend WithEvents Label4 As Label
+ Friend WithEvents picPaypallQR As PictureBox
+ Friend WithEvents Label5 As Label
+End Class
diff --git a/2D_wave_sim_V01/AboutForm.resx b/2D_wave_sim_V01/AboutForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/2D_wave_sim_V01/AboutForm.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
diff --git a/2D_wave_sim_V01/AboutForm.vb b/2D_wave_sim_V01/AboutForm.vb
new file mode 100644
index 0000000..12a67e6
--- /dev/null
+++ b/2D_wave_sim_V01/AboutForm.vb
@@ -0,0 +1,57 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Drawing
+
+''' <summary>
+''' The Info > About window: program name, version and a one-paragraph description. Designer-editable - the
+''' layout lives in AboutForm.Designer.vb, open with the Windows Forms Designer to move/resize things. This file
+''' only fills in the two pieces of text that aren't fixed at design time (the copyright string, read from the
+''' assembly) and loads the application icon. Opened from Form1's AboutToolStripMenuItem_Click.
+''' </summary>
+Public Class AboutForm
+
+ ''' <summary>Shown as the version - kept in sync by hand with Form1's title bar ("Wave Maker 2D V0.25"),
+ ''' since AssemblyInfo.vb's AssemblyVersion is left at the generic "1.0.0.0" and does not track it.</summary>
+ Private Const DisplayVersion As String = "0.27"
+
+ Public Sub New()
+ InitializeComponent()
+
+ lblVersion.Text = "Version " & DisplayVersion
+ lblCopyright.Text = My.Application.Info.Copyright
+
+ Try
+ Using ic As Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath)
+ If ic IsNot Nothing Then picIcon.Image = ic.ToBitmap()
+ End Using
+ Catch
+ ' no icon available (e.g. running outside a normal exe) - the picture box just stays empty
+ End Try
+ End Sub
+
+ Private Sub AboutForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+
+ End Sub
+
+
+End Class
diff --git a/2D_wave_sim_V01/App.config b/2D_wave_sim_V01/App.config
new file mode 100644
index 0000000..5534e28
--- /dev/null
+++ b/2D_wave_sim_V01/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+ </startup>
+</configuration>
\ No newline at end of file
diff --git a/2D_wave_sim_V01/AppIcon.ico b/2D_wave_sim_V01/AppIcon.ico
new file mode 100644
index 0000000..daf72c8
Binary files /dev/null and b/2D_wave_sim_V01/AppIcon.ico differ
diff --git a/2D_wave_sim_V01/ColorSchemeList/Blue_to_yellow_GNU.json b/2D_wave_sim_V01/ColorSchemeList/Blue_to_yellow_GNU.json
new file mode 100644
index 0000000..01d6d8a
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Blue_to_yellow_GNU.json
@@ -0,0 +1,42 @@
+{
+ "name": "Blue_to_yellow_GNU",
+ "origin": "matplotlib colormap gnuplot2, sampled at 255 points",
+ "category": "sequential",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [0,0,0], [0,0,4], [0,0,8], [0,0,12], [0,0,16], [0,0,20], [0,0,24], [0,0,28],
+ [0,0,32], [0,0,36], [0,0,40], [0,0,44], [0,0,48], [0,0,52], [0,0,56], [0,0,60],
+ [0,0,64], [0,0,68], [0,0,72], [0,0,76], [0,0,80], [0,0,84], [0,0,88], [0,0,92],
+ [0,0,96], [0,0,100], [0,0,104], [0,0,108], [0,0,112], [0,0,116], [0,0,120], [0,0,124],
+ [0,0,128], [0,0,131], [0,0,136], [0,0,140], [0,0,144], [0,0,147], [0,0,152], [0,0,156],
+ [0,0,160], [0,0,163], [0,0,168], [0,0,172], [0,0,176], [0,0,179], [0,0,184], [0,0,188],
+ [0,0,192], [0,0,195], [0,0,200], [0,0,204], [0,0,208], [0,0,211], [0,0,216], [0,0,220],
+ [0,0,224], [0,0,227], [0,0,232], [0,0,236], [0,0,240], [0,0,243], [0,0,248], [0,0,252],
+ [0,0,255], [3,0,255], [7,0,255], [10,0,255], [13,0,255], [16,0,255], [19,0,255], [22,0,255],
+ [25,0,255], [28,0,255], [32,0,255], [35,0,255], [38,0,255], [41,0,255], [44,0,255], [47,0,255],
+ [50,0,255], [53,0,255], [57,0,255], [60,0,255], [63,0,255], [66,0,255], [69,0,255], [72,0,255],
+ [75,0,255], [78,0,255], [82,0,255], [85,0,255], [88,0,255], [91,0,255], [94,0,255], [97,0,255],
+ [100,0,255], [103,0,255], [107,0,255], [110,0,255], [113,0,255], [116,0,255], [119,0,255], [122,0,255],
+ [125,0,255], [128,0,255], [132,0,255], [135,0,255], [138,1,253], [141,3,251], [144,5,249], [147,7,247],
+ [150,9,245], [153,11,243], [157,13,241], [160,15,239], [163,17,237], [166,19,235], [169,21,233], [172,23,231],
+ [175,25,229], [178,27,227], [182,29,225], [185,31,223], [188,33,221], [191,35,219], [194,37,217], [200,41,213],
+ [203,43,211], [207,45,209], [210,47,207], [213,49,205], [216,51,203], [219,53,201], [222,55,199], [225,57,197],
+ [228,59,195], [232,61,193], [235,63,191], [238,65,189], [241,67,187], [244,69,185], [247,71,183], [250,73,181],
+ [253,75,179], [255,77,177], [255,79,175], [255,81,173], [255,83,171], [255,85,169], [255,87,167], [255,89,165],
+ [255,91,163], [255,93,161], [255,95,159], [255,97,157], [255,99,155], [255,101,153], [255,103,151], [255,105,149],
+ [255,107,147], [255,109,145], [255,111,143], [255,113,141], [255,115,139], [255,117,137], [255,119,135], [255,121,133],
+ [255,123,131], [255,125,129], [255,127,127], [255,129,125], [255,131,123], [255,133,121], [255,135,119], [255,137,117],
+ [255,139,115], [255,141,113], [255,143,111], [255,145,109], [255,147,107], [255,149,105], [255,151,103], [255,153,101],
+ [255,155,99], [255,157,97], [255,159,95], [255,161,93], [255,163,91], [255,165,89], [255,167,87], [255,169,85],
+ [255,171,83], [255,173,81], [255,175,79], [255,177,77], [255,179,75], [255,181,73], [255,183,71], [255,185,69],
+ [255,187,67], [255,189,65], [255,191,63], [255,193,61], [255,195,59], [255,197,57], [255,199,55], [255,201,53],
+ [255,203,51], [255,205,49], [255,207,47], [255,209,45], [255,211,43], [255,213,41], [255,215,39], [255,217,37],
+ [255,219,35], [255,221,33], [255,223,31], [255,225,29], [255,227,27], [255,229,25], [255,231,23], [255,233,21],
+ [255,235,19], [255,237,17], [255,239,15], [255,241,13], [255,243,11], [255,245,9], [255,247,7], [255,249,5],
+ [255,251,3], [255,253,1], [255,255,4], [255,255,17], [255,255,29], [255,255,42], [255,255,54], [255,255,67],
+ [255,255,79], [255,255,92], [255,255,104], [255,255,117], [255,255,130], [255,255,142], [255,255,154], [255,255,167],
+ [255,255,179], [255,255,192], [255,255,204], [255,255,217], [255,255,230], [255,255,242], [255,255,255]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Bright_rainbow.json b/2D_wave_sim_V01/ColorSchemeList/Bright_rainbow.json
new file mode 100644
index 0000000..a745ae2
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Bright_rainbow.json
@@ -0,0 +1,43 @@
+{
+ "name": "Bright_rainbow",
+ "origin": "9-stop copy of scheme 'Bright_rainbow'",
+ "category": "custom",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[0,0,0], [128,5,182], [50,18,224], [32,164,224], [64,249,191], [96,240,109], [207,234,72], [252,168,29], [255,0,0]],
+ "colors": [
+ [0,0,0], [4,0,6], [8,0,11], [12,0,17], [16,1,23], [20,1,29], [24,1,34], [28,1,40],
+ [32,1,46], [36,1,52], [40,2,57], [44,2,63], [48,2,69], [52,2,75], [56,2,80], [60,2,86],
+ [65,3,92], [69,3,97], [73,3,103], [77,3,109], [81,3,115], [85,3,120], [89,3,126], [93,4,132],
+ [97,4,138], [101,4,143], [105,4,149], [109,4,155], [113,4,161], [117,5,166], [121,5,172], [125,5,178],
+ [127,5,182], [125,6,184], [122,6,185], [120,6,186], [118,7,188], [115,7,189], [113,8,190], [110,8,192],
+ [108,8,193], [105,9,194], [103,9,196], [100,10,197], [98,10,198], [95,10,200], [93,11,201], [91,11,202],
+ [88,12,203], [86,12,205], [83,12,206], [81,13,207], [78,13,209], [76,14,210], [73,14,211], [71,15,213],
+ [68,15,214], [66,15,215], [64,16,217], [61,16,218], [59,17,219], [56,17,221], [54,17,222], [51,18,223],
+ [50,20,224], [49,25,224], [49,29,224], [48,34,224], [47,39,224], [47,43,224], [46,48,224], [46,52,224],
+ [45,57,224], [45,62,224], [44,66,224], [43,71,224], [43,75,224], [42,80,224], [42,85,224], [41,89,224],
+ [41,94,224], [40,98,224], [40,103,224], [39,108,224], [38,112,224], [38,117,224], [37,121,224], [37,126,224],
+ [36,131,224], [36,135,224], [35,140,224], [34,144,224], [34,149,224], [33,154,224], [33,158,224], [32,163,224],
+ [33,166,223], [34,169,222], [35,171,221], [36,174,220], [37,177,219], [38,179,218], [39,182,217], [40,185,216],
+ [41,187,215], [42,190,214], [43,193,213], [44,195,212], [45,198,211], [46,201,210], [47,203,209], [48,206,208],
+ [49,209,207], [50,212,206], [51,214,205], [52,217,203], [53,220,202], [54,222,201], [55,225,200], [56,228,199],
+ [57,230,198], [58,233,197], [59,236,196], [60,238,195], [61,241,194], [62,244,193], [63,246,192], [64,249,191],
+ [65,249,188], [66,248,186], [67,248,183], [68,248,181], [69,248,178], [70,247,176], [71,247,173], [72,247,170],
+ [73,246,168], [74,246,165], [75,246,163], [76,246,160], [77,245,157], [78,245,155], [79,245,152], [80,244,150],
+ [81,244,147], [82,244,145], [83,244,142], [84,243,139], [85,243,137], [86,243,134], [87,242,132], [88,242,129],
+ [89,242,126], [90,242,124], [91,241,121], [92,241,119], [93,241,116], [94,240,114], [95,240,111], [97,240,109],
+ [100,240,108], [104,240,106], [107,239,105], [111,239,104], [114,239,103], [118,239,102], [121,239,101], [125,238,99],
+ [128,238,98], [132,238,97], [135,238,96], [139,238,95], [142,237,94], [146,237,92], [149,237,91], [153,237,90],
+ [156,237,89], [160,237,88], [163,236,87], [167,236,85], [170,236,84], [174,236,83], [177,236,82], [181,235,81],
+ [184,235,80], [188,235,78], [191,235,77], [195,235,76], [198,234,75], [202,234,74], [205,234,73], [208,233,71],
+ [209,231,70], [211,229,69], [212,227,67], [213,225,66], [215,223,65], [216,220,63], [218,218,62], [219,216,60],
+ [220,214,59], [222,212,58], [223,210,56], [225,208,55], [226,206,54], [228,204,52], [229,202,51], [230,200,50],
+ [232,198,48], [233,196,47], [235,193,46], [236,191,44], [237,189,43], [239,187,42], [240,185,40], [242,183,39],
+ [243,181,37], [245,179,36], [246,177,35], [247,175,33], [249,173,32], [250,171,31], [252,169,29], [252,164,28],
+ [252,159,27], [252,153,26], [252,148,26], [252,143,25], [253,138,24], [253,132,23], [253,127,22], [253,122,21],
+ [253,116,20], [253,111,19], [253,106,18], [253,101,17], [253,95,16], [253,90,16], [253,85,15], [254,79,14],
+ [254,74,13], [254,69,12], [254,63,11], [254,58,10], [254,53,9], [254,48,8], [254,42,7], [254,37,6],
+ [254,32,5], [255,26,5], [255,21,4], [255,16,3], [255,11,2], [255,5,1], [255,0,0]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Copper.json b/2D_wave_sim_V01/ColorSchemeList/Copper.json
new file mode 100644
index 0000000..ed36f93
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Copper.json
@@ -0,0 +1,42 @@
+{
+ "name": "Copper",
+ "origin": "matplotlib colormap copper, sampled at 255 points",
+ "category": "sequential",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [0,0,0], [1,0,0], [2,1,0], [3,2,1], [4,3,1], [6,3,2], [7,4,2], [8,5,3],
+ [9,6,3], [11,7,4], [12,7,4], [13,8,5], [14,9,5], [16,10,6], [17,10,6], [18,11,7],
+ [19,12,7], [20,13,8], [22,14,8], [23,14,9], [24,15,9], [25,16,10], [27,17,10], [28,17,11],
+ [29,18,11], [30,19,12], [32,20,12], [33,21,13], [34,21,13], [35,22,14], [37,23,14], [38,24,15],
+ [39,24,15], [40,25,16], [41,26,16], [43,27,17], [44,28,17], [45,28,18], [46,29,18], [48,30,19],
+ [49,31,19], [50,32,20], [51,32,20], [53,33,21], [54,34,21], [55,35,22], [56,35,22], [58,36,23],
+ [59,37,23], [60,38,24], [61,39,24], [62,39,25], [64,40,25], [65,41,26], [66,42,26], [67,42,27],
+ [69,43,27], [70,44,28], [71,45,28], [72,46,29], [74,46,29], [75,47,30], [76,48,30], [77,49,31],
+ [79,49,31], [80,50,32], [81,51,32], [82,52,33], [83,53,33], [85,53,34], [86,54,34], [87,55,35],
+ [88,56,35], [90,57,36], [91,57,36], [92,58,37], [93,59,37], [95,60,38], [96,60,38], [97,61,39],
+ [98,62,39], [100,63,40], [101,64,40], [102,64,41], [103,65,41], [104,66,42], [106,67,42], [107,67,43],
+ [108,68,43], [109,69,44], [111,70,44], [112,71,45], [113,71,45], [114,72,46], [116,73,46], [117,74,47],
+ [118,74,47], [119,75,48], [121,76,48], [122,77,49], [123,78,49], [124,78,50], [125,79,50], [127,80,51],
+ [128,81,51], [129,82,52], [130,82,52], [132,83,53], [133,84,53], [134,85,54], [135,85,54], [137,86,55],
+ [138,87,55], [139,88,56], [140,89,56], [142,89,57], [143,90,57], [144,91,58], [145,92,58], [146,92,59],
+ [148,93,59], [149,94,60], [150,95,60], [151,96,61], [153,96,61], [154,97,62], [155,98,62], [158,99,63],
+ [159,100,64], [160,101,64], [161,102,65], [163,103,65], [164,103,66], [165,104,66], [166,105,67], [167,106,67],
+ [169,107,68], [170,107,68], [171,108,69], [172,109,69], [174,110,70], [175,110,70], [176,111,71], [177,112,71],
+ [179,113,72], [180,114,72], [181,114,73], [182,115,73], [184,116,74], [185,117,74], [186,117,75], [187,118,75],
+ [188,119,76], [190,120,76], [191,121,77], [192,121,77], [193,122,78], [195,123,78], [196,124,79], [197,124,79],
+ [198,125,80], [200,126,80], [201,127,81], [202,128,81], [203,128,82], [205,129,82], [206,130,83], [207,131,83],
+ [208,132,84], [209,132,84], [211,133,85], [212,134,85], [213,135,86], [214,135,86], [216,136,87], [217,137,87],
+ [218,138,88], [219,139,88], [221,139,89], [222,140,89], [223,141,90], [224,142,90], [226,142,91], [227,143,91],
+ [228,144,92], [229,145,92], [230,146,93], [232,146,93], [233,147,94], [234,148,94], [235,149,95], [237,149,95],
+ [238,150,96], [239,151,96], [240,152,97], [242,153,97], [243,153,98], [244,154,98], [245,155,99], [247,156,99],
+ [248,157,99], [249,157,100], [250,158,100], [251,159,101], [253,160,101], [254,160,102], [255,161,102], [255,162,103],
+ [255,163,103], [255,164,104], [255,164,104], [255,165,105], [255,166,105], [255,167,106], [255,167,106], [255,168,107],
+ [255,169,107], [255,170,108], [255,171,108], [255,171,109], [255,172,109], [255,173,110], [255,174,110], [255,174,111],
+ [255,175,111], [255,176,112], [255,177,112], [255,178,113], [255,178,113], [255,179,114], [255,180,114], [255,181,115],
+ [255,182,115], [255,182,116], [255,183,116], [255,184,117], [255,185,117], [255,185,118], [255,186,118], [255,187,119],
+ [255,188,119], [255,189,120], [255,189,120], [255,190,121], [255,191,121], [255,192,122], [255,192,122], [255,193,123],
+ [255,194,123], [255,195,124], [255,196,124], [255,196,125], [255,197,125], [255,198,126], [255,199,126]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Default_Field.json b/2D_wave_sim_V01/ColorSchemeList/Default_Field.json
new file mode 100644
index 0000000..a204ce4
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Default_Field.json
@@ -0,0 +1,43 @@
+{
+ "name": "Default_Field",
+ "origin": "9-stop copy of scheme 'Default_Field'",
+ "category": "custom",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[253,253,253], [48,32,244], [22,11,210], [26,24,170], [0,0,0], [119,2,2], [191,21,21], [251,59,59], [255,255,255]],
+ "colors": [
+ [253,253,253], [247,246,253], [240,239,252], [234,232,252], [227,225,252], [221,218,252], [214,211,251], [208,204,251],
+ [201,197,251], [195,190,250], [188,183,250], [182,176,250], [176,169,250], [169,163,249], [163,156,249], [156,149,249],
+ [150,142,248], [143,135,248], [137,128,248], [130,121,248], [124,114,247], [117,107,247], [111,100,247], [104,93,246],
+ [98,86,246], [92,79,246], [85,72,246], [79,65,245], [72,58,245], [66,51,245], [59,44,244], [53,37,244],
+ [48,32,244], [47,31,243], [46,31,242], [45,30,241], [45,29,239], [44,29,238], [43,28,237], [42,27,236],
+ [41,27,235], [40,26,234], [40,25,233], [39,25,232], [38,24,231], [37,23,230], [36,23,229], [36,22,228],
+ [35,21,227], [34,21,226], [33,20,224], [32,19,223], [31,19,222], [31,18,221], [30,17,220], [29,17,219],
+ [28,16,218], [27,15,217], [27,15,216], [26,14,215], [25,13,214], [24,13,213], [23,12,212], [22,11,211],
+ [22,11,209], [22,12,208], [22,12,207], [22,12,206], [23,13,204], [23,13,203], [23,14,202], [23,14,201],
+ [23,14,199], [23,15,198], [23,15,197], [23,16,196], [24,16,194], [24,17,193], [24,17,192], [24,17,190],
+ [24,18,189], [24,18,188], [24,19,187], [24,19,185], [25,19,184], [25,20,183], [25,20,182], [25,21,180],
+ [25,21,179], [25,21,178], [25,22,177], [25,22,175], [26,23,174], [26,23,173], [26,23,172], [26,24,170],
+ [25,23,166], [25,23,161], [24,22,155], [23,21,150], [22,20,145], [21,20,139], [20,19,134], [20,18,129],
+ [19,17,123], [18,17,118], [17,16,112], [16,15,107], [16,14,102], [15,14,96], [14,13,91], [13,12,86],
+ [12,11,80], [11,11,75], [11,10,70], [10,9,64], [9,8,59], [8,8,54], [7,7,48], [7,6,43],
+ [6,5,37], [5,5,32], [4,4,27], [3,3,21], [2,2,16], [2,2,11], [1,1,5], [0,0,0],
+ [4,0,0], [7,0,0], [11,0,0], [15,0,0], [19,0,0], [22,0,0], [26,0,0], [30,1,1],
+ [34,1,1], [37,1,1], [41,1,1], [45,1,1], [49,1,1], [52,1,1], [56,1,1], [60,1,1],
+ [64,1,1], [67,1,1], [71,1,1], [75,1,1], [79,1,1], [82,1,1], [86,1,1], [90,2,2],
+ [94,2,2], [97,2,2], [101,2,2], [105,2,2], [109,2,2], [112,2,2], [116,2,2], [120,2,2],
+ [122,3,3], [124,3,3], [126,4,4], [129,5,5], [131,5,5], [133,6,6], [135,6,6], [138,7,7],
+ [140,8,8], [142,8,8], [145,9,9], [147,9,9], [149,10,10], [151,11,11], [154,11,11], [156,12,12],
+ [158,12,12], [160,13,13], [163,14,14], [165,14,14], [167,15,15], [169,15,15], [172,16,16], [174,17,17],
+ [176,17,17], [179,18,18], [181,18,18], [183,19,19], [185,20,20], [188,20,20], [190,21,21], [192,22,22],
+ [194,23,23], [196,24,24], [198,25,25], [200,26,26], [201,28,28], [203,29,29], [205,30,30], [207,31,31],
+ [209,32,32], [211,34,34], [213,35,35], [215,36,36], [217,37,37], [218,38,38], [220,40,40], [222,41,41],
+ [224,42,42], [226,43,43], [228,44,44], [230,46,46], [232,47,47], [234,48,48], [235,49,49], [237,50,50],
+ [239,52,52], [241,53,53], [243,54,54], [245,55,55], [247,56,56], [249,58,58], [251,59,59], [251,64,64],
+ [251,70,70], [251,76,76], [251,82,82], [252,88,88], [252,94,94], [252,101,101], [252,107,107], [252,113,113],
+ [252,119,119], [252,125,125], [252,132,132], [253,138,138], [253,144,144], [253,150,150], [253,156,156], [253,162,162],
+ [253,169,169], [253,175,175], [253,181,181], [254,187,187], [254,193,193], [254,199,199], [254,206,206], [254,212,212],
+ [254,218,218], [254,224,224], [254,230,230], [255,236,236], [255,243,243], [255,249,249], [255,255,255]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Default_Intensity.json b/2D_wave_sim_V01/ColorSchemeList/Default_Intensity.json
new file mode 100644
index 0000000..d492198
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Default_Intensity.json
@@ -0,0 +1,43 @@
+{
+ "name": "Default_Intensity",
+ "origin": "9-stop copy of scheme 'rainbow_JV'",
+ "category": "custom",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[0,0,0], [14,68,148], [33,172,222], [32,224,211], [33,246,61], [242,249,77], [234,179,72], [240,77,29], [255,0,0]],
+ "colors": [
+ [0,0,0], [0,2,5], [1,4,9], [1,6,14], [2,9,19], [2,11,23], [3,13,28], [3,15,33],
+ [4,17,37], [4,19,42], [4,21,47], [5,24,51], [5,26,56], [6,28,61], [6,30,65], [7,32,70],
+ [7,34,75], [7,36,79], [8,39,84], [8,41,89], [9,43,93], [9,45,98], [10,47,103], [10,49,107],
+ [11,51,112], [11,54,117], [11,56,121], [12,58,126], [12,60,131], [13,62,135], [13,64,140], [14,66,145],
+ [14,69,149], [15,72,151], [15,75,153], [16,79,156], [17,82,158], [17,85,160], [18,88,163], [18,92,165],
+ [19,95,167], [20,98,170], [20,102,172], [21,105,174], [21,108,177], [22,111,179], [23,115,181], [23,118,184],
+ [24,121,186], [24,125,188], [25,128,191], [26,131,193], [26,134,195], [27,138,198], [27,141,200], [28,144,202],
+ [29,147,205], [29,151,207], [30,154,209], [30,157,212], [31,161,214], [32,164,216], [32,167,219], [33,170,221],
+ [33,173,222], [33,174,221], [33,176,221], [33,178,221], [33,179,220], [33,181,220], [33,183,220], [33,184,219],
+ [33,186,219], [33,188,219], [33,189,218], [33,191,218], [33,192,218], [33,194,217], [33,196,217], [33,197,217],
+ [32,199,216], [32,201,216], [32,202,216], [32,204,215], [32,206,215], [32,207,215], [32,209,214], [32,210,214],
+ [32,212,214], [32,214,213], [32,215,213], [32,217,212], [32,219,212], [32,220,212], [32,222,211], [32,224,211],
+ [32,225,207], [32,225,203], [32,226,198], [32,227,193], [32,227,189], [32,228,184], [32,229,179], [32,229,174],
+ [32,230,170], [32,231,165], [32,231,160], [32,232,155], [32,233,151], [32,234,146], [32,234,141], [32,235,137],
+ [33,236,132], [33,236,127], [33,237,122], [33,238,118], [33,238,113], [33,239,108], [33,240,104], [33,240,99],
+ [33,241,94], [33,242,89], [33,243,85], [33,243,80], [33,244,75], [33,245,70], [33,245,66], [33,246,61],
+ [40,246,62], [46,246,62], [53,246,63], [59,246,63], [66,246,64], [72,247,64], [79,247,65], [86,247,65],
+ [92,247,66], [99,247,66], [105,247,67], [112,247,67], [119,247,68], [125,247,68], [132,247,69], [138,248,69],
+ [145,248,70], [151,248,70], [158,248,71], [165,248,71], [171,248,72], [178,248,72], [184,248,73], [191,248,73],
+ [198,248,74], [204,248,74], [211,249,75], [217,249,75], [224,249,76], [230,249,76], [237,249,77], [242,248,77],
+ [242,246,77], [241,244,77], [241,242,76], [241,240,76], [241,237,76], [240,235,76], [240,233,76], [240,231,76],
+ [240,229,76], [239,226,75], [239,224,75], [239,222,75], [239,220,75], [238,218,75], [238,215,75], [238,213,74],
+ [238,211,74], [237,209,74], [237,207,74], [237,204,74], [237,202,74], [236,200,73], [236,198,73], [236,196,73],
+ [236,193,73], [235,191,73], [235,189,73], [235,187,73], [235,185,72], [234,182,72], [234,180,72], [234,177,71],
+ [234,174,70], [234,171,69], [235,168,67], [235,165,66], [235,161,65], [235,158,63], [235,155,62], [236,152,60],
+ [236,148,59], [236,145,58], [236,142,56], [236,139,55], [237,136,54], [237,132,52], [237,129,51], [237,126,50],
+ [237,123,48], [237,120,47], [238,116,46], [238,113,44], [238,110,43], [238,107,42], [238,104,40], [239,100,39],
+ [239,97,37], [239,94,36], [239,91,35], [239,87,33], [240,84,32], [240,81,31], [240,78,29], [240,75,28],
+ [241,73,27], [241,70,26], [242,68,26], [242,65,25], [243,63,24], [243,61,23], [244,58,22], [244,56,21],
+ [245,53,20], [245,51,19], [246,49,18], [246,46,17], [246,44,16], [247,41,16], [247,39,15], [248,36,14],
+ [248,34,13], [249,32,12], [249,29,11], [250,27,10], [250,24,9], [251,22,8], [251,19,7], [252,17,6],
+ [252,15,5], [253,12,5], [253,10,4], [254,7,3], [254,5,2], [255,2,1], [255,0,0]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Flare_inv.json b/2D_wave_sim_V01/ColorSchemeList/Flare_inv.json
new file mode 100644
index 0000000..5a592c2
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Flare_inv.json
@@ -0,0 +1,42 @@
+{
+ "name": "Flare_inv",
+ "origin": "matplotlib colormap flare, sampled at 255 points",
+ "category": "sequential",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [236,175,128], [236,174,127], [236,173,127], [236,172,126], [236,171,126], [236,170,125], [236,169,124], [236,168,124],
+ [236,167,123], [236,166,123], [236,166,122], [236,165,121], [235,164,121], [235,163,120], [235,162,120], [235,161,119],
+ [235,160,118], [235,159,118], [235,158,117], [235,157,117], [235,156,116], [235,155,116], [235,154,115], [234,153,114],
+ [234,152,114], [234,151,113], [234,150,113], [234,149,112], [234,148,111], [234,147,111], [234,146,110], [234,145,110],
+ [233,144,109], [233,143,109], [233,142,108], [233,141,107], [233,140,107], [233,139,106], [233,138,106], [233,137,105],
+ [232,136,105], [232,135,104], [232,134,103], [232,133,103], [232,132,102], [232,131,102], [232,130,101], [232,129,101],
+ [231,128,100], [231,127,100], [231,126,99], [231,125,99], [231,124,98], [231,123,98], [230,122,98], [230,121,97],
+ [230,120,97], [230,119,96], [230,118,96], [229,118,96], [229,117,95], [229,116,95], [229,115,95], [229,114,94],
+ [228,113,94], [228,112,94], [228,111,93], [228,110,93], [227,109,93], [227,108,93], [227,107,92], [227,106,92],
+ [226,105,92], [226,104,92], [226,103,92], [225,102,92], [225,101,91], [225,100,91], [224,99,91], [224,98,91],
+ [224,97,91], [223,96,91], [223,95,91], [223,94,91], [222,93,91], [222,92,91], [221,91,91], [221,90,91],
+ [221,89,91], [220,89,92], [220,88,92], [219,87,92], [219,86,92], [218,85,92], [218,84,92], [217,83,93],
+ [217,83,93], [216,82,93], [215,81,93], [215,80,94], [214,79,94], [214,79,94], [213,78,94], [212,77,95],
+ [212,77,95], [211,76,95], [211,75,96], [210,75,96], [209,74,96], [208,73,97], [208,73,97], [207,72,97],
+ [206,71,98], [206,71,98], [205,70,98], [204,70,99], [203,69,99], [202,69,99], [202,68,100], [201,68,100],
+ [200,67,101], [199,67,101], [198,66,101], [197,66,102], [197,66,102], [196,65,102], [195,65,103], [193,64,103],
+ [192,64,104], [191,63,104], [190,63,104], [189,63,104], [188,63,105], [187,62,105], [186,62,105], [186,62,105],
+ [185,61,106], [184,61,106], [183,61,106], [182,61,106], [181,60,107], [180,60,107], [179,60,107], [178,60,107],
+ [177,59,108], [176,59,108], [175,59,108], [174,59,108], [173,58,108], [172,58,109], [171,58,109], [170,58,109],
+ [169,57,109], [168,57,109], [168,57,110], [167,57,110], [166,56,110], [165,56,110], [164,56,110], [163,56,110],
+ [162,55,110], [161,55,111], [160,55,111], [159,55,111], [158,54,111], [157,54,111], [156,54,111], [155,54,111],
+ [154,53,111], [154,53,111], [153,53,112], [152,53,112], [151,52,112], [150,52,112], [149,52,112], [148,52,112],
+ [147,51,112], [146,51,112], [145,51,112], [144,51,112], [143,50,112], [142,50,112], [141,50,112], [141,50,112],
+ [140,49,112], [139,49,112], [138,49,112], [137,49,112], [136,48,112], [135,48,112], [134,48,112], [133,48,112],
+ [132,48,112], [131,47,112], [130,47,112], [129,47,112], [128,47,112], [127,47,112], [126,46,112], [126,46,112],
+ [125,46,111], [124,46,111], [123,46,111], [122,45,111], [121,45,111], [120,45,111], [119,45,111], [118,45,110],
+ [117,44,110], [116,44,110], [115,44,110], [114,44,110], [113,44,109], [112,44,109], [111,43,109], [110,43,109],
+ [109,43,109], [108,43,108], [108,43,108], [107,43,108], [106,42,108], [105,42,107], [104,42,107], [103,42,107],
+ [102,42,107], [101,41,106], [100,41,106], [99,41,106], [98,41,105], [97,41,105], [96,40,105], [95,40,104],
+ [94,40,104], [93,40,104], [93,40,104], [92,39,103], [91,39,103], [90,39,103], [89,39,102], [88,38,102],
+ [87,38,102], [86,38,101], [85,38,101], [84,38,101], [83,37,100], [82,37,100], [82,37,100], [81,36,100],
+ [80,36,99], [79,36,99], [78,36,99], [77,35,98], [76,35,98], [75,35,98], [74,34,98]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Gray_scales.json b/2D_wave_sim_V01/ColorSchemeList/Gray_scales.json
new file mode 100644
index 0000000..73e8ba1
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Gray_scales.json
@@ -0,0 +1,43 @@
+{
+ "name": "Gray_scales",
+ "origin": "9-stop copy of scheme 'Gray scales'",
+ "category": "custom",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[0,0,0], [35,35,35], [98,98,98], [135,134,134], [159,159,159], [185,185,185], [210,210,210], [235,235,235], [255,255,255]],
+ "colors": [
+ [0,0,0], [1,1,1], [2,2,2], [3,3,3], [4,4,4], [6,6,6], [7,7,7], [8,8,8],
+ [9,9,9], [10,10,10], [11,11,11], [12,12,12], [13,13,13], [14,14,14], [15,15,15], [17,17,17],
+ [18,18,18], [19,19,19], [20,20,20], [21,21,21], [22,22,22], [23,23,23], [24,24,24], [25,25,25],
+ [26,26,26], [28,28,28], [29,29,29], [30,30,30], [31,31,31], [32,32,32], [33,33,33], [34,34,34],
+ [35,35,35], [37,37,37], [39,39,39], [41,41,41], [43,43,43], [45,45,45], [47,47,47], [49,49,49],
+ [51,51,51], [53,53,53], [55,55,55], [57,57,57], [59,59,59], [61,61,61], [63,63,63], [65,65,65],
+ [67,67,67], [69,69,69], [71,71,71], [73,73,73], [75,75,75], [77,77,77], [79,79,79], [81,81,81],
+ [83,83,83], [85,85,85], [87,87,87], [89,89,89], [91,91,91], [93,93,93], [95,95,95], [97,97,97],
+ [99,99,99], [100,100,100], [101,101,101], [102,102,102], [103,103,103], [104,104,104], [106,105,105], [107,107,107],
+ [108,108,108], [109,109,109], [110,110,110], [111,111,111], [113,112,112], [114,113,113], [115,114,114], [116,116,116],
+ [117,117,117], [118,118,118], [120,119,119], [121,120,120], [122,121,121], [123,122,122], [124,124,124], [125,125,125],
+ [127,126,126], [128,127,127], [129,128,128], [130,129,129], [131,130,130], [132,131,131], [134,133,133], [135,134,134],
+ [136,135,135], [136,135,135], [137,136,136], [138,137,137], [139,138,138], [139,139,139], [140,139,139], [141,140,140],
+ [142,141,141], [142,142,142], [143,142,142], [144,143,143], [145,144,144], [145,145,145], [146,146,146], [147,146,146],
+ [148,147,147], [148,148,148], [149,149,149], [150,150,150], [151,150,150], [151,151,151], [152,152,152], [153,153,153],
+ [154,153,153], [154,154,154], [155,155,155], [156,156,156], [157,157,157], [157,157,157], [158,158,158], [159,159,159],
+ [160,160,160], [161,161,161], [161,161,161], [162,162,162], [163,163,163], [164,164,164], [165,165,165], [166,166,166],
+ [166,166,166], [167,167,167], [168,168,168], [169,169,169], [170,170,170], [170,170,170], [171,171,171], [172,172,172],
+ [173,173,173], [174,174,174], [175,175,175], [175,175,175], [176,176,176], [177,177,177], [178,178,178], [179,179,179],
+ [179,179,179], [180,180,180], [181,181,181], [182,182,182], [183,183,183], [184,184,184], [184,184,184], [185,185,185],
+ [186,186,186], [187,187,187], [188,188,188], [188,188,188], [189,189,189], [190,190,190], [191,191,191], [191,191,191],
+ [192,192,192], [193,193,193], [194,194,194], [195,195,195], [195,195,195], [196,196,196], [197,197,197], [198,198,198],
+ [199,199,199], [199,199,199], [200,200,200], [201,201,201], [202,202,202], [203,203,203], [203,203,203], [204,204,204],
+ [205,205,205], [206,206,206], [206,206,206], [207,207,207], [208,208,208], [209,209,209], [210,210,210], [210,210,210],
+ [211,211,211], [212,212,212], [213,213,213], [214,214,214], [214,214,214], [215,215,215], [216,216,216], [217,217,217],
+ [217,217,217], [218,218,218], [219,219,219], [220,220,220], [221,221,221], [221,221,221], [222,222,222], [223,223,223],
+ [224,224,224], [225,225,225], [225,225,225], [226,226,226], [227,227,227], [228,228,228], [229,229,229], [229,229,229],
+ [230,230,230], [231,231,231], [232,232,232], [232,232,232], [233,233,233], [234,234,234], [235,235,235], [235,235,235],
+ [236,236,236], [237,237,237], [237,237,237], [238,238,238], [239,239,239], [239,239,239], [240,240,240], [241,241,241],
+ [241,241,241], [242,242,242], [242,242,242], [243,243,243], [244,244,244], [244,244,244], [245,245,245], [246,246,246],
+ [246,246,246], [247,247,247], [247,247,247], [248,248,248], [249,249,249], [249,249,249], [250,250,250], [251,251,251],
+ [251,251,251], [252,252,252], [252,252,252], [253,253,253], [254,254,254], [254,254,254], [255,255,255]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Gray_scales_inv.json b/2D_wave_sim_V01/ColorSchemeList/Gray_scales_inv.json
new file mode 100644
index 0000000..80793be
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Gray_scales_inv.json
@@ -0,0 +1,43 @@
+{
+ "name": "Gray_scales_inv",
+ "origin": "9-stop copy of scheme 'Gray scales'",
+ "category": "custom",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[252,251,251], [226,223,223], [200,198,198], [171,170,170], [136,135,135], [101,101,101], [71,70,70], [29,29,29], [0,0,0]],
+ "colors": [
+ [252,251,251], [251,250,250], [250,249,249], [250,248,248], [249,247,247], [248,247,247], [247,246,246], [246,245,245],
+ [245,244,244], [245,243,243], [244,242,242], [243,241,241], [242,240,240], [241,240,240], [241,239,239], [240,238,238],
+ [239,237,237], [238,236,236], [237,235,235], [236,234,234], [236,233,233], [235,232,232], [234,232,232], [233,231,231],
+ [232,230,230], [232,229,229], [231,228,228], [230,227,227], [229,226,226], [228,225,225], [227,225,225], [227,224,224],
+ [226,223,223], [225,222,222], [224,221,221], [223,220,220], [223,220,220], [222,219,219], [221,218,218], [220,217,217],
+ [219,217,217], [218,216,216], [218,215,215], [217,214,214], [216,213,213], [215,213,213], [214,212,212], [214,211,211],
+ [213,210,210], [212,209,209], [211,209,209], [210,208,208], [209,207,207], [209,206,206], [208,205,205], [207,205,205],
+ [206,204,204], [205,203,203], [205,202,202], [204,202,202], [203,201,201], [202,200,200], [201,199,199], [200,198,198],
+ [200,198,198], [199,197,197], [198,196,196], [197,195,195], [196,194,194], [195,193,193], [194,192,192], [193,191,191],
+ [192,191,191], [191,190,190], [190,189,189], [189,188,188], [189,187,187], [188,186,186], [187,185,185], [186,184,184],
+ [185,183,183], [184,183,183], [183,182,182], [182,181,181], [181,180,180], [180,179,179], [179,178,178], [179,177,177],
+ [178,176,176], [177,176,176], [176,175,175], [175,174,174], [174,173,173], [173,172,172], [172,171,171], [171,170,170],
+ [170,169,169], [169,168,168], [168,167,167], [167,166,166], [166,165,165], [165,164,164], [164,163,163], [162,161,161],
+ [161,160,160], [160,159,159], [159,158,158], [158,157,157], [157,156,156], [156,155,155], [155,154,154], [154,153,153],
+ [153,152,152], [151,150,150], [150,149,149], [149,148,148], [148,147,147], [147,146,146], [146,145,145], [145,144,144],
+ [144,143,143], [143,142,142], [142,141,141], [140,139,139], [139,138,138], [138,137,137], [137,136,136], [136,135,135],
+ [135,134,134], [134,133,133], [133,132,132], [132,131,131], [130,130,130], [129,129,129], [128,128,128], [127,126,126],
+ [126,125,125], [125,124,124], [124,123,123], [123,122,122], [122,121,121], [121,120,120], [119,119,119], [118,118,118],
+ [117,117,117], [116,116,116], [115,115,115], [114,114,114], [113,113,113], [112,111,111], [111,110,110], [110,109,109],
+ [108,108,108], [107,107,107], [106,106,106], [105,105,105], [104,104,104], [103,103,103], [102,102,102], [101,101,101],
+ [100,100,100], [99,99,99], [98,98,98], [97,97,97], [96,96,96], [95,95,95], [94,94,94], [93,93,93],
+ [92,92,92], [91,91,91], [90,90,90], [89,89,89], [88,88,88], [88,87,87], [87,86,86], [86,85,85],
+ [85,84,84], [84,83,83], [83,82,82], [82,81,81], [81,80,80], [80,79,79], [79,78,78], [78,77,77],
+ [77,76,76], [76,75,75], [75,74,74], [74,73,73], [73,72,72], [72,71,71], [71,70,70], [70,69,69],
+ [69,68,68], [68,67,67], [66,65,65], [65,64,64], [64,63,63], [62,62,62], [61,60,60], [60,59,59],
+ [58,58,58], [57,56,56], [56,55,55], [54,54,54], [53,53,53], [52,51,51], [50,50,50], [49,49,49],
+ [48,47,47], [47,46,46], [45,45,45], [44,44,44], [43,42,42], [41,41,41], [40,40,40], [39,38,38],
+ [37,37,37], [36,36,36], [35,34,34], [33,33,33], [32,32,32], [31,31,31], [29,29,29], [28,28,28],
+ [27,27,27], [26,26,26], [26,26,26], [25,25,25], [24,24,24], [23,23,23], [22,22,22], [21,21,21],
+ [20,20,20], [19,19,19], [18,18,18], [17,17,17], [16,16,16], [16,16,16], [15,15,15], [14,14,14],
+ [13,13,13], [12,12,12], [11,11,11], [10,10,10], [9,9,9], [8,8,8], [7,7,7], [6,6,6],
+ [5,5,5], [5,5,5], [4,4,4], [3,3,3], [2,2,2], [1,1,1], [0,0,0]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Green_blue.json b/2D_wave_sim_V01/ColorSchemeList/Green_blue.json
new file mode 100644
index 0000000..444c5b0
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Green_blue.json
@@ -0,0 +1,43 @@
+{
+ "name": "Green_blue",
+ "origin": "9-stop copy of scheme 'afmhot (5-stop)'",
+ "category": "custom",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[255,250,250], [89,96,246], [35,49,220], [3,27,164], [0,0,0], [2,127,6], [27,197,42], [78,245,86], [255,255,255]],
+ "colors": [
+ [255,250,250], [250,245,250], [245,240,250], [239,235,250], [234,231,249], [229,226,249], [224,221,249], [218,216,249],
+ [213,211,249], [208,206,249], [203,201,249], [197,197,249], [192,192,248], [187,187,248], [182,182,248], [177,177,248],
+ [171,172,248], [166,168,248], [161,163,248], [156,158,248], [150,153,247], [145,148,247], [140,143,247], [135,138,247],
+ [130,134,247], [124,129,247], [119,124,247], [114,119,247], [109,114,246], [103,109,246], [98,104,246], [93,100,246],
+ [89,96,246], [87,94,245], [85,93,244], [83,91,243], [82,90,243], [80,88,242], [78,87,241], [77,85,240],
+ [75,84,239], [73,82,238], [72,81,238], [70,79,237], [68,78,236], [66,76,235], [65,75,234], [63,73,234],
+ [61,72,233], [60,70,232], [58,69,231], [56,68,230], [55,66,229], [53,65,229], [51,63,228], [49,62,227],
+ [48,60,226], [46,59,225], [44,57,225], [43,56,224], [41,54,223], [39,53,222], [38,51,221], [36,50,220],
+ [34,49,219], [33,48,217], [32,47,216], [31,47,214], [30,46,212], [29,45,210], [28,44,209], [27,44,207],
+ [26,43,205], [25,42,203], [24,42,201], [23,41,200], [22,40,198], [21,40,196], [20,39,194], [19,38,193],
+ [18,38,191], [17,37,189], [16,36,187], [15,35,186], [14,35,184], [13,34,182], [12,33,180], [11,33,179],
+ [10,32,177], [9,31,175], [8,31,173], [7,30,171], [6,29,170], [5,29,168], [4,28,166], [3,27,164],
+ [3,26,160], [3,26,155], [3,25,150], [3,24,145], [3,23,139], [2,22,134], [2,21,129], [2,20,124],
+ [2,20,119], [2,19,114], [2,18,108], [2,17,103], [2,16,98], [2,15,93], [2,14,88], [2,14,83],
+ [1,13,77], [1,12,72], [1,11,67], [1,10,62], [1,9,57], [1,9,52], [1,8,46], [1,7,41],
+ [1,6,36], [1,5,31], [0,4,26], [0,3,21], [0,3,15], [0,2,10], [0,1,5], [0,0,0],
+ [0,4,0], [0,8,0], [0,12,1], [0,16,1], [0,20,1], [0,24,1], [0,28,1], [1,32,2],
+ [1,36,2], [1,40,2], [1,44,2], [1,48,2], [1,52,2], [1,56,3], [1,60,3], [1,64,3],
+ [1,68,3], [1,72,3], [1,76,4], [1,80,4], [1,84,4], [1,88,4], [1,92,4], [2,96,5],
+ [2,100,5], [2,104,5], [2,108,5], [2,112,5], [2,116,5], [2,120,6], [2,124,6], [2,128,6],
+ [3,130,7], [4,132,9], [5,134,10], [5,136,11], [6,139,12], [7,141,13], [8,143,14], [8,145,15],
+ [9,147,16], [10,150,18], [11,152,19], [12,154,20], [12,156,21], [13,158,22], [14,161,23], [15,163,24],
+ [16,165,26], [16,167,27], [17,169,28], [18,172,29], [19,174,30], [20,176,31], [20,178,32], [21,180,33],
+ [22,183,35], [23,185,36], [23,187,37], [24,189,38], [25,191,39], [26,194,40], [27,196,41], [28,198,43],
+ [29,199,44], [31,201,45], [33,202,47], [34,204,48], [36,205,50], [37,207,51], [39,208,52], [41,210,54],
+ [42,211,55], [44,213,57], [45,214,58], [47,216,59], [49,217,61], [50,219,62], [52,220,63], [54,222,65],
+ [55,223,66], [57,225,68], [58,226,69], [60,228,70], [62,230,72], [63,231,73], [65,233,75], [66,234,76],
+ [68,236,77], [70,237,79], [71,239,80], [73,240,81], [74,242,83], [76,243,84], [78,245,86], [82,245,90],
+ [88,246,95], [93,246,101], [99,246,106], [104,246,111], [110,247,117], [116,247,122], [121,247,127], [127,248,133],
+ [132,248,138], [138,248,143], [144,249,149], [149,249,154], [155,249,159], [160,250,165], [166,250,170], [171,250,175],
+ [177,251,180], [183,251,186], [188,251,191], [194,252,196], [199,252,202], [205,252,207], [210,252,212], [216,253,218],
+ [222,253,223], [227,253,228], [233,254,234], [238,254,239], [244,254,244], [249,255,250], [255,255,255]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Green_pink.json b/2D_wave_sim_V01/ColorSchemeList/Green_pink.json
new file mode 100644
index 0000000..edd9f1a
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Green_pink.json
@@ -0,0 +1,42 @@
+{
+ "name": "Green_pink",
+ "origin": "9-stop copy of scheme 'vanimo'",
+ "category": "custom",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[255,204,252], [205,120,189], [147,63,128], [65,27,56], [25,21,18], [41,55,21], [82,113,38], [126,173,69], [189,252,165]],
+ "colors": [
+ [255,204,252], [253,201,250], [252,199,248], [250,196,246], [249,193,244], [247,191,242], [246,188,240], [244,185,238],
+ [242,183,236], [241,180,234], [239,178,232], [238,175,230], [236,172,228], [235,170,226], [233,167,224], [231,164,222],
+ [230,162,220], [228,159,218], [227,156,216], [225,154,214], [224,151,212], [222,148,210], [220,146,208], [219,143,206],
+ [217,141,204], [216,138,202], [214,135,200], [212,133,198], [211,130,196], [209,127,194], [208,125,192], [206,122,190],
+ [205,120,189], [203,118,187], [201,116,185], [199,114,183], [197,112,181], [195,111,179], [194,109,177], [192,107,175],
+ [190,105,173], [188,103,171], [186,102,169], [184,100,167], [183,98,165], [181,96,164], [179,94,162], [177,93,160],
+ [175,91,158], [173,89,156], [172,87,154], [170,85,152], [168,84,150], [166,82,148], [164,80,146], [163,78,144],
+ [161,76,142], [159,75,140], [157,73,139], [155,71,137], [153,69,135], [152,67,133], [150,66,131], [148,64,129],
+ [146,62,127], [143,61,125], [141,60,122], [138,59,120], [135,58,118], [133,57,116], [130,56,113], [128,54,111],
+ [125,53,109], [122,52,106], [120,51,104], [117,50,102], [115,49,100], [112,48,97], [110,47,95], [107,45,93],
+ [104,44,91], [102,43,88], [99,42,86], [97,41,84], [94,40,82], [91,39,79], [89,37,77], [86,36,75],
+ [84,35,72], [81,34,70], [79,33,68], [76,32,66], [73,31,63], [71,30,61], [68,28,59], [66,27,57],
+ [64,27,55], [63,27,54], [62,26,53], [60,26,52], [59,26,50], [58,26,49], [56,26,48], [55,26,47],
+ [54,25,46], [53,25,44], [51,25,43], [50,25,42], [49,25,41], [48,24,40], [46,24,38], [45,24,37],
+ [44,24,36], [43,24,35], [41,23,34], [40,23,32], [39,23,31], [38,23,30], [36,23,29], [35,23,28],
+ [34,22,26], [33,22,25], [31,22,24], [30,22,23], [29,22,22], [28,21,20], [26,21,19], [25,21,18],
+ [26,22,18], [26,23,18], [27,24,18], [27,25,18], [28,26,18], [28,27,19], [29,28,19], [29,30,19],
+ [30,31,19], [30,32,19], [31,33,19], [31,34,19], [32,35,19], [32,36,19], [33,37,19], [33,38,20],
+ [34,39,20], [34,40,20], [35,41,20], [35,42,20], [36,43,20], [36,45,20], [37,46,20], [37,47,20],
+ [38,48,20], [38,49,20], [39,50,21], [39,51,21], [40,52,21], [40,53,21], [41,54,21], [41,55,21],
+ [43,57,22], [44,59,22], [45,61,23], [46,63,23], [48,65,24], [49,66,24], [50,68,25], [52,70,25],
+ [53,72,26], [54,74,26], [56,76,27], [57,77,28], [58,79,28], [59,81,29], [61,83,29], [62,85,30],
+ [63,87,30], [65,88,31], [66,90,31], [67,92,32], [68,94,32], [70,96,33], [71,97,33], [72,99,34],
+ [74,101,35], [75,103,35], [76,105,36], [77,107,36], [79,108,37], [80,110,37], [81,112,38], [83,114,38],
+ [84,116,39], [85,118,40], [87,120,41], [88,122,42], [90,123,43], [91,125,44], [92,127,45], [94,129,46],
+ [95,131,47], [97,133,48], [98,135,49], [99,137,50], [101,139,51], [102,140,52], [103,142,53], [105,144,54],
+ [106,146,55], [108,148,56], [109,150,57], [110,152,58], [112,154,59], [113,156,60], [115,157,61], [116,159,62],
+ [117,161,63], [119,163,64], [120,165,65], [121,167,66], [123,169,67], [124,171,68], [126,173,69], [127,175,71],
+ [129,177,74], [131,180,77], [133,182,80], [135,185,83], [137,187,86], [139,190,89], [141,192,92], [143,195,95],
+ [145,197,98], [147,200,102], [149,202,105], [151,205,108], [153,207,111], [155,210,114], [157,212,117], [159,215,120],
+ [161,217,123], [163,220,126], [165,222,129], [167,225,132], [169,227,135], [171,230,138], [173,232,141], [175,235,144],
+ [177,237,147], [179,240,150], [181,242,153], [183,245,156], [185,247,159], [187,250,162], [189,252,165]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Greens.json b/2D_wave_sim_V01/ColorSchemeList/Greens.json
new file mode 100644
index 0000000..ee4e9b3
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Greens.json
@@ -0,0 +1,42 @@
+{
+ "name": "Greens",
+ "origin": "matplotlib colormap Greens, sampled at 255 points",
+ "category": "sequential",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [247,252,245], [246,251,244], [245,251,243], [245,251,243], [244,251,242], [244,250,241], [243,250,241], [243,250,240],
+ [242,250,239], [241,250,239], [241,249,238], [240,249,237], [240,249,237], [239,249,236], [239,248,235], [238,248,235],
+ [237,248,234], [237,248,233], [236,248,233], [236,247,232], [235,247,231], [235,247,231], [234,247,230], [234,246,229],
+ [233,246,229], [232,246,228], [232,246,227], [231,246,227], [231,245,226], [230,245,225], [230,245,225], [229,245,224],
+ [228,244,223], [227,244,222], [227,244,221], [226,243,220], [225,243,219], [224,243,218], [223,242,217], [222,242,216],
+ [221,241,215], [220,241,214], [219,241,213], [218,240,212], [217,240,211], [216,240,210], [215,239,209], [214,239,208],
+ [213,238,207], [212,238,206], [211,238,205], [211,237,204], [210,237,203], [209,237,202], [208,236,201], [207,236,200],
+ [206,235,199], [205,235,198], [204,235,197], [203,234,196], [202,234,195], [201,234,194], [200,233,193], [199,233,192],
+ [198,232,191], [197,232,190], [196,231,189], [195,231,188], [193,230,187], [192,230,185], [191,229,184], [190,229,183],
+ [189,228,182], [187,228,181], [186,227,180], [185,227,178], [184,226,177], [183,226,176], [182,225,175], [180,225,174],
+ [179,224,173], [178,224,171], [177,223,170], [176,223,169], [174,222,168], [173,222,167], [172,221,166], [171,221,165],
+ [170,220,163], [168,220,162], [167,219,161], [166,219,160], [165,218,159], [164,218,158], [162,217,156], [161,217,155],
+ [160,216,154], [159,216,153], [157,215,152], [156,214,151], [154,214,149], [153,213,148], [152,212,147], [150,212,146],
+ [149,211,145], [147,210,144], [146,210,142], [144,209,141], [143,208,140], [142,208,139], [140,207,138], [139,206,137],
+ [137,206,135], [136,205,134], [135,204,133], [133,204,132], [132,203,131], [130,202,130], [129,202,129], [128,201,127],
+ [126,200,126], [125,200,125], [123,199,124], [122,198,123], [120,198,122], [119,197,120], [118,196,119], [115,195,117],
+ [113,194,116], [112,194,116], [110,193,115], [108,192,114], [107,191,113], [105,190,112], [104,190,112], [102,189,111],
+ [100,188,110], [99,187,109], [97,186,108], [96,186,108], [94,185,107], [92,184,106], [91,183,105], [89,183,105],
+ [88,182,104], [86,181,103], [84,180,102], [83,179,101], [81,179,101], [80,178,100], [78,177,99], [76,176,98],
+ [75,176,97], [73,175,97], [72,174,96], [70,173,95], [68,172,94], [67,172,94], [65,171,93], [64,170,92],
+ [63,169,91], [62,168,91], [61,167,90], [60,166,89], [59,165,88], [58,164,88], [57,163,87], [56,162,86],
+ [55,161,85], [55,160,85], [54,159,84], [53,158,83], [52,157,82], [51,156,81], [50,155,81], [49,154,80],
+ [48,153,79], [47,152,78], [46,151,78], [45,150,77], [44,149,76], [43,148,75], [42,147,75], [41,146,74],
+ [40,145,73], [39,144,72], [39,143,72], [38,142,71], [37,141,70], [36,140,69], [35,139,69], [34,138,68],
+ [33,137,67], [31,136,66], [30,135,66], [29,134,65], [28,133,64], [27,132,63], [26,131,62], [25,130,62],
+ [24,129,61], [23,128,60], [22,127,59], [21,126,58], [19,126,58], [18,125,57], [17,124,56], [16,123,55],
+ [15,122,55], [14,121,54], [13,120,53], [12,119,52], [11,118,51], [10,117,51], [8,116,50], [7,115,49],
+ [6,114,48], [5,113,48], [4,112,47], [3,111,46], [2,111,45], [1,110,44], [0,109,44], [0,107,43],
+ [0,106,43], [0,105,42], [0,104,41], [0,102,41], [0,101,40], [0,100,40], [0,98,39], [0,97,39],
+ [0,96,38], [0,95,38], [0,93,37], [0,92,37], [0,91,36], [0,89,36], [0,88,35], [0,87,35],
+ [0,86,34], [0,84,33], [0,83,33], [0,82,32], [0,80,32], [0,79,31], [0,78,31], [0,77,30],
+ [0,75,30], [0,74,29], [0,73,29], [0,71,28], [0,70,28], [0,69,27], [0,68,27]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Hot_orange.json b/2D_wave_sim_V01/ColorSchemeList/Hot_orange.json
new file mode 100644
index 0000000..45a3f98
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Hot_orange.json
@@ -0,0 +1,41 @@
+{
+ "name": "Hot_orange",
+ "origin": "matplotlib colormap afmhot, sampled at 255 points",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [0,0,0], [2,0,0], [4,0,0], [6,0,0], [8,0,0], [10,0,0], [12,0,0], [14,0,0],
+ [16,0,0], [18,0,0], [20,0,0], [22,0,0], [24,0,0], [26,0,0], [28,0,0], [30,0,0],
+ [32,0,0], [34,0,0], [36,0,0], [38,0,0], [40,0,0], [42,0,0], [44,0,0], [46,0,0],
+ [48,0,0], [50,0,0], [52,0,0], [54,0,0], [56,0,0], [58,0,0], [60,0,0], [62,0,0],
+ [64,0,0], [65,0,0], [68,0,0], [70,0,0], [72,0,0], [73,0,0], [76,0,0], [78,0,0],
+ [80,0,0], [81,0,0], [84,0,0], [86,0,0], [88,0,0], [89,0,0], [92,0,0], [94,0,0],
+ [96,0,0], [97,0,0], [100,0,0], [102,0,0], [104,0,0], [105,0,0], [108,0,0], [110,0,0],
+ [112,0,0], [113,0,0], [116,0,0], [118,0,0], [120,0,0], [121,0,0], [124,0,0], [126,0,0],
+ [128,0,0], [130,2,0], [131,4,0], [134,6,0], [136,8,0], [138,10,0], [140,12,0], [142,14,0],
+ [144,16,0], [146,18,0], [147,20,0], [150,22,0], [152,24,0], [154,26,0], [156,28,0], [158,30,0],
+ [160,32,0], [162,34,0], [163,36,0], [166,38,0], [168,40,0], [170,42,0], [172,44,0], [174,46,0],
+ [176,48,0], [178,50,0], [179,52,0], [182,54,0], [184,56,0], [186,58,0], [188,60,0], [190,62,0],
+ [192,64,0], [194,66,0], [195,68,0], [198,70,0], [200,72,0], [202,74,0], [204,76,0], [206,78,0],
+ [208,80,0], [210,82,0], [211,84,0], [214,86,0], [216,88,0], [218,90,0], [220,92,0], [222,94,0],
+ [224,96,0], [226,98,0], [227,100,0], [230,102,0], [232,104,0], [234,106,0], [236,108,0], [238,110,0],
+ [240,112,0], [242,114,0], [243,116,0], [246,118,0], [248,120,0], [250,122,0], [252,124,0], [255,128,0],
+ [255,130,2], [255,132,4], [255,134,6], [255,136,8], [255,138,11], [255,140,13], [255,142,15], [255,144,16],
+ [255,146,18], [255,148,20], [255,150,22], [255,152,25], [255,154,27], [255,156,29], [255,158,31], [255,160,32],
+ [255,162,34], [255,164,36], [255,166,38], [255,168,40], [255,170,43], [255,172,45], [255,174,47], [255,176,48],
+ [255,178,50], [255,180,52], [255,182,54], [255,184,57], [255,186,59], [255,188,61], [255,190,63], [255,192,65],
+ [255,194,66], [255,196,68], [255,198,70], [255,200,72], [255,202,75], [255,204,77], [255,206,79], [255,208,81],
+ [255,210,82], [255,212,84], [255,214,86], [255,216,89], [255,218,91], [255,220,93], [255,222,95], [255,224,97],
+ [255,226,98], [255,228,100], [255,230,102], [255,232,104], [255,234,107], [255,236,109], [255,238,111], [255,240,113],
+ [255,242,114], [255,244,116], [255,246,118], [255,248,121], [255,250,123], [255,252,125], [255,254,127], [255,255,129],
+ [255,255,131], [255,255,132], [255,255,134], [255,255,136], [255,255,139], [255,255,141], [255,255,143], [255,255,145],
+ [255,255,147], [255,255,148], [255,255,150], [255,255,153], [255,255,155], [255,255,157], [255,255,159], [255,255,161],
+ [255,255,163], [255,255,164], [255,255,166], [255,255,168], [255,255,171], [255,255,173], [255,255,175], [255,255,177],
+ [255,255,179], [255,255,180], [255,255,182], [255,255,185], [255,255,187], [255,255,189], [255,255,191], [255,255,193],
+ [255,255,195], [255,255,196], [255,255,198], [255,255,200], [255,255,203], [255,255,205], [255,255,207], [255,255,209],
+ [255,255,211], [255,255,212], [255,255,214], [255,255,217], [255,255,219], [255,255,221], [255,255,223], [255,255,225],
+ [255,255,227], [255,255,228], [255,255,230], [255,255,232], [255,255,235], [255,255,237], [255,255,239], [255,255,241],
+ [255,255,243], [255,255,244], [255,255,246], [255,255,249], [255,255,251], [255,255,253], [255,255,255]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Ice_and_fire.json b/2D_wave_sim_V01/ColorSchemeList/Ice_and_fire.json
new file mode 100644
index 0000000..fe75dee
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Ice_and_fire.json
@@ -0,0 +1,41 @@
+{
+ "name": "Ice_and_fire",
+ "origin": "embedded table in wave_visualizer.py",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [179,224,216], [178,223,216], [176,222,215], [175,221,215], [173,219,214], [171,218,214], [169,217,214], [167,215,213],
+ [165,214,213], [162,212,212], [160,210,212], [157,209,211], [154,207,211], [151,205,210], [148,203,210], [146,201,209],
+ [143,199,209], [140,198,208], [137,196,208], [134,194,208], [131,192,207], [128,190,207], [125,188,207], [122,187,207],
+ [119,185,206], [116,183,206], [113,181,206], [110,179,206], [108,177,206], [105,176,205], [102,174,205], [99,172,205],
+ [97,170,205], [94,168,205], [91,166,205], [89,164,205], [86,162,205], [84,161,205], [82,159,205], [79,157,205],
+ [77,155,205], [75,153,206], [73,151,206], [71,149,206], [69,147,206], [68,145,206], [66,143,206], [65,140,206],
+ [64,138,206], [63,136,206], [62,134,206], [61,132,206], [61,130,205], [61,127,205], [60,125,205], [60,123,204],
+ [60,121,203], [60,118,203], [61,116,202], [61,114,201], [61,112,200], [62,109,198], [62,107,197], [63,105,195],
+ [64,103,194], [65,100,192], [65,98,190], [66,96,187], [67,94,185], [67,92,183], [68,90,180], [68,88,177],
+ [69,86,174], [69,85,171], [69,83,168], [70,81,165], [70,79,162], [70,78,158], [69,76,155], [69,75,151],
+ [69,73,148], [68,72,144], [68,70,141], [67,69,137], [66,67,134], [66,66,130], [65,65,127], [64,63,123],
+ [63,62,120], [62,61,116], [61,60,113], [60,59,109], [59,57,106], [58,56,103], [57,55,99], [55,54,96],
+ [54,53,93], [53,52,90], [52,50,87], [51,49,84], [50,48,81], [48,47,78], [47,46,75], [46,45,72],
+ [45,44,70], [44,43,67], [43,42,65], [42,41,62], [41,40,60], [40,39,57], [39,38,55], [38,37,53],
+ [37,37,51], [37,36,49], [36,35,47], [35,35,45], [35,34,44], [34,33,42], [34,33,41], [33,32,39],
+ [33,32,38], [33,32,37], [33,31,36], [33,31,35], [33,31,35], [34,30,34], [34,30,33], [34,30,33],
+ [35,30,32], [36,30,32], [36,30,32], [37,30,32], [38,30,32], [39,30,32], [40,30,32], [41,30,32],
+ [42,30,33], [44,31,33], [46,31,34], [47,31,34], [49,31,35], [51,32,35], [53,32,36], [55,32,37],
+ [57,33,38], [59,33,38], [61,33,39], [63,34,40], [65,34,41], [67,35,42], [70,35,43], [72,36,44],
+ [74,36,45], [77,37,46], [79,37,47], [82,38,48], [84,38,49], [87,39,50], [90,39,51], [92,40,52],
+ [95,40,53], [98,40,54], [100,41,55], [103,41,56], [106,42,57], [109,42,58], [111,42,59], [114,43,60],
+ [117,43,60], [120,43,61], [123,44,62], [126,44,63], [129,44,63], [131,44,64], [134,45,64], [137,45,65],
+ [140,45,65], [143,46,65], [146,46,65], [149,46,66], [152,47,66], [155,47,66], [158,48,66], [160,48,66],
+ [163,49,65], [166,49,65], [169,50,65], [172,51,64], [174,52,64], [177,53,63], [180,54,63], [182,55,62],
+ [185,56,62], [187,57,61], [190,58,61], [192,60,60], [195,61,59], [197,63,59], [199,65,58], [201,66,57],
+ [203,68,57], [206,70,56], [208,72,55], [209,74,55], [211,76,54], [213,78,54], [215,81,54], [217,83,53],
+ [218,85,53], [220,88,53], [221,90,53], [223,93,54], [224,95,54], [225,98,55], [227,101,55], [228,103,56],
+ [229,106,57], [230,109,58], [231,111,60], [232,114,61], [233,117,62], [234,120,64], [235,123,66], [236,125,68],
+ [237,128,70], [237,131,73], [238,134,75], [239,137,78], [240,139,80], [240,142,83], [241,145,86], [242,148,89],
+ [242,151,93], [243,153,96], [243,156,99], [244,159,103], [245,162,106], [245,165,110], [246,167,113], [246,170,117],
+ [247,173,120], [247,176,124], [248,178,127], [248,181,131], [249,184,134], [249,186,138], [250,188,141], [250,190,144],
+ [251,192,147], [251,194,149], [251,196,152], [252,198,154], [252,200,156], [252,201,158], [253,203,160]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Orange_hot.json b/2D_wave_sim_V01/ColorSchemeList/Orange_hot.json
new file mode 100644
index 0000000..0b4ccc0
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Orange_hot.json
@@ -0,0 +1,42 @@
+{
+ "name": "Orange_hot",
+ "origin": "matplotlib colormap hot, sampled at 255 points",
+ "category": "sequential",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [10,0,0], [13,0,0], [15,0,0], [18,0,0], [21,0,0], [23,0,0], [26,0,0], [28,0,0],
+ [31,0,0], [34,0,0], [36,0,0], [39,0,0], [42,0,0], [44,0,0], [47,0,0], [49,0,0],
+ [52,0,0], [55,0,0], [57,0,0], [60,0,0], [63,0,0], [65,0,0], [68,0,0], [70,0,0],
+ [73,0,0], [76,0,0], [78,0,0], [81,0,0], [84,0,0], [86,0,0], [89,0,0], [91,0,0],
+ [94,0,0], [97,0,0], [99,0,0], [102,0,0], [105,0,0], [107,0,0], [110,0,0], [112,0,0],
+ [115,0,0], [118,0,0], [120,0,0], [123,0,0], [126,0,0], [128,0,0], [131,0,0], [133,0,0],
+ [136,0,0], [139,0,0], [141,0,0], [144,0,0], [147,0,0], [149,0,0], [152,0,0], [154,0,0],
+ [157,0,0], [160,0,0], [162,0,0], [165,0,0], [168,0,0], [170,0,0], [173,0,0], [175,0,0],
+ [178,0,0], [181,0,0], [183,0,0], [186,0,0], [189,0,0], [191,0,0], [194,0,0], [196,0,0],
+ [199,0,0], [202,0,0], [204,0,0], [207,0,0], [210,0,0], [212,0,0], [215,0,0], [217,0,0],
+ [220,0,0], [223,0,0], [225,0,0], [228,0,0], [231,0,0], [233,0,0], [236,0,0], [238,0,0],
+ [241,0,0], [244,0,0], [246,0,0], [249,0,0], [252,0,0], [254,0,0], [255,2,0], [255,5,0],
+ [255,7,0], [255,10,0], [255,12,0], [255,15,0], [255,18,0], [255,20,0], [255,23,0], [255,26,0],
+ [255,28,0], [255,31,0], [255,33,0], [255,36,0], [255,39,0], [255,41,0], [255,44,0], [255,47,0],
+ [255,49,0], [255,52,0], [255,54,0], [255,57,0], [255,60,0], [255,62,0], [255,65,0], [255,68,0],
+ [255,70,0], [255,73,0], [255,75,0], [255,78,0], [255,81,0], [255,83,0], [255,86,0], [255,91,0],
+ [255,94,0], [255,96,0], [255,99,0], [255,102,0], [255,104,0], [255,107,0], [255,110,0], [255,112,0],
+ [255,115,0], [255,117,0], [255,120,0], [255,123,0], [255,125,0], [255,128,0], [255,131,0], [255,133,0],
+ [255,136,0], [255,138,0], [255,141,0], [255,144,0], [255,146,0], [255,149,0], [255,151,0], [255,154,0],
+ [255,157,0], [255,159,0], [255,162,0], [255,165,0], [255,167,0], [255,170,0], [255,172,0], [255,175,0],
+ [255,178,0], [255,180,0], [255,183,0], [255,186,0], [255,188,0], [255,191,0], [255,193,0], [255,196,0],
+ [255,199,0], [255,201,0], [255,204,0], [255,207,0], [255,209,0], [255,212,0], [255,214,0], [255,217,0],
+ [255,220,0], [255,222,0], [255,225,0], [255,228,0], [255,230,0], [255,233,0], [255,235,0], [255,238,0],
+ [255,241,0], [255,243,0], [255,246,0], [255,249,0], [255,251,0], [255,254,0], [255,255,2], [255,255,6],
+ [255,255,10], [255,255,14], [255,255,18], [255,255,22], [255,255,26], [255,255,30], [255,255,34], [255,255,38],
+ [255,255,42], [255,255,46], [255,255,50], [255,255,54], [255,255,58], [255,255,62], [255,255,65], [255,255,69],
+ [255,255,73], [255,255,77], [255,255,81], [255,255,85], [255,255,89], [255,255,93], [255,255,97], [255,255,101],
+ [255,255,105], [255,255,109], [255,255,113], [255,255,117], [255,255,121], [255,255,125], [255,255,128], [255,255,132],
+ [255,255,136], [255,255,140], [255,255,144], [255,255,148], [255,255,152], [255,255,156], [255,255,160], [255,255,164],
+ [255,255,168], [255,255,172], [255,255,176], [255,255,180], [255,255,184], [255,255,188], [255,255,191], [255,255,195],
+ [255,255,199], [255,255,203], [255,255,207], [255,255,211], [255,255,215], [255,255,219], [255,255,223], [255,255,227],
+ [255,255,231], [255,255,235], [255,255,239], [255,255,243], [255,255,247], [255,255,251], [255,255,255]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Orange_symmetry.json b/2D_wave_sim_V01/ColorSchemeList/Orange_symmetry.json
new file mode 100644
index 0000000..49a9582
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Orange_symmetry.json
@@ -0,0 +1,41 @@
+{
+ "name": "Orange_symmetry",
+ "origin": "embedded table in wave_visualizer.py",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [253,203,160], [252,201,158], [252,200,156], [252,198,154], [251,196,152], [251,194,149], [251,192,147], [250,190,145],
+ [250,189,142], [249,187,139], [249,185,135], [248,182,132], [248,179,129], [247,177,125], [247,175,122], [247,172,119],
+ [246,168,115], [246,166,112], [245,164,108], [245,161,105], [244,158,102], [243,155,98], [243,152,95], [242,150,92],
+ [242,147,88], [241,145,86], [240,142,83], [240,139,80], [239,137,78], [238,134,75], [237,131,73], [237,129,70],
+ [236,126,68], [235,124,67], [234,121,65], [233,118,63], [232,115,61], [231,112,61], [230,110,59], [229,107,57],
+ [228,104,56], [228,102,55], [226,100,55], [224,97,55], [224,94,54], [222,92,54], [221,89,53], [219,87,53],
+ [218,84,53], [217,83,53], [215,80,54], [213,78,54], [211,76,54], [209,74,55], [208,72,55], [206,70,56],
+ [203,68,57], [201,66,57], [199,65,58], [198,64,59], [196,62,59], [193,60,60], [191,59,61], [188,57,61],
+ [186,56,62], [183,55,62], [181,55,63], [179,54,63], [176,53,63], [173,52,64], [171,51,64], [168,50,65],
+ [165,49,65], [162,49,65], [159,48,66], [157,48,66], [155,47,66], [152,47,66], [149,46,66], [146,46,65],
+ [143,46,65], [140,45,65], [138,45,65], [135,45,64], [132,44,64], [130,44,63], [127,44,63], [124,44,62],
+ [121,43,61], [118,43,60], [115,43,60], [112,42,60], [110,42,59], [108,42,58], [105,42,57], [102,41,56],
+ [99,41,55], [97,40,54], [94,40,53], [91,40,52], [89,39,51], [86,39,50], [84,38,49], [82,38,48],
+ [79,37,47], [77,37,46], [74,36,45], [72,36,44], [70,35,43], [68,35,42], [65,34,41], [64,34,40],
+ [62,33,39], [60,33,38], [58,33,38], [56,32,38], [54,32,36], [52,32,35], [50,32,35], [48,31,35],
+ [47,31,34], [45,31,34], [43,31,33], [42,30,33], [41,30,32], [40,30,32], [39,30,32], [38,30,32],
+ [37,30,32], [36,30,32], [36,30,32], [37,30,32], [38,30,32], [39,30,32], [40,30,32], [41,30,32],
+ [42,30,33], [44,31,33], [46,31,34], [47,31,34], [49,31,35], [51,32,35], [53,32,36], [55,32,37],
+ [57,33,38], [59,33,38], [61,33,39], [63,34,40], [65,34,41], [67,35,42], [70,35,43], [72,36,44],
+ [74,36,45], [77,37,46], [79,37,47], [82,38,48], [84,38,49], [87,39,50], [90,39,51], [92,40,52],
+ [95,40,53], [98,40,54], [100,41,55], [103,41,56], [106,42,57], [109,42,58], [111,42,59], [114,43,60],
+ [117,43,60], [120,43,61], [123,44,62], [126,44,63], [129,44,63], [131,44,64], [134,45,64], [137,45,65],
+ [140,45,65], [143,46,65], [146,46,65], [149,46,66], [152,47,66], [155,47,66], [158,48,66], [160,48,66],
+ [163,49,65], [166,49,65], [169,50,65], [172,51,64], [174,52,64], [177,53,63], [180,54,63], [182,55,62],
+ [185,56,62], [187,57,61], [190,58,61], [192,60,60], [195,61,59], [197,63,59], [199,65,58], [201,66,57],
+ [203,68,57], [206,70,56], [208,72,55], [209,74,55], [211,76,54], [213,78,54], [215,81,54], [217,83,53],
+ [218,85,53], [220,88,53], [221,90,53], [223,93,54], [224,95,54], [225,98,55], [227,101,55], [228,103,56],
+ [229,106,57], [230,109,58], [231,111,60], [232,114,61], [233,117,62], [234,120,64], [235,123,66], [236,125,68],
+ [237,128,70], [237,131,73], [238,134,75], [239,137,78], [240,139,80], [240,142,83], [241,145,86], [242,148,89],
+ [242,151,93], [243,153,96], [243,156,99], [244,159,103], [245,162,106], [245,165,110], [246,167,113], [246,170,117],
+ [247,173,120], [247,176,124], [248,178,127], [248,181,131], [249,184,134], [249,186,138], [250,188,141], [250,190,144],
+ [251,192,147], [251,194,149], [251,196,152], [252,198,154], [252,200,156], [252,201,158], [253,203,160]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Purple_rain.json b/2D_wave_sim_V01/ColorSchemeList/Purple_rain.json
new file mode 100644
index 0000000..12a28c1
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Purple_rain.json
@@ -0,0 +1,43 @@
+{
+ "name": "Purple_rain",
+ "origin": "9-stop copy of scheme 'Gray scales'",
+ "category": "custom",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[0,0,0], [29,1,47], [50,1,81], [65,2,104], [107,2,128], [132,2,158], [167,5,198], [201,21,236], [228,105,252]],
+ "colors": [
+ [0,0,0], [1,0,1], [2,0,3], [3,0,4], [4,0,6], [5,0,7], [5,0,9], [6,0,10],
+ [7,0,12], [8,0,13], [9,0,15], [10,0,16], [11,0,18], [12,0,19], [13,0,21], [14,0,22],
+ [15,1,24], [16,1,25], [16,1,27], [17,1,28], [18,1,30], [19,1,31], [20,1,33], [21,1,34],
+ [22,1,36], [23,1,37], [24,1,38], [25,1,40], [26,1,41], [26,1,43], [27,1,44], [28,1,46],
+ [29,1,47], [30,1,48], [30,1,49], [31,1,50], [32,1,52], [32,1,53], [33,1,54], [34,1,55],
+ [34,1,56], [35,1,57], [36,1,58], [36,1,59], [37,1,60], [38,1,61], [38,1,62], [39,1,63],
+ [40,1,64], [40,1,65], [41,1,67], [42,1,68], [42,1,69], [43,1,70], [44,1,71], [44,1,72],
+ [45,1,73], [46,1,74], [46,1,75], [47,1,76], [48,1,77], [48,1,78], [49,1,79], [50,1,80],
+ [50,1,81], [51,1,82], [51,1,83], [52,1,84], [52,1,84], [53,1,85], [53,1,86], [54,1,86],
+ [54,1,87], [54,1,88], [55,1,89], [55,1,89], [56,1,90], [56,1,91], [57,1,92], [57,1,92],
+ [58,2,93], [58,2,94], [59,2,94], [59,2,95], [60,2,96], [60,2,97], [61,2,97], [61,2,98],
+ [62,2,99], [62,2,99], [63,2,100], [63,2,101], [63,2,102], [64,2,102], [64,2,103], [65,2,104],
+ [66,2,105], [67,2,105], [69,2,106], [70,2,107], [71,2,108], [73,2,108], [74,2,109], [75,2,110],
+ [77,2,111], [78,2,111], [79,2,112], [81,2,113], [82,2,114], [83,2,114], [85,2,115], [86,2,116],
+ [87,2,117], [88,2,117], [90,2,118], [91,2,119], [92,2,120], [94,2,120], [95,2,121], [96,2,122],
+ [98,2,123], [99,2,123], [100,2,124], [102,2,125], [103,2,126], [104,2,126], [106,2,127], [107,2,128],
+ [108,2,129], [109,2,130], [109,2,131], [110,2,132], [111,2,133], [112,2,134], [113,2,135], [113,2,136],
+ [114,2,137], [115,2,137], [116,2,138], [116,2,139], [117,2,140], [118,2,141], [119,2,142], [120,2,143],
+ [120,2,144], [121,2,145], [122,2,146], [123,2,147], [124,2,148], [124,2,149], [125,2,150], [126,2,151],
+ [127,2,152], [127,2,153], [128,2,154], [129,2,154], [130,2,155], [131,2,156], [131,2,157], [132,2,158],
+ [133,2,160], [134,2,161], [136,2,162], [137,2,163], [138,2,165], [139,3,166], [140,3,167], [141,3,168],
+ [142,3,170], [143,3,171], [144,3,172], [146,3,173], [147,3,175], [148,3,176], [149,3,177], [150,4,178],
+ [151,4,180], [152,4,181], [153,4,182], [154,4,184], [155,4,185], [157,4,186], [158,4,187], [159,4,189],
+ [160,4,190], [161,4,191], [162,5,192], [163,5,194], [164,5,195], [165,5,196], [166,5,197], [168,5,199],
+ [169,6,200], [170,6,201], [171,7,202], [172,7,203], [173,8,205], [174,8,206], [175,9,207], [176,9,208],
+ [177,10,209], [178,10,211], [179,11,212], [180,11,213], [181,12,214], [183,12,215], [184,13,217], [185,13,218],
+ [186,14,219], [187,14,220], [188,15,221], [189,15,223], [190,16,224], [191,16,225], [192,17,226], [193,17,227],
+ [194,18,229], [195,18,230], [196,19,231], [198,19,232], [199,20,233], [200,20,235], [201,21,236], [202,23,236],
+ [202,26,237], [203,28,237], [204,31,238], [205,34,238], [206,36,239], [207,39,239], [208,42,240], [208,44,240],
+ [209,47,241], [210,49,241], [211,52,242], [212,55,242], [213,57,243], [214,60,243], [214,63,244], [215,65,244],
+ [216,68,245], [217,71,245], [218,73,246], [219,76,246], [219,79,247], [220,81,247], [221,84,248], [222,86,248],
+ [223,89,249], [224,92,249], [225,94,250], [225,97,250], [226,100,251], [227,102,251], [228,105,252]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Simply_red.json b/2D_wave_sim_V01/ColorSchemeList/Simply_red.json
new file mode 100644
index 0000000..255f243
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Simply_red.json
@@ -0,0 +1,42 @@
+{
+ "name": "Simply_red",
+ "origin": "7-stop copy of scheme 'afmhot'",
+ "category": "custom",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [0,0,0], [3,0,0], [6,0,0], [9,0,0], [12,0,0], [15,0,0], [18,0,0], [21,0,0],
+ [24,0,0], [27,0,0], [30,0,0], [33,0,0], [36,0,0], [39,0,0], [42,0,0], [45,0,0],
+ [48,0,0], [51,0,0], [54,0,0], [57,0,0], [60,0,0], [63,0,0], [65,1,1], [68,1,1],
+ [71,1,1], [74,1,1], [77,1,1], [80,1,1], [83,1,1], [86,1,1], [89,1,1], [92,1,1],
+ [95,1,1], [98,1,1], [101,1,1], [104,1,1], [107,1,1], [110,1,1], [113,1,1], [116,1,1],
+ [119,1,1], [122,1,1], [125,1,1], [127,1,1], [128,1,1], [129,1,1], [130,1,1], [131,1,1],
+ [132,1,1], [133,1,1], [134,1,1], [135,1,1], [136,1,1], [137,1,1], [138,1,1], [139,1,1],
+ [140,1,1], [141,1,1], [142,1,1], [143,1,1], [144,1,1], [145,1,1], [146,1,1], [147,1,1],
+ [148,0,0], [149,0,0], [150,0,0], [151,0,0], [152,0,0], [153,0,0], [154,0,0], [155,0,0],
+ [156,0,0], [157,0,0], [158,0,0], [159,0,0], [160,0,0], [161,0,0], [162,0,0], [163,0,0],
+ [164,0,0], [165,0,0], [166,0,0], [167,0,0], [168,0,0], [170,0,0], [171,1,1], [173,1,1],
+ [174,1,1], [176,2,2], [177,2,2], [179,3,3], [180,3,3], [182,3,3], [184,4,4], [185,4,4],
+ [187,5,5], [188,5,5], [190,5,5], [191,6,6], [193,6,6], [194,7,7], [196,7,7], [198,7,7],
+ [199,8,8], [201,8,8], [202,9,9], [204,9,9], [205,9,9], [207,10,10], [208,10,10], [210,11,11],
+ [212,11,11], [213,11,11], [215,12,12], [216,12,12], [218,13,13], [219,13,13], [221,13,13], [223,14,14],
+ [224,14,14], [226,15,15], [227,15,15], [229,15,15], [230,16,16], [232,16,16], [233,17,17], [235,17,17],
+ [235,19,19], [236,20,20], [236,22,22], [236,23,23], [236,25,25], [237,26,26], [237,28,28], [237,29,29],
+ [237,31,31], [238,32,32], [238,34,34], [238,35,35], [238,37,37], [239,38,38], [239,40,40], [239,41,41],
+ [239,43,43], [240,44,44], [240,46,46], [240,47,47], [240,49,49], [241,50,50], [241,52,52], [241,53,53],
+ [241,55,55], [242,56,56], [242,58,58], [242,59,59], [243,61,61], [243,62,62], [243,64,64], [243,65,65],
+ [244,67,67], [244,68,68], [244,70,70], [244,71,71], [245,73,73], [245,74,74], [245,76,76], [245,77,77],
+ [246,79,79], [246,80,80], [246,82,82], [246,84,84], [246,85,85], [246,87,87], [246,88,88], [246,90,90],
+ [246,91,91], [246,93,93], [246,94,94], [246,96,96], [246,97,97], [246,99,99], [246,100,100], [246,102,102],
+ [246,103,103], [246,105,105], [246,106,106], [246,108,108], [246,109,109], [246,111,111], [246,112,112], [247,114,114],
+ [247,115,115], [247,117,117], [247,118,118], [247,120,120], [247,121,121], [247,123,123], [247,124,124], [247,126,126],
+ [247,127,127], [247,129,129], [247,130,130], [247,132,132], [247,133,133], [247,135,135], [247,136,136], [247,138,138],
+ [247,139,139], [247,141,141], [247,142,142], [247,144,144], [247,146,146], [247,148,148], [247,150,150], [247,152,152],
+ [248,154,154], [248,157,157], [248,159,159], [248,161,161], [248,163,163], [248,165,165], [248,167,167], [248,170,170],
+ [248,172,172], [249,174,174], [249,176,176], [249,178,178], [249,180,180], [249,183,183], [249,185,185], [249,187,187],
+ [249,189,189], [250,191,191], [250,194,194], [250,196,196], [250,198,198], [250,200,200], [250,202,202], [250,204,204],
+ [250,207,207], [250,209,209], [251,211,211], [251,213,213], [251,215,215], [251,217,217], [251,220,220], [251,222,222],
+ [251,224,224], [251,226,226], [252,228,228], [252,230,230], [252,233,233], [252,235,235], [252,237,237]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Turky_brown.json b/2D_wave_sim_V01/ColorSchemeList/Turky_brown.json
new file mode 100644
index 0000000..35d8bd5
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Turky_brown.json
@@ -0,0 +1,43 @@
+{
+ "name": "Turky_brown",
+ "origin": "9-stop copy of scheme 'Green_blown'",
+ "category": "custom",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[62,34,1], [153,93,18], [207,161,84], [239,222,176], [255,255,255], [180,226,219], [90,177,167], [14,114,106], [0,9,8]],
+ "colors": [
+ [62,34,1], [65,36,2], [68,38,2], [71,40,3], [73,41,3], [76,43,4], [79,45,4], [82,47,5],
+ [85,49,5], [88,51,6], [91,53,6], [94,54,7], [96,56,7], [99,58,8], [102,60,8], [105,62,9],
+ [108,64,10], [111,66,10], [114,67,11], [116,69,11], [119,71,12], [122,73,12], [125,75,13], [128,77,13],
+ [131,79,14], [134,80,14], [137,82,15], [139,84,15], [142,86,16], [145,88,17], [148,90,17], [151,92,18],
+ [153,94,19], [155,96,21], [157,98,23], [159,100,25], [160,102,27], [162,104,29], [164,106,31], [165,109,33],
+ [167,111,35], [169,113,37], [170,115,39], [172,117,41], [174,119,43], [176,121,46], [177,124,48], [179,126,50],
+ [181,128,52], [182,130,54], [184,132,56], [186,134,58], [187,136,60], [189,139,62], [191,141,64], [193,143,66],
+ [194,145,68], [196,147,70], [198,149,73], [199,151,75], [201,154,77], [203,156,79], [204,158,81], [206,160,83],
+ [208,162,85], [209,164,88], [210,166,91], [211,168,94], [212,170,97], [213,172,100], [214,173,103], [215,175,106],
+ [216,177,109], [217,179,112], [218,181,114], [219,183,117], [220,185,120], [221,187,123], [222,189,126], [223,191,129],
+ [224,193,132], [225,195,135], [226,197,138], [227,198,141], [228,200,143], [229,202,146], [230,204,149], [231,206,152],
+ [232,208,155], [233,210,158], [234,212,161], [235,214,164], [236,216,167], [237,218,169], [238,220,172], [239,222,175],
+ [239,223,178], [240,224,180], [240,225,183], [241,226,185], [241,227,188], [242,228,190], [242,229,193], [243,230,195],
+ [243,231,198], [244,232,200], [244,233,203], [245,234,205], [245,235,208], [246,236,210], [246,237,213], [247,238,215],
+ [247,239,218], [248,240,220], [248,241,223], [249,243,225], [249,244,228], [250,245,230], [250,246,233], [251,247,235],
+ [251,248,238], [252,249,240], [252,250,243], [253,251,245], [253,252,248], [254,253,250], [254,254,253], [255,255,255],
+ [253,254,254], [250,253,253], [248,252,252], [246,251,250], [243,250,249], [241,250,248], [238,249,247], [236,248,246],
+ [234,247,245], [231,246,244], [229,245,243], [227,244,241], [224,243,240], [222,242,239], [220,241,238], [217,240,237],
+ [215,239,236], [212,239,235], [210,238,233], [208,237,232], [205,236,231], [203,235,230], [201,234,229], [198,233,228],
+ [196,232,227], [194,231,226], [191,230,224], [189,229,223], [186,229,222], [184,228,221], [182,227,220], [179,226,219],
+ [176,224,217], [174,223,215], [171,221,214], [168,219,212], [165,218,210], [162,216,209], [159,215,207], [157,213,205],
+ [154,212,204], [151,210,202], [148,209,201], [145,207,199], [142,206,197], [140,204,196], [137,202,194], [134,201,192],
+ [131,199,191], [128,198,189], [125,196,187], [123,195,186], [120,193,184], [117,192,183], [114,190,181], [111,189,179],
+ [108,187,178], [106,185,176], [103,184,174], [100,182,173], [97,181,171], [94,179,169], [91,178,168], [89,176,166],
+ [86,174,164], [84,172,162], [82,170,160], [79,168,158], [77,166,156], [74,164,155], [72,162,153], [70,160,151],
+ [67,158,149], [65,156,147], [62,154,145], [60,152,143], [58,150,141], [55,148,139], [53,146,137], [51,144,135],
+ [48,142,133], [46,140,131], [43,138,130], [41,136,128], [39,134,126], [36,132,124], [34,130,122], [31,128,120],
+ [29,126,118], [27,124,116], [24,122,114], [22,120,112], [19,118,110], [17,116,108], [15,114,106], [14,112,104],
+ [13,108,101], [13,105,98], [12,102,94], [12,98,91], [11,95,88], [11,92,85], [11,88,82], [10,85,79],
+ [10,82,76], [9,78,73], [9,75,70], [8,72,67], [8,69,64], [7,65,60], [7,62,57], [7,59,54],
+ [6,55,51], [6,52,48], [5,49,45], [5,45,42], [4,42,39], [4,39,36], [4,35,33], [3,32,30],
+ [3,29,27], [2,26,23], [2,22,20], [1,19,17], [1,16,14], [0,12,11], [0,9,8]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/Yellow_purple.json b/2D_wave_sim_V01/ColorSchemeList/Yellow_purple.json
new file mode 100644
index 0000000..148ad37
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/Yellow_purple.json
@@ -0,0 +1,43 @@
+{
+ "name": "Yellow_purple",
+ "origin": "9-stop copy of scheme 'gist_earth'",
+ "category": "custom",
+ "scheme_type": "field",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[247,110,252], [190,2,190], [128,2,134], [77,2,79], [0,0,0], [111,105,2], [193,194,3], [250,246,15], [253,248,115]],
+ "colors": [
+ [247,110,252], [245,107,250], [243,103,248], [242,100,246], [240,96,244], [238,93,242], [236,90,240], [234,86,238],
+ [233,83,236], [231,79,234], [229,76,232], [227,73,231], [225,69,229], [224,66,227], [222,62,225], [220,59,223],
+ [218,56,221], [216,52,219], [215,49,217], [213,45,215], [211,42,213], [209,39,211], [208,35,209], [206,32,207],
+ [204,28,205], [202,25,203], [200,22,201], [199,18,199], [197,15,197], [195,11,195], [193,8,193], [191,5,191],
+ [190,2,190], [188,2,188], [186,2,186], [184,2,184], [182,2,183], [180,2,181], [178,2,179], [176,2,177],
+ [174,2,175], [172,2,174], [170,2,172], [168,2,170], [166,2,168], [164,2,167], [162,2,165], [160,2,163],
+ [158,2,161], [156,2,160], [154,2,158], [152,2,156], [150,2,154], [149,2,153], [147,2,151], [145,2,149],
+ [143,2,147], [141,2,145], [139,2,144], [137,2,142], [135,2,140], [133,2,138], [131,2,137], [129,2,135],
+ [127,2,133], [126,2,131], [124,2,130], [122,2,128], [121,2,126], [119,2,124], [118,2,123], [116,2,121],
+ [114,2,119], [113,2,118], [111,2,116], [110,2,114], [108,2,112], [106,2,111], [105,2,109], [103,2,107],
+ [101,2,105], [100,2,104], [98,2,102], [97,2,100], [95,2,98], [93,2,97], [92,2,95], [90,2,93],
+ [89,2,92], [87,2,90], [85,2,88], [84,2,86], [82,2,85], [81,2,83], [79,2,81], [77,2,79],
+ [75,2,77], [73,2,75], [70,2,72], [68,2,70], [65,2,67], [63,2,65], [61,2,62], [58,2,60],
+ [56,1,57], [53,1,55], [51,1,52], [49,1,50], [46,1,47], [44,1,45], [41,1,42], [39,1,40],
+ [36,1,37], [34,1,35], [32,1,32], [29,1,30], [27,1,27], [24,1,25], [22,1,22], [19,1,20],
+ [17,0,17], [15,0,15], [12,0,12], [10,0,10], [7,0,7], [5,0,5], [2,0,2], [0,0,0],
+ [3,3,0], [7,7,0], [10,10,0], [14,13,0], [17,17,0], [21,20,0], [24,23,0], [28,26,1],
+ [31,30,1], [35,33,1], [38,36,1], [42,40,1], [45,43,1], [49,46,1], [52,50,1], [56,53,1],
+ [59,56,1], [63,60,1], [66,63,1], [70,66,1], [73,69,1], [77,73,1], [80,76,1], [84,79,2],
+ [87,83,2], [91,86,2], [94,89,2], [98,93,2], [101,96,2], [105,99,2], [108,103,2], [112,106,2],
+ [114,109,2], [117,111,2], [119,114,2], [122,117,2], [125,120,2], [127,123,2], [130,125,2], [132,128,2],
+ [135,131,2], [137,134,2], [140,137,2], [143,139,2], [145,142,2], [148,145,2], [150,148,2], [153,151,3],
+ [156,153,3], [158,156,3], [161,159,3], [163,162,3], [166,165,3], [168,167,3], [171,170,3], [174,173,3],
+ [176,176,3], [179,179,3], [181,181,3], [184,184,3], [187,187,3], [189,190,3], [192,193,3], [194,195,3],
+ [196,196,4], [197,198,4], [199,200,4], [201,201,5], [203,203,5], [205,205,5], [206,206,6], [208,208,6],
+ [210,210,7], [212,211,7], [214,213,7], [215,214,8], [217,216,8], [219,218,8], [221,219,9], [223,221,9],
+ [224,223,10], [226,224,10], [228,226,10], [230,228,11], [232,229,11], [233,231,12], [235,232,12], [237,234,12],
+ [239,236,13], [241,237,13], [242,239,13], [244,241,14], [246,242,14], [248,244,15], [250,246,15], [250,246,17],
+ [250,246,21], [250,246,24], [250,246,27], [250,246,30], [251,246,33], [251,246,36], [251,246,39], [251,247,43],
+ [251,247,46], [251,247,49], [251,247,52], [251,247,55], [251,247,58], [251,247,61], [251,247,65], [252,247,68],
+ [252,247,71], [252,247,74], [252,247,77], [252,247,80], [252,247,84], [252,247,87], [252,247,90], [252,248,93],
+ [252,248,96], [253,248,99], [253,248,102], [253,248,106], [253,248,109], [253,248,112], [253,248,115]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/inferno.json b/2D_wave_sim_V01/ColorSchemeList/inferno.json
new file mode 100644
index 0000000..155f031
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/inferno.json
@@ -0,0 +1,42 @@
+{
+ "name": "inferno",
+ "origin": "matplotlib colormap inferno, sampled at 255 points",
+ "category": "sequential",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [0,0,3], [0,0,4], [0,0,6], [1,0,7], [1,1,9], [1,1,11], [2,1,14], [2,2,16],
+ [3,2,18], [4,3,20], [4,3,22], [5,4,24], [6,4,27], [7,5,29], [8,6,31], [9,6,33],
+ [10,7,35], [11,7,38], [13,8,40], [14,8,42], [15,9,45], [16,9,47], [18,10,50], [19,10,52],
+ [20,11,54], [22,11,57], [23,11,59], [25,11,62], [26,11,64], [28,12,67], [29,12,69], [31,12,71],
+ [32,12,74], [34,11,76], [36,11,78], [38,11,80], [39,11,82], [41,11,84], [43,10,86], [45,10,88],
+ [46,10,90], [48,10,92], [50,9,93], [52,9,95], [53,9,96], [55,9,97], [57,9,98], [59,9,100],
+ [60,9,101], [62,9,102], [64,9,102], [65,9,103], [67,10,104], [69,10,105], [70,10,105], [72,11,106],
+ [74,11,106], [75,12,107], [77,12,107], [79,13,108], [80,13,108], [82,14,108], [83,14,109], [85,15,109],
+ [87,15,109], [88,16,109], [90,17,109], [91,17,110], [93,18,110], [95,18,110], [96,19,110], [98,20,110],
+ [99,20,110], [101,21,110], [102,21,110], [104,22,110], [106,23,110], [107,23,110], [109,24,110], [110,24,110],
+ [112,25,110], [114,25,109], [115,26,109], [117,27,109], [118,27,109], [120,28,109], [122,28,109], [123,29,108],
+ [125,29,108], [126,30,108], [128,31,107], [129,31,107], [131,32,107], [133,32,106], [134,33,106], [136,33,106],
+ [137,34,105], [139,34,105], [141,35,105], [142,36,104], [144,36,104], [145,37,103], [147,37,103], [149,38,102],
+ [150,38,102], [152,39,101], [153,40,100], [155,40,100], [156,41,99], [158,41,99], [160,42,98], [161,43,97],
+ [163,43,97], [164,44,96], [166,44,95], [167,45,95], [169,46,94], [171,46,93], [172,47,92], [174,48,91],
+ [175,49,91], [177,49,90], [178,50,89], [180,51,88], [181,51,87], [183,52,86], [184,53,86], [187,55,84],
+ [189,55,83], [190,56,82], [191,57,81], [193,58,80], [194,59,79], [196,60,78], [197,61,77], [199,62,76],
+ [200,62,75], [201,63,74], [203,64,73], [204,65,72], [205,66,71], [207,68,70], [208,69,68], [209,70,67],
+ [210,71,66], [212,72,65], [213,73,64], [214,74,63], [215,75,62], [217,77,61], [218,78,59], [219,79,58],
+ [220,80,57], [221,82,56], [222,83,55], [223,84,54], [224,86,52], [226,87,51], [227,88,50], [228,90,49],
+ [229,91,48], [230,92,46], [230,94,45], [231,95,44], [232,97,43], [233,98,42], [234,100,40], [235,101,39],
+ [236,103,38], [237,104,37], [237,106,35], [238,108,34], [239,109,33], [240,111,31], [240,112,30], [241,114,29],
+ [242,116,28], [242,117,26], [243,119,25], [243,121,24], [244,122,22], [245,124,21], [245,126,20], [246,128,18],
+ [246,129,17], [247,131,16], [247,133,14], [248,135,13], [248,136,12], [248,138,11], [249,140,9], [249,142,8],
+ [249,144,8], [250,145,7], [250,147,6], [250,149,6], [250,151,6], [251,153,6], [251,155,6], [251,157,6],
+ [251,158,7], [251,160,7], [251,162,8], [251,164,10], [251,166,11], [251,168,13], [251,170,14], [251,172,16],
+ [251,174,18], [251,176,20], [251,177,22], [251,179,24], [251,181,26], [251,183,28], [251,185,30], [250,187,33],
+ [250,189,35], [250,191,37], [250,193,40], [249,195,42], [249,197,44], [249,199,47], [248,201,49], [248,203,52],
+ [248,205,55], [247,207,58], [247,209,60], [246,211,63], [246,213,66], [245,215,69], [245,217,72], [244,219,75],
+ [244,220,79], [243,222,82], [243,224,86], [243,226,89], [242,228,93], [242,230,96], [241,232,100], [241,233,104],
+ [241,235,108], [241,237,112], [241,238,116], [241,240,121], [241,242,125], [242,243,129], [242,244,133], [243,246,137],
+ [244,247,141], [245,248,145], [246,250,149], [247,251,153], [249,252,157], [250,253,160], [252,254,164]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/magma.json b/2D_wave_sim_V01/ColorSchemeList/magma.json
new file mode 100644
index 0000000..35f03bb
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/magma.json
@@ -0,0 +1,42 @@
+{
+ "name": "magma",
+ "origin": "matplotlib colormap magma, sampled at 255 points",
+ "category": "sequential",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [0,0,3], [0,0,4], [0,0,6], [1,0,7], [1,1,9], [1,1,11], [2,2,13], [2,2,15],
+ [3,3,17], [4,3,19], [4,4,21], [5,4,23], [6,5,25], [7,5,27], [8,6,29], [9,7,31],
+ [10,7,34], [11,8,36], [12,9,38], [13,10,40], [14,10,42], [15,11,44], [16,12,47], [17,12,49],
+ [18,13,51], [20,13,53], [21,14,56], [22,14,58], [23,15,60], [24,15,63], [26,16,65], [27,16,68],
+ [28,16,70], [30,16,73], [31,17,75], [32,17,77], [34,17,80], [35,17,82], [37,17,85], [38,17,87],
+ [40,17,89], [42,17,92], [43,17,94], [45,16,96], [47,16,98], [48,16,101], [50,16,103], [52,16,104],
+ [53,15,106], [55,15,108], [57,15,110], [59,15,111], [60,15,113], [62,15,114], [64,15,115], [66,15,116],
+ [67,15,117], [69,15,118], [71,15,119], [72,16,120], [74,16,121], [75,16,121], [77,17,122], [79,17,123],
+ [80,18,123], [82,18,124], [83,19,124], [85,19,125], [87,20,125], [88,21,126], [90,21,126], [91,22,126],
+ [93,23,126], [94,23,127], [96,24,127], [97,24,127], [99,25,127], [101,26,128], [102,26,128], [104,27,128],
+ [105,28,128], [107,28,128], [108,29,128], [110,30,129], [111,30,129], [113,31,129], [115,31,129], [116,32,129],
+ [118,33,129], [119,33,129], [121,34,129], [122,34,129], [124,35,129], [126,36,129], [127,36,129], [129,37,129],
+ [130,37,129], [132,38,129], [133,38,129], [135,39,129], [137,40,129], [138,40,129], [140,41,128], [141,41,128],
+ [143,42,128], [145,42,128], [146,43,128], [148,43,128], [149,44,128], [151,44,127], [153,45,127], [154,45,127],
+ [156,46,127], [158,46,126], [159,47,126], [161,47,126], [163,48,126], [164,48,125], [166,49,125], [167,49,125],
+ [169,50,124], [171,51,124], [172,51,123], [174,52,123], [176,52,123], [177,53,122], [179,53,122], [182,54,121],
+ [184,55,120], [185,55,120], [187,56,119], [189,57,119], [190,57,118], [192,58,117], [194,58,117], [195,59,116],
+ [197,60,116], [198,60,115], [200,61,114], [202,62,114], [203,62,113], [205,63,112], [206,64,112], [208,65,111],
+ [209,66,110], [211,66,109], [212,67,109], [214,68,108], [215,69,107], [217,70,106], [218,71,105], [220,72,105],
+ [221,73,104], [222,74,103], [224,75,102], [225,76,102], [226,77,101], [228,78,100], [229,80,99], [230,81,98],
+ [231,82,98], [232,84,97], [234,85,96], [235,86,96], [236,88,95], [237,89,95], [238,91,94], [238,93,93],
+ [239,94,93], [240,96,93], [241,97,92], [242,99,92], [243,101,92], [243,103,91], [244,104,91], [245,106,91],
+ [245,108,91], [246,110,91], [246,112,91], [247,113,91], [247,115,92], [248,117,92], [248,119,92], [249,121,92],
+ [249,123,93], [249,125,93], [250,127,94], [250,128,94], [250,130,95], [251,132,96], [251,134,96], [251,136,97],
+ [251,138,98], [252,140,99], [252,142,99], [252,144,100], [252,146,101], [252,147,102], [253,149,103], [253,151,104],
+ [253,153,105], [253,155,106], [253,157,107], [253,159,108], [253,161,110], [253,162,111], [253,164,112], [254,166,113],
+ [254,168,115], [254,170,116], [254,172,117], [254,174,118], [254,175,120], [254,177,121], [254,179,123], [254,181,124],
+ [254,183,125], [254,185,127], [254,187,128], [254,188,130], [254,190,131], [254,192,133], [254,194,134], [254,196,136],
+ [254,198,137], [254,199,139], [254,201,141], [254,203,142], [253,205,144], [253,207,146], [253,209,147], [253,210,149],
+ [253,212,151], [253,214,152], [253,216,154], [253,218,156], [253,220,157], [253,221,159], [253,223,161], [253,225,163],
+ [252,227,165], [252,229,166], [252,230,168], [252,232,170], [252,234,172], [252,236,174], [252,238,176], [252,240,177],
+ [252,241,179], [252,243,181], [252,245,183], [251,247,185], [251,249,187], [251,250,189], [251,252,191]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/plasma.json b/2D_wave_sim_V01/ColorSchemeList/plasma.json
new file mode 100644
index 0000000..768aacb
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/plasma.json
@@ -0,0 +1,43 @@
+{
+ "name": "plasma",
+ "origin": "9-stop copy of scheme 'plasma'",
+ "category": "custom",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "stops": [[12,7,134], [76,2,161], [125,3,167], [168,34,150], [203,71,119], [229,108,91], [248,148,65], [253,195,40], [239,248,33]],
+ "colors": [
+ [12,7,134], [14,7,135], [16,7,136], [18,7,137], [20,6,137], [22,6,138], [24,6,139], [26,6,140],
+ [28,6,141], [30,6,142], [32,5,143], [34,5,143], [36,5,144], [38,5,145], [40,5,146], [42,5,147],
+ [44,4,148], [46,4,148], [48,4,149], [50,4,150], [52,4,151], [54,4,152], [56,4,153], [58,3,154],
+ [60,3,154], [62,3,155], [64,3,156], [66,3,157], [68,3,158], [70,2,159], [72,2,160], [74,2,160],
+ [76,2,161], [78,2,161], [79,2,161], [81,2,162], [83,2,162], [84,2,162], [86,2,162], [87,2,162],
+ [89,2,163], [90,2,163], [92,2,163], [93,2,163], [95,2,163], [96,2,164], [98,2,164], [100,2,164],
+ [101,3,164], [103,3,164], [104,3,164], [106,3,165], [107,3,165], [109,3,165], [110,3,165], [112,3,165],
+ [113,3,166], [115,3,166], [117,3,166], [118,3,166], [120,3,166], [121,3,167], [123,3,167], [124,3,167],
+ [126,3,167], [127,4,166], [128,5,166], [130,6,165], [131,7,165], [132,8,164], [134,9,164], [135,10,163],
+ [137,11,162], [138,12,162], [139,13,161], [141,14,161], [142,15,160], [143,16,160], [145,17,159], [146,18,159],
+ [147,19,158], [149,20,158], [150,21,157], [151,22,157], [153,23,156], [154,24,155], [155,25,155], [157,26,154],
+ [158,27,154], [160,28,153], [161,29,153], [162,30,152], [164,31,152], [165,32,151], [166,33,151], [168,34,150],
+ [169,35,149], [170,36,148], [171,37,147], [172,38,146], [173,40,145], [174,41,144], [175,42,143], [177,43,142],
+ [178,44,141], [179,45,140], [180,47,140], [181,48,139], [182,49,138], [183,50,137], [184,51,136], [185,52,135],
+ [186,54,134], [188,55,133], [189,56,132], [190,57,131], [191,58,130], [192,59,129], [193,61,128], [194,62,127],
+ [195,63,126], [196,64,125], [197,65,124], [199,66,123], [200,68,122], [201,69,121], [202,70,120], [203,71,119],
+ [204,72,118], [205,73,117], [205,74,116], [206,76,115], [207,77,115], [208,78,114], [209,79,113], [210,80,112],
+ [210,81,111], [211,83,110], [212,84,109], [213,85,108], [214,86,108], [214,87,107], [215,88,106], [216,90,105],
+ [217,91,104], [218,92,103], [219,93,102], [219,94,101], [220,95,100], [221,97,100], [222,98,99], [223,99,98],
+ [223,100,97], [224,101,96], [225,102,95], [226,104,94], [227,105,93], [228,106,93], [228,107,92], [229,108,91],
+ [230,110,90], [230,111,89], [231,112,88], [232,113,88], [232,115,87], [233,116,86], [233,117,85], [234,118,84],
+ [235,120,83], [235,121,83], [236,122,82], [236,123,81], [237,125,80], [238,126,79], [238,127,79], [239,128,78],
+ [239,130,77], [240,131,76], [241,132,75], [241,134,74], [242,135,74], [242,136,73], [243,137,72], [244,139,71],
+ [244,140,70], [245,141,70], [245,142,69], [246,144,68], [247,145,67], [247,146,66], [248,147,65], [248,149,65],
+ [248,150,64], [248,152,63], [249,153,62], [249,155,61], [249,156,61], [249,158,60], [249,159,59], [249,161,58],
+ [249,162,58], [250,164,57], [250,165,56], [250,167,55], [250,168,54], [250,169,54], [250,171,53], [251,172,52],
+ [251,174,51], [251,175,50], [251,177,50], [251,178,49], [251,180,48], [252,181,47], [252,183,46], [252,184,46],
+ [252,186,45], [252,187,44], [252,189,43], [252,190,43], [253,192,42], [253,193,41], [253,195,40], [253,196,40],
+ [252,198,40], [252,200,39], [251,201,39], [251,203,39], [250,205,39], [250,206,39], [250,208,38], [249,210,38],
+ [249,211,38], [248,213,38], [248,215,37], [247,216,37], [247,218,37], [246,220,37], [246,221,37], [246,223,36],
+ [245,225,36], [245,226,36], [244,228,36], [244,230,35], [243,231,35], [243,233,35], [243,235,35], [242,236,35],
+ [242,238,34], [241,240,34], [241,241,34], [240,243,34], [240,245,33], [239,246,33], [239,248,33]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemeList/rainbow.json b/2D_wave_sim_V01/ColorSchemeList/rainbow.json
new file mode 100644
index 0000000..e865ade
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemeList/rainbow.json
@@ -0,0 +1,42 @@
+{
+ "name": "rainbow",
+ "origin": "matplotlib colormap rainbow, sampled at 255 points",
+ "category": "other",
+ "scheme_type": "intensity",
+ "bits_per_channel": 8,
+ "entry_count": 255,
+ "colors": [
+ [127,0,255], [125,3,254], [123,6,254], [121,9,254], [119,12,254], [117,15,254], [115,18,254], [113,21,254],
+ [111,25,254], [109,28,254], [107,31,254], [105,34,254], [103,37,254], [101,40,254], [99,43,254], [97,46,253],
+ [95,49,253], [93,53,253], [91,56,253], [89,59,253], [87,62,253], [85,65,252], [83,68,252], [81,71,252],
+ [79,74,252], [77,77,251], [75,80,251], [73,83,251], [71,86,251], [69,89,250], [67,92,250], [65,95,250],
+ [63,97,250], [61,100,249], [59,103,249], [57,106,249], [55,109,248], [53,112,248], [51,115,248], [49,117,247],
+ [47,120,247], [45,123,246], [43,126,246], [41,128,246], [39,131,245], [37,134,245], [35,136,244], [33,139,244],
+ [31,142,243], [29,144,243], [27,147,243], [25,149,242], [23,152,242], [21,154,241], [19,157,241], [17,159,240],
+ [15,162,239], [13,164,239], [11,167,238], [9,169,238], [7,171,237], [5,174,237], [3,176,236], [1,178,236],
+ [0,180,235], [2,183,234], [4,185,234], [6,187,233], [8,189,232], [10,191,232], [12,193,231], [14,195,230],
+ [16,197,230], [18,199,229], [20,201,228], [22,203,228], [24,205,227], [26,207,226], [28,209,226], [30,210,225],
+ [32,212,224], [34,214,223], [36,215,223], [38,217,222], [40,219,221], [42,220,220], [44,222,220], [46,223,219],
+ [48,225,218], [50,226,217], [52,228,216], [54,229,215], [56,230,215], [58,232,214], [60,233,213], [62,234,212],
+ [64,236,211], [66,237,210], [68,238,209], [70,239,209], [72,240,208], [74,241,207], [76,242,206], [78,243,205],
+ [80,244,204], [82,245,203], [84,246,202], [86,246,201], [88,247,200], [90,248,199], [92,249,198], [94,249,197],
+ [96,250,196], [98,250,195], [100,251,194], [102,251,193], [104,252,192], [106,252,191], [108,253,190], [110,253,189],
+ [112,253,188], [114,254,187], [116,254,186], [118,254,185], [120,254,184], [122,254,183], [124,254,181], [128,254,179],
+ [130,254,178], [132,254,177], [134,254,176], [136,254,175], [138,254,174], [140,254,172], [142,253,171], [144,253,170],
+ [146,253,169], [148,252,168], [150,252,167], [152,251,165], [154,251,164], [156,250,163], [158,250,162], [160,249,161],
+ [162,249,159], [164,248,158], [166,247,157], [168,246,156], [170,246,154], [172,245,153], [174,244,152], [176,243,151],
+ [178,242,149], [180,241,148], [182,240,147], [184,239,146], [186,238,144], [188,237,143], [190,236,142], [192,234,140],
+ [194,233,139], [196,232,138], [198,230,136], [200,229,135], [202,228,134], [204,226,132], [206,225,131], [208,223,130],
+ [210,222,128], [212,220,127], [214,219,126], [216,217,124], [218,215,123], [220,214,122], [222,212,120], [224,210,119],
+ [226,209,117], [228,207,116], [230,205,115], [232,203,113], [234,201,112], [236,199,110], [238,197,109], [240,195,108],
+ [242,193,106], [244,191,105], [246,189,103], [248,187,102], [250,185,100], [252,183,99], [254,180,97], [255,178,96],
+ [255,176,95], [255,174,93], [255,171,92], [255,169,90], [255,167,89], [255,164,87], [255,162,86], [255,159,84],
+ [255,157,83], [255,154,81], [255,152,80], [255,149,78], [255,147,77], [255,144,75], [255,142,74], [255,139,72],
+ [255,136,71], [255,134,69], [255,131,68], [255,128,66], [255,126,65], [255,123,63], [255,120,62], [255,117,60],
+ [255,115,59], [255,112,57], [255,109,56], [255,106,54], [255,103,53], [255,100,51], [255,97,49], [255,95,48],
+ [255,92,46], [255,89,45], [255,86,43], [255,83,42], [255,80,40], [255,77,39], [255,74,37], [255,71,36],
+ [255,68,34], [255,65,32], [255,62,31], [255,59,29], [255,56,28], [255,53,26], [255,49,25], [255,46,23],
+ [255,43,21], [255,40,20], [255,37,18], [255,34,17], [255,31,15], [255,28,14], [255,25,12], [255,21,10],
+ [255,18,9], [255,15,7], [255,12,6], [255,9,4], [255,6,3], [255,3,1], [255,0,0]
+ ]
+}
diff --git a/2D_wave_sim_V01/ColorSchemes/ColorLut.vb b/2D_wave_sim_V01/ColorSchemes/ColorLut.vb
new file mode 100644
index 0000000..98456f8
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemes/ColorLut.vb
@@ -0,0 +1,141 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+'
+' Portions of this file are based on WaveSimulator2D by 0x23
+' <https://github.com/0x23/WaveSimulator2D>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Drawing
+
+''' <summary>
+''' A ready-to-use lookup table (255 colors) made from a color scheme plus the display options of the
+''' Python function get_colormap_lut: invert, black level and make symmetric. Also converts field and
+''' intensity values to table indices exactly like WaveVisualizer.render_field / render_intensity.
+'''
+''' The options belong to how a scheme is used in a simulation (field or intensity), not to the scheme
+''' itself, so they are not saved in the scheme file.
+''' </summary>
+Public NotInheritable Class ColorLut
+
+ ''' <summary>Number of entries (255).</summary>
+ Public Const Size As Integer = ColorScheme.EntryCount
+
+ Private ReadOnly _argb As Integer()
+
+ Private Sub New(argb As Integer())
+ _argb = argb
+ End Sub
+
+ ''' <summary>
+ ''' Packed 32-bit ARGB values (alpha 255), ready to be copied into a Format32bppArgb bitmap.
+ ''' Treat as read-only.
+ ''' </summary>
+ Public ReadOnly Property Argb As Integer()
+ Get
+ Return _argb
+ End Get
+ End Property
+
+ Public Function ColorAt(index As Integer) As Color
+ Return Color.FromArgb(_argb(index))
+ End Function
+
+ ''' <summary>
+ ''' Builds the table. Order of operations, as in Python: reverse (new, optional), invert (1 - color),
+ ''' make symmetric, black level (c * (1 - b) + b). Values are limited to 0..1 and converted to 8 bit
+ ''' by truncation, like the Python code.
+ ''' </summary>
+ ''' <param name="invert">Replaces every color by its complement (1 - color), like the Python option.</param>
+ ''' <param name="blackLevel">Lifts (positive) or lowers (negative) the darkest level. 0 = unchanged.</param>
+ ''' <param name="makeSymmetric">Squeezes the whole scheme into each half and mirrors it around the centre.</param>
+ ''' <param name="reverse">Reverses the order of the scheme (like matplotlib's _r maps).</param>
+ Public Shared Function Build(scheme As ColorScheme,
+ Optional invert As Boolean = False,
+ Optional blackLevel As Double = 0.0,
+ Optional makeSymmetric As Boolean = False,
+ Optional reverse As Boolean = False) As ColorLut
+ If scheme Is Nothing Then Throw New ArgumentNullException("scheme")
+ Dim n As Integer = Size
+
+ ' source values 0..1
+ Dim src(n - 1, 2) As Double
+ For i As Integer = 0 To n - 1
+ Dim c As Color = scheme.GetEntry(If(reverse, n - 1 - i, i))
+ src(i, 0) = c.R / 255.0
+ src(i, 1) = c.G / 255.0
+ src(i, 2) = c.B / 255.0
+ Next
+
+ If invert Then
+ For i As Integer = 0 To n - 1
+ For k As Integer = 0 To 2
+ src(i, k) = 1.0 - src(i, k)
+ Next
+ Next
+ End If
+
+ Dim argb(n - 1) As Integer
+ For i As Integer = 0 To n - 1
+ ' Python: entries 0..127 = src[0::2] and entries 127..254 = the same list mirrored,
+ ' which is entry i = src(2 * min(i, 254 - i))
+ Dim s As Integer = i
+ If makeSymmetric Then s = 2 * Math.Min(i, n - 1 - i)
+
+ Dim rgb(2) As Integer
+ For k As Integer = 0 To 2
+ Dim v As Double = src(s, k) * (1.0 - blackLevel) + blackLevel
+ If v < 0.0 Then v = 0.0
+ If v > 1.0 Then v = 1.0
+ Dim b As Integer = CInt(Math.Truncate(v * 255.0))
+ If b > 255 Then b = 255
+ rgb(k) = b
+ Next
+ argb(i) = Color.FromArgb(255, rgb(0), rgb(1), rgb(2)).ToArgb()
+ Next
+
+ Return New ColorLut(argb)
+ End Function
+
+ ''' <summary>
+ ''' Table index for a field value, like render_field: clip(value * brightness, -1, 1) * 127 + 127.
+ ''' Zero field gives index 127 (the centre color); result is 0..254.
+ ''' </summary>
+ Public Shared Function FieldIndex(value As Single, brightness As Single) As Integer
+ Dim x As Single = value * brightness
+ If Single.IsNaN(x) Then Return 127
+ If x > 1.0F Then x = 1.0F
+ If x < -1.0F Then x = -1.0F
+ Return CInt(Math.Truncate(x * 127.0F + 127.0F))
+ End Function
+
+ ''' <summary>
+ ''' Table index for an intensity value, like render_intensity:
+ ''' clip(intensity ^ exponent * brightness, 0, 1) * 254. The Python default exponent is 0.5.
+ ''' </summary>
+ Public Shared Function IntensityIndex(intensity As Single, brightness As Single, Optional exponent As Single = 0.5F) As Integer
+ If Single.IsNaN(intensity) OrElse intensity <= 0.0F Then Return 0
+ Dim x As Double = Math.Pow(intensity, exponent) * brightness
+ If Double.IsNaN(x) OrElse x < 0.0 Then Return 0
+ If x > 1.0 Then x = 1.0
+ Return CInt(Math.Truncate(x * 254.0))
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/ColorSchemes/ColorPickerControl.vb b/2D_wave_sim_V01/ColorSchemes/ColorPickerControl.vb
new file mode 100644
index 0000000..59e642f
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemes/ColorPickerControl.vb
@@ -0,0 +1,403 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.ComponentModel
+Imports System.Drawing
+Imports System.Drawing.Drawing2D
+Imports System.Drawing.Imaging
+Imports System.Globalization
+Imports System.Runtime.InteropServices
+Imports System.Windows.Forms
+
+''' <summary>
+''' A small color picker: a saturation/brightness square, a hue bar, a new/old swatch, a hex box and a
+''' button that opens the standard Windows color dialog. Raises ColorChanged while the user picks.
+''' It is built completely in code, so it has no designer file.
+''' </summary>
+<DesignerCategory("Code")>
+Public Class ColorPickerControl
+ Inherits UserControl
+
+ ''' <summary>Raised whenever the user changes the color (dragging, typing a hex code, dialog, old swatch).</summary>
+ Public Event ColorChanged As EventHandler
+
+ Private Const SvResolution As Integer = 150
+
+ Private ReadOnly _svRect As New Rectangle(10, 10, 300, 300)
+ Private ReadOnly _hueRect As New Rectangle(326, 10, 28, 300)
+ Private ReadOnly _newRect As New Rectangle(10, 324, 150, 36)
+ Private ReadOnly _oldRect As New Rectangle(160, 324, 150, 36)
+
+ Private ReadOnly _lblHex As New Label()
+ Private ReadOnly _txtHex As New TextBox()
+ Private ReadOnly _lblRgb As New Label()
+ Private ReadOnly _btnDialog As New Button()
+
+ Private _h As Double ' hue 0..360
+ Private _s As Double ' saturation 0..1
+ Private _v As Double ' brightness 0..1
+ Private _color As Color = Color.Red
+ Private _original As Color = Color.Gray
+
+ Private _svBitmap As Bitmap
+ Private _svHue As Double = -1.0
+ Private _hueBitmap As Bitmap
+ Private _drag As Integer ' 0 = none, 1 = square, 2 = hue bar
+ Private _updatingText As Boolean
+
+ Public Sub New()
+ MyBase.New()
+ SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
+ ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw, True)
+ Me.Size = New Size(423, 411)
+
+ _lblHex.Text = "Hex"
+ _lblHex.AutoSize = True
+ _lblHex.Location = New Point(10, 377)
+
+ _txtHex.Location = New Point(48, 373)
+ _txtHex.Width = 90
+ _txtHex.MaxLength = 7
+
+ _lblRgb.AutoSize = True
+ _lblRgb.Location = New Point(152, 377)
+
+ _btnDialog.Text = "More..."
+ _btnDialog.Location = New Point(326, 324)
+ _btnDialog.Size = New Size(90, 36)
+
+ Me.Controls.Add(_lblHex)
+ Me.Controls.Add(_txtHex)
+ Me.Controls.Add(_lblRgb)
+ Me.Controls.Add(_btnDialog)
+
+ AddHandler _txtHex.TextChanged, AddressOf HexTextChanged
+ AddHandler _btnDialog.Click, AddressOf DialogButtonClick
+
+ ApplyColor(Color.Red, False, False)
+ End Sub
+
+ ' ---------------------------------------------------------------- public
+
+ ''' <summary>The current color. Setting it does not raise ColorChanged.</summary>
+ Public Property SelectedColor As Color
+ Get
+ Return _color
+ End Get
+ Set(value As Color)
+ ApplyColor(value, False, False)
+ End Set
+ End Property
+
+ ''' <summary>The color shown in the "Old" swatch; clicking that swatch restores it.</summary>
+ Public Property OriginalColor As Color
+ Get
+ Return _original
+ End Get
+ Set(value As Color)
+ _original = Color.FromArgb(value.R, value.G, value.B)
+ Invalidate()
+ End Set
+ End Property
+
+ ' ---------------------------------------------------------------- color logic
+
+ Private Sub ApplyColor(c As Color, raiseChanged As Boolean, fromHexBox As Boolean)
+ _color = Color.FromArgb(c.R, c.G, c.B)
+
+ Dim hh, ss, vv As Double
+ RgbToHsv(_color, hh, ss, vv)
+ If ss > 0.0 AndAlso vv > 0.0 Then _h = hh ' keep the old hue for grays and black
+ _s = ss
+ _v = vv
+
+ UpdateTexts(fromHexBox)
+ Invalidate()
+ If raiseChanged Then RaiseEvent ColorChanged(Me, EventArgs.Empty)
+ End Sub
+
+ Private Sub SyncFromHsv()
+ _color = HsvToColor(_h, _s, _v)
+ UpdateTexts(False)
+ Invalidate()
+ RaiseEvent ColorChanged(Me, EventArgs.Empty)
+ End Sub
+
+ Private Sub UpdateTexts(skipHexBox As Boolean)
+ _updatingText = True
+ Try
+ If Not skipHexBox Then
+ _txtHex.Text = "#" & _color.R.ToString("X2", CultureInfo.InvariantCulture) &
+ _color.G.ToString("X2", CultureInfo.InvariantCulture) &
+ _color.B.ToString("X2", CultureInfo.InvariantCulture)
+ End If
+ _lblRgb.Text = String.Format(CultureInfo.InvariantCulture, "R {0} G {1} B {2}", _color.R, _color.G, _color.B)
+ Finally
+ _updatingText = False
+ End Try
+ End Sub
+
+ Private Sub HexTextChanged(sender As Object, e As EventArgs)
+ If _updatingText Then Return
+ Dim t As String = _txtHex.Text.Trim().TrimStart("#"c)
+ If t.Length <> 6 Then Return
+ Dim rgb As Integer
+ If Integer.TryParse(t, NumberStyles.HexNumber, CultureInfo.InvariantCulture, rgb) Then
+ ApplyColor(Color.FromArgb((rgb >> 16) And &HFF, (rgb >> 8) And &HFF, rgb And &HFF), True, True)
+ End If
+ End Sub
+
+ Private Sub DialogButtonClick(sender As Object, e As EventArgs)
+ Using dlg As New ColorDialog()
+ dlg.FullOpen = True
+ dlg.Color = _color
+ If dlg.ShowDialog(Me) = DialogResult.OK Then
+ ApplyColor(dlg.Color, True, False)
+ End If
+ End Using
+ End Sub
+
+ ' ---------------------------------------------------------------- mouse
+
+ Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
+ MyBase.OnMouseDown(e)
+ If e.Button <> MouseButtons.Left Then Return
+ If _svRect.Contains(e.Location) Then
+ _drag = 1
+ UpdateFromMouse(e.Location)
+ ElseIf _hueRect.Contains(e.Location) Then
+ _drag = 2
+ UpdateFromMouse(e.Location)
+ ElseIf _oldRect.Contains(e.Location) Then
+ ApplyColor(_original, True, False)
+ End If
+ End Sub
+
+ Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
+ MyBase.OnMouseMove(e)
+ If _drag <> 0 Then UpdateFromMouse(e.Location)
+ End Sub
+
+ Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
+ MyBase.OnMouseUp(e)
+ _drag = 0
+ End Sub
+
+ Private Sub UpdateFromMouse(p As Point)
+ If _drag = 1 Then
+ _s = Clamp01((p.X - _svRect.X) / CDbl(_svRect.Width - 1))
+ _v = 1.0 - Clamp01((p.Y - _svRect.Y) / CDbl(_svRect.Height - 1))
+ ElseIf _drag = 2 Then
+ _h = Clamp01((p.Y - _hueRect.Y) / CDbl(_hueRect.Height - 1)) * 360.0
+ Else
+ Return
+ End If
+ SyncFromHsv()
+ End Sub
+
+ ' ---------------------------------------------------------------- painting
+
+ Protected Overrides Sub OnPaint(e As PaintEventArgs)
+ MyBase.OnPaint(e)
+ Dim g As Graphics = e.Graphics
+ g.Clear(Me.BackColor)
+
+ ' saturation / brightness square
+ EnsureSvBitmap()
+ g.InterpolationMode = InterpolationMode.HighQualityBilinear
+ g.PixelOffsetMode = PixelOffsetMode.Half
+ g.DrawImage(_svBitmap, _svRect)
+ g.DrawRectangle(Pens.Black, _svRect.X - 1, _svRect.Y - 1, _svRect.Width + 1, _svRect.Height + 1)
+
+ ' hue bar
+ EnsureHueBitmap()
+ g.InterpolationMode = InterpolationMode.NearestNeighbor
+ g.DrawImage(_hueBitmap, _hueRect)
+ g.DrawRectangle(Pens.Black, _hueRect.X - 1, _hueRect.Y - 1, _hueRect.Width + 1, _hueRect.Height + 1)
+
+ g.SmoothingMode = SmoothingMode.AntiAlias
+
+ ' marker in the square
+ Dim mx As Single = CSng(_svRect.X + _s * (_svRect.Width - 1))
+ Dim my As Single = CSng(_svRect.Y + (1.0 - _v) * (_svRect.Height - 1))
+ g.DrawEllipse(Pens.Black, mx - 7.0F, my - 7.0F, 14.0F, 14.0F)
+ g.DrawEllipse(Pens.White, mx - 6.0F, my - 6.0F, 12.0F, 12.0F)
+
+ ' marker on the hue bar
+ Dim hy As Single = CSng(_hueRect.Y + (_h / 360.0) * (_hueRect.Height - 1))
+ g.DrawRectangle(Pens.Black, _hueRect.X - 3, hy - 3.0F, _hueRect.Width + 5, 6.0F)
+ g.DrawRectangle(Pens.White, _hueRect.X - 2, hy - 2.0F, _hueRect.Width + 3, 4.0F)
+
+ g.SmoothingMode = SmoothingMode.Default
+
+ ' swatches
+ Using br As New SolidBrush(_color)
+ g.FillRectangle(br, _newRect)
+ End Using
+ Using br As New SolidBrush(_original)
+ g.FillRectangle(br, _oldRect)
+ End Using
+ g.DrawRectangle(Pens.Black, _newRect.X, _newRect.Y, _newRect.Width - 1, _newRect.Height - 1)
+ g.DrawRectangle(Pens.Black, _oldRect.X, _oldRect.Y, _oldRect.Width - 1, _oldRect.Height - 1)
+ TextRenderer.DrawText(g, "New", Me.Font, _newRect, ContrastColor(_color),
+ TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)
+ TextRenderer.DrawText(g, "Old (click to restore)", Me.Font, _oldRect, ContrastColor(_original),
+ TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)
+
+ If Not Me.Enabled Then
+ Using veil As New SolidBrush(Color.FromArgb(150, Me.BackColor))
+ g.FillRectangle(veil, Me.ClientRectangle)
+ End Using
+ End If
+ End Sub
+
+ Protected Overrides Sub OnEnabledChanged(e As EventArgs)
+ MyBase.OnEnabledChanged(e)
+ Invalidate()
+ End Sub
+
+ Private Sub EnsureSvBitmap()
+ If _svBitmap IsNot Nothing AndAlso Math.Abs(_svHue - _h) < 0.0001 Then Return
+ If _svBitmap Is Nothing Then
+ _svBitmap = New Bitmap(SvResolution, SvResolution, PixelFormat.Format32bppArgb)
+ End If
+
+ Dim baseColor As Color = HsvToColor(_h, 1.0, 1.0)
+ Dim br As Double = baseColor.R / 255.0
+ Dim bg As Double = baseColor.G / 255.0
+ Dim bb As Double = baseColor.B / 255.0
+
+ Dim pixels(SvResolution * SvResolution - 1) As Integer
+ For y As Integer = 0 To SvResolution - 1
+ Dim v As Double = 1.0 - y / CDbl(SvResolution - 1)
+ For x As Integer = 0 To SvResolution - 1
+ Dim s As Double = x / CDbl(SvResolution - 1)
+ Dim r As Integer = CInt(Math.Round(255.0 * v * ((1.0 - s) + s * br)))
+ Dim gg As Integer = CInt(Math.Round(255.0 * v * ((1.0 - s) + s * bg)))
+ Dim b As Integer = CInt(Math.Round(255.0 * v * ((1.0 - s) + s * bb)))
+ pixels(y * SvResolution + x) = Color.FromArgb(255, r, gg, b).ToArgb()
+ Next
+ Next
+
+ Dim data As BitmapData = _svBitmap.LockBits(New Rectangle(0, 0, SvResolution, SvResolution),
+ ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb)
+ Try
+ Marshal.Copy(pixels, 0, data.Scan0, pixels.Length)
+ Finally
+ _svBitmap.UnlockBits(data)
+ End Try
+ _svHue = _h
+ End Sub
+
+ Private Sub EnsureHueBitmap()
+ If _hueBitmap IsNot Nothing Then Return
+ _hueBitmap = New Bitmap(1, _hueRect.Height, PixelFormat.Format32bppArgb)
+ For y As Integer = 0 To _hueRect.Height - 1
+ _hueBitmap.SetPixel(0, y, HsvToColor(y / CDbl(_hueRect.Height - 1) * 360.0, 1.0, 1.0))
+ Next
+ End Sub
+
+ Protected Overrides Sub Dispose(disposing As Boolean)
+ If disposing Then
+ If _svBitmap IsNot Nothing Then _svBitmap.Dispose()
+ If _hueBitmap IsNot Nothing Then _hueBitmap.Dispose()
+ End If
+ MyBase.Dispose(disposing)
+ End Sub
+
+ ' ---------------------------------------------------------------- helpers
+
+ Private Shared Function Clamp01(x As Double) As Double
+ If x < 0.0 Then Return 0.0
+ If x > 1.0 Then Return 1.0
+ Return x
+ End Function
+
+ Private Shared Function ContrastColor(c As Color) As Color
+ Dim lum As Double = 0.299 * c.R + 0.587 * c.G + 0.114 * c.B
+ If lum > 140.0 Then Return Color.Black
+ Return Color.White
+ End Function
+
+ ''' <summary>Converts hue (0..360), saturation and value (0..1) to an RGB color.</summary>
+ Public Shared Function HsvToColor(h As Double, s As Double, v As Double) As Color
+ Dim hue As Double = h Mod 360.0
+ If hue < 0.0 Then hue += 360.0
+ Dim c As Double = v * s
+ Dim hp As Double = hue / 60.0
+ Dim x As Double = c * (1.0 - Math.Abs((hp Mod 2.0) - 1.0))
+
+ Dim r1, g1, b1 As Double
+ Select Case CInt(Math.Floor(hp))
+ Case 0
+ r1 = c : g1 = x : b1 = 0.0
+ Case 1
+ r1 = x : g1 = c : b1 = 0.0
+ Case 2
+ r1 = 0.0 : g1 = c : b1 = x
+ Case 3
+ r1 = 0.0 : g1 = x : b1 = c
+ Case 4
+ r1 = x : g1 = 0.0 : b1 = c
+ Case Else
+ r1 = c : g1 = 0.0 : b1 = x
+ End Select
+
+ Dim m As Double = v - c
+ Return Color.FromArgb(ToByte(r1 + m), ToByte(g1 + m), ToByte(b1 + m))
+ End Function
+
+ Private Shared Function ToByte(v As Double) As Integer
+ Dim n As Integer = CInt(Math.Round(v * 255.0))
+ If n < 0 Then n = 0
+ If n > 255 Then n = 255
+ Return n
+ End Function
+
+ Private Shared Sub RgbToHsv(c As Color, ByRef h As Double, ByRef s As Double, ByRef v As Double)
+ Dim r As Double = c.R / 255.0
+ Dim g As Double = c.G / 255.0
+ Dim b As Double = c.B / 255.0
+ Dim mx As Double = Math.Max(r, Math.Max(g, b))
+ Dim mn As Double = Math.Min(r, Math.Min(g, b))
+ Dim d As Double = mx - mn
+
+ v = mx
+ If mx <= 0.0 Then
+ s = 0.0
+ Else
+ s = d / mx
+ End If
+
+ If d <= 0.0 Then
+ h = 0.0
+ ElseIf mx = r Then
+ h = 60.0 * (((g - b) / d) Mod 6.0)
+ ElseIf mx = g Then
+ h = 60.0 * (((b - r) / d) + 2.0)
+ Else
+ h = 60.0 * (((r - g) / d) + 4.0)
+ End If
+ If h < 0.0 Then h += 360.0
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/ColorSchemes/ColorScheme.vb b/2D_wave_sim_V01/ColorSchemes/ColorScheme.vb
new file mode 100644
index 0000000..baeaa2e
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemes/ColorScheme.vb
@@ -0,0 +1,232 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Drawing
+
+''' <summary>
+''' A color scheme: a lookup table of exactly 255 RGB colors, the same table size the Python
+''' simulator uses. A scheme can be used for the field view or for the intensity view.
+'''
+''' Schemes made in the stop editor also keep their anchor colors ("stops", StopCount of them) so they can be
+''' edited again. The stops sit at fixed, equally spaced positions on the scale: stop 1 is the first entry,
+''' the last stop is the last entry and, with an odd number of stops, the middle stop is exactly the centre
+''' entry 127 (the zero-field color). With 9 stops that is Color 5.
+''' All other entries are interpolated linearly in RGB between neighbouring stops.
+''' Imported schemes (matplotlib, seaborn, Python tables) have no stops and are used as they are.
+''' </summary>
+Public Class ColorScheme
+
+ ''' <summary>Number of entries in every scheme.</summary>
+ Public Const EntryCount As Integer = 255
+
+ ''' <summary>Number of fixed anchor colors in the stop editor (one Color button each) - 9 since the Color 8/9
+ ''' buttons were added to the Designer (previously upgraded from 5 to 7 the same way).</summary>
+ Public Const StopCount As Integer = 9
+
+ Private _entries As Color()
+ Private _stops As Color()
+
+ ''' <summary>Scheme type "field" (signed values, centre = zero field) as stored in the file.</summary>
+ Public Const SchemeTypeField As String = "field"
+
+ ''' <summary>Scheme type "intensity" (values from zero upwards) as stored in the file.</summary>
+ Public Const SchemeTypeIntensity As String = "intensity"
+
+ Public Property Name As String
+ Public Property Origin As String
+ Public Property Category As String
+
+ ''' <summary>
+ ''' What the scheme is meant for: "field", "intensity" or an empty string when not specified.
+ ''' This is only a label saved in the file; any scheme can technically be used for either.
+ ''' </summary>
+ Public Property SchemeType As String
+
+ ''' <summary>Full path of the JSON file this scheme was loaded from or saved to (empty if never saved).</summary>
+ Public Property FilePath As String
+
+ Public Sub New(schemeName As String, colors As IList(Of Color))
+ If colors Is Nothing Then Throw New ArgumentNullException("colors")
+ Me.Name = schemeName
+ Me.Origin = ""
+ Me.Category = ""
+ Me.SchemeType = ""
+ Me.FilePath = ""
+ _entries = Resample(colors, EntryCount)
+ End Sub
+
+ ' ---------------------------------------------------------------- reading
+
+ ''' <summary>A copy of the 255 entries.</summary>
+ Public ReadOnly Property Entries As Color()
+ Get
+ Return CType(_entries.Clone(), Color())
+ End Get
+ End Property
+
+ ''' <summary>One entry, index 0 to 254.</summary>
+ Public Function GetEntry(index As Integer) As Color
+ Return _entries(index)
+ End Function
+
+ ''' <summary>True when the scheme has StopCount editable stops.</summary>
+ Public ReadOnly Property HasStops As Boolean
+ Get
+ Return _stops IsNot Nothing
+ End Get
+ End Property
+
+ ''' <summary>A copy of the stops, or Nothing when the scheme has none.</summary>
+ Public ReadOnly Property Stops As Color()
+ Get
+ If _stops Is Nothing Then Return Nothing
+ Return CType(_stops.Clone(), Color())
+ End Get
+ End Property
+
+ ''' <summary>The color at a fractional position (0 to 254) on the scale, interpolated between entries.</summary>
+ Public Function SampleAt(position As Double) As Color
+ If position <= 0.0 Then Return _entries(0)
+ If position >= EntryCount - 1 Then Return _entries(EntryCount - 1)
+ Dim lo As Integer = CInt(Math.Floor(position))
+ Return Lerp(_entries(lo), _entries(lo + 1), position - lo)
+ End Function
+
+ Public Overrides Function ToString() As String
+ Return Name
+ End Function
+
+ ' ---------------------------------------------------------------- stops
+
+ ''' <summary>
+ ''' Creates a stop-based scheme. The stops must be given in scale order
+ ''' (stop 1 first, the middle stop in the centre, the last stop last).
+ ''' </summary>
+ Public Shared Function FromStops(schemeName As String, stops As IList(Of Color)) As ColorScheme
+ Dim scheme As New ColorScheme(schemeName, InterpolateStops(stops))
+ scheme.AttachStops(stops)
+ scheme.Origin = StopCount.ToString() & "-stop gradient made in the color scheme editor"
+ scheme.Category = "custom"
+ Return scheme
+ End Function
+
+ ''' <summary>Sets the stops of this scheme without recomputing the entries (used when loading a file).</summary>
+ Friend Sub AttachStops(stops As IList(Of Color))
+ If stops Is Nothing OrElse stops.Count <> StopCount Then
+ Throw New ArgumentException("Exactly " & StopCount.ToString() & " stops are required.")
+ End If
+ Dim copy(StopCount - 1) As Color
+ stops.CopyTo(copy, 0)
+ _stops = copy
+ End Sub
+
+ ''' <summary>Changes one stop (0 to StopCount - 1) and recomputes all 255 entries. Only for schemes with stops.</summary>
+ Public Sub SetStop(stopIndex As Integer, value As Color)
+ If _stops Is Nothing Then
+ Throw New InvalidOperationException("This scheme has no editable stops. Use ToStopScheme first.")
+ End If
+ If stopIndex < 0 OrElse stopIndex >= StopCount Then
+ Throw New ArgumentOutOfRangeException("stopIndex")
+ End If
+ _stops(stopIndex) = Color.FromArgb(value.R, value.G, value.B)
+ _entries = InterpolateStops(_stops)
+ End Sub
+
+ ''' <summary>
+ ''' Makes an editable stop scheme from any scheme by sampling it at the stop positions.
+ ''' This is lossy: the copy is a smooth approximation of the original.
+ ''' </summary>
+ Public Function ToStopScheme(newName As String) As ColorScheme
+ Dim picked(StopCount - 1) As Color
+ For k As Integer = 0 To StopCount - 1
+ picked(k) = SampleAt(k * (EntryCount - 1) / CDbl(StopCount - 1))
+ Next
+ Dim scheme As ColorScheme = FromStops(newName, picked)
+ scheme.Origin = StopCount.ToString() & "-stop copy of scheme '" & Name & "'"
+ scheme.SchemeType = SchemeType
+ Return scheme
+ End Function
+
+ ''' <summary>An independent copy under a new name (FilePath is not copied).</summary>
+ Public Function Clone(newName As String) As ColorScheme
+ Dim scheme As New ColorScheme(newName, _entries)
+ scheme.Origin = Origin
+ scheme.Category = Category
+ scheme.SchemeType = SchemeType
+ If _stops IsNot Nothing Then scheme.AttachStops(_stops)
+ Return scheme
+ End Function
+
+ ''' <summary>Builds the 255 entries from the stops at fixed, equally spaced positions (linear in RGB).</summary>
+ Public Shared Function InterpolateStops(stops As IList(Of Color)) As Color()
+ If stops Is Nothing OrElse stops.Count <> StopCount Then
+ Throw New ArgumentException("Exactly " & StopCount.ToString() & " stops are required.")
+ End If
+ Dim result(EntryCount - 1) As Color
+ For i As Integer = 0 To EntryCount - 1
+ ' position on the stop scale: 0.0 (first stop) to StopCount - 1 (last stop);
+ ' with 9 stops entry 127 is exactly 4.0, the middle stop
+ Dim pos As Double = i * (StopCount - 1) / CDbl(EntryCount - 1)
+ Dim seg As Integer = CInt(Math.Floor(pos))
+ If seg > StopCount - 2 Then seg = StopCount - 2
+ result(i) = Lerp(stops(seg), stops(seg + 1), pos - seg)
+ Next
+ Return result
+ End Function
+
+ ' ---------------------------------------------------------------- helpers
+
+ ''' <summary>Resamples a list of colors to the requested number of entries (linear in RGB).</summary>
+ Public Shared Function Resample(source As IList(Of Color), count As Integer) As Color()
+ If source Is Nothing OrElse source.Count < 2 Then
+ Throw New ArgumentException("A color scheme needs at least 2 colors.")
+ End If
+ Dim result(count - 1) As Color
+ If source.Count = count Then
+ source.CopyTo(result, 0)
+ Return result
+ End If
+ For i As Integer = 0 To count - 1
+ Dim pos As Double = i * (source.Count - 1) / CDbl(count - 1)
+ Dim lo As Integer = CInt(Math.Floor(pos))
+ If lo >= source.Count - 1 Then
+ result(i) = source(source.Count - 1)
+ Else
+ result(i) = Lerp(source(lo), source(lo + 1), pos - lo)
+ End If
+ Next
+ Return result
+ End Function
+
+ Private Shared Function Lerp(a As Color, b As Color, t As Double) As Color
+ Return Color.FromArgb(LerpChannel(a.R, b.R, t), LerpChannel(a.G, b.G, t), LerpChannel(a.B, b.B, t))
+ End Function
+
+ Private Shared Function LerpChannel(a As Integer, b As Integer, t As Double) As Integer
+ Dim v As Integer = CInt(Math.Round(a + (b - a) * t, MidpointRounding.AwayFromZero))
+ If v < 0 Then v = 0
+ If v > 255 Then v = 255
+ Return v
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/ColorSchemes/ColorSchemeStore.vb b/2D_wave_sim_V01/ColorSchemes/ColorSchemeStore.vb
new file mode 100644
index 0000000..a250a55
--- /dev/null
+++ b/2D_wave_sim_V01/ColorSchemes/ColorSchemeStore.vb
@@ -0,0 +1,289 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections
+Imports System.Collections.Generic
+Imports System.Drawing
+Imports System.Globalization
+Imports System.IO
+Imports System.Text
+Imports System.Web.Script.Serialization
+
+''' <summary>
+''' Reads and writes color schemes as JSON files (one file per scheme, e.g. in the color_schemes folder).
+'''
+''' File format (the same as the files exported from Python):
+''' name, origin, category (optional), scheme_type (optional: "field" or "intensity"),
+''' bits_per_channel, entry_count, colors = 255 x [r,g,b]
+''' and, only for schemes made in the stop editor:
+''' stops = 9 x [r,g,b] (ColorScheme.StopCount)
+''' </summary>
+Public NotInheritable Class ColorSchemeStore
+
+ ''' <summary>Name of the folder with the color schemes that belongs to the program.</summary>
+ Public Const SchemeFolderName As String = "ColorSchemeList"
+
+ Private Sub New()
+ End Sub
+
+ ''' <summary>
+ ''' The program's own color scheme folder. While developing (the exe runs from bin\Debug inside the
+ ''' Visual Studio project) this is the ColorSchemeList folder of the project itself, so edits end up
+ ''' in the project. In a deployed program it is the ColorSchemeList folder next to the exe.
+ ''' The folder is created when it does not exist.
+ ''' </summary>
+ Public Shared Function FindDefaultFolder() As String
+ Dim exeFolder As String = AppDomain.CurrentDomain.BaseDirectory
+ Dim result As String = Path.Combine(exeFolder, SchemeFolderName)
+
+ Try
+ Dim probe As DirectoryInfo = New DirectoryInfo(exeFolder)
+ For level As Integer = 0 To 4
+ If probe Is Nothing Then Exit For
+ If probe.GetFiles("*.vbproj").Length > 0 Then
+ Dim candidate As String = Path.Combine(probe.FullName, SchemeFolderName)
+ If Directory.Exists(candidate) Then result = candidate
+ Exit For
+ End If
+ probe = probe.Parent
+ Next
+
+ If Not Directory.Exists(result) Then Directory.CreateDirectory(result)
+ Catch
+ ' the caller checks whether the folder exists
+ End Try
+ Return result
+ End Function
+
+ ''' <summary>Loads one scheme file. Throws when the file cannot be read or is not a color scheme.</summary>
+ Public Shared Function Load(filePath As String) As ColorScheme
+ Dim text As String = File.ReadAllText(filePath, Encoding.UTF8)
+
+ Dim serializer As New JavaScriptSerializer()
+ serializer.MaxJsonLength = Integer.MaxValue
+ Dim root As Dictionary(Of String, Object) = TryCast(serializer.DeserializeObject(text), Dictionary(Of String, Object))
+ If root Is Nothing Then
+ Throw New InvalidDataException("Not a color scheme file (a JSON object was expected).")
+ End If
+
+ Dim schemeName As String = GetString(root, "name", Path.GetFileNameWithoutExtension(filePath))
+
+ Dim colors As List(Of Color) = Nothing
+ If root.ContainsKey("colors") Then colors = ParseColorList(root("colors"))
+
+ Dim stops As List(Of Color) = Nothing
+ If root.ContainsKey("stops") Then stops = ParseColorList(root("stops"))
+ If stops IsNot Nothing AndAlso stops.Count <> ColorScheme.StopCount Then stops = Nothing
+
+ Dim scheme As ColorScheme
+ If colors IsNot Nothing AndAlso colors.Count >= 2 Then
+ scheme = New ColorScheme(schemeName, colors)
+ ElseIf stops IsNot Nothing Then
+ scheme = ColorScheme.FromStops(schemeName, stops)
+ Else
+ Throw New InvalidDataException("The file contains no usable 'colors' list.")
+ End If
+
+ If stops IsNot Nothing Then scheme.AttachStops(stops)
+ scheme.Origin = GetString(root, "origin", scheme.Origin)
+ scheme.Category = GetString(root, "category", scheme.Category)
+ scheme.SchemeType = NormalizeSchemeType(GetString(root, "scheme_type", scheme.SchemeType))
+ scheme.FilePath = filePath
+ Return scheme
+ End Function
+
+ ''' <summary>
+ ''' Loads every *.json file in a folder. Files that cannot be read are skipped and described in errors
+ ''' (errors may be Nothing).
+ ''' </summary>
+ Public Shared Function LoadFolder(folder As String, errors As List(Of String)) As List(Of ColorScheme)
+ Dim result As New List(Of ColorScheme)()
+ If String.IsNullOrEmpty(folder) OrElse Not Directory.Exists(folder) Then Return result
+
+ Dim files As New List(Of String)(Directory.GetFiles(folder, "*.json"))
+ files.Sort(StringComparer.OrdinalIgnoreCase)
+
+ For Each f As String In files
+ Try
+ result.Add(Load(f))
+ Catch ex As Exception
+ If errors IsNot Nothing Then errors.Add(Path.GetFileName(f) & ": " & ex.Message)
+ End Try
+ Next
+ Return result
+ End Function
+
+ ''' <summary>Writes a scheme to a JSON file (overwriting an existing file) and sets scheme.FilePath.</summary>
+ Public Shared Sub Save(scheme As ColorScheme, filePath As String)
+ If scheme Is Nothing Then Throw New ArgumentNullException("scheme")
+
+ Dim sb As New StringBuilder()
+ sb.AppendLine("{")
+ sb.AppendLine(" ""name"": " & Quote(scheme.Name) & ",")
+ sb.AppendLine(" ""origin"": " & Quote(scheme.Origin) & ",")
+ If Not String.IsNullOrEmpty(scheme.Category) Then
+ sb.AppendLine(" ""category"": " & Quote(scheme.Category) & ",")
+ End If
+ If Not String.IsNullOrEmpty(scheme.SchemeType) Then
+ sb.AppendLine(" ""scheme_type"": " & Quote(scheme.SchemeType) & ",")
+ End If
+ sb.AppendLine(" ""bits_per_channel"": 8,")
+ sb.AppendLine(" ""entry_count"": " & ColorScheme.EntryCount.ToString(CultureInfo.InvariantCulture) & ",")
+
+ If scheme.HasStops Then
+ Dim stopParts As New List(Of String)()
+ For Each c As Color In scheme.Stops
+ stopParts.Add(FormatRgb(c))
+ Next
+ sb.AppendLine(" ""stops"": [" & String.Join(", ", stopParts) & "],")
+ End If
+
+ Dim entries As Color() = scheme.Entries
+ sb.AppendLine(" ""colors"": [")
+ For i As Integer = 0 To entries.Length - 1 Step 8
+ Dim last As Integer = Math.Min(i + 7, entries.Length - 1)
+ Dim parts As New List(Of String)()
+ For j As Integer = i To last
+ parts.Add(FormatRgb(entries(j)))
+ Next
+ sb.Append(" ")
+ sb.Append(String.Join(", ", parts))
+ If last < entries.Length - 1 Then sb.Append(",")
+ sb.AppendLine()
+ Next
+ sb.AppendLine(" ]")
+ sb.AppendLine("}")
+
+ Dim folderPath As String = Path.GetDirectoryName(filePath)
+ If Not String.IsNullOrEmpty(folderPath) Then Directory.CreateDirectory(folderPath)
+
+ ' write to a temporary file first so a failed save never leaves a half-written scheme behind
+ Dim tmp As String = filePath & ".tmp"
+ File.WriteAllText(tmp, sb.ToString(), New UTF8Encoding(False))
+ If File.Exists(filePath) Then File.Delete(filePath)
+ File.Move(tmp, filePath)
+
+ scheme.FilePath = filePath
+ End Sub
+
+ ''' <summary>A file name (without extension) that is safe on Windows for the given scheme name.</summary>
+ Public Shared Function SafeFileName(schemeName As String) As String
+ If String.IsNullOrEmpty(schemeName) Then Return "color_scheme"
+ Dim invalid As Char() = Path.GetInvalidFileNameChars()
+ Dim sb As New StringBuilder()
+ For Each ch As Char In schemeName.Trim()
+ If Array.IndexOf(invalid, ch) >= 0 Then
+ sb.Append("_"c)
+ Else
+ sb.Append(ch)
+ End If
+ Next
+ Dim s As String = sb.ToString().Trim().TrimEnd("."c)
+ If s.Length = 0 Then s = "color_scheme"
+ Return s
+ End Function
+
+ ''' <summary>Full path of the JSON file for a scheme name inside a folder.</summary>
+ Public Shared Function PathFor(folder As String, schemeName As String) As String
+ Return Path.Combine(folder, SafeFileName(schemeName) & ".json")
+ End Function
+
+ ' ---------------------------------------------------------------- helpers
+
+ Private Shared Function NormalizeSchemeType(value As String) As String
+ If value Is Nothing Then Return ""
+ Dim v As String = value.Trim().ToLowerInvariant()
+ If v = ColorScheme.SchemeTypeField OrElse v = ColorScheme.SchemeTypeIntensity Then Return v
+ Return ""
+ End Function
+
+ Private Shared Function GetString(root As Dictionary(Of String, Object), key As String, fallback As String) As String
+ Dim v As Object = Nothing
+ If root.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Return Convert.ToString(v, CultureInfo.InvariantCulture)
+ End If
+ Return fallback
+ End Function
+
+ Private Shared Function ParseColorList(node As Object) As List(Of Color)
+ Dim outer As IEnumerable = TryCast(node, IEnumerable)
+ If outer Is Nothing OrElse TypeOf node Is String Then
+ Throw New InvalidDataException("Expected a list of [r,g,b] triplets.")
+ End If
+
+ Dim result As New List(Of Color)()
+ For Each item As Object In outer
+ Dim inner As IEnumerable = TryCast(item, IEnumerable)
+ If inner Is Nothing OrElse TypeOf item Is String Then
+ Throw New InvalidDataException("Expected a list of [r,g,b] triplets.")
+ End If
+ Dim rgb As New List(Of Integer)()
+ For Each v As Object In inner
+ rgb.Add(Convert.ToInt32(v, CultureInfo.InvariantCulture))
+ Next
+ If rgb.Count < 3 Then
+ Throw New InvalidDataException("A color needs three values [r,g,b].")
+ End If
+ result.Add(Color.FromArgb(Clamp255(rgb(0)), Clamp255(rgb(1)), Clamp255(rgb(2))))
+ Next
+ Return result
+ End Function
+
+ Private Shared Function Clamp255(v As Integer) As Integer
+ If v < 0 Then Return 0
+ If v > 255 Then Return 255
+ Return v
+ End Function
+
+ Private Shared Function FormatRgb(c As Color) As String
+ Return String.Format(CultureInfo.InvariantCulture, "[{0},{1},{2}]", c.R, c.G, c.B)
+ End Function
+
+ Private Shared Function Quote(text As String) As String
+ If text Is Nothing Then Return """"""
+ Dim sb As New StringBuilder()
+ sb.Append(""""c)
+ For Each ch As Char In text
+ Select Case ch
+ Case """"c
+ sb.Append("\""")
+ Case "\"c
+ sb.Append("\\")
+ Case ChrW(10)
+ sb.Append("\n")
+ Case ChrW(13)
+ sb.Append("\r")
+ Case ChrW(9)
+ sb.Append("\t")
+ Case Else
+ If AscW(ch) < 32 Then
+ sb.Append("\u").Append(AscW(ch).ToString("x4", CultureInfo.InvariantCulture))
+ Else
+ sb.Append(ch)
+ End If
+ End Select
+ Next
+ sb.Append(""""c)
+ Return sb.ToString()
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Form1.Designer.vb b/2D_wave_sim_V01/Form1.Designer.vb
new file mode 100644
index 0000000..a8f79d8
--- /dev/null
+++ b/2D_wave_sim_V01/Form1.Designer.vb
@@ -0,0 +1,4164 @@
+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
+Partial Class Form1
+ Inherits System.Windows.Forms.Form
+
+ 'Form overrides dispose to clean up the component list.
+ <System.Diagnostics.DebuggerNonUserCode()> _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+ <System.Diagnostics.DebuggerStepThrough()> _
+ Private Sub InitializeComponent()
+ Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
+ Me.tabMainFunctions = New System.Windows.Forms.TabControl()
+ Me.tabConfiguration = New System.Windows.Forms.TabPage()
+ Me.grpProjects = New System.Windows.Forms.GroupBox()
+ Me.btnPickRoot = New System.Windows.Forms.Button()
+ Me.btnSaveConfiguration2 = New System.Windows.Forms.Button()
+ Me.lstAllProjects = New System.Windows.Forms.ListView()
+ Me.colProjectName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.colLastEdit = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.btnNewProject = New System.Windows.Forms.Button()
+ Me.btnRenameProject = New System.Windows.Forms.Button()
+ Me.btnLoadProject = New System.Windows.Forms.Button()
+ Me.btnDeleteProject = New System.Windows.Forms.Button()
+ Me.btnSaveAs = New System.Windows.Forms.Button()
+ Me.grpSimulationSettings = New System.Windows.Forms.GroupBox()
+ Me.Label61 = New System.Windows.Forms.Label()
+ Me.numTimeDecayFactor = New System.Windows.Forms.NumericUpDown()
+ Me.numSimulationSteps = New System.Windows.Forms.NumericUpDown()
+ Me.lblInfo = New System.Windows.Forms.Label()
+ Me.chkUse4thOrderLaplacian = New System.Windows.Forms.CheckBox()
+ Me.chkUseGPU = New System.Windows.Forms.CheckBox()
+ Me.numQuality = New System.Windows.Forms.NumericUpDown()
+ Me.lblVideoQuality = New System.Windows.Forms.Label()
+ Me.numIntensityScaling = New System.Windows.Forms.NumericUpDown()
+ Me.numOffsetIntensity = New System.Windows.Forms.NumericUpDown()
+ Me.numOffsetField = New System.Windows.Forms.NumericUpDown()
+ Me.numFieldScaling = New System.Windows.Forms.NumericUpDown()
+ Me.Label3 = New System.Windows.Forms.Label()
+ Me.numScaleIntensityValues = New System.Windows.Forms.Label()
+ Me.Label6 = New System.Windows.Forms.Label()
+ Me.lblOffsetField = New System.Windows.Forms.Label()
+ Me.Label5 = New System.Windows.Forms.Label()
+ Me.Label2 = New System.Windows.Forms.Label()
+ Me.cmbIntensityColorScheme = New System.Windows.Forms.ComboBox()
+ Me.cmbFieldColorScheme = New System.Windows.Forms.ComboBox()
+ Me.chkPreviewVideoIntensity = New System.Windows.Forms.CheckBox()
+ Me.chkExportVideoIntensity = New System.Windows.Forms.CheckBox()
+ Me.chkPreviewVideoField = New System.Windows.Forms.CheckBox()
+ Me.chkExportVideoField = New System.Windows.Forms.CheckBox()
+ Me.lblPreviewVideo = New System.Windows.Forms.Label()
+ Me.lblExportVideo = New System.Windows.Forms.Label()
+ Me.numVisualizeEvery = New System.Windows.Forms.NumericUpDown()
+ Me.Label4 = New System.Windows.Forms.Label()
+ Me.lblVisualizeEvery = New System.Windows.Forms.Label()
+ Me.Label7 = New System.Windows.Forms.Label()
+ Me.lblSimulationSteps = New System.Windows.Forms.Label()
+ Me.grpSceneProperties = New System.Windows.Forms.GroupBox()
+ Me.Label20 = New System.Windows.Forms.Label()
+ Me.numRefractiveIndex = New System.Windows.Forms.NumericUpDown()
+ Me.picImagePreview = New System.Windows.Forms.PictureBox()
+ Me.lblScaleImgSourceIntensity = New System.Windows.Forms.Label()
+ Me.numScaleImageSource = New System.Windows.Forms.NumericUpDown()
+ Me.btnEditObjectSourceList = New System.Windows.Forms.Button()
+ Me.txtDampingEdgeSize = New System.Windows.Forms.TextBox()
+ Me.chkUseObjectSources = New System.Windows.Forms.CheckBox()
+ Me.chkUseImageSources = New System.Windows.Forms.CheckBox()
+ Me.chkDampingEdge = New System.Windows.Forms.CheckBox()
+ Me.btnLoadSceneImage = New System.Windows.Forms.Button()
+ Me.Label1 = New System.Windows.Forms.Label()
+ Me.lblPix = New System.Windows.Forms.Label()
+ Me.lblX = New System.Windows.Forms.Label()
+ Me.txtYsize = New System.Windows.Forms.TextBox()
+ Me.txtXSize = New System.Windows.Forms.TextBox()
+ Me.radUserDefinedScene = New System.Windows.Forms.RadioButton()
+ Me.radUseSceneImage = New System.Windows.Forms.RadioButton()
+ Me.lblImageNameAndSize = New System.Windows.Forms.Label()
+ Me.tabSourceList = New System.Windows.Forms.TabPage()
+ Me.Label62 = New System.Windows.Forms.Label()
+ Me.Label60 = New System.Windows.Forms.Label()
+ Me.chkAutoRescaleSourceOn = New System.Windows.Forms.CheckBox()
+ Me.picPreviewSource = New System.Windows.Forms.PictureBox()
+ Me.grpPlaceSource = New System.Windows.Forms.GroupBox()
+ Me.pnlPosition = New System.Windows.Forms.Panel()
+ Me.numSourcePositionX = New System.Windows.Forms.NumericUpDown()
+ Me.Label36 = New System.Windows.Forms.Label()
+ Me.lblPosition = New System.Windows.Forms.Label()
+ Me.btnPickSourcePosition = New System.Windows.Forms.Button()
+ Me.numSourcePositionY = New System.Windows.Forms.NumericUpDown()
+ Me.Label35 = New System.Windows.Forms.Label()
+ Me.btnDelete = New System.Windows.Forms.Button()
+ Me.btnNew = New System.Windows.Forms.Button()
+ Me.btnCopy = New System.Windows.Forms.Button()
+ Me.lstSources = New System.Windows.Forms.ListBox()
+ Me.pnlSourceImage = New System.Windows.Forms.Panel()
+ Me.grpSourceDetails = New System.Windows.Forms.GroupBox()
+ Me.txtDetachAfterSteps = New System.Windows.Forms.TextBox()
+ Me.btnSaveSource = New System.Windows.Forms.Button()
+ Me.Label47 = New System.Windows.Forms.Label()
+ Me.chkDetachSource = New System.Windows.Forms.CheckBox()
+ Me.lblLambdaIs = New System.Windows.Forms.Label()
+ Me.chkSourceOn = New System.Windows.Forms.CheckBox()
+ Me.grpComposite = New System.Windows.Forms.GroupBox()
+ Me.Label59 = New System.Windows.Forms.Label()
+ Me.Label58 = New System.Windows.Forms.Label()
+ Me.numRandomizeOffWidth = New System.Windows.Forms.NumericUpDown()
+ Me.numRandomizePosition = New System.Windows.Forms.NumericUpDown()
+ Me.NumRandomizePhase = New System.Windows.Forms.NumericUpDown()
+ Me.numRandomizeFrequency = New System.Windows.Forms.NumericUpDown()
+ Me.chkRandomizePhase = New System.Windows.Forms.CheckBox()
+ Me.chkRandomizePosition = New System.Windows.Forms.CheckBox()
+ Me.chkOffWidth = New System.Windows.Forms.CheckBox()
+ Me.chkRandomizeFrequency = New System.Windows.Forms.CheckBox()
+ Me.numSpacingSizeY = New System.Windows.Forms.NumericUpDown()
+ Me.numSpacingSizeX = New System.Windows.Forms.NumericUpDown()
+ Me.numArraySizeY = New System.Windows.Forms.NumericUpDown()
+ Me.numArraySizeX = New System.Windows.Forms.NumericUpDown()
+ Me.Label50 = New System.Windows.Forms.Label()
+ Me.Label51 = New System.Windows.Forms.Label()
+ Me.Label52 = New System.Windows.Forms.Label()
+ Me.Label53 = New System.Windows.Forms.Label()
+ Me.cmbCompositeProperties = New System.Windows.Forms.ComboBox()
+ Me.grpSingleSource = New System.Windows.Forms.GroupBox()
+ Me.numOffStateCycles = New System.Windows.Forms.NumericUpDown()
+ Me.numPhase = New System.Windows.Forms.NumericUpDown()
+ Me.numAmplitude = New System.Windows.Forms.NumericUpDown()
+ Me.numFrequency = New System.Windows.Forms.NumericUpDown()
+ Me.numPulseWidthCycles = New System.Windows.Forms.NumericUpDown()
+ Me.Label44 = New System.Windows.Forms.Label()
+ Me.Label46 = New System.Windows.Forms.Label()
+ Me.Label45 = New System.Windows.Forms.Label()
+ Me.Label43 = New System.Windows.Forms.Label()
+ Me.Label42 = New System.Windows.Forms.Label()
+ Me.Label54 = New System.Windows.Forms.Label()
+ Me.Label41 = New System.Windows.Forms.Label()
+ Me.Label40 = New System.Windows.Forms.Label()
+ Me.cmbPulseShape = New System.Windows.Forms.ComboBox()
+ Me.radModePulsed = New System.Windows.Forms.RadioButton()
+ Me.radModeContinuous = New System.Windows.Forms.RadioButton()
+ Me.txtName = New System.Windows.Forms.TextBox()
+ Me.cmbMainType = New System.Windows.Forms.ComboBox()
+ Me.Label39 = New System.Windows.Forms.Label()
+ Me.lblName = New System.Windows.Forms.Label()
+ Me.Label38 = New System.Windows.Forms.Label()
+ Me.tabProbeList = New System.Windows.Forms.TabPage()
+ Me.GroupBox2 = New System.Windows.Forms.GroupBox()
+ Me.Label49 = New System.Windows.Forms.Label()
+ Me.Label48 = New System.Windows.Forms.Label()
+ Me.Label37 = New System.Windows.Forms.Label()
+ Me.grpProbe2 = New System.Windows.Forms.GroupBox()
+ Me.Label22 = New System.Windows.Forms.Label()
+ Me.numRunningWindow2 = New System.Windows.Forms.NumericUpDown()
+ Me.chkProbeOn2 = New System.Windows.Forms.CheckBox()
+ Me.txtStartAfterStep2 = New System.Windows.Forms.TextBox()
+ Me.chkStartAfterStep2 = New System.Windows.Forms.CheckBox()
+ Me.Label23 = New System.Windows.Forms.Label()
+ Me.Label24 = New System.Windows.Forms.Label()
+ Me.txtMaxScaleY2 = New System.Windows.Forms.TextBox()
+ Me.txtMinScaleY2 = New System.Windows.Forms.TextBox()
+ Me.radFullScale2 = New System.Windows.Forms.RadioButton()
+ Me.radRunningScale2 = New System.Windows.Forms.RadioButton()
+ Me.chkAutoScaleY2 = New System.Windows.Forms.CheckBox()
+ Me.chkAutoScaleX2 = New System.Windows.Forms.CheckBox()
+ Me.numBPosY2 = New System.Windows.Forms.NumericUpDown()
+ Me.numAPosY2 = New System.Windows.Forms.NumericUpDown()
+ Me.numBPosX2 = New System.Windows.Forms.NumericUpDown()
+ Me.numAPosX2 = New System.Windows.Forms.NumericUpDown()
+ Me.butPicPositions2 = New System.Windows.Forms.Button()
+ Me.Label25 = New System.Windows.Forms.Label()
+ Me.cmbPlaceOn2 = New System.Windows.Forms.ComboBox()
+ Me.cmbMeasurement2 = New System.Windows.Forms.ComboBox()
+ Me.Label26 = New System.Windows.Forms.Label()
+ Me.Label27 = New System.Windows.Forms.Label()
+ Me.cmbBoxSize2 = New System.Windows.Forms.ComboBox()
+ Me.cmbProbeType2 = New System.Windows.Forms.ComboBox()
+ Me.Label28 = New System.Windows.Forms.Label()
+ Me.Label29 = New System.Windows.Forms.Label()
+ Me.Label30 = New System.Windows.Forms.Label()
+ Me.Label31 = New System.Windows.Forms.Label()
+ Me.Label32 = New System.Windows.Forms.Label()
+ Me.Label33 = New System.Windows.Forms.Label()
+ Me.Label34 = New System.Windows.Forms.Label()
+ Me.grpProbe1 = New System.Windows.Forms.GroupBox()
+ Me.Label21 = New System.Windows.Forms.Label()
+ Me.numRunningWindow = New System.Windows.Forms.NumericUpDown()
+ Me.chkProbeOn1 = New System.Windows.Forms.CheckBox()
+ Me.txtStartAfterStep = New System.Windows.Forms.TextBox()
+ Me.chkStartAfterStep = New System.Windows.Forms.CheckBox()
+ Me.Label19 = New System.Windows.Forms.Label()
+ Me.Label18 = New System.Windows.Forms.Label()
+ Me.txtMaxScaleY = New System.Windows.Forms.TextBox()
+ Me.txtMinScaleY = New System.Windows.Forms.TextBox()
+ Me.radFullScale = New System.Windows.Forms.RadioButton()
+ Me.radRunningScale = New System.Windows.Forms.RadioButton()
+ Me.chkAutoScaleY = New System.Windows.Forms.CheckBox()
+ Me.chkAutoScaleX = New System.Windows.Forms.CheckBox()
+ Me.numBPosY = New System.Windows.Forms.NumericUpDown()
+ Me.numAPosY = New System.Windows.Forms.NumericUpDown()
+ Me.numBPosX = New System.Windows.Forms.NumericUpDown()
+ Me.numAPosX = New System.Windows.Forms.NumericUpDown()
+ Me.butPicPositions = New System.Windows.Forms.Button()
+ Me.Label16 = New System.Windows.Forms.Label()
+ Me.cmbPlaceOn = New System.Windows.Forms.ComboBox()
+ Me.cmbMeasurement = New System.Windows.Forms.ComboBox()
+ Me.Label13 = New System.Windows.Forms.Label()
+ Me.Label15 = New System.Windows.Forms.Label()
+ Me.cmbBoxSize = New System.Windows.Forms.ComboBox()
+ Me.cmbProbeType = New System.Windows.Forms.ComboBox()
+ Me.Label14 = New System.Windows.Forms.Label()
+ Me.Label12 = New System.Windows.Forms.Label()
+ Me.Label11 = New System.Windows.Forms.Label()
+ Me.Label17 = New System.Windows.Forms.Label()
+ Me.Label10 = New System.Windows.Forms.Label()
+ Me.Label9 = New System.Windows.Forms.Label()
+ Me.Label8 = New System.Windows.Forms.Label()
+ Me.pnlProbeImage = New System.Windows.Forms.Panel()
+ Me.tabViewer = New System.Windows.Forms.TabPage()
+ Me.pnlPreviewIntensityProps = New System.Windows.Forms.Panel()
+ Me.chkExportVideoIntensity2 = New System.Windows.Forms.CheckBox()
+ Me.Label64 = New System.Windows.Forms.Label()
+ Me.numBrightnessIntensityOverlay = New System.Windows.Forms.NumericUpDown()
+ Me.numIntensityScaling2 = New System.Windows.Forms.NumericUpDown()
+ Me.chkDiplayOverlayInIntensity = New System.Windows.Forms.CheckBox()
+ Me.Label66 = New System.Windows.Forms.Label()
+ Me.Panel3 = New System.Windows.Forms.Panel()
+ Me.Label63 = New System.Windows.Forms.Label()
+ Me.chkExportVideoField2 = New System.Windows.Forms.CheckBox()
+ Me.numFieldScaling2 = New System.Windows.Forms.NumericUpDown()
+ Me.Label65 = New System.Windows.Forms.Label()
+ Me.numBrightnessFieldOverlay = New System.Windows.Forms.NumericUpDown()
+ Me.chkDiplayOverlayInField = New System.Windows.Forms.CheckBox()
+ Me.Label56 = New System.Windows.Forms.Label()
+ Me.Label55 = New System.Windows.Forms.Label()
+ Me.lblWarningIntensity = New System.Windows.Forms.Label()
+ Me.lblWarningField = New System.Windows.Forms.Label()
+ Me.btnExportIntensityFrame = New System.Windows.Forms.Button()
+ Me.btnExportFieldFrame = New System.Windows.Forms.Button()
+ Me.btnOpenImageFolder = New System.Windows.Forms.Button()
+ Me.btnOpenVideoFolder = New System.Windows.Forms.Button()
+ Me.btnViewIntensityVideo = New System.Windows.Forms.Button()
+ Me.btnViewFieldVideo = New System.Windows.Forms.Button()
+ Me.pnlPreviewIntensity = New System.Windows.Forms.Panel()
+ Me.pnlPreviewField = New System.Windows.Forms.Panel()
+ Me.tabOutput = New System.Windows.Forms.TabPage()
+ Me.btnRenameVideo = New System.Windows.Forms.Button()
+ Me.btnShareWithEditors = New System.Windows.Forms.Button()
+ Me.btnCopyToClipboard = New System.Windows.Forms.Button()
+ Me.btnOpenImageFolder2 = New System.Windows.Forms.Button()
+ Me.btnViewVIdeoInPlayer2 = New System.Windows.Forms.Button()
+ Me.btnOpenVIdeoFolder2 = New System.Windows.Forms.Button()
+ Me.lblPreview = New System.Windows.Forms.Label()
+ Me.btnDeleteVideos = New System.Windows.Forms.Button()
+ Me.btnDeleteImages = New System.Windows.Forms.Button()
+ Me.btnDeleteScene = New System.Windows.Forms.Button()
+ Me.btnLoadExternal = New System.Windows.Forms.Button()
+ Me.pnlPreview = New System.Windows.Forms.Panel()
+ Me.Label57 = New System.Windows.Forms.Label()
+ Me.lstScenes = New System.Windows.Forms.ListView()
+ Me.colSceneName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.colSceneCreated = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.lstImages = New System.Windows.Forms.ListView()
+ Me.colImageName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.colCreatedOn = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.lstVideo = New System.Windows.Forms.ListView()
+ Me.colVideoName = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.colCreatedOn2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.lstAllProjects3 = New System.Windows.Forms.ListView()
+ Me.colProjectName2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.colLastEdited2 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader)
+ Me.tabColorScheme = New System.Windows.Forms.TabPage()
+ Me.lblType = New System.Windows.Forms.Label()
+ Me.radSchemeTypeIntensity = New System.Windows.Forms.RadioButton()
+ Me.radSchemeTypeField = New System.Windows.Forms.RadioButton()
+ Me.btnLoadScheme = New System.Windows.Forms.Button()
+ Me.btbChooseFFolder = New System.Windows.Forms.Button()
+ Me.lblSchemeFolder = New System.Windows.Forms.Label()
+ Me.ListView1 = New System.Windows.Forms.ListView()
+ Me.txtSchemeFolder = New System.Windows.Forms.TextBox()
+ Me.txtCurrentColorScheme = New System.Windows.Forms.TextBox()
+ Me.lblCurrentCOlorScheme = New System.Windows.Forms.Label()
+ Me.lblColorSchemeEditor = New System.Windows.Forms.Label()
+ Me.btnColor9 = New System.Windows.Forms.Button()
+ Me.btnColor8 = New System.Windows.Forms.Button()
+ Me.btnColor7 = New System.Windows.Forms.Button()
+ Me.btnColor6 = New System.Windows.Forms.Button()
+ Me.btnColor5 = New System.Windows.Forms.Button()
+ Me.btnColor4 = New System.Windows.Forms.Button()
+ Me.btnColor3 = New System.Windows.Forms.Button()
+ Me.btnCOlor2 = New System.Windows.Forms.Button()
+ Me.btnColor1 = New System.Windows.Forms.Button()
+ Me.lblColorPicker = New System.Windows.Forms.Label()
+ Me.Panel2 = New System.Windows.Forms.Panel()
+ Me.pnlScheme = New System.Windows.Forms.Panel()
+ Me.btnDeleteColorScheme = New System.Windows.Forms.Button()
+ Me.btnRenameColorScheme = New System.Windows.Forms.Button()
+ Me.btnSaveAsColorScheme = New System.Windows.Forms.Button()
+ Me.btnSaveCurrentScheme = New System.Windows.Forms.Button()
+ Me.btnSaveConfiguration = New System.Windows.Forms.Button()
+ Me.btnStartSimulation = New System.Windows.Forms.Button()
+ Me.btnPauzeResume = New System.Windows.Forms.Button()
+ Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
+ Me.itemFile = New System.Windows.Forms.ToolStripMenuItem()
+ Me.NewToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.OpenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ChooseProjectRootToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.SetCValueToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.SaveToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.ExitToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.InfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.HelpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
+ Me.lblProjectName = New System.Windows.Forms.Label()
+ Me.txtProjectName = New System.Windows.Forms.TextBox()
+ Me.txtRootFolder = New System.Windows.Forms.TextBox()
+ Me.lblRootFolder = New System.Windows.Forms.Label()
+ Me.btnBrowseRoot = New System.Windows.Forms.Button()
+ Me.StatusStrip1 = New System.Windows.Forms.StatusStrip()
+ Me.ToolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
+ Me.grpNavigateTabs = New System.Windows.Forms.GroupBox()
+ Me.btnGotoPreview = New System.Windows.Forms.Button()
+ Me.btnGotoProbes = New System.Windows.Forms.Button()
+ Me.btnGotoSources = New System.Windows.Forms.Button()
+ Me.btnGotoConfiguration = New System.Windows.Forms.Button()
+ Me.grpSimulationControlButtons = New System.Windows.Forms.GroupBox()
+ Me.Panel1 = New System.Windows.Forms.Panel()
+ Me.btnDescription = New System.Windows.Forms.Button()
+ Me.grpShareImage = New System.Windows.Forms.GroupBox()
+ Me.btnShareIntensityImage = New System.Windows.Forms.Button()
+ Me.btnShareFieldImage = New System.Windows.Forms.Button()
+ Me.btnShareSceneImage = New System.Windows.Forms.Button()
+ Me.tabMainFunctions.SuspendLayout()
+ Me.tabConfiguration.SuspendLayout()
+ Me.grpProjects.SuspendLayout()
+ Me.grpSimulationSettings.SuspendLayout()
+ CType(Me.numTimeDecayFactor, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numSimulationSteps, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numQuality, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numIntensityScaling, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numOffsetIntensity, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numOffsetField, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numFieldScaling, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numVisualizeEvery, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.grpSceneProperties.SuspendLayout()
+ CType(Me.numRefractiveIndex, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.picImagePreview, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numScaleImageSource, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.tabSourceList.SuspendLayout()
+ CType(Me.picPreviewSource, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.grpPlaceSource.SuspendLayout()
+ Me.pnlPosition.SuspendLayout()
+ CType(Me.numSourcePositionX, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numSourcePositionY, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.grpSourceDetails.SuspendLayout()
+ Me.grpComposite.SuspendLayout()
+ CType(Me.numRandomizeOffWidth, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numRandomizePosition, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.NumRandomizePhase, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numRandomizeFrequency, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numSpacingSizeY, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numSpacingSizeX, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numArraySizeY, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numArraySizeX, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.grpSingleSource.SuspendLayout()
+ CType(Me.numOffStateCycles, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numPhase, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numAmplitude, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numFrequency, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numPulseWidthCycles, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.tabProbeList.SuspendLayout()
+ Me.GroupBox2.SuspendLayout()
+ Me.grpProbe2.SuspendLayout()
+ CType(Me.numRunningWindow2, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numBPosY2, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numAPosY2, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numBPosX2, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numAPosX2, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.grpProbe1.SuspendLayout()
+ CType(Me.numRunningWindow, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numBPosY, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numAPosY, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numBPosX, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numAPosX, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.tabViewer.SuspendLayout()
+ Me.pnlPreviewIntensityProps.SuspendLayout()
+ CType(Me.numBrightnessIntensityOverlay, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numIntensityScaling2, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.Panel3.SuspendLayout()
+ CType(Me.numFieldScaling2, System.ComponentModel.ISupportInitialize).BeginInit()
+ CType(Me.numBrightnessFieldOverlay, System.ComponentModel.ISupportInitialize).BeginInit()
+ Me.tabOutput.SuspendLayout()
+ Me.tabColorScheme.SuspendLayout()
+ Me.MenuStrip1.SuspendLayout()
+ Me.StatusStrip1.SuspendLayout()
+ Me.grpNavigateTabs.SuspendLayout()
+ Me.grpSimulationControlButtons.SuspendLayout()
+ Me.Panel1.SuspendLayout()
+ Me.grpShareImage.SuspendLayout()
+ Me.SuspendLayout()
+ '
+ 'tabMainFunctions
+ '
+ Me.tabMainFunctions.Controls.Add(Me.tabConfiguration)
+ Me.tabMainFunctions.Controls.Add(Me.tabSourceList)
+ Me.tabMainFunctions.Controls.Add(Me.tabProbeList)
+ Me.tabMainFunctions.Controls.Add(Me.tabViewer)
+ Me.tabMainFunctions.Controls.Add(Me.tabOutput)
+ Me.tabMainFunctions.Controls.Add(Me.tabColorScheme)
+ Me.tabMainFunctions.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.tabMainFunctions.Location = New System.Drawing.Point(16, 89)
+ Me.tabMainFunctions.Name = "tabMainFunctions"
+ Me.tabMainFunctions.Padding = New System.Drawing.Point(10, 3)
+ Me.tabMainFunctions.SelectedIndex = 0
+ Me.tabMainFunctions.Size = New System.Drawing.Size(1750, 731)
+ Me.tabMainFunctions.TabIndex = 0
+ '
+ 'tabConfiguration
+ '
+ Me.tabConfiguration.Controls.Add(Me.grpProjects)
+ Me.tabConfiguration.Controls.Add(Me.grpSimulationSettings)
+ Me.tabConfiguration.Controls.Add(Me.grpSceneProperties)
+ Me.tabConfiguration.Location = New System.Drawing.Point(4, 34)
+ Me.tabConfiguration.Name = "tabConfiguration"
+ Me.tabConfiguration.Padding = New System.Windows.Forms.Padding(3)
+ Me.tabConfiguration.Size = New System.Drawing.Size(1742, 693)
+ Me.tabConfiguration.TabIndex = 1
+ Me.tabConfiguration.Text = " Settings "
+ Me.tabConfiguration.UseVisualStyleBackColor = True
+ '
+ 'grpProjects
+ '
+ Me.grpProjects.Controls.Add(Me.btnPickRoot)
+ Me.grpProjects.Controls.Add(Me.btnSaveConfiguration2)
+ Me.grpProjects.Controls.Add(Me.lstAllProjects)
+ Me.grpProjects.Controls.Add(Me.btnNewProject)
+ Me.grpProjects.Controls.Add(Me.btnRenameProject)
+ Me.grpProjects.Controls.Add(Me.btnLoadProject)
+ Me.grpProjects.Controls.Add(Me.btnDeleteProject)
+ Me.grpProjects.Controls.Add(Me.btnSaveAs)
+ Me.grpProjects.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpProjects.Location = New System.Drawing.Point(23, 25)
+ Me.grpProjects.Name = "grpProjects"
+ Me.grpProjects.Size = New System.Drawing.Size(473, 641)
+ Me.grpProjects.TabIndex = 8
+ Me.grpProjects.TabStop = False
+ Me.grpProjects.Text = "Projects in current root"
+ '
+ 'btnPickRoot
+ '
+ Me.btnPickRoot.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnPickRoot.Location = New System.Drawing.Point(363, 506)
+ Me.btnPickRoot.Name = "btnPickRoot"
+ Me.btnPickRoot.Size = New System.Drawing.Size(88, 27)
+ Me.btnPickRoot.TabIndex = 10
+ Me.btnPickRoot.Text = "Pick root"
+ Me.btnPickRoot.UseVisualStyleBackColor = True
+ '
+ 'btnSaveConfiguration2
+ '
+ Me.btnSaveConfiguration2.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnSaveConfiguration2.Location = New System.Drawing.Point(252, 562)
+ Me.btnSaveConfiguration2.Name = "btnSaveConfiguration2"
+ Me.btnSaveConfiguration2.Size = New System.Drawing.Size(191, 49)
+ Me.btnSaveConfiguration2.TabIndex = 9
+ Me.btnSaveConfiguration2.Text = "Save"
+ Me.btnSaveConfiguration2.UseVisualStyleBackColor = True
+ '
+ 'lstAllProjects
+ '
+ Me.lstAllProjects.BackColor = System.Drawing.SystemColors.MenuBar
+ Me.lstAllProjects.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colProjectName, Me.colLastEdit})
+ Me.lstAllProjects.FullRowSelect = True
+ Me.lstAllProjects.HideSelection = False
+ Me.lstAllProjects.Location = New System.Drawing.Point(16, 28)
+ Me.lstAllProjects.MultiSelect = False
+ Me.lstAllProjects.Name = "lstAllProjects"
+ Me.lstAllProjects.Size = New System.Drawing.Size(435, 472)
+ Me.lstAllProjects.TabIndex = 8
+ Me.lstAllProjects.UseCompatibleStateImageBehavior = False
+ Me.lstAllProjects.View = System.Windows.Forms.View.Details
+ '
+ 'colProjectName
+ '
+ Me.colProjectName.Text = "ProjectName"
+ Me.colProjectName.Width = 280
+ '
+ 'colLastEdit
+ '
+ Me.colLastEdit.Text = "Last edited"
+ Me.colLastEdit.Width = 150
+ '
+ 'btnNewProject
+ '
+ Me.btnNewProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnNewProject.Location = New System.Drawing.Point(16, 560)
+ Me.btnNewProject.Name = "btnNewProject"
+ Me.btnNewProject.Size = New System.Drawing.Size(191, 51)
+ Me.btnNewProject.TabIndex = 7
+ Me.btnNewProject.Text = "New project"
+ Me.btnNewProject.UseVisualStyleBackColor = True
+ '
+ 'btnRenameProject
+ '
+ Me.btnRenameProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnRenameProject.Location = New System.Drawing.Point(188, 505)
+ Me.btnRenameProject.Name = "btnRenameProject"
+ Me.btnRenameProject.Size = New System.Drawing.Size(78, 28)
+ Me.btnRenameProject.TabIndex = 6
+ Me.btnRenameProject.Text = "Rename"
+ Me.btnRenameProject.UseVisualStyleBackColor = True
+ '
+ 'btnLoadProject
+ '
+ Me.btnLoadProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnLoadProject.Location = New System.Drawing.Point(16, 507)
+ Me.btnLoadProject.Name = "btnLoadProject"
+ Me.btnLoadProject.Size = New System.Drawing.Size(77, 29)
+ Me.btnLoadProject.TabIndex = 6
+ Me.btnLoadProject.Text = "Load"
+ Me.btnLoadProject.UseVisualStyleBackColor = True
+ '
+ 'btnDeleteProject
+ '
+ Me.btnDeleteProject.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnDeleteProject.Location = New System.Drawing.Point(272, 506)
+ Me.btnDeleteProject.Name = "btnDeleteProject"
+ Me.btnDeleteProject.Size = New System.Drawing.Size(73, 27)
+ Me.btnDeleteProject.TabIndex = 6
+ Me.btnDeleteProject.Text = "Delete"
+ Me.btnDeleteProject.UseVisualStyleBackColor = True
+ '
+ 'btnSaveAs
+ '
+ Me.btnSaveAs.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnSaveAs.Location = New System.Drawing.Point(99, 507)
+ Me.btnSaveAs.Name = "btnSaveAs"
+ Me.btnSaveAs.Size = New System.Drawing.Size(83, 27)
+ Me.btnSaveAs.TabIndex = 4
+ Me.btnSaveAs.Text = "Save as"
+ Me.btnSaveAs.UseVisualStyleBackColor = True
+ '
+ 'grpSimulationSettings
+ '
+ Me.grpSimulationSettings.Controls.Add(Me.Label61)
+ Me.grpSimulationSettings.Controls.Add(Me.numTimeDecayFactor)
+ Me.grpSimulationSettings.Controls.Add(Me.numSimulationSteps)
+ Me.grpSimulationSettings.Controls.Add(Me.lblInfo)
+ Me.grpSimulationSettings.Controls.Add(Me.chkUse4thOrderLaplacian)
+ Me.grpSimulationSettings.Controls.Add(Me.chkUseGPU)
+ Me.grpSimulationSettings.Controls.Add(Me.numQuality)
+ Me.grpSimulationSettings.Controls.Add(Me.lblVideoQuality)
+ Me.grpSimulationSettings.Controls.Add(Me.numIntensityScaling)
+ Me.grpSimulationSettings.Controls.Add(Me.numOffsetIntensity)
+ Me.grpSimulationSettings.Controls.Add(Me.numOffsetField)
+ Me.grpSimulationSettings.Controls.Add(Me.numFieldScaling)
+ Me.grpSimulationSettings.Controls.Add(Me.Label3)
+ Me.grpSimulationSettings.Controls.Add(Me.numScaleIntensityValues)
+ Me.grpSimulationSettings.Controls.Add(Me.Label6)
+ Me.grpSimulationSettings.Controls.Add(Me.lblOffsetField)
+ Me.grpSimulationSettings.Controls.Add(Me.Label5)
+ Me.grpSimulationSettings.Controls.Add(Me.Label2)
+ Me.grpSimulationSettings.Controls.Add(Me.cmbIntensityColorScheme)
+ Me.grpSimulationSettings.Controls.Add(Me.cmbFieldColorScheme)
+ Me.grpSimulationSettings.Controls.Add(Me.chkPreviewVideoIntensity)
+ Me.grpSimulationSettings.Controls.Add(Me.chkExportVideoIntensity)
+ Me.grpSimulationSettings.Controls.Add(Me.chkPreviewVideoField)
+ Me.grpSimulationSettings.Controls.Add(Me.chkExportVideoField)
+ Me.grpSimulationSettings.Controls.Add(Me.lblPreviewVideo)
+ Me.grpSimulationSettings.Controls.Add(Me.lblExportVideo)
+ Me.grpSimulationSettings.Controls.Add(Me.numVisualizeEvery)
+ Me.grpSimulationSettings.Controls.Add(Me.Label4)
+ Me.grpSimulationSettings.Controls.Add(Me.lblVisualizeEvery)
+ Me.grpSimulationSettings.Controls.Add(Me.Label7)
+ Me.grpSimulationSettings.Controls.Add(Me.lblSimulationSteps)
+ Me.grpSimulationSettings.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpSimulationSettings.Location = New System.Drawing.Point(516, 432)
+ Me.grpSimulationSettings.Name = "grpSimulationSettings"
+ Me.grpSimulationSettings.Size = New System.Drawing.Size(1200, 234)
+ Me.grpSimulationSettings.TabIndex = 3
+ Me.grpSimulationSettings.TabStop = False
+ Me.grpSimulationSettings.Text = "Simulation Settings"
+ '
+ 'Label61
+ '
+ Me.Label61.AutoSize = True
+ Me.Label61.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label61.Location = New System.Drawing.Point(27, 152)
+ Me.Label61.Name = "Label61"
+ Me.Label61.Size = New System.Drawing.Size(133, 16)
+ Me.Label61.TabIndex = 16
+ Me.Label61.Text = "Intensity decay factor"
+ '
+ 'numTimeDecayFactor
+ '
+ Me.numTimeDecayFactor.Location = New System.Drawing.Point(179, 150)
+ Me.numTimeDecayFactor.Maximum = New Decimal(New Integer() {20, 0, 0, 0})
+ Me.numTimeDecayFactor.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
+ Me.numTimeDecayFactor.Name = "numTimeDecayFactor"
+ Me.numTimeDecayFactor.Size = New System.Drawing.Size(80, 24)
+ Me.numTimeDecayFactor.TabIndex = 15
+ Me.numTimeDecayFactor.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numTimeDecayFactor.Value = New Decimal(New Integer() {5, 0, 0, 0})
+ '
+ 'numSimulationSteps
+ '
+ Me.numSimulationSteps.Increment = New Decimal(New Integer() {500, 0, 0, 0})
+ Me.numSimulationSteps.Location = New System.Drawing.Point(179, 188)
+ Me.numSimulationSteps.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})
+ Me.numSimulationSteps.Minimum = New Decimal(New Integer() {100, 0, 0, 0})
+ Me.numSimulationSteps.Name = "numSimulationSteps"
+ Me.numSimulationSteps.Size = New System.Drawing.Size(80, 24)
+ Me.numSimulationSteps.TabIndex = 14
+ Me.numSimulationSteps.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numSimulationSteps.Value = New Decimal(New Integer() {3000, 0, 0, 0})
+ '
+ 'lblInfo
+ '
+ Me.lblInfo.AutoSize = True
+ Me.lblInfo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblInfo.Location = New System.Drawing.Point(1051, 193)
+ Me.lblInfo.Name = "lblInfo"
+ Me.lblInfo.Size = New System.Drawing.Size(37, 16)
+ Me.lblInfo.TabIndex = 13
+ Me.lblInfo.Text = "(Info)"
+ '
+ 'chkUse4thOrderLaplacian
+ '
+ Me.chkUse4thOrderLaplacian.AutoSize = True
+ Me.chkUse4thOrderLaplacian.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkUse4thOrderLaplacian.Location = New System.Drawing.Point(786, 191)
+ Me.chkUse4thOrderLaplacian.Name = "chkUse4thOrderLaplacian"
+ Me.chkUse4thOrderLaplacian.Size = New System.Drawing.Size(266, 20)
+ Me.chkUse4thOrderLaplacian.TabIndex = 12
+ Me.chkUse4thOrderLaplacian.Text = "Use 4th order Laplacian + sub-sampling "
+ Me.chkUse4thOrderLaplacian.UseVisualStyleBackColor = True
+ '
+ 'chkUseGPU
+ '
+ Me.chkUseGPU.AutoSize = True
+ Me.chkUseGPU.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkUseGPU.Location = New System.Drawing.Point(787, 153)
+ Me.chkUseGPU.Name = "chkUseGPU"
+ Me.chkUseGPU.Size = New System.Drawing.Size(187, 20)
+ Me.chkUseGPU.TabIndex = 11
+ Me.chkUseGPU.Text = "Use GPU (generally faster)"
+ Me.chkUseGPU.UseVisualStyleBackColor = True
+ '
+ 'numQuality
+ '
+ Me.numQuality.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numQuality.Location = New System.Drawing.Point(491, 191)
+ Me.numQuality.Name = "numQuality"
+ Me.numQuality.Size = New System.Drawing.Size(61, 22)
+ Me.numQuality.TabIndex = 10
+ Me.numQuality.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numQuality.Value = New Decimal(New Integer() {70, 0, 0, 0})
+ '
+ 'lblVideoQuality
+ '
+ Me.lblVideoQuality.AutoSize = True
+ Me.lblVideoQuality.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblVideoQuality.Location = New System.Drawing.Point(377, 193)
+ Me.lblVideoQuality.Name = "lblVideoQuality"
+ Me.lblVideoQuality.Size = New System.Drawing.Size(109, 16)
+ Me.lblVideoQuality.TabIndex = 9
+ Me.lblVideoQuality.Text = "Video quality (%)"
+ '
+ 'numIntensityScaling
+ '
+ Me.numIntensityScaling.DecimalPlaces = 1
+ Me.numIntensityScaling.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numIntensityScaling.Increment = New Decimal(New Integer() {1, 0, 0, 65536})
+ Me.numIntensityScaling.Location = New System.Drawing.Point(904, 79)
+ Me.numIntensityScaling.Name = "numIntensityScaling"
+ Me.numIntensityScaling.Size = New System.Drawing.Size(74, 22)
+ Me.numIntensityScaling.TabIndex = 8
+ Me.numIntensityScaling.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numIntensityScaling.Value = New Decimal(New Integer() {30, 0, 0, 0})
+ '
+ 'numOffsetIntensity
+ '
+ Me.numOffsetIntensity.DecimalPlaces = 1
+ Me.numOffsetIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numOffsetIntensity.Increment = New Decimal(New Integer() {1, 0, 0, 131072})
+ Me.numOffsetIntensity.Location = New System.Drawing.Point(1044, 80)
+ Me.numOffsetIntensity.Maximum = New Decimal(New Integer() {1, 0, 0, 0})
+ Me.numOffsetIntensity.Minimum = New Decimal(New Integer() {1, 0, 0, -2147483648})
+ Me.numOffsetIntensity.Name = "numOffsetIntensity"
+ Me.numOffsetIntensity.Size = New System.Drawing.Size(82, 22)
+ Me.numOffsetIntensity.TabIndex = 8
+ Me.numOffsetIntensity.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numOffsetField
+ '
+ Me.numOffsetField.DecimalPlaces = 1
+ Me.numOffsetField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numOffsetField.Increment = New Decimal(New Integer() {1, 0, 0, 131072})
+ Me.numOffsetField.Location = New System.Drawing.Point(1044, 40)
+ Me.numOffsetField.Maximum = New Decimal(New Integer() {1, 0, 0, 0})
+ Me.numOffsetField.Minimum = New Decimal(New Integer() {1, 0, 0, -2147483648})
+ Me.numOffsetField.Name = "numOffsetField"
+ Me.numOffsetField.Size = New System.Drawing.Size(82, 22)
+ Me.numOffsetField.TabIndex = 8
+ Me.numOffsetField.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numFieldScaling
+ '
+ Me.numFieldScaling.DecimalPlaces = 1
+ Me.numFieldScaling.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numFieldScaling.Increment = New Decimal(New Integer() {1, 0, 0, 65536})
+ Me.numFieldScaling.Location = New System.Drawing.Point(904, 40)
+ Me.numFieldScaling.Name = "numFieldScaling"
+ Me.numFieldScaling.Size = New System.Drawing.Size(74, 22)
+ Me.numFieldScaling.TabIndex = 8
+ Me.numFieldScaling.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numFieldScaling.Value = New Decimal(New Integer() {30, 0, 0, 0})
+ '
+ 'Label3
+ '
+ Me.Label3.AutoSize = True
+ Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label3.Location = New System.Drawing.Point(363, 83)
+ Me.Label3.Name = "Label3"
+ Me.Label3.Size = New System.Drawing.Size(140, 16)
+ Me.Label3.TabIndex = 6
+ Me.Label3.Text = "Intensity color scheme"
+ '
+ 'numScaleIntensityValues
+ '
+ Me.numScaleIntensityValues.AutoSize = True
+ Me.numScaleIntensityValues.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numScaleIntensityValues.Location = New System.Drawing.Point(785, 81)
+ Me.numScaleIntensityValues.Name = "numScaleIntensityValues"
+ Me.numScaleIntensityValues.Size = New System.Drawing.Size(105, 16)
+ Me.numScaleIntensityValues.TabIndex = 6
+ Me.numScaleIntensityValues.Text = "Scale Int. values"
+ '
+ 'Label6
+ '
+ Me.Label6.AutoSize = True
+ Me.Label6.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label6.Location = New System.Drawing.Point(997, 82)
+ Me.Label6.Name = "Label6"
+ Me.Label6.Size = New System.Drawing.Size(42, 16)
+ Me.Label6.TabIndex = 6
+ Me.Label6.Text = "Offset"
+ '
+ 'lblOffsetField
+ '
+ Me.lblOffsetField.AutoSize = True
+ Me.lblOffsetField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblOffsetField.Location = New System.Drawing.Point(996, 42)
+ Me.lblOffsetField.Name = "lblOffsetField"
+ Me.lblOffsetField.Size = New System.Drawing.Size(42, 16)
+ Me.lblOffsetField.TabIndex = 6
+ Me.lblOffsetField.Text = "Offset"
+ '
+ 'Label5
+ '
+ Me.Label5.AutoSize = True
+ Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label5.Location = New System.Drawing.Point(783, 42)
+ Me.Label5.Name = "Label5"
+ Me.Label5.Size = New System.Drawing.Size(114, 16)
+ Me.Label5.TabIndex = 6
+ Me.Label5.Text = "Scale field values"
+ '
+ 'Label2
+ '
+ Me.Label2.AutoSize = True
+ Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label2.Location = New System.Drawing.Point(363, 44)
+ Me.Label2.Name = "Label2"
+ Me.Label2.Size = New System.Drawing.Size(122, 16)
+ Me.Label2.TabIndex = 6
+ Me.Label2.Text = "Field color scheme"
+ '
+ 'cmbIntensityColorScheme
+ '
+ Me.cmbIntensityColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.cmbIntensityColorScheme.FormattingEnabled = True
+ Me.cmbIntensityColorScheme.Location = New System.Drawing.Point(509, 79)
+ Me.cmbIntensityColorScheme.Name = "cmbIntensityColorScheme"
+ Me.cmbIntensityColorScheme.Size = New System.Drawing.Size(165, 24)
+ Me.cmbIntensityColorScheme.TabIndex = 5
+ '
+ 'cmbFieldColorScheme
+ '
+ Me.cmbFieldColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.cmbFieldColorScheme.FormattingEnabled = True
+ Me.cmbFieldColorScheme.Location = New System.Drawing.Point(509, 40)
+ Me.cmbFieldColorScheme.Name = "cmbFieldColorScheme"
+ Me.cmbFieldColorScheme.Size = New System.Drawing.Size(165, 24)
+ Me.cmbFieldColorScheme.TabIndex = 5
+ '
+ 'chkPreviewVideoIntensity
+ '
+ Me.chkPreviewVideoIntensity.AutoSize = True
+ Me.chkPreviewVideoIntensity.Checked = True
+ Me.chkPreviewVideoIntensity.CheckState = System.Windows.Forms.CheckState.Checked
+ Me.chkPreviewVideoIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkPreviewVideoIntensity.Location = New System.Drawing.Point(193, 80)
+ Me.chkPreviewVideoIntensity.Name = "chkPreviewVideoIntensity"
+ Me.chkPreviewVideoIntensity.Size = New System.Drawing.Size(75, 20)
+ Me.chkPreviewVideoIntensity.TabIndex = 4
+ Me.chkPreviewVideoIntensity.Text = "Intensity"
+ Me.chkPreviewVideoIntensity.UseVisualStyleBackColor = True
+ '
+ 'chkExportVideoIntensity
+ '
+ Me.chkExportVideoIntensity.AutoSize = True
+ Me.chkExportVideoIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkExportVideoIntensity.Location = New System.Drawing.Point(193, 41)
+ Me.chkExportVideoIntensity.Name = "chkExportVideoIntensity"
+ Me.chkExportVideoIntensity.Size = New System.Drawing.Size(75, 20)
+ Me.chkExportVideoIntensity.TabIndex = 4
+ Me.chkExportVideoIntensity.Text = "Intensity"
+ Me.chkExportVideoIntensity.UseVisualStyleBackColor = True
+ '
+ 'chkPreviewVideoField
+ '
+ Me.chkPreviewVideoField.AutoSize = True
+ Me.chkPreviewVideoField.Checked = True
+ Me.chkPreviewVideoField.CheckState = System.Windows.Forms.CheckState.Checked
+ Me.chkPreviewVideoField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkPreviewVideoField.Location = New System.Drawing.Point(130, 81)
+ Me.chkPreviewVideoField.Name = "chkPreviewVideoField"
+ Me.chkPreviewVideoField.Size = New System.Drawing.Size(57, 20)
+ Me.chkPreviewVideoField.TabIndex = 4
+ Me.chkPreviewVideoField.Text = "Field"
+ Me.chkPreviewVideoField.UseVisualStyleBackColor = True
+ '
+ 'chkExportVideoField
+ '
+ Me.chkExportVideoField.AutoSize = True
+ Me.chkExportVideoField.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkExportVideoField.Location = New System.Drawing.Point(130, 42)
+ Me.chkExportVideoField.Name = "chkExportVideoField"
+ Me.chkExportVideoField.Size = New System.Drawing.Size(57, 20)
+ Me.chkExportVideoField.TabIndex = 4
+ Me.chkExportVideoField.Text = "Field"
+ Me.chkExportVideoField.UseVisualStyleBackColor = True
+ '
+ 'lblPreviewVideo
+ '
+ Me.lblPreviewVideo.AutoSize = True
+ Me.lblPreviewVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblPreviewVideo.Location = New System.Drawing.Point(24, 82)
+ Me.lblPreviewVideo.Name = "lblPreviewVideo"
+ Me.lblPreviewVideo.Size = New System.Drawing.Size(93, 16)
+ Me.lblPreviewVideo.TabIndex = 3
+ Me.lblPreviewVideo.Text = "Preview video"
+ '
+ 'lblExportVideo
+ '
+ Me.lblExportVideo.AutoSize = True
+ Me.lblExportVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblExportVideo.Location = New System.Drawing.Point(24, 43)
+ Me.lblExportVideo.Name = "lblExportVideo"
+ Me.lblExportVideo.Size = New System.Drawing.Size(100, 16)
+ Me.lblExportVideo.TabIndex = 3
+ Me.lblExportVideo.Text = "Export video of:"
+ '
+ 'numVisualizeEvery
+ '
+ Me.numVisualizeEvery.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numVisualizeEvery.Location = New System.Drawing.Point(491, 152)
+ Me.numVisualizeEvery.Maximum = New Decimal(New Integer() {6, 0, 0, 0})
+ Me.numVisualizeEvery.Name = "numVisualizeEvery"
+ Me.numVisualizeEvery.Size = New System.Drawing.Size(61, 22)
+ Me.numVisualizeEvery.TabIndex = 1
+ Me.numVisualizeEvery.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numVisualizeEvery.Value = New Decimal(New Integer() {2, 0, 0, 0})
+ '
+ 'Label4
+ '
+ Me.Label4.AutoSize = True
+ Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label4.Location = New System.Drawing.Point(558, 155)
+ Me.Label4.Name = "Label4"
+ Me.Label4.Size = New System.Drawing.Size(49, 16)
+ Me.Label4.TabIndex = 0
+ Me.Label4.Text = "frames"
+ '
+ 'lblVisualizeEvery
+ '
+ Me.lblVisualizeEvery.AutoSize = True
+ Me.lblVisualizeEvery.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblVisualizeEvery.Location = New System.Drawing.Point(377, 154)
+ Me.lblVisualizeEvery.Name = "lblVisualizeEvery"
+ Me.lblVisualizeEvery.Size = New System.Drawing.Size(99, 16)
+ Me.lblVisualizeEvery.TabIndex = 0
+ Me.lblVisualizeEvery.Text = "Visualize every"
+ '
+ 'Label7
+ '
+ Me.Label7.AutoSize = True
+ Me.Label7.Location = New System.Drawing.Point(386, 195)
+ Me.Label7.Name = "Label7"
+ Me.Label7.Size = New System.Drawing.Size(0, 18)
+ Me.Label7.TabIndex = 0
+ '
+ 'lblSimulationSteps
+ '
+ Me.lblSimulationSteps.AutoSize = True
+ Me.lblSimulationSteps.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblSimulationSteps.Location = New System.Drawing.Point(32, 193)
+ Me.lblSimulationSteps.Name = "lblSimulationSteps"
+ Me.lblSimulationSteps.Size = New System.Drawing.Size(106, 16)
+ Me.lblSimulationSteps.TabIndex = 0
+ Me.lblSimulationSteps.Text = "Simulation steps"
+ '
+ 'grpSceneProperties
+ '
+ Me.grpSceneProperties.Controls.Add(Me.Label20)
+ Me.grpSceneProperties.Controls.Add(Me.numRefractiveIndex)
+ Me.grpSceneProperties.Controls.Add(Me.picImagePreview)
+ Me.grpSceneProperties.Controls.Add(Me.lblScaleImgSourceIntensity)
+ Me.grpSceneProperties.Controls.Add(Me.numScaleImageSource)
+ Me.grpSceneProperties.Controls.Add(Me.btnEditObjectSourceList)
+ Me.grpSceneProperties.Controls.Add(Me.txtDampingEdgeSize)
+ Me.grpSceneProperties.Controls.Add(Me.chkUseObjectSources)
+ Me.grpSceneProperties.Controls.Add(Me.chkUseImageSources)
+ Me.grpSceneProperties.Controls.Add(Me.chkDampingEdge)
+ Me.grpSceneProperties.Controls.Add(Me.btnLoadSceneImage)
+ Me.grpSceneProperties.Controls.Add(Me.Label1)
+ Me.grpSceneProperties.Controls.Add(Me.lblPix)
+ Me.grpSceneProperties.Controls.Add(Me.lblX)
+ Me.grpSceneProperties.Controls.Add(Me.txtYsize)
+ Me.grpSceneProperties.Controls.Add(Me.txtXSize)
+ Me.grpSceneProperties.Controls.Add(Me.radUserDefinedScene)
+ Me.grpSceneProperties.Controls.Add(Me.radUseSceneImage)
+ Me.grpSceneProperties.Controls.Add(Me.lblImageNameAndSize)
+ Me.grpSceneProperties.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpSceneProperties.Location = New System.Drawing.Point(516, 25)
+ Me.grpSceneProperties.Name = "grpSceneProperties"
+ Me.grpSceneProperties.Size = New System.Drawing.Size(1200, 390)
+ Me.grpSceneProperties.TabIndex = 1
+ Me.grpSceneProperties.TabStop = False
+ Me.grpSceneProperties.Text = "Scene properties"
+ '
+ 'Label20
+ '
+ Me.Label20.AutoSize = True
+ Me.Label20.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label20.Location = New System.Drawing.Point(366, 80)
+ Me.Label20.Name = "Label20"
+ Me.Label20.Size = New System.Drawing.Size(104, 16)
+ Me.Label20.TabIndex = 12
+ Me.Label20.Text = "Refractive index"
+ '
+ 'numRefractiveIndex
+ '
+ Me.numRefractiveIndex.DecimalPlaces = 2
+ Me.numRefractiveIndex.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numRefractiveIndex.Increment = New Decimal(New Integer() {1, 0, 0, 131072})
+ Me.numRefractiveIndex.Location = New System.Drawing.Point(476, 78)
+ Me.numRefractiveIndex.Maximum = New Decimal(New Integer() {25, 0, 0, 65536})
+ Me.numRefractiveIndex.Minimum = New Decimal(New Integer() {10, 0, 0, 65536})
+ Me.numRefractiveIndex.Name = "numRefractiveIndex"
+ Me.numRefractiveIndex.Size = New System.Drawing.Size(60, 22)
+ Me.numRefractiveIndex.TabIndex = 11
+ Me.numRefractiveIndex.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numRefractiveIndex.Value = New Decimal(New Integer() {10, 0, 0, 65536})
+ '
+ 'picImagePreview
+ '
+ Me.picImagePreview.BackColor = System.Drawing.SystemColors.Control
+ Me.picImagePreview.Location = New System.Drawing.Point(587, 22)
+ Me.picImagePreview.Name = "picImagePreview"
+ Me.picImagePreview.Size = New System.Drawing.Size(600, 338)
+ Me.picImagePreview.TabIndex = 1
+ Me.picImagePreview.TabStop = False
+ '
+ 'lblScaleImgSourceIntensity
+ '
+ Me.lblScaleImgSourceIntensity.AutoSize = True
+ Me.lblScaleImgSourceIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblScaleImgSourceIntensity.Location = New System.Drawing.Point(179, 183)
+ Me.lblScaleImgSourceIntensity.Name = "lblScaleImgSourceIntensity"
+ Me.lblScaleImgSourceIntensity.Size = New System.Drawing.Size(155, 16)
+ Me.lblScaleImgSourceIntensity.TabIndex = 10
+ Me.lblScaleImgSourceIntensity.Text = "Scale intensity values by"
+ '
+ 'numScaleImageSource
+ '
+ Me.numScaleImageSource.DecimalPlaces = 1
+ Me.numScaleImageSource.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numScaleImageSource.Increment = New Decimal(New Integer() {1, 0, 0, 65536})
+ Me.numScaleImageSource.Location = New System.Drawing.Point(337, 181)
+ Me.numScaleImageSource.Name = "numScaleImageSource"
+ Me.numScaleImageSource.Size = New System.Drawing.Size(65, 22)
+ Me.numScaleImageSource.TabIndex = 9
+ Me.numScaleImageSource.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numScaleImageSource.Value = New Decimal(New Integer() {1, 0, 0, 0})
+ '
+ 'btnEditObjectSourceList
+ '
+ Me.btnEditObjectSourceList.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnEditObjectSourceList.Location = New System.Drawing.Point(201, 214)
+ Me.btnEditObjectSourceList.Name = "btnEditObjectSourceList"
+ Me.btnEditObjectSourceList.Size = New System.Drawing.Size(117, 23)
+ Me.btnEditObjectSourceList.TabIndex = 8
+ Me.btnEditObjectSourceList.Text = "Edit source list"
+ Me.btnEditObjectSourceList.UseVisualStyleBackColor = True
+ '
+ 'txtDampingEdgeSize
+ '
+ Me.txtDampingEdgeSize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.txtDampingEdgeSize.Location = New System.Drawing.Point(152, 143)
+ Me.txtDampingEdgeSize.Name = "txtDampingEdgeSize"
+ Me.txtDampingEdgeSize.Size = New System.Drawing.Size(100, 22)
+ Me.txtDampingEdgeSize.TabIndex = 7
+ '
+ 'chkUseObjectSources
+ '
+ Me.chkUseObjectSources.AutoSize = True
+ Me.chkUseObjectSources.Checked = True
+ Me.chkUseObjectSources.CheckState = System.Windows.Forms.CheckState.Checked
+ Me.chkUseObjectSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkUseObjectSources.Location = New System.Drawing.Point(26, 218)
+ Me.chkUseObjectSources.Name = "chkUseObjectSources"
+ Me.chkUseObjectSources.Size = New System.Drawing.Size(143, 20)
+ Me.chkUseObjectSources.TabIndex = 6
+ Me.chkUseObjectSources.Text = "Use object sources"
+ Me.chkUseObjectSources.UseVisualStyleBackColor = True
+ '
+ 'chkUseImageSources
+ '
+ Me.chkUseImageSources.AutoSize = True
+ Me.chkUseImageSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkUseImageSources.Location = New System.Drawing.Point(26, 182)
+ Me.chkUseImageSources.Name = "chkUseImageSources"
+ Me.chkUseImageSources.Size = New System.Drawing.Size(157, 20)
+ Me.chkUseImageSources.TabIndex = 6
+ Me.chkUseImageSources.Text = "Use image sources -"
+ Me.chkUseImageSources.UseVisualStyleBackColor = True
+ '
+ 'chkDampingEdge
+ '
+ Me.chkDampingEdge.AutoSize = True
+ Me.chkDampingEdge.Checked = True
+ Me.chkDampingEdge.CheckState = System.Windows.Forms.CheckState.Checked
+ Me.chkDampingEdge.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkDampingEdge.Location = New System.Drawing.Point(26, 145)
+ Me.chkDampingEdge.Name = "chkDampingEdge"
+ Me.chkDampingEdge.Size = New System.Drawing.Size(120, 20)
+ Me.chkDampingEdge.TabIndex = 6
+ Me.chkDampingEdge.Text = "Damping edge "
+ Me.chkDampingEdge.UseVisualStyleBackColor = True
+ '
+ 'btnLoadSceneImage
+ '
+ Me.btnLoadSceneImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnLoadSceneImage.Location = New System.Drawing.Point(138, 39)
+ Me.btnLoadSceneImage.Name = "btnLoadSceneImage"
+ Me.btnLoadSceneImage.Size = New System.Drawing.Size(75, 23)
+ Me.btnLoadSceneImage.TabIndex = 5
+ Me.btnLoadSceneImage.Text = "load"
+ Me.btnLoadSceneImage.UseVisualStyleBackColor = True
+ '
+ 'Label1
+ '
+ Me.Label1.AutoSize = True
+ Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label1.Location = New System.Drawing.Point(258, 146)
+ Me.Label1.Name = "Label1"
+ Me.Label1.Size = New System.Drawing.Size(22, 16)
+ Me.Label1.TabIndex = 4
+ Me.Label1.Text = "px"
+ '
+ 'lblPix
+ '
+ Me.lblPix.AutoSize = True
+ Me.lblPix.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblPix.Location = New System.Drawing.Point(327, 80)
+ Me.lblPix.Name = "lblPix"
+ Me.lblPix.Size = New System.Drawing.Size(22, 16)
+ Me.lblPix.TabIndex = 4
+ Me.lblPix.Text = "px"
+ '
+ 'lblX
+ '
+ Me.lblX.AutoSize = True
+ Me.lblX.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblX.Location = New System.Drawing.Point(243, 80)
+ Me.lblX.Name = "lblX"
+ Me.lblX.Size = New System.Drawing.Size(12, 16)
+ Me.lblX.TabIndex = 4
+ Me.lblX.Text = "/"
+ '
+ 'txtYsize
+ '
+ Me.txtYsize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.txtYsize.Location = New System.Drawing.Point(258, 77)
+ Me.txtYsize.Name = "txtYsize"
+ Me.txtYsize.Size = New System.Drawing.Size(64, 22)
+ Me.txtYsize.TabIndex = 3
+ '
+ 'txtXSize
+ '
+ Me.txtXSize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.txtXSize.Location = New System.Drawing.Point(169, 76)
+ Me.txtXSize.Name = "txtXSize"
+ Me.txtXSize.Size = New System.Drawing.Size(72, 22)
+ Me.txtXSize.TabIndex = 3
+ '
+ 'radUserDefinedScene
+ '
+ Me.radUserDefinedScene.AutoSize = True
+ Me.radUserDefinedScene.Checked = True
+ Me.radUserDefinedScene.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.radUserDefinedScene.Location = New System.Drawing.Point(26, 77)
+ Me.radUserDefinedScene.Name = "radUserDefinedScene"
+ Me.radUserDefinedScene.Size = New System.Drawing.Size(141, 20)
+ Me.radUserDefinedScene.TabIndex = 2
+ Me.radUserDefinedScene.TabStop = True
+ Me.radUserDefinedScene.Text = "User defined (X /Y)"
+ Me.radUserDefinedScene.UseVisualStyleBackColor = True
+ '
+ 'radUseSceneImage
+ '
+ Me.radUseSceneImage.AutoSize = True
+ Me.radUseSceneImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.radUseSceneImage.Location = New System.Drawing.Point(26, 40)
+ Me.radUseSceneImage.Name = "radUseSceneImage"
+ Me.radUseSceneImage.Size = New System.Drawing.Size(106, 20)
+ Me.radUseSceneImage.TabIndex = 0
+ Me.radUseSceneImage.Text = "Scene image"
+ Me.radUseSceneImage.UseVisualStyleBackColor = True
+ '
+ 'lblImageNameAndSize
+ '
+ Me.lblImageNameAndSize.AutoSize = True
+ Me.lblImageNameAndSize.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblImageNameAndSize.Location = New System.Drawing.Point(228, 41)
+ Me.lblImageNameAndSize.Name = "lblImageNameAndSize"
+ Me.lblImageNameAndSize.Size = New System.Drawing.Size(103, 16)
+ Me.lblImageNameAndSize.TabIndex = 4
+ Me.lblImageNameAndSize.Text = "(name and size)"
+ '
+ 'tabSourceList
+ '
+ Me.tabSourceList.Controls.Add(Me.Label62)
+ Me.tabSourceList.Controls.Add(Me.Label60)
+ Me.tabSourceList.Controls.Add(Me.chkAutoRescaleSourceOn)
+ Me.tabSourceList.Controls.Add(Me.picPreviewSource)
+ Me.tabSourceList.Controls.Add(Me.grpPlaceSource)
+ Me.tabSourceList.Controls.Add(Me.btnDelete)
+ Me.tabSourceList.Controls.Add(Me.btnNew)
+ Me.tabSourceList.Controls.Add(Me.btnCopy)
+ Me.tabSourceList.Controls.Add(Me.lstSources)
+ Me.tabSourceList.Controls.Add(Me.pnlSourceImage)
+ Me.tabSourceList.Controls.Add(Me.grpSourceDetails)
+ Me.tabSourceList.Location = New System.Drawing.Point(4, 34)
+ Me.tabSourceList.Name = "tabSourceList"
+ Me.tabSourceList.Size = New System.Drawing.Size(1742, 693)
+ Me.tabSourceList.TabIndex = 6
+ Me.tabSourceList.Text = " Sources "
+ Me.tabSourceList.UseVisualStyleBackColor = True
+ '
+ 'Label62
+ '
+ Me.Label62.AutoSize = True
+ Me.Label62.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label62.Location = New System.Drawing.Point(1187, 18)
+ Me.Label62.Name = "Label62"
+ Me.Label62.Size = New System.Drawing.Size(121, 18)
+ Me.Label62.TabIndex = 8
+ Me.Label62.Text = "List of sources"
+ '
+ 'Label60
+ '
+ Me.Label60.AutoSize = True
+ Me.Label60.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label60.Location = New System.Drawing.Point(1185, 408)
+ Me.Label60.Name = "Label60"
+ Me.Label60.Size = New System.Drawing.Size(124, 18)
+ Me.Label60.TabIndex = 7
+ Me.Label60.Text = "Source preview"
+ '
+ 'chkAutoRescaleSourceOn
+ '
+ Me.chkAutoRescaleSourceOn.AutoSize = True
+ Me.chkAutoRescaleSourceOn.Checked = True
+ Me.chkAutoRescaleSourceOn.CheckState = System.Windows.Forms.CheckState.Checked
+ Me.chkAutoRescaleSourceOn.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkAutoRescaleSourceOn.Location = New System.Drawing.Point(1192, 651)
+ Me.chkAutoRescaleSourceOn.Name = "chkAutoRescaleSourceOn"
+ Me.chkAutoRescaleSourceOn.Size = New System.Drawing.Size(186, 20)
+ Me.chkAutoRescaleSourceOn.TabIndex = 6
+ Me.chkAutoRescaleSourceOn.Text = "Auto-rescale source layout"
+ Me.chkAutoRescaleSourceOn.UseVisualStyleBackColor = True
+ '
+ 'picPreviewSource
+ '
+ Me.picPreviewSource.Location = New System.Drawing.Point(1185, 430)
+ Me.picPreviewSource.Name = "picPreviewSource"
+ Me.picPreviewSource.Size = New System.Drawing.Size(273, 215)
+ Me.picPreviewSource.TabIndex = 5
+ Me.picPreviewSource.TabStop = False
+ '
+ 'grpPlaceSource
+ '
+ Me.grpPlaceSource.Controls.Add(Me.pnlPosition)
+ Me.grpPlaceSource.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpPlaceSource.Location = New System.Drawing.Point(1185, 285)
+ Me.grpPlaceSource.Name = "grpPlaceSource"
+ Me.grpPlaceSource.Size = New System.Drawing.Size(273, 117)
+ Me.grpPlaceSource.TabIndex = 4
+ Me.grpPlaceSource.TabStop = False
+ Me.grpPlaceSource.Text = "Place current source"
+ '
+ 'pnlPosition
+ '
+ Me.pnlPosition.BackColor = System.Drawing.Color.Azure
+ Me.pnlPosition.Controls.Add(Me.numSourcePositionX)
+ Me.pnlPosition.Controls.Add(Me.Label36)
+ Me.pnlPosition.Controls.Add(Me.lblPosition)
+ Me.pnlPosition.Controls.Add(Me.btnPickSourcePosition)
+ Me.pnlPosition.Controls.Add(Me.numSourcePositionY)
+ Me.pnlPosition.Controls.Add(Me.Label35)
+ Me.pnlPosition.Location = New System.Drawing.Point(22, 25)
+ Me.pnlPosition.Name = "pnlPosition"
+ Me.pnlPosition.Size = New System.Drawing.Size(228, 77)
+ Me.pnlPosition.TabIndex = 20
+ '
+ 'numSourcePositionX
+ '
+ Me.numSourcePositionX.Location = New System.Drawing.Point(146, 9)
+ Me.numSourcePositionX.Name = "numSourcePositionX"
+ Me.numSourcePositionX.Size = New System.Drawing.Size(65, 22)
+ Me.numSourcePositionX.TabIndex = 11
+ Me.numSourcePositionX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'Label36
+ '
+ Me.Label36.AutoSize = True
+ Me.Label36.Location = New System.Drawing.Point(123, 11)
+ Me.Label36.Name = "Label36"
+ Me.Label36.Size = New System.Drawing.Size(16, 16)
+ Me.Label36.TabIndex = 7
+ Me.Label36.Text = "X"
+ '
+ 'lblPosition
+ '
+ Me.lblPosition.AutoSize = True
+ Me.lblPosition.Location = New System.Drawing.Point(16, 6)
+ Me.lblPosition.Name = "lblPosition"
+ Me.lblPosition.Size = New System.Drawing.Size(97, 16)
+ Me.lblPosition.TabIndex = 12
+ Me.lblPosition.Text = "Center position"
+ '
+ 'btnPickSourcePosition
+ '
+ Me.btnPickSourcePosition.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnPickSourcePosition.Location = New System.Drawing.Point(15, 31)
+ Me.btnPickSourcePosition.Name = "btnPickSourcePosition"
+ Me.btnPickSourcePosition.Size = New System.Drawing.Size(102, 35)
+ Me.btnPickSourcePosition.TabIndex = 9
+ Me.btnPickSourcePosition.Text = "Pick "
+ Me.btnPickSourcePosition.UseVisualStyleBackColor = True
+ '
+ 'numSourcePositionY
+ '
+ Me.numSourcePositionY.Location = New System.Drawing.Point(146, 41)
+ Me.numSourcePositionY.Name = "numSourcePositionY"
+ Me.numSourcePositionY.Size = New System.Drawing.Size(65, 22)
+ Me.numSourcePositionY.TabIndex = 10
+ Me.numSourcePositionY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'Label35
+ '
+ Me.Label35.AutoSize = True
+ Me.Label35.Location = New System.Drawing.Point(123, 43)
+ Me.Label35.Name = "Label35"
+ Me.Label35.Size = New System.Drawing.Size(17, 16)
+ Me.Label35.TabIndex = 6
+ Me.Label35.Text = "Y"
+ '
+ 'btnDelete
+ '
+ Me.btnDelete.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnDelete.Location = New System.Drawing.Point(1389, 245)
+ Me.btnDelete.Name = "btnDelete"
+ Me.btnDelete.Size = New System.Drawing.Size(70, 29)
+ Me.btnDelete.TabIndex = 2
+ Me.btnDelete.Text = "Delete"
+ Me.btnDelete.UseVisualStyleBackColor = True
+ '
+ 'btnNew
+ '
+ Me.btnNew.BackColor = System.Drawing.Color.Azure
+ Me.btnNew.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnNew.Location = New System.Drawing.Point(1189, 245)
+ Me.btnNew.Name = "btnNew"
+ Me.btnNew.Size = New System.Drawing.Size(70, 28)
+ Me.btnNew.TabIndex = 2
+ Me.btnNew.Text = "New"
+ Me.btnNew.UseVisualStyleBackColor = False
+ '
+ 'btnCopy
+ '
+ Me.btnCopy.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnCopy.Location = New System.Drawing.Point(1314, 244)
+ Me.btnCopy.Name = "btnCopy"
+ Me.btnCopy.Size = New System.Drawing.Size(70, 29)
+ Me.btnCopy.TabIndex = 2
+ Me.btnCopy.Text = "Copy"
+ Me.btnCopy.UseVisualStyleBackColor = True
+ '
+ 'lstSources
+ '
+ Me.lstSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lstSources.FormattingEnabled = True
+ Me.lstSources.ItemHeight = 16
+ Me.lstSources.Location = New System.Drawing.Point(1187, 43)
+ Me.lstSources.Name = "lstSources"
+ Me.lstSources.Size = New System.Drawing.Size(273, 196)
+ Me.lstSources.TabIndex = 1
+ '
+ 'pnlSourceImage
+ '
+ Me.pnlSourceImage.Location = New System.Drawing.Point(16, 14)
+ Me.pnlSourceImage.Name = "pnlSourceImage"
+ Me.pnlSourceImage.Size = New System.Drawing.Size(1160, 653)
+ Me.pnlSourceImage.TabIndex = 0
+ '
+ 'grpSourceDetails
+ '
+ Me.grpSourceDetails.Controls.Add(Me.txtDetachAfterSteps)
+ Me.grpSourceDetails.Controls.Add(Me.btnSaveSource)
+ Me.grpSourceDetails.Controls.Add(Me.Label47)
+ Me.grpSourceDetails.Controls.Add(Me.chkDetachSource)
+ Me.grpSourceDetails.Controls.Add(Me.lblLambdaIs)
+ Me.grpSourceDetails.Controls.Add(Me.chkSourceOn)
+ Me.grpSourceDetails.Controls.Add(Me.grpComposite)
+ Me.grpSourceDetails.Controls.Add(Me.grpSingleSource)
+ Me.grpSourceDetails.Controls.Add(Me.radModePulsed)
+ Me.grpSourceDetails.Controls.Add(Me.radModeContinuous)
+ Me.grpSourceDetails.Controls.Add(Me.txtName)
+ Me.grpSourceDetails.Controls.Add(Me.cmbMainType)
+ Me.grpSourceDetails.Controls.Add(Me.Label39)
+ Me.grpSourceDetails.Controls.Add(Me.lblName)
+ Me.grpSourceDetails.Controls.Add(Me.Label38)
+ Me.grpSourceDetails.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpSourceDetails.Location = New System.Drawing.Point(1471, 15)
+ Me.grpSourceDetails.Name = "grpSourceDetails"
+ Me.grpSourceDetails.Size = New System.Drawing.Size(254, 666)
+ Me.grpSourceDetails.TabIndex = 3
+ Me.grpSourceDetails.TabStop = False
+ Me.grpSourceDetails.Text = "Source "
+ '
+ 'txtDetachAfterSteps
+ '
+ Me.txtDetachAfterSteps.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.txtDetachAfterSteps.Location = New System.Drawing.Point(128, 591)
+ Me.txtDetachAfterSteps.Name = "txtDetachAfterSteps"
+ Me.txtDetachAfterSteps.Size = New System.Drawing.Size(65, 22)
+ Me.txtDetachAfterSteps.TabIndex = 23
+ '
+ 'btnSaveSource
+ '
+ Me.btnSaveSource.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnSaveSource.Location = New System.Drawing.Point(12, 623)
+ Me.btnSaveSource.Name = "btnSaveSource"
+ Me.btnSaveSource.Size = New System.Drawing.Size(228, 30)
+ Me.btnSaveSource.TabIndex = 17
+ Me.btnSaveSource.Text = "Save source data"
+ Me.btnSaveSource.UseVisualStyleBackColor = True
+ '
+ 'Label47
+ '
+ Me.Label47.AutoSize = True
+ Me.Label47.Location = New System.Drawing.Point(199, 594)
+ Me.Label47.Name = "Label47"
+ Me.Label47.Size = New System.Drawing.Size(41, 16)
+ Me.Label47.TabIndex = 22
+ Me.Label47.Text = "steps"
+ '
+ 'chkDetachSource
+ '
+ Me.chkDetachSource.AutoSize = True
+ Me.chkDetachSource.Location = New System.Drawing.Point(23, 592)
+ Me.chkDetachSource.Name = "chkDetachSource"
+ Me.chkDetachSource.Size = New System.Drawing.Size(99, 20)
+ Me.chkDetachSource.TabIndex = 21
+ Me.chkDetachSource.Text = "Detach after"
+ Me.chkDetachSource.UseVisualStyleBackColor = True
+ '
+ 'lblLambdaIs
+ '
+ Me.lblLambdaIs.AutoSize = True
+ Me.lblLambdaIs.BackColor = System.Drawing.Color.White
+ Me.lblLambdaIs.Location = New System.Drawing.Point(162, 1)
+ Me.lblLambdaIs.Name = "lblLambdaIs"
+ Me.lblLambdaIs.Size = New System.Drawing.Size(52, 16)
+ Me.lblLambdaIs.TabIndex = 19
+ Me.lblLambdaIs.Text = "λ= px"
+ '
+ 'chkSourceOn
+ '
+ Me.chkSourceOn.AutoSize = True
+ Me.chkSourceOn.Location = New System.Drawing.Point(60, 0)
+ Me.chkSourceOn.Name = "chkSourceOn"
+ Me.chkSourceOn.Size = New System.Drawing.Size(42, 20)
+ Me.chkSourceOn.TabIndex = 18
+ Me.chkSourceOn.Text = "on"
+ Me.chkSourceOn.UseVisualStyleBackColor = True
+ '
+ 'grpComposite
+ '
+ Me.grpComposite.Controls.Add(Me.Label59)
+ Me.grpComposite.Controls.Add(Me.Label58)
+ Me.grpComposite.Controls.Add(Me.numRandomizeOffWidth)
+ Me.grpComposite.Controls.Add(Me.numRandomizePosition)
+ Me.grpComposite.Controls.Add(Me.NumRandomizePhase)
+ Me.grpComposite.Controls.Add(Me.numRandomizeFrequency)
+ Me.grpComposite.Controls.Add(Me.chkRandomizePhase)
+ Me.grpComposite.Controls.Add(Me.chkRandomizePosition)
+ Me.grpComposite.Controls.Add(Me.chkOffWidth)
+ Me.grpComposite.Controls.Add(Me.chkRandomizeFrequency)
+ Me.grpComposite.Controls.Add(Me.numSpacingSizeY)
+ Me.grpComposite.Controls.Add(Me.numSpacingSizeX)
+ Me.grpComposite.Controls.Add(Me.numArraySizeY)
+ Me.grpComposite.Controls.Add(Me.numArraySizeX)
+ Me.grpComposite.Controls.Add(Me.Label50)
+ Me.grpComposite.Controls.Add(Me.Label51)
+ Me.grpComposite.Controls.Add(Me.Label52)
+ Me.grpComposite.Controls.Add(Me.Label53)
+ Me.grpComposite.Controls.Add(Me.cmbCompositeProperties)
+ Me.grpComposite.Location = New System.Drawing.Point(12, 344)
+ Me.grpComposite.Name = "grpComposite"
+ Me.grpComposite.Size = New System.Drawing.Size(230, 241)
+ Me.grpComposite.TabIndex = 16
+ Me.grpComposite.TabStop = False
+ Me.grpComposite.Text = "Composite source"
+ '
+ 'Label59
+ '
+ Me.Label59.AutoSize = True
+ Me.Label59.Location = New System.Drawing.Point(181, 17)
+ Me.Label59.Name = "Label59"
+ Me.Label59.Size = New System.Drawing.Size(15, 16)
+ Me.Label59.TabIndex = 16
+ Me.Label59.Text = "y"
+ '
+ 'Label58
+ '
+ Me.Label58.AutoSize = True
+ Me.Label58.Location = New System.Drawing.Point(110, 17)
+ Me.Label58.Name = "Label58"
+ Me.Label58.Size = New System.Drawing.Size(14, 16)
+ Me.Label58.TabIndex = 16
+ Me.Label58.Text = "x"
+ '
+ 'numRandomizeOffWidth
+ '
+ Me.numRandomizeOffWidth.Location = New System.Drawing.Point(17, 208)
+ Me.numRandomizeOffWidth.Maximum = New Decimal(New Integer() {10000, 0, 0, 0})
+ Me.numRandomizeOffWidth.Name = "numRandomizeOffWidth"
+ Me.numRandomizeOffWidth.Size = New System.Drawing.Size(81, 22)
+ Me.numRandomizeOffWidth.TabIndex = 14
+ Me.numRandomizeOffWidth.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numRandomizePosition
+ '
+ Me.numRandomizePosition.Location = New System.Drawing.Point(129, 208)
+ Me.numRandomizePosition.Maximum = New Decimal(New Integer() {5, 0, 0, 0})
+ Me.numRandomizePosition.Name = "numRandomizePosition"
+ Me.numRandomizePosition.Size = New System.Drawing.Size(80, 22)
+ Me.numRandomizePosition.TabIndex = 14
+ Me.numRandomizePosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'NumRandomizePhase
+ '
+ Me.NumRandomizePhase.Location = New System.Drawing.Point(129, 162)
+ Me.NumRandomizePhase.Maximum = New Decimal(New Integer() {180, 0, 0, 0})
+ Me.NumRandomizePhase.Name = "NumRandomizePhase"
+ Me.NumRandomizePhase.Size = New System.Drawing.Size(80, 22)
+ Me.NumRandomizePhase.TabIndex = 14
+ Me.NumRandomizePhase.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numRandomizeFrequency
+ '
+ Me.numRandomizeFrequency.Location = New System.Drawing.Point(18, 163)
+ Me.numRandomizeFrequency.Maximum = New Decimal(New Integer() {50, 0, 0, 0})
+ Me.numRandomizeFrequency.Name = "numRandomizeFrequency"
+ Me.numRandomizeFrequency.Size = New System.Drawing.Size(80, 22)
+ Me.numRandomizeFrequency.TabIndex = 14
+ Me.numRandomizeFrequency.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'chkRandomizePhase
+ '
+ Me.chkRandomizePhase.AutoSize = True
+ Me.chkRandomizePhase.Location = New System.Drawing.Point(129, 144)
+ Me.chkRandomizePhase.Name = "chkRandomizePhase"
+ Me.chkRandomizePhase.Size = New System.Drawing.Size(66, 20)
+ Me.chkRandomizePhase.TabIndex = 15
+ Me.chkRandomizePhase.Text = "Phase"
+ Me.chkRandomizePhase.UseVisualStyleBackColor = True
+ '
+ 'chkRandomizePosition
+ '
+ Me.chkRandomizePosition.AutoSize = True
+ Me.chkRandomizePosition.Location = New System.Drawing.Point(129, 190)
+ Me.chkRandomizePosition.Name = "chkRandomizePosition"
+ Me.chkRandomizePosition.Size = New System.Drawing.Size(75, 20)
+ Me.chkRandomizePosition.TabIndex = 15
+ Me.chkRandomizePosition.Text = "Position"
+ Me.chkRandomizePosition.UseVisualStyleBackColor = True
+ '
+ 'chkOffWidth
+ '
+ Me.chkOffWidth.AutoSize = True
+ Me.chkOffWidth.Location = New System.Drawing.Point(17, 190)
+ Me.chkOffWidth.Name = "chkOffWidth"
+ Me.chkOffWidth.Size = New System.Drawing.Size(75, 20)
+ Me.chkOffWidth.TabIndex = 15
+ Me.chkOffWidth.Text = "Off state"
+ Me.chkOffWidth.UseVisualStyleBackColor = True
+ '
+ 'chkRandomizeFrequency
+ '
+ Me.chkRandomizeFrequency.AutoSize = True
+ Me.chkRandomizeFrequency.Location = New System.Drawing.Point(19, 145)
+ Me.chkRandomizeFrequency.Name = "chkRandomizeFrequency"
+ Me.chkRandomizeFrequency.Size = New System.Drawing.Size(91, 20)
+ Me.chkRandomizeFrequency.TabIndex = 15
+ Me.chkRandomizeFrequency.Text = "Frequency"
+ Me.chkRandomizeFrequency.UseVisualStyleBackColor = True
+ '
+ 'numSpacingSizeY
+ '
+ Me.numSpacingSizeY.Location = New System.Drawing.Point(161, 64)
+ Me.numSpacingSizeY.Name = "numSpacingSizeY"
+ Me.numSpacingSizeY.Size = New System.Drawing.Size(55, 22)
+ Me.numSpacingSizeY.TabIndex = 14
+ Me.numSpacingSizeY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numSpacingSizeX
+ '
+ Me.numSpacingSizeX.Location = New System.Drawing.Point(94, 64)
+ Me.numSpacingSizeX.Name = "numSpacingSizeX"
+ Me.numSpacingSizeX.Size = New System.Drawing.Size(55, 22)
+ Me.numSpacingSizeX.TabIndex = 14
+ Me.numSpacingSizeX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numArraySizeY
+ '
+ Me.numArraySizeY.Increment = New Decimal(New Integer() {2, 0, 0, 0})
+ Me.numArraySizeY.Location = New System.Drawing.Point(161, 36)
+ Me.numArraySizeY.Maximum = New Decimal(New Integer() {101, 0, 0, 0})
+ Me.numArraySizeY.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
+ Me.numArraySizeY.Name = "numArraySizeY"
+ Me.numArraySizeY.Size = New System.Drawing.Size(55, 22)
+ Me.numArraySizeY.TabIndex = 14
+ Me.numArraySizeY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numArraySizeY.Value = New Decimal(New Integer() {1, 0, 0, 0})
+ '
+ 'numArraySizeX
+ '
+ Me.numArraySizeX.Increment = New Decimal(New Integer() {2, 0, 0, 0})
+ Me.numArraySizeX.Location = New System.Drawing.Point(93, 36)
+ Me.numArraySizeX.Maximum = New Decimal(New Integer() {101, 0, 0, 0})
+ Me.numArraySizeX.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
+ Me.numArraySizeX.Name = "numArraySizeX"
+ Me.numArraySizeX.Size = New System.Drawing.Size(55, 22)
+ Me.numArraySizeX.TabIndex = 14
+ Me.numArraySizeX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numArraySizeX.Value = New Decimal(New Integer() {1, 0, 0, 0})
+ '
+ 'Label50
+ '
+ Me.Label50.AutoSize = True
+ Me.Label50.Location = New System.Drawing.Point(15, 124)
+ Me.Label50.Name = "Label50"
+ Me.Label50.Size = New System.Drawing.Size(77, 16)
+ Me.Label50.TabIndex = 0
+ Me.Label50.Text = "Randomize"
+ '
+ 'Label51
+ '
+ Me.Label51.AutoSize = True
+ Me.Label51.Location = New System.Drawing.Point(15, 96)
+ Me.Label51.Name = "Label51"
+ Me.Label51.Size = New System.Drawing.Size(70, 16)
+ Me.Label51.TabIndex = 0
+ Me.Label51.Text = "Properties"
+ '
+ 'Label52
+ '
+ Me.Label52.AutoSize = True
+ Me.Label52.Location = New System.Drawing.Point(15, 66)
+ Me.Label52.Name = "Label52"
+ Me.Label52.Size = New System.Drawing.Size(61, 16)
+ Me.Label52.TabIndex = 0
+ Me.Label52.Text = "Spacing "
+ '
+ 'Label53
+ '
+ Me.Label53.AutoSize = True
+ Me.Label53.Location = New System.Drawing.Point(15, 36)
+ Me.Label53.Name = "Label53"
+ Me.Label53.Size = New System.Drawing.Size(67, 16)
+ Me.Label53.TabIndex = 0
+ Me.Label53.Text = "Array size"
+ '
+ 'cmbCompositeProperties
+ '
+ Me.cmbCompositeProperties.Enabled = False
+ Me.cmbCompositeProperties.FormattingEnabled = True
+ Me.cmbCompositeProperties.Items.AddRange(New Object() {"Inherit from single", "Inherit + randomize"})
+ Me.cmbCompositeProperties.Location = New System.Drawing.Point(88, 93)
+ Me.cmbCompositeProperties.Name = "cmbCompositeProperties"
+ Me.cmbCompositeProperties.Size = New System.Drawing.Size(134, 24)
+ Me.cmbCompositeProperties.TabIndex = 13
+ '
+ 'grpSingleSource
+ '
+ Me.grpSingleSource.Controls.Add(Me.numOffStateCycles)
+ Me.grpSingleSource.Controls.Add(Me.numPhase)
+ Me.grpSingleSource.Controls.Add(Me.numAmplitude)
+ Me.grpSingleSource.Controls.Add(Me.numFrequency)
+ Me.grpSingleSource.Controls.Add(Me.numPulseWidthCycles)
+ Me.grpSingleSource.Controls.Add(Me.Label44)
+ Me.grpSingleSource.Controls.Add(Me.Label46)
+ Me.grpSingleSource.Controls.Add(Me.Label45)
+ Me.grpSingleSource.Controls.Add(Me.Label43)
+ Me.grpSingleSource.Controls.Add(Me.Label42)
+ Me.grpSingleSource.Controls.Add(Me.Label54)
+ Me.grpSingleSource.Controls.Add(Me.Label41)
+ Me.grpSingleSource.Controls.Add(Me.Label40)
+ Me.grpSingleSource.Controls.Add(Me.cmbPulseShape)
+ Me.grpSingleSource.Location = New System.Drawing.Point(12, 126)
+ Me.grpSingleSource.Name = "grpSingleSource"
+ Me.grpSingleSource.Size = New System.Drawing.Size(230, 213)
+ Me.grpSingleSource.TabIndex = 16
+ Me.grpSingleSource.TabStop = False
+ Me.grpSingleSource.Text = "Single source properties"
+ '
+ 'numOffStateCycles
+ '
+ Me.numOffStateCycles.Location = New System.Drawing.Point(106, 179)
+ Me.numOffStateCycles.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})
+ Me.numOffStateCycles.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
+ Me.numOffStateCycles.Name = "numOffStateCycles"
+ Me.numOffStateCycles.Size = New System.Drawing.Size(64, 22)
+ Me.numOffStateCycles.TabIndex = 14
+ Me.numOffStateCycles.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numOffStateCycles.Value = New Decimal(New Integer() {10, 0, 0, 0})
+ '
+ 'numPhase
+ '
+ Me.numPhase.Location = New System.Drawing.Point(106, 87)
+ Me.numPhase.Maximum = New Decimal(New Integer() {180, 0, 0, 0})
+ Me.numPhase.Minimum = New Decimal(New Integer() {180, 0, 0, -2147483648})
+ Me.numPhase.Name = "numPhase"
+ Me.numPhase.Size = New System.Drawing.Size(64, 22)
+ Me.numPhase.TabIndex = 14
+ Me.numPhase.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numAmplitude
+ '
+ Me.numAmplitude.Location = New System.Drawing.Point(106, 59)
+ Me.numAmplitude.Name = "numAmplitude"
+ Me.numAmplitude.Size = New System.Drawing.Size(64, 22)
+ Me.numAmplitude.TabIndex = 14
+ Me.numAmplitude.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numAmplitude.Value = New Decimal(New Integer() {100, 0, 0, 0})
+ '
+ 'numFrequency
+ '
+ Me.numFrequency.Location = New System.Drawing.Point(106, 31)
+ Me.numFrequency.Maximum = New Decimal(New Integer() {255, 0, 0, 0})
+ Me.numFrequency.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
+ Me.numFrequency.Name = "numFrequency"
+ Me.numFrequency.Size = New System.Drawing.Size(64, 22)
+ Me.numFrequency.TabIndex = 14
+ Me.numFrequency.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numFrequency.Value = New Decimal(New Integer() {100, 0, 0, 0})
+ '
+ 'numPulseWidthCycles
+ '
+ Me.numPulseWidthCycles.Location = New System.Drawing.Point(106, 151)
+ Me.numPulseWidthCycles.Name = "numPulseWidthCycles"
+ Me.numPulseWidthCycles.Size = New System.Drawing.Size(64, 22)
+ Me.numPulseWidthCycles.TabIndex = 14
+ Me.numPulseWidthCycles.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numPulseWidthCycles.Value = New Decimal(New Integer() {10, 0, 0, 0})
+ '
+ 'Label44
+ '
+ Me.Label44.AutoSize = True
+ Me.Label44.Location = New System.Drawing.Point(15, 182)
+ Me.Label44.Name = "Label44"
+ Me.Label44.Size = New System.Drawing.Size(56, 16)
+ Me.Label44.TabIndex = 0
+ Me.Label44.Text = "Off state"
+ '
+ 'Label46
+ '
+ Me.Label46.AutoSize = True
+ Me.Label46.Location = New System.Drawing.Point(176, 181)
+ Me.Label46.Name = "Label46"
+ Me.Label46.Size = New System.Drawing.Size(47, 16)
+ Me.Label46.TabIndex = 0
+ Me.Label46.Text = "cycles"
+ '
+ 'Label45
+ '
+ Me.Label45.AutoSize = True
+ Me.Label45.Location = New System.Drawing.Point(176, 153)
+ Me.Label45.Name = "Label45"
+ Me.Label45.Size = New System.Drawing.Size(47, 16)
+ Me.Label45.TabIndex = 0
+ Me.Label45.Text = "cycles"
+ '
+ 'Label43
+ '
+ Me.Label43.AutoSize = True
+ Me.Label43.Location = New System.Drawing.Point(15, 153)
+ Me.Label43.Name = "Label43"
+ Me.Label43.Size = New System.Drawing.Size(75, 16)
+ Me.Label43.TabIndex = 0
+ Me.Label43.Text = "Pulse width"
+ '
+ 'Label42
+ '
+ Me.Label42.AutoSize = True
+ Me.Label42.Location = New System.Drawing.Point(15, 121)
+ Me.Label42.Name = "Label42"
+ Me.Label42.Size = New System.Drawing.Size(83, 16)
+ Me.Label42.TabIndex = 0
+ Me.Label42.Text = "Pulse shape"
+ '
+ 'Label54
+ '
+ Me.Label54.AutoSize = True
+ Me.Label54.Location = New System.Drawing.Point(14, 89)
+ Me.Label54.Name = "Label54"
+ Me.Label54.Size = New System.Drawing.Size(47, 16)
+ Me.Label54.TabIndex = 0
+ Me.Label54.Text = "Phase"
+ '
+ 'Label41
+ '
+ Me.Label41.AutoSize = True
+ Me.Label41.Location = New System.Drawing.Point(14, 61)
+ Me.Label41.Name = "Label41"
+ Me.Label41.Size = New System.Drawing.Size(68, 16)
+ Me.Label41.TabIndex = 0
+ Me.Label41.Text = "Amplitude"
+ '
+ 'Label40
+ '
+ Me.Label40.AutoSize = True
+ Me.Label40.Location = New System.Drawing.Point(14, 33)
+ Me.Label40.Name = "Label40"
+ Me.Label40.Size = New System.Drawing.Size(72, 16)
+ Me.Label40.TabIndex = 0
+ Me.Label40.Text = "Frequency"
+ '
+ 'cmbPulseShape
+ '
+ Me.cmbPulseShape.Enabled = False
+ Me.cmbPulseShape.FormattingEnabled = True
+ Me.cmbPulseShape.Items.AddRange(New Object() {"Gaussian", "Smoothed square"})
+ Me.cmbPulseShape.Location = New System.Drawing.Point(106, 118)
+ Me.cmbPulseShape.Name = "cmbPulseShape"
+ Me.cmbPulseShape.Size = New System.Drawing.Size(110, 24)
+ Me.cmbPulseShape.TabIndex = 13
+ '
+ 'radModePulsed
+ '
+ Me.radModePulsed.AutoSize = True
+ Me.radModePulsed.Location = New System.Drawing.Point(156, 97)
+ Me.radModePulsed.Name = "radModePulsed"
+ Me.radModePulsed.Size = New System.Drawing.Size(68, 20)
+ Me.radModePulsed.TabIndex = 15
+ Me.radModePulsed.TabStop = True
+ Me.radModePulsed.Text = "Pulsed"
+ Me.radModePulsed.UseVisualStyleBackColor = True
+ '
+ 'radModeContinuous
+ '
+ Me.radModeContinuous.AutoSize = True
+ Me.radModeContinuous.Location = New System.Drawing.Point(65, 97)
+ Me.radModeContinuous.Name = "radModeContinuous"
+ Me.radModeContinuous.Size = New System.Drawing.Size(92, 20)
+ Me.radModeContinuous.TabIndex = 15
+ Me.radModeContinuous.TabStop = True
+ Me.radModeContinuous.Text = "Continuous"
+ Me.radModeContinuous.UseVisualStyleBackColor = True
+ '
+ 'txtName
+ '
+ Me.txtName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.txtName.Location = New System.Drawing.Point(92, 30)
+ Me.txtName.Name = "txtName"
+ Me.txtName.Size = New System.Drawing.Size(142, 22)
+ Me.txtName.TabIndex = 14
+ '
+ 'cmbMainType
+ '
+ Me.cmbMainType.FormattingEnabled = True
+ Me.cmbMainType.Items.AddRange(New Object() {"Single point", "Composite"})
+ Me.cmbMainType.Location = New System.Drawing.Point(92, 61)
+ Me.cmbMainType.Name = "cmbMainType"
+ Me.cmbMainType.Size = New System.Drawing.Size(142, 24)
+ Me.cmbMainType.TabIndex = 13
+ '
+ 'Label39
+ '
+ Me.Label39.AutoSize = True
+ Me.Label39.Location = New System.Drawing.Point(20, 99)
+ Me.Label39.Name = "Label39"
+ Me.Label39.Size = New System.Drawing.Size(43, 16)
+ Me.Label39.TabIndex = 12
+ Me.Label39.Text = "Mode"
+ '
+ 'lblName
+ '
+ Me.lblName.AutoSize = True
+ Me.lblName.Location = New System.Drawing.Point(20, 33)
+ Me.lblName.Name = "lblName"
+ Me.lblName.Size = New System.Drawing.Size(45, 16)
+ Me.lblName.TabIndex = 12
+ Me.lblName.Text = "Name"
+ '
+ 'Label38
+ '
+ Me.Label38.AutoSize = True
+ Me.Label38.Location = New System.Drawing.Point(20, 64)
+ Me.Label38.Name = "Label38"
+ Me.Label38.Size = New System.Drawing.Size(66, 16)
+ Me.Label38.TabIndex = 12
+ Me.Label38.Text = "Main type"
+ '
+ 'tabProbeList
+ '
+ Me.tabProbeList.Controls.Add(Me.GroupBox2)
+ Me.tabProbeList.Controls.Add(Me.grpProbe2)
+ Me.tabProbeList.Controls.Add(Me.grpProbe1)
+ Me.tabProbeList.Controls.Add(Me.pnlProbeImage)
+ Me.tabProbeList.Location = New System.Drawing.Point(4, 34)
+ Me.tabProbeList.Name = "tabProbeList"
+ Me.tabProbeList.Size = New System.Drawing.Size(1742, 693)
+ Me.tabProbeList.TabIndex = 2
+ Me.tabProbeList.Text = " Probes "
+ Me.tabProbeList.UseVisualStyleBackColor = True
+ '
+ 'GroupBox2
+ '
+ Me.GroupBox2.Controls.Add(Me.Label49)
+ Me.GroupBox2.Controls.Add(Me.Label48)
+ Me.GroupBox2.Controls.Add(Me.Label37)
+ Me.GroupBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.GroupBox2.Location = New System.Drawing.Point(1201, 584)
+ Me.GroupBox2.Name = "GroupBox2"
+ Me.GroupBox2.Size = New System.Drawing.Size(504, 83)
+ Me.GroupBox2.TabIndex = 2
+ Me.GroupBox2.TabStop = False
+ Me.GroupBox2.Text = "How to use probes"
+ '
+ 'Label49
+ '
+ Me.Label49.AutoSize = True
+ Me.Label49.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label49.Location = New System.Drawing.Point(15, 60)
+ Me.Label49.Name = "Label49"
+ Me.Label49.Size = New System.Drawing.Size(430, 16)
+ Me.Label49.TabIndex = 0
+ Me.Label49.Text = "- Probe type ""Line"": Use 2 clicks to set line, then third click to place plot ."
+ '
+ 'Label48
+ '
+ Me.Label48.AutoSize = True
+ Me.Label48.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label48.Location = New System.Drawing.Point(14, 42)
+ Me.Label48.Name = "Label48"
+ Me.Label48.Size = New System.Drawing.Size(461, 16)
+ Me.Label48.TabIndex = 0
+ Me.Label48.Text = "- Probe type ""Point"": First click sets probe location, second sets data window"
+ '
+ 'Label37
+ '
+ Me.Label37.AutoSize = True
+ Me.Label37.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label37.Location = New System.Drawing.Point(15, 22)
+ Me.Label37.Name = "Label37"
+ Me.Label37.Size = New System.Drawing.Size(442, 16)
+ Me.Label37.TabIndex = 0
+ Me.Label37.Text = "Set all properties first and then use the ""Pick"" button to choose a location. "
+ '
+ 'grpProbe2
+ '
+ Me.grpProbe2.BackColor = System.Drawing.Color.Gainsboro
+ Me.grpProbe2.Controls.Add(Me.Label22)
+ Me.grpProbe2.Controls.Add(Me.numRunningWindow2)
+ Me.grpProbe2.Controls.Add(Me.chkProbeOn2)
+ Me.grpProbe2.Controls.Add(Me.txtStartAfterStep2)
+ Me.grpProbe2.Controls.Add(Me.chkStartAfterStep2)
+ Me.grpProbe2.Controls.Add(Me.Label23)
+ Me.grpProbe2.Controls.Add(Me.Label24)
+ Me.grpProbe2.Controls.Add(Me.txtMaxScaleY2)
+ Me.grpProbe2.Controls.Add(Me.txtMinScaleY2)
+ Me.grpProbe2.Controls.Add(Me.radFullScale2)
+ Me.grpProbe2.Controls.Add(Me.radRunningScale2)
+ Me.grpProbe2.Controls.Add(Me.chkAutoScaleY2)
+ Me.grpProbe2.Controls.Add(Me.chkAutoScaleX2)
+ Me.grpProbe2.Controls.Add(Me.numBPosY2)
+ Me.grpProbe2.Controls.Add(Me.numAPosY2)
+ Me.grpProbe2.Controls.Add(Me.numBPosX2)
+ Me.grpProbe2.Controls.Add(Me.numAPosX2)
+ Me.grpProbe2.Controls.Add(Me.butPicPositions2)
+ Me.grpProbe2.Controls.Add(Me.Label25)
+ Me.grpProbe2.Controls.Add(Me.cmbPlaceOn2)
+ Me.grpProbe2.Controls.Add(Me.cmbMeasurement2)
+ Me.grpProbe2.Controls.Add(Me.Label26)
+ Me.grpProbe2.Controls.Add(Me.Label27)
+ Me.grpProbe2.Controls.Add(Me.cmbBoxSize2)
+ Me.grpProbe2.Controls.Add(Me.cmbProbeType2)
+ Me.grpProbe2.Controls.Add(Me.Label28)
+ Me.grpProbe2.Controls.Add(Me.Label29)
+ Me.grpProbe2.Controls.Add(Me.Label30)
+ Me.grpProbe2.Controls.Add(Me.Label31)
+ Me.grpProbe2.Controls.Add(Me.Label32)
+ Me.grpProbe2.Controls.Add(Me.Label33)
+ Me.grpProbe2.Controls.Add(Me.Label34)
+ Me.grpProbe2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpProbe2.Location = New System.Drawing.Point(1202, 303)
+ Me.grpProbe2.Name = "grpProbe2"
+ Me.grpProbe2.Size = New System.Drawing.Size(506, 276)
+ Me.grpProbe2.TabIndex = 1
+ Me.grpProbe2.TabStop = False
+ Me.grpProbe2.Text = "Probe 2 "
+ '
+ 'Label22
+ '
+ Me.Label22.AutoSize = True
+ Me.Label22.Location = New System.Drawing.Point(259, 59)
+ Me.Label22.Name = "Label22"
+ Me.Label22.Size = New System.Drawing.Size(104, 16)
+ Me.Label22.TabIndex = 14
+ Me.Label22.Text = "Running window"
+ '
+ 'numRunningWindow2
+ '
+ Me.numRunningWindow2.Location = New System.Drawing.Point(371, 58)
+ Me.numRunningWindow2.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})
+ Me.numRunningWindow2.Minimum = New Decimal(New Integer() {10, 0, 0, 0})
+ Me.numRunningWindow2.Name = "numRunningWindow2"
+ Me.numRunningWindow2.Size = New System.Drawing.Size(83, 22)
+ Me.numRunningWindow2.TabIndex = 13
+ Me.numRunningWindow2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numRunningWindow2.Value = New Decimal(New Integer() {500, 0, 0, 0})
+ '
+ 'chkProbeOn2
+ '
+ Me.chkProbeOn2.AutoSize = True
+ Me.chkProbeOn2.Location = New System.Drawing.Point(66, -1)
+ Me.chkProbeOn2.Name = "chkProbeOn2"
+ Me.chkProbeOn2.Size = New System.Drawing.Size(44, 20)
+ Me.chkProbeOn2.TabIndex = 12
+ Me.chkProbeOn2.Text = "On"
+ Me.chkProbeOn2.UseVisualStyleBackColor = True
+ '
+ 'txtStartAfterStep2
+ '
+ Me.txtStartAfterStep2.Location = New System.Drawing.Point(179, 163)
+ Me.txtStartAfterStep2.Name = "txtStartAfterStep2"
+ Me.txtStartAfterStep2.Size = New System.Drawing.Size(57, 22)
+ Me.txtStartAfterStep2.TabIndex = 11
+ Me.txtStartAfterStep2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
+ '
+ 'chkStartAfterStep2
+ '
+ Me.chkStartAfterStep2.AutoSize = True
+ Me.chkStartAfterStep2.Location = New System.Drawing.Point(17, 165)
+ Me.chkStartAfterStep2.Name = "chkStartAfterStep2"
+ Me.chkStartAfterStep2.Size = New System.Drawing.Size(167, 20)
+ Me.chkStartAfterStep2.TabIndex = 10
+ Me.chkStartAfterStep2.Text = "Start recording at step #"
+ Me.chkStartAfterStep2.UseVisualStyleBackColor = True
+ '
+ 'Label23
+ '
+ Me.Label23.AutoSize = True
+ Me.Label23.Location = New System.Drawing.Point(438, 111)
+ Me.Label23.Name = "Label23"
+ Me.Label23.Size = New System.Drawing.Size(33, 16)
+ Me.Label23.TabIndex = 2
+ Me.Label23.Text = "Max"
+ '
+ 'Label24
+ '
+ Me.Label24.AutoSize = True
+ Me.Label24.Location = New System.Drawing.Point(378, 111)
+ Me.Label24.Name = "Label24"
+ Me.Label24.Size = New System.Drawing.Size(29, 16)
+ Me.Label24.TabIndex = 2
+ Me.Label24.Text = "Min"
+ '
+ 'txtMaxScaleY2
+ '
+ Me.txtMaxScaleY2.Location = New System.Drawing.Point(431, 127)
+ Me.txtMaxScaleY2.Name = "txtMaxScaleY2"
+ Me.txtMaxScaleY2.Size = New System.Drawing.Size(52, 22)
+ Me.txtMaxScaleY2.TabIndex = 8
+ Me.txtMaxScaleY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
+ '
+ 'txtMinScaleY2
+ '
+ Me.txtMinScaleY2.Location = New System.Drawing.Point(371, 127)
+ Me.txtMinScaleY2.Name = "txtMinScaleY2"
+ Me.txtMinScaleY2.Size = New System.Drawing.Size(52, 22)
+ Me.txtMinScaleY2.TabIndex = 8
+ Me.txtMinScaleY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
+ '
+ 'radFullScale2
+ '
+ Me.radFullScale2.AutoSize = True
+ Me.radFullScale2.Location = New System.Drawing.Point(379, 24)
+ Me.radFullScale2.Name = "radFullScale2"
+ Me.radFullScale2.Size = New System.Drawing.Size(83, 20)
+ Me.radFullScale2.TabIndex = 7
+ Me.radFullScale2.TabStop = True
+ Me.radFullScale2.Text = "Full scale"
+ Me.radFullScale2.UseVisualStyleBackColor = True
+ '
+ 'radRunningScale2
+ '
+ Me.radRunningScale2.AutoSize = True
+ Me.radRunningScale2.Location = New System.Drawing.Point(262, 24)
+ Me.radRunningScale2.Name = "radRunningScale2"
+ Me.radRunningScale2.Size = New System.Drawing.Size(111, 20)
+ Me.radRunningScale2.TabIndex = 7
+ Me.radRunningScale2.TabStop = True
+ Me.radRunningScale2.Text = "Running scale"
+ Me.radRunningScale2.UseVisualStyleBackColor = True
+ '
+ 'chkAutoScaleY2
+ '
+ Me.chkAutoScaleY2.AutoSize = True
+ Me.chkAutoScaleY2.Location = New System.Drawing.Point(262, 127)
+ Me.chkAutoScaleY2.Name = "chkAutoScaleY2"
+ Me.chkAutoScaleY2.Size = New System.Drawing.Size(110, 20)
+ Me.chkAutoScaleY2.TabIndex = 6
+ Me.chkAutoScaleY2.Text = "Auto Scale Y"
+ Me.chkAutoScaleY2.UseVisualStyleBackColor = True
+ '
+ 'chkAutoScaleX2
+ '
+ Me.chkAutoScaleX2.AutoSize = True
+ Me.chkAutoScaleX2.Location = New System.Drawing.Point(262, 91)
+ Me.chkAutoScaleX2.Name = "chkAutoScaleX2"
+ Me.chkAutoScaleX2.Size = New System.Drawing.Size(101, 20)
+ Me.chkAutoScaleX2.TabIndex = 6
+ Me.chkAutoScaleX2.Text = "Auto scale X"
+ Me.chkAutoScaleX2.UseVisualStyleBackColor = True
+ '
+ 'numBPosY2
+ '
+ Me.numBPosY2.Location = New System.Drawing.Point(326, 234)
+ Me.numBPosY2.Name = "numBPosY2"
+ Me.numBPosY2.Size = New System.Drawing.Size(65, 22)
+ Me.numBPosY2.TabIndex = 5
+ Me.numBPosY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numAPosY2
+ '
+ Me.numAPosY2.Location = New System.Drawing.Point(126, 234)
+ Me.numAPosY2.Name = "numAPosY2"
+ Me.numAPosY2.Size = New System.Drawing.Size(65, 22)
+ Me.numAPosY2.TabIndex = 5
+ Me.numAPosY2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numBPosX2
+ '
+ Me.numBPosX2.Location = New System.Drawing.Point(238, 234)
+ Me.numBPosX2.Name = "numBPosX2"
+ Me.numBPosX2.Size = New System.Drawing.Size(65, 22)
+ Me.numBPosX2.TabIndex = 5
+ Me.numBPosX2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numAPosX2
+ '
+ Me.numAPosX2.Location = New System.Drawing.Point(38, 234)
+ Me.numAPosX2.Name = "numAPosX2"
+ Me.numAPosX2.Size = New System.Drawing.Size(65, 22)
+ Me.numAPosX2.TabIndex = 5
+ Me.numAPosX2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'butPicPositions2
+ '
+ Me.butPicPositions2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.butPicPositions2.Location = New System.Drawing.Point(402, 226)
+ Me.butPicPositions2.Name = "butPicPositions2"
+ Me.butPicPositions2.Size = New System.Drawing.Size(90, 34)
+ Me.butPicPositions2.TabIndex = 4
+ Me.butPicPositions2.Text = "Pick "
+ Me.butPicPositions2.UseVisualStyleBackColor = True
+ '
+ 'Label25
+ '
+ Me.Label25.AutoSize = True
+ Me.Label25.Location = New System.Drawing.Point(311, 236)
+ Me.Label25.Name = "Label25"
+ Me.Label25.Size = New System.Drawing.Size(17, 16)
+ Me.Label25.TabIndex = 2
+ Me.Label25.Text = "Y"
+ '
+ 'cmbPlaceOn2
+ '
+ Me.cmbPlaceOn2.FormattingEnabled = True
+ Me.cmbPlaceOn2.Items.AddRange(New Object() {"Field", "Intensity"})
+ Me.cmbPlaceOn2.Location = New System.Drawing.Point(106, 24)
+ Me.cmbPlaceOn2.Name = "cmbPlaceOn2"
+ Me.cmbPlaceOn2.Size = New System.Drawing.Size(130, 24)
+ Me.cmbPlaceOn2.TabIndex = 3
+ '
+ 'cmbMeasurement2
+ '
+ Me.cmbMeasurement2.FormattingEnabled = True
+ Me.cmbMeasurement2.Items.AddRange(New Object() {"Amplitude", "Intensity", "Integrate Intensity"})
+ Me.cmbMeasurement2.Location = New System.Drawing.Point(106, 56)
+ Me.cmbMeasurement2.Name = "cmbMeasurement2"
+ Me.cmbMeasurement2.Size = New System.Drawing.Size(130, 24)
+ Me.cmbMeasurement2.TabIndex = 3
+ '
+ 'Label26
+ '
+ Me.Label26.AutoSize = True
+ Me.Label26.Location = New System.Drawing.Point(111, 236)
+ Me.Label26.Name = "Label26"
+ Me.Label26.Size = New System.Drawing.Size(17, 16)
+ Me.Label26.TabIndex = 2
+ Me.Label26.Text = "Y"
+ '
+ 'Label27
+ '
+ Me.Label27.AutoSize = True
+ Me.Label27.Location = New System.Drawing.Point(223, 236)
+ Me.Label27.Name = "Label27"
+ Me.Label27.Size = New System.Drawing.Size(16, 16)
+ Me.Label27.TabIndex = 2
+ Me.Label27.Text = "X"
+ '
+ 'cmbBoxSize2
+ '
+ Me.cmbBoxSize2.FormattingEnabled = True
+ Me.cmbBoxSize2.Items.AddRange(New Object() {"Tiny (200 x100)", "Small (300 x 150)", "Medium (400x200)", "Large (500x250)", "Extra Large (700x350)"})
+ Me.cmbBoxSize2.Location = New System.Drawing.Point(106, 124)
+ Me.cmbBoxSize2.Name = "cmbBoxSize2"
+ Me.cmbBoxSize2.Size = New System.Drawing.Size(130, 24)
+ Me.cmbBoxSize2.TabIndex = 3
+ '
+ 'cmbProbeType2
+ '
+ Me.cmbProbeType2.FormattingEnabled = True
+ Me.cmbProbeType2.Items.AddRange(New Object() {"Point (A)", "Line (A-B)"})
+ Me.cmbProbeType2.Location = New System.Drawing.Point(106, 89)
+ Me.cmbProbeType2.Name = "cmbProbeType2"
+ Me.cmbProbeType2.Size = New System.Drawing.Size(130, 24)
+ Me.cmbProbeType2.TabIndex = 3
+ '
+ 'Label28
+ '
+ Me.Label28.AutoSize = True
+ Me.Label28.Location = New System.Drawing.Point(277, 209)
+ Me.Label28.Name = "Label28"
+ Me.Label28.Size = New System.Drawing.Size(68, 16)
+ Me.Label28.TabIndex = 2
+ Me.Label28.Text = "Position B"
+ '
+ 'Label29
+ '
+ Me.Label29.AutoSize = True
+ Me.Label29.Location = New System.Drawing.Point(23, 236)
+ Me.Label29.Name = "Label29"
+ Me.Label29.Size = New System.Drawing.Size(16, 16)
+ Me.Label29.TabIndex = 2
+ Me.Label29.Text = "X"
+ '
+ 'Label30
+ '
+ Me.Label30.AutoSize = True
+ Me.Label30.Location = New System.Drawing.Point(76, 209)
+ Me.Label30.Name = "Label30"
+ Me.Label30.Size = New System.Drawing.Size(68, 16)
+ Me.Label30.TabIndex = 2
+ Me.Label30.Text = "Position A"
+ '
+ 'Label31
+ '
+ Me.Label31.AutoSize = True
+ Me.Label31.Location = New System.Drawing.Point(14, 127)
+ Me.Label31.Name = "Label31"
+ Me.Label31.Size = New System.Drawing.Size(60, 16)
+ Me.Label31.TabIndex = 2
+ Me.Label31.Text = "Box Size"
+ '
+ 'Label32
+ '
+ Me.Label32.AutoSize = True
+ Me.Label32.Location = New System.Drawing.Point(14, 92)
+ Me.Label32.Name = "Label32"
+ Me.Label32.Size = New System.Drawing.Size(74, 16)
+ Me.Label32.TabIndex = 2
+ Me.Label32.Text = "Probe type"
+ '
+ 'Label33
+ '
+ Me.Label33.AutoSize = True
+ Me.Label33.Location = New System.Drawing.Point(12, 59)
+ Me.Label33.Name = "Label33"
+ Me.Label33.Size = New System.Drawing.Size(90, 16)
+ Me.Label33.TabIndex = 2
+ Me.Label33.Text = "Measurement"
+ '
+ 'Label34
+ '
+ Me.Label34.AutoSize = True
+ Me.Label34.Location = New System.Drawing.Point(14, 29)
+ Me.Label34.Name = "Label34"
+ Me.Label34.Size = New System.Drawing.Size(64, 16)
+ Me.Label34.TabIndex = 1
+ Me.Label34.Text = "Place on:"
+ '
+ 'grpProbe1
+ '
+ Me.grpProbe1.BackColor = System.Drawing.Color.Gainsboro
+ Me.grpProbe1.Controls.Add(Me.Label21)
+ Me.grpProbe1.Controls.Add(Me.numRunningWindow)
+ Me.grpProbe1.Controls.Add(Me.chkProbeOn1)
+ Me.grpProbe1.Controls.Add(Me.txtStartAfterStep)
+ Me.grpProbe1.Controls.Add(Me.chkStartAfterStep)
+ Me.grpProbe1.Controls.Add(Me.Label19)
+ Me.grpProbe1.Controls.Add(Me.Label18)
+ Me.grpProbe1.Controls.Add(Me.txtMaxScaleY)
+ Me.grpProbe1.Controls.Add(Me.txtMinScaleY)
+ Me.grpProbe1.Controls.Add(Me.radFullScale)
+ Me.grpProbe1.Controls.Add(Me.radRunningScale)
+ Me.grpProbe1.Controls.Add(Me.chkAutoScaleY)
+ Me.grpProbe1.Controls.Add(Me.chkAutoScaleX)
+ Me.grpProbe1.Controls.Add(Me.numBPosY)
+ Me.grpProbe1.Controls.Add(Me.numAPosY)
+ Me.grpProbe1.Controls.Add(Me.numBPosX)
+ Me.grpProbe1.Controls.Add(Me.numAPosX)
+ Me.grpProbe1.Controls.Add(Me.butPicPositions)
+ Me.grpProbe1.Controls.Add(Me.Label16)
+ Me.grpProbe1.Controls.Add(Me.cmbPlaceOn)
+ Me.grpProbe1.Controls.Add(Me.cmbMeasurement)
+ Me.grpProbe1.Controls.Add(Me.Label13)
+ Me.grpProbe1.Controls.Add(Me.Label15)
+ Me.grpProbe1.Controls.Add(Me.cmbBoxSize)
+ Me.grpProbe1.Controls.Add(Me.cmbProbeType)
+ Me.grpProbe1.Controls.Add(Me.Label14)
+ Me.grpProbe1.Controls.Add(Me.Label12)
+ Me.grpProbe1.Controls.Add(Me.Label11)
+ Me.grpProbe1.Controls.Add(Me.Label17)
+ Me.grpProbe1.Controls.Add(Me.Label10)
+ Me.grpProbe1.Controls.Add(Me.Label9)
+ Me.grpProbe1.Controls.Add(Me.Label8)
+ Me.grpProbe1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpProbe1.Location = New System.Drawing.Point(1202, 14)
+ Me.grpProbe1.Name = "grpProbe1"
+ Me.grpProbe1.Size = New System.Drawing.Size(506, 276)
+ Me.grpProbe1.TabIndex = 1
+ Me.grpProbe1.TabStop = False
+ Me.grpProbe1.Text = "Probe 1 "
+ '
+ 'Label21
+ '
+ Me.Label21.AutoSize = True
+ Me.Label21.Location = New System.Drawing.Point(259, 59)
+ Me.Label21.Name = "Label21"
+ Me.Label21.Size = New System.Drawing.Size(104, 16)
+ Me.Label21.TabIndex = 14
+ Me.Label21.Text = "Running window"
+ '
+ 'numRunningWindow
+ '
+ Me.numRunningWindow.Location = New System.Drawing.Point(371, 58)
+ Me.numRunningWindow.Maximum = New Decimal(New Integer() {1000000, 0, 0, 0})
+ Me.numRunningWindow.Minimum = New Decimal(New Integer() {10, 0, 0, 0})
+ Me.numRunningWindow.Name = "numRunningWindow"
+ Me.numRunningWindow.Size = New System.Drawing.Size(83, 22)
+ Me.numRunningWindow.TabIndex = 13
+ Me.numRunningWindow.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numRunningWindow.Value = New Decimal(New Integer() {500, 0, 0, 0})
+ '
+ 'chkProbeOn1
+ '
+ Me.chkProbeOn1.AutoSize = True
+ Me.chkProbeOn1.Location = New System.Drawing.Point(66, -1)
+ Me.chkProbeOn1.Name = "chkProbeOn1"
+ Me.chkProbeOn1.Size = New System.Drawing.Size(44, 20)
+ Me.chkProbeOn1.TabIndex = 12
+ Me.chkProbeOn1.Text = "On"
+ Me.chkProbeOn1.UseVisualStyleBackColor = True
+ '
+ 'txtStartAfterStep
+ '
+ Me.txtStartAfterStep.Location = New System.Drawing.Point(179, 163)
+ Me.txtStartAfterStep.Name = "txtStartAfterStep"
+ Me.txtStartAfterStep.Size = New System.Drawing.Size(57, 22)
+ Me.txtStartAfterStep.TabIndex = 11
+ Me.txtStartAfterStep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
+ '
+ 'chkStartAfterStep
+ '
+ Me.chkStartAfterStep.AutoSize = True
+ Me.chkStartAfterStep.Location = New System.Drawing.Point(17, 165)
+ Me.chkStartAfterStep.Name = "chkStartAfterStep"
+ Me.chkStartAfterStep.Size = New System.Drawing.Size(167, 20)
+ Me.chkStartAfterStep.TabIndex = 10
+ Me.chkStartAfterStep.Text = "Start recording at step #"
+ Me.chkStartAfterStep.UseVisualStyleBackColor = True
+ '
+ 'Label19
+ '
+ Me.Label19.AutoSize = True
+ Me.Label19.Location = New System.Drawing.Point(438, 111)
+ Me.Label19.Name = "Label19"
+ Me.Label19.Size = New System.Drawing.Size(33, 16)
+ Me.Label19.TabIndex = 2
+ Me.Label19.Text = "Max"
+ '
+ 'Label18
+ '
+ Me.Label18.AutoSize = True
+ Me.Label18.Location = New System.Drawing.Point(378, 111)
+ Me.Label18.Name = "Label18"
+ Me.Label18.Size = New System.Drawing.Size(29, 16)
+ Me.Label18.TabIndex = 2
+ Me.Label18.Text = "Min"
+ '
+ 'txtMaxScaleY
+ '
+ Me.txtMaxScaleY.Location = New System.Drawing.Point(431, 127)
+ Me.txtMaxScaleY.Name = "txtMaxScaleY"
+ Me.txtMaxScaleY.Size = New System.Drawing.Size(52, 22)
+ Me.txtMaxScaleY.TabIndex = 8
+ Me.txtMaxScaleY.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
+ '
+ 'txtMinScaleY
+ '
+ Me.txtMinScaleY.Location = New System.Drawing.Point(371, 127)
+ Me.txtMinScaleY.Name = "txtMinScaleY"
+ Me.txtMinScaleY.Size = New System.Drawing.Size(52, 22)
+ Me.txtMinScaleY.TabIndex = 8
+ Me.txtMinScaleY.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
+ '
+ 'radFullScale
+ '
+ Me.radFullScale.AutoSize = True
+ Me.radFullScale.Location = New System.Drawing.Point(379, 24)
+ Me.radFullScale.Name = "radFullScale"
+ Me.radFullScale.Size = New System.Drawing.Size(83, 20)
+ Me.radFullScale.TabIndex = 7
+ Me.radFullScale.TabStop = True
+ Me.radFullScale.Text = "Full scale"
+ Me.radFullScale.UseVisualStyleBackColor = True
+ '
+ 'radRunningScale
+ '
+ Me.radRunningScale.AutoSize = True
+ Me.radRunningScale.Location = New System.Drawing.Point(262, 24)
+ Me.radRunningScale.Name = "radRunningScale"
+ Me.radRunningScale.Size = New System.Drawing.Size(111, 20)
+ Me.radRunningScale.TabIndex = 7
+ Me.radRunningScale.TabStop = True
+ Me.radRunningScale.Text = "Running scale"
+ Me.radRunningScale.UseVisualStyleBackColor = True
+ '
+ 'chkAutoScaleY
+ '
+ Me.chkAutoScaleY.AutoSize = True
+ Me.chkAutoScaleY.Location = New System.Drawing.Point(262, 127)
+ Me.chkAutoScaleY.Name = "chkAutoScaleY"
+ Me.chkAutoScaleY.Size = New System.Drawing.Size(110, 20)
+ Me.chkAutoScaleY.TabIndex = 6
+ Me.chkAutoScaleY.Text = "Auto Scale Y"
+ Me.chkAutoScaleY.UseVisualStyleBackColor = True
+ '
+ 'chkAutoScaleX
+ '
+ Me.chkAutoScaleX.AutoSize = True
+ Me.chkAutoScaleX.Location = New System.Drawing.Point(262, 91)
+ Me.chkAutoScaleX.Name = "chkAutoScaleX"
+ Me.chkAutoScaleX.Size = New System.Drawing.Size(101, 20)
+ Me.chkAutoScaleX.TabIndex = 6
+ Me.chkAutoScaleX.Text = "Auto scale X"
+ Me.chkAutoScaleX.UseVisualStyleBackColor = True
+ '
+ 'numBPosY
+ '
+ Me.numBPosY.Location = New System.Drawing.Point(326, 234)
+ Me.numBPosY.Name = "numBPosY"
+ Me.numBPosY.Size = New System.Drawing.Size(65, 22)
+ Me.numBPosY.TabIndex = 5
+ Me.numBPosY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numAPosY
+ '
+ Me.numAPosY.Location = New System.Drawing.Point(126, 234)
+ Me.numAPosY.Name = "numAPosY"
+ Me.numAPosY.Size = New System.Drawing.Size(65, 22)
+ Me.numAPosY.TabIndex = 5
+ Me.numAPosY.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numBPosX
+ '
+ Me.numBPosX.Location = New System.Drawing.Point(238, 234)
+ Me.numBPosX.Name = "numBPosX"
+ Me.numBPosX.Size = New System.Drawing.Size(65, 22)
+ Me.numBPosX.TabIndex = 5
+ Me.numBPosX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'numAPosX
+ '
+ Me.numAPosX.Location = New System.Drawing.Point(38, 234)
+ Me.numAPosX.Name = "numAPosX"
+ Me.numAPosX.Size = New System.Drawing.Size(65, 22)
+ Me.numAPosX.TabIndex = 5
+ Me.numAPosX.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'butPicPositions
+ '
+ Me.butPicPositions.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.butPicPositions.Location = New System.Drawing.Point(402, 226)
+ Me.butPicPositions.Name = "butPicPositions"
+ Me.butPicPositions.Size = New System.Drawing.Size(90, 34)
+ Me.butPicPositions.TabIndex = 4
+ Me.butPicPositions.Text = "Pick "
+ Me.butPicPositions.UseVisualStyleBackColor = True
+ '
+ 'Label16
+ '
+ Me.Label16.AutoSize = True
+ Me.Label16.Location = New System.Drawing.Point(311, 236)
+ Me.Label16.Name = "Label16"
+ Me.Label16.Size = New System.Drawing.Size(17, 16)
+ Me.Label16.TabIndex = 2
+ Me.Label16.Text = "Y"
+ '
+ 'cmbPlaceOn
+ '
+ Me.cmbPlaceOn.FormattingEnabled = True
+ Me.cmbPlaceOn.Items.AddRange(New Object() {"Field", "Intensity"})
+ Me.cmbPlaceOn.Location = New System.Drawing.Point(106, 24)
+ Me.cmbPlaceOn.Name = "cmbPlaceOn"
+ Me.cmbPlaceOn.Size = New System.Drawing.Size(130, 24)
+ Me.cmbPlaceOn.TabIndex = 3
+ '
+ 'cmbMeasurement
+ '
+ Me.cmbMeasurement.FormattingEnabled = True
+ Me.cmbMeasurement.Items.AddRange(New Object() {"Amplitude", "Intensity", "Integrate Intensity"})
+ Me.cmbMeasurement.Location = New System.Drawing.Point(106, 56)
+ Me.cmbMeasurement.Name = "cmbMeasurement"
+ Me.cmbMeasurement.Size = New System.Drawing.Size(130, 24)
+ Me.cmbMeasurement.TabIndex = 3
+ '
+ 'Label13
+ '
+ Me.Label13.AutoSize = True
+ Me.Label13.Location = New System.Drawing.Point(111, 236)
+ Me.Label13.Name = "Label13"
+ Me.Label13.Size = New System.Drawing.Size(17, 16)
+ Me.Label13.TabIndex = 2
+ Me.Label13.Text = "Y"
+ '
+ 'Label15
+ '
+ Me.Label15.AutoSize = True
+ Me.Label15.Location = New System.Drawing.Point(223, 236)
+ Me.Label15.Name = "Label15"
+ Me.Label15.Size = New System.Drawing.Size(16, 16)
+ Me.Label15.TabIndex = 2
+ Me.Label15.Text = "X"
+ '
+ 'cmbBoxSize
+ '
+ Me.cmbBoxSize.FormattingEnabled = True
+ Me.cmbBoxSize.Items.AddRange(New Object() {"Tiny (200 x100)", "Small (300 x 150)", "Medium (400x200)", "Large (500x250)", "Extra Large (700x350)"})
+ Me.cmbBoxSize.Location = New System.Drawing.Point(106, 124)
+ Me.cmbBoxSize.Name = "cmbBoxSize"
+ Me.cmbBoxSize.Size = New System.Drawing.Size(130, 24)
+ Me.cmbBoxSize.TabIndex = 3
+ '
+ 'cmbProbeType
+ '
+ Me.cmbProbeType.FormattingEnabled = True
+ Me.cmbProbeType.Items.AddRange(New Object() {"Point (A)", "Line (A-B)"})
+ Me.cmbProbeType.Location = New System.Drawing.Point(106, 89)
+ Me.cmbProbeType.Name = "cmbProbeType"
+ Me.cmbProbeType.Size = New System.Drawing.Size(130, 24)
+ Me.cmbProbeType.TabIndex = 3
+ '
+ 'Label14
+ '
+ Me.Label14.AutoSize = True
+ Me.Label14.Location = New System.Drawing.Point(277, 209)
+ Me.Label14.Name = "Label14"
+ Me.Label14.Size = New System.Drawing.Size(68, 16)
+ Me.Label14.TabIndex = 2
+ Me.Label14.Text = "Position B"
+ '
+ 'Label12
+ '
+ Me.Label12.AutoSize = True
+ Me.Label12.Location = New System.Drawing.Point(23, 236)
+ Me.Label12.Name = "Label12"
+ Me.Label12.Size = New System.Drawing.Size(16, 16)
+ Me.Label12.TabIndex = 2
+ Me.Label12.Text = "X"
+ '
+ 'Label11
+ '
+ Me.Label11.AutoSize = True
+ Me.Label11.Location = New System.Drawing.Point(76, 209)
+ Me.Label11.Name = "Label11"
+ Me.Label11.Size = New System.Drawing.Size(68, 16)
+ Me.Label11.TabIndex = 2
+ Me.Label11.Text = "Position A"
+ '
+ 'Label17
+ '
+ Me.Label17.AutoSize = True
+ Me.Label17.Location = New System.Drawing.Point(14, 127)
+ Me.Label17.Name = "Label17"
+ Me.Label17.Size = New System.Drawing.Size(60, 16)
+ Me.Label17.TabIndex = 2
+ Me.Label17.Text = "Box Size"
+ '
+ 'Label10
+ '
+ Me.Label10.AutoSize = True
+ Me.Label10.Location = New System.Drawing.Point(14, 92)
+ Me.Label10.Name = "Label10"
+ Me.Label10.Size = New System.Drawing.Size(74, 16)
+ Me.Label10.TabIndex = 2
+ Me.Label10.Text = "Probe type"
+ '
+ 'Label9
+ '
+ Me.Label9.AutoSize = True
+ Me.Label9.Location = New System.Drawing.Point(12, 59)
+ Me.Label9.Name = "Label9"
+ Me.Label9.Size = New System.Drawing.Size(90, 16)
+ Me.Label9.TabIndex = 2
+ Me.Label9.Text = "Measurement"
+ '
+ 'Label8
+ '
+ Me.Label8.AutoSize = True
+ Me.Label8.Location = New System.Drawing.Point(14, 29)
+ Me.Label8.Name = "Label8"
+ Me.Label8.Size = New System.Drawing.Size(64, 16)
+ Me.Label8.TabIndex = 1
+ Me.Label8.Text = "Place on:"
+ '
+ 'pnlProbeImage
+ '
+ Me.pnlProbeImage.Location = New System.Drawing.Point(16, 14)
+ Me.pnlProbeImage.Name = "pnlProbeImage"
+ Me.pnlProbeImage.Size = New System.Drawing.Size(1160, 653)
+ Me.pnlProbeImage.TabIndex = 0
+ '
+ 'tabViewer
+ '
+ Me.tabViewer.Controls.Add(Me.pnlPreviewIntensityProps)
+ Me.tabViewer.Controls.Add(Me.Panel3)
+ Me.tabViewer.Controls.Add(Me.Label56)
+ Me.tabViewer.Controls.Add(Me.Label55)
+ Me.tabViewer.Controls.Add(Me.lblWarningIntensity)
+ Me.tabViewer.Controls.Add(Me.lblWarningField)
+ Me.tabViewer.Controls.Add(Me.btnExportIntensityFrame)
+ Me.tabViewer.Controls.Add(Me.btnExportFieldFrame)
+ Me.tabViewer.Controls.Add(Me.btnOpenImageFolder)
+ Me.tabViewer.Controls.Add(Me.btnOpenVideoFolder)
+ Me.tabViewer.Controls.Add(Me.btnViewIntensityVideo)
+ Me.tabViewer.Controls.Add(Me.btnViewFieldVideo)
+ Me.tabViewer.Controls.Add(Me.pnlPreviewIntensity)
+ Me.tabViewer.Controls.Add(Me.pnlPreviewField)
+ Me.tabViewer.Location = New System.Drawing.Point(4, 34)
+ Me.tabViewer.Name = "tabViewer"
+ Me.tabViewer.Size = New System.Drawing.Size(1742, 693)
+ Me.tabViewer.TabIndex = 4
+ Me.tabViewer.Text = " Preview "
+ Me.tabViewer.UseVisualStyleBackColor = True
+ '
+ 'pnlPreviewIntensityProps
+ '
+ Me.pnlPreviewIntensityProps.BackColor = System.Drawing.SystemColors.ButtonFace
+ Me.pnlPreviewIntensityProps.Controls.Add(Me.chkExportVideoIntensity2)
+ Me.pnlPreviewIntensityProps.Controls.Add(Me.Label64)
+ Me.pnlPreviewIntensityProps.Controls.Add(Me.numBrightnessIntensityOverlay)
+ Me.pnlPreviewIntensityProps.Controls.Add(Me.numIntensityScaling2)
+ Me.pnlPreviewIntensityProps.Controls.Add(Me.chkDiplayOverlayInIntensity)
+ Me.pnlPreviewIntensityProps.Controls.Add(Me.Label66)
+ Me.pnlPreviewIntensityProps.Location = New System.Drawing.Point(1023, 12)
+ Me.pnlPreviewIntensityProps.Name = "pnlPreviewIntensityProps"
+ Me.pnlPreviewIntensityProps.Size = New System.Drawing.Size(700, 40)
+ Me.pnlPreviewIntensityProps.TabIndex = 14
+ '
+ 'chkExportVideoIntensity2
+ '
+ Me.chkExportVideoIntensity2.AutoSize = True
+ Me.chkExportVideoIntensity2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkExportVideoIntensity2.Location = New System.Drawing.Point(577, 8)
+ Me.chkExportVideoIntensity2.Name = "chkExportVideoIntensity2"
+ Me.chkExportVideoIntensity2.Size = New System.Drawing.Size(115, 24)
+ Me.chkExportVideoIntensity2.TabIndex = 12
+ Me.chkExportVideoIntensity2.Text = "Export video"
+ Me.chkExportVideoIntensity2.UseVisualStyleBackColor = True
+ '
+ 'Label64
+ '
+ Me.Label64.AutoSize = True
+ Me.Label64.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label64.Location = New System.Drawing.Point(13, 9)
+ Me.Label64.Name = "Label64"
+ Me.Label64.Size = New System.Drawing.Size(129, 20)
+ Me.Label64.TabIndex = 9
+ Me.Label64.Text = "Field scale factor"
+ '
+ 'numBrightnessIntensityOverlay
+ '
+ Me.numBrightnessIntensityOverlay.DecimalPlaces = 2
+ Me.numBrightnessIntensityOverlay.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numBrightnessIntensityOverlay.Increment = New Decimal(New Integer() {5, 0, 0, 131072})
+ Me.numBrightnessIntensityOverlay.Location = New System.Drawing.Point(473, 7)
+ Me.numBrightnessIntensityOverlay.Maximum = New Decimal(New Integer() {5, 0, 0, 0})
+ Me.numBrightnessIntensityOverlay.Name = "numBrightnessIntensityOverlay"
+ Me.numBrightnessIntensityOverlay.Size = New System.Drawing.Size(67, 26)
+ Me.numBrightnessIntensityOverlay.TabIndex = 11
+ Me.numBrightnessIntensityOverlay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numBrightnessIntensityOverlay.Value = New Decimal(New Integer() {1, 0, 0, 0})
+ '
+ 'numIntensityScaling2
+ '
+ Me.numIntensityScaling2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numIntensityScaling2.Location = New System.Drawing.Point(151, 7)
+ Me.numIntensityScaling2.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})
+ Me.numIntensityScaling2.Name = "numIntensityScaling2"
+ Me.numIntensityScaling2.Size = New System.Drawing.Size(74, 26)
+ Me.numIntensityScaling2.TabIndex = 8
+ Me.numIntensityScaling2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'chkDiplayOverlayInIntensity
+ '
+ Me.chkDiplayOverlayInIntensity.AutoSize = True
+ Me.chkDiplayOverlayInIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkDiplayOverlayInIntensity.Location = New System.Drawing.Point(253, 9)
+ Me.chkDiplayOverlayInIntensity.Name = "chkDiplayOverlayInIntensity"
+ Me.chkDiplayOverlayInIntensity.Size = New System.Drawing.Size(132, 24)
+ Me.chkDiplayOverlayInIntensity.TabIndex = 10
+ Me.chkDiplayOverlayInIntensity.Text = "Display overlay"
+ Me.chkDiplayOverlayInIntensity.UseVisualStyleBackColor = True
+ '
+ 'Label66
+ '
+ Me.Label66.AutoSize = True
+ Me.Label66.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label66.Location = New System.Drawing.Point(382, 10)
+ Me.Label66.Name = "Label66"
+ Me.Label66.Size = New System.Drawing.Size(91, 20)
+ Me.Label66.TabIndex = 9
+ Me.Label66.Text = "/ brightness"
+ '
+ 'Panel3
+ '
+ Me.Panel3.BackColor = System.Drawing.SystemColors.ButtonFace
+ Me.Panel3.Controls.Add(Me.Label63)
+ Me.Panel3.Controls.Add(Me.chkExportVideoField2)
+ Me.Panel3.Controls.Add(Me.numFieldScaling2)
+ Me.Panel3.Controls.Add(Me.Label65)
+ Me.Panel3.Controls.Add(Me.numBrightnessFieldOverlay)
+ Me.Panel3.Controls.Add(Me.chkDiplayOverlayInField)
+ Me.Panel3.Location = New System.Drawing.Point(170, 11)
+ Me.Panel3.Name = "Panel3"
+ Me.Panel3.Size = New System.Drawing.Size(697, 40)
+ Me.Panel3.TabIndex = 13
+ '
+ 'Label63
+ '
+ Me.Label63.AutoSize = True
+ Me.Label63.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label63.Location = New System.Drawing.Point(9, 10)
+ Me.Label63.Name = "Label63"
+ Me.Label63.Size = New System.Drawing.Size(129, 20)
+ Me.Label63.TabIndex = 9
+ Me.Label63.Text = "Field scale factor"
+ '
+ 'chkExportVideoField2
+ '
+ Me.chkExportVideoField2.AutoSize = True
+ Me.chkExportVideoField2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkExportVideoField2.Location = New System.Drawing.Point(571, 9)
+ Me.chkExportVideoField2.Name = "chkExportVideoField2"
+ Me.chkExportVideoField2.Size = New System.Drawing.Size(115, 24)
+ Me.chkExportVideoField2.TabIndex = 12
+ Me.chkExportVideoField2.Text = "Export video"
+ Me.chkExportVideoField2.UseVisualStyleBackColor = True
+ '
+ 'numFieldScaling2
+ '
+ Me.numFieldScaling2.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numFieldScaling2.Location = New System.Drawing.Point(144, 8)
+ Me.numFieldScaling2.Maximum = New Decimal(New Integer() {1000, 0, 0, 0})
+ Me.numFieldScaling2.Name = "numFieldScaling2"
+ Me.numFieldScaling2.Size = New System.Drawing.Size(75, 26)
+ Me.numFieldScaling2.TabIndex = 8
+ Me.numFieldScaling2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ '
+ 'Label65
+ '
+ Me.Label65.AutoSize = True
+ Me.Label65.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label65.Location = New System.Drawing.Point(380, 10)
+ Me.Label65.Name = "Label65"
+ Me.Label65.Size = New System.Drawing.Size(91, 20)
+ Me.Label65.TabIndex = 9
+ Me.Label65.Text = "/ brightness"
+ '
+ 'numBrightnessFieldOverlay
+ '
+ Me.numBrightnessFieldOverlay.DecimalPlaces = 2
+ Me.numBrightnessFieldOverlay.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.numBrightnessFieldOverlay.Increment = New Decimal(New Integer() {5, 0, 0, 131072})
+ Me.numBrightnessFieldOverlay.Location = New System.Drawing.Point(474, 8)
+ Me.numBrightnessFieldOverlay.Maximum = New Decimal(New Integer() {5, 0, 0, 0})
+ Me.numBrightnessFieldOverlay.Name = "numBrightnessFieldOverlay"
+ Me.numBrightnessFieldOverlay.Size = New System.Drawing.Size(67, 26)
+ Me.numBrightnessFieldOverlay.TabIndex = 11
+ Me.numBrightnessFieldOverlay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
+ Me.numBrightnessFieldOverlay.Value = New Decimal(New Integer() {1, 0, 0, 0})
+ '
+ 'chkDiplayOverlayInField
+ '
+ Me.chkDiplayOverlayInField.AutoSize = True
+ Me.chkDiplayOverlayInField.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.chkDiplayOverlayInField.Location = New System.Drawing.Point(254, 9)
+ Me.chkDiplayOverlayInField.Name = "chkDiplayOverlayInField"
+ Me.chkDiplayOverlayInField.Size = New System.Drawing.Size(132, 24)
+ Me.chkDiplayOverlayInField.TabIndex = 10
+ Me.chkDiplayOverlayInField.Text = "Display overlay"
+ Me.chkDiplayOverlayInField.UseVisualStyleBackColor = True
+ '
+ 'Label56
+ '
+ Me.Label56.AutoSize = True
+ Me.Label56.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label56.Location = New System.Drawing.Point(881, 16)
+ Me.Label56.Name = "Label56"
+ Me.Label56.Size = New System.Drawing.Size(126, 31)
+ Me.Label56.TabIndex = 7
+ Me.Label56.Text = "Intensity"
+ '
+ 'Label55
+ '
+ Me.Label55.AutoSize = True
+ Me.Label55.Font = New System.Drawing.Font("Microsoft Sans Serif", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Label55.Location = New System.Drawing.Point(53, 16)
+ Me.Label55.Name = "Label55"
+ Me.Label55.Size = New System.Drawing.Size(78, 31)
+ Me.Label55.TabIndex = 7
+ Me.Label55.Text = "Field"
+ '
+ 'lblWarningIntensity
+ '
+ Me.lblWarningIntensity.AutoSize = True
+ Me.lblWarningIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblWarningIntensity.Location = New System.Drawing.Point(1201, 550)
+ Me.lblWarningIntensity.Name = "lblWarningIntensity"
+ Me.lblWarningIntensity.Size = New System.Drawing.Size(183, 20)
+ Me.lblWarningIntensity.TabIndex = 6
+ Me.lblWarningIntensity.Text = "Intensity video is created"
+ '
+ 'lblWarningField
+ '
+ Me.lblWarningField.AutoSize = True
+ Me.lblWarningField.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblWarningField.Location = New System.Drawing.Point(335, 551)
+ Me.lblWarningField.Name = "lblWarningField"
+ Me.lblWarningField.Size = New System.Drawing.Size(157, 20)
+ Me.lblWarningField.TabIndex = 6
+ Me.lblWarningField.Text = "Field video is created"
+ '
+ 'btnExportIntensityFrame
+ '
+ Me.btnExportIntensityFrame.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnExportIntensityFrame.Location = New System.Drawing.Point(1410, 545)
+ Me.btnExportIntensityFrame.Name = "btnExportIntensityFrame"
+ Me.btnExportIntensityFrame.Size = New System.Drawing.Size(247, 31)
+ Me.btnExportIntensityFrame.TabIndex = 5
+ Me.btnExportIntensityFrame.Text = "Export frame as image"
+ Me.btnExportIntensityFrame.UseVisualStyleBackColor = True
+ '
+ 'btnExportFieldFrame
+ '
+ Me.btnExportFieldFrame.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnExportFieldFrame.Location = New System.Drawing.Point(536, 547)
+ Me.btnExportFieldFrame.Name = "btnExportFieldFrame"
+ Me.btnExportFieldFrame.Size = New System.Drawing.Size(243, 29)
+ Me.btnExportFieldFrame.TabIndex = 4
+ Me.btnExportFieldFrame.Text = "Export frame as Image"
+ Me.btnExportFieldFrame.UseVisualStyleBackColor = True
+ '
+ 'btnOpenImageFolder
+ '
+ Me.btnOpenImageFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnOpenImageFolder.Location = New System.Drawing.Point(1524, 650)
+ Me.btnOpenImageFolder.Name = "btnOpenImageFolder"
+ Me.btnOpenImageFolder.Size = New System.Drawing.Size(207, 33)
+ Me.btnOpenImageFolder.TabIndex = 2
+ Me.btnOpenImageFolder.Text = "Open Image folder"
+ Me.btnOpenImageFolder.UseVisualStyleBackColor = True
+ '
+ 'btnOpenVideoFolder
+ '
+ Me.btnOpenVideoFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnOpenVideoFolder.Location = New System.Drawing.Point(1311, 650)
+ Me.btnOpenVideoFolder.Name = "btnOpenVideoFolder"
+ Me.btnOpenVideoFolder.Size = New System.Drawing.Size(207, 33)
+ Me.btnOpenVideoFolder.TabIndex = 2
+ Me.btnOpenVideoFolder.Text = "Open video folder"
+ Me.btnOpenVideoFolder.UseVisualStyleBackColor = True
+ '
+ 'btnViewIntensityVideo
+ '
+ Me.btnViewIntensityVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnViewIntensityVideo.Location = New System.Drawing.Point(929, 546)
+ Me.btnViewIntensityVideo.Name = "btnViewIntensityVideo"
+ Me.btnViewIntensityVideo.Size = New System.Drawing.Size(247, 29)
+ Me.btnViewIntensityVideo.TabIndex = 1
+ Me.btnViewIntensityVideo.Text = "View video in media player"
+ Me.btnViewIntensityVideo.UseVisualStyleBackColor = True
+ '
+ 'btnViewFieldVideo
+ '
+ Me.btnViewFieldVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnViewFieldVideo.Location = New System.Drawing.Point(79, 547)
+ Me.btnViewFieldVideo.Name = "btnViewFieldVideo"
+ Me.btnViewFieldVideo.Size = New System.Drawing.Size(216, 29)
+ Me.btnViewFieldVideo.TabIndex = 1
+ Me.btnViewFieldVideo.Text = "View video in media player"
+ Me.btnViewFieldVideo.UseVisualStyleBackColor = True
+ '
+ 'pnlPreviewIntensity
+ '
+ Me.pnlPreviewIntensity.Location = New System.Drawing.Point(873, 57)
+ Me.pnlPreviewIntensity.Name = "pnlPreviewIntensity"
+ Me.pnlPreviewIntensity.Size = New System.Drawing.Size(850, 478)
+ Me.pnlPreviewIntensity.TabIndex = 0
+ '
+ 'pnlPreviewField
+ '
+ Me.pnlPreviewField.Location = New System.Drawing.Point(17, 56)
+ Me.pnlPreviewField.Name = "pnlPreviewField"
+ Me.pnlPreviewField.Size = New System.Drawing.Size(850, 478)
+ Me.pnlPreviewField.TabIndex = 0
+ '
+ 'tabOutput
+ '
+ Me.tabOutput.Controls.Add(Me.btnRenameVideo)
+ Me.tabOutput.Controls.Add(Me.btnShareWithEditors)
+ Me.tabOutput.Controls.Add(Me.btnCopyToClipboard)
+ Me.tabOutput.Controls.Add(Me.btnOpenImageFolder2)
+ Me.tabOutput.Controls.Add(Me.btnViewVIdeoInPlayer2)
+ Me.tabOutput.Controls.Add(Me.btnOpenVIdeoFolder2)
+ Me.tabOutput.Controls.Add(Me.lblPreview)
+ Me.tabOutput.Controls.Add(Me.btnDeleteVideos)
+ Me.tabOutput.Controls.Add(Me.btnDeleteImages)
+ Me.tabOutput.Controls.Add(Me.btnDeleteScene)
+ Me.tabOutput.Controls.Add(Me.btnLoadExternal)
+ Me.tabOutput.Controls.Add(Me.pnlPreview)
+ Me.tabOutput.Controls.Add(Me.Label57)
+ Me.tabOutput.Controls.Add(Me.lstScenes)
+ Me.tabOutput.Controls.Add(Me.lstImages)
+ Me.tabOutput.Controls.Add(Me.lstVideo)
+ Me.tabOutput.Controls.Add(Me.lstAllProjects3)
+ Me.tabOutput.Location = New System.Drawing.Point(4, 34)
+ Me.tabOutput.Name = "tabOutput"
+ Me.tabOutput.Size = New System.Drawing.Size(1742, 693)
+ Me.tabOutput.TabIndex = 3
+ Me.tabOutput.Text = " Manage output "
+ Me.tabOutput.UseVisualStyleBackColor = True
+ '
+ 'btnRenameVideo
+ '
+ Me.btnRenameVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnRenameVideo.Location = New System.Drawing.Point(566, 631)
+ Me.btnRenameVideo.Name = "btnRenameVideo"
+ Me.btnRenameVideo.Size = New System.Drawing.Size(75, 31)
+ Me.btnRenameVideo.TabIndex = 20
+ Me.btnRenameVideo.Text = "Rename"
+ Me.btnRenameVideo.UseVisualStyleBackColor = True
+ '
+ 'btnShareWithEditors
+ '
+ Me.btnShareWithEditors.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnShareWithEditors.Location = New System.Drawing.Point(1517, 635)
+ Me.btnShareWithEditors.Name = "btnShareWithEditors"
+ Me.btnShareWithEditors.Size = New System.Drawing.Size(193, 27)
+ Me.btnShareWithEditors.TabIndex = 19
+ Me.btnShareWithEditors.Text = "Share this image with tabs"
+ Me.btnShareWithEditors.UseVisualStyleBackColor = True
+ '
+ 'btnCopyToClipboard
+ '
+ Me.btnCopyToClipboard.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnCopyToClipboard.Location = New System.Drawing.Point(594, 407)
+ Me.btnCopyToClipboard.Name = "btnCopyToClipboard"
+ Me.btnCopyToClipboard.Size = New System.Drawing.Size(129, 30)
+ Me.btnCopyToClipboard.TabIndex = 18
+ Me.btnCopyToClipboard.Text = "Copy to clipboard"
+ Me.btnCopyToClipboard.UseVisualStyleBackColor = True
+ '
+ 'btnOpenImageFolder2
+ '
+ Me.btnOpenImageFolder2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnOpenImageFolder2.Location = New System.Drawing.Point(759, 407)
+ Me.btnOpenImageFolder2.Name = "btnOpenImageFolder2"
+ Me.btnOpenImageFolder2.Size = New System.Drawing.Size(132, 30)
+ Me.btnOpenImageFolder2.TabIndex = 17
+ Me.btnOpenImageFolder2.Text = "Open image folder"
+ Me.btnOpenImageFolder2.UseVisualStyleBackColor = True
+ '
+ 'btnViewVIdeoInPlayer2
+ '
+ Me.btnViewVIdeoInPlayer2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnViewVIdeoInPlayer2.Location = New System.Drawing.Point(677, 630)
+ Me.btnViewVIdeoInPlayer2.Name = "btnViewVIdeoInPlayer2"
+ Me.btnViewVIdeoInPlayer2.Size = New System.Drawing.Size(114, 33)
+ Me.btnViewVIdeoInPlayer2.TabIndex = 16
+ Me.btnViewVIdeoInPlayer2.Text = "View in player"
+ Me.btnViewVIdeoInPlayer2.UseVisualStyleBackColor = True
+ '
+ 'btnOpenVIdeoFolder2
+ '
+ Me.btnOpenVIdeoFolder2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnOpenVIdeoFolder2.Location = New System.Drawing.Point(799, 630)
+ Me.btnOpenVIdeoFolder2.Name = "btnOpenVIdeoFolder2"
+ Me.btnOpenVIdeoFolder2.Size = New System.Drawing.Size(93, 34)
+ Me.btnOpenVIdeoFolder2.TabIndex = 15
+ Me.btnOpenVIdeoFolder2.Text = "Open folder"
+ Me.btnOpenVIdeoFolder2.UseVisualStyleBackColor = True
+ '
+ 'lblPreview
+ '
+ Me.lblPreview.AutoSize = True
+ Me.lblPreview.Location = New System.Drawing.Point(911, 25)
+ Me.lblPreview.Name = "lblPreview"
+ Me.lblPreview.Size = New System.Drawing.Size(88, 25)
+ Me.lblPreview.TabIndex = 14
+ Me.lblPreview.Text = "Preview"
+ '
+ 'btnDeleteVideos
+ '
+ Me.btnDeleteVideos.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnDeleteVideos.Location = New System.Drawing.Point(456, 631)
+ Me.btnDeleteVideos.Name = "btnDeleteVideos"
+ Me.btnDeleteVideos.Size = New System.Drawing.Size(101, 31)
+ Me.btnDeleteVideos.TabIndex = 13
+ Me.btnDeleteVideos.Text = "Delete video"
+ Me.btnDeleteVideos.UseVisualStyleBackColor = True
+ '
+ 'btnDeleteImages
+ '
+ Me.btnDeleteImages.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnDeleteImages.Location = New System.Drawing.Point(458, 405)
+ Me.btnDeleteImages.Name = "btnDeleteImages"
+ Me.btnDeleteImages.Size = New System.Drawing.Size(99, 32)
+ Me.btnDeleteImages.TabIndex = 13
+ Me.btnDeleteImages.Text = "Delete image"
+ Me.btnDeleteImages.UseVisualStyleBackColor = True
+ '
+ 'btnDeleteScene
+ '
+ Me.btnDeleteScene.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnDeleteScene.Location = New System.Drawing.Point(459, 177)
+ Me.btnDeleteScene.Name = "btnDeleteScene"
+ Me.btnDeleteScene.Size = New System.Drawing.Size(111, 32)
+ Me.btnDeleteScene.TabIndex = 13
+ Me.btnDeleteScene.Text = "Delete scene"
+ Me.btnDeleteScene.UseVisualStyleBackColor = True
+ '
+ 'btnLoadExternal
+ '
+ Me.btnLoadExternal.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnLoadExternal.Location = New System.Drawing.Point(785, 177)
+ Me.btnLoadExternal.Name = "btnLoadExternal"
+ Me.btnLoadExternal.Size = New System.Drawing.Size(104, 32)
+ Me.btnLoadExternal.TabIndex = 13
+ Me.btnLoadExternal.Text = "Load external"
+ Me.btnLoadExternal.UseVisualStyleBackColor = True
+ '
+ 'pnlPreview
+ '
+ Me.pnlPreview.BackColor = System.Drawing.Color.Gainsboro
+ Me.pnlPreview.Location = New System.Drawing.Point(908, 52)
+ Me.pnlPreview.Name = "pnlPreview"
+ Me.pnlPreview.Size = New System.Drawing.Size(806, 573)
+ Me.pnlPreview.TabIndex = 12
+ '
+ 'Label57
+ '
+ Me.Label57.AutoSize = True
+ Me.Label57.Location = New System.Drawing.Point(20, 16)
+ Me.Label57.Name = "Label57"
+ Me.Label57.Size = New System.Drawing.Size(227, 25)
+ Me.Label57.TabIndex = 11
+ Me.Label57.Text = "Manage project output"
+ '
+ 'lstScenes
+ '
+ Me.lstScenes.BackColor = System.Drawing.SystemColors.MenuBar
+ Me.lstScenes.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colSceneName, Me.colSceneCreated})
+ Me.lstScenes.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lstScenes.FullRowSelect = True
+ Me.lstScenes.HideSelection = False
+ Me.lstScenes.Location = New System.Drawing.Point(460, 51)
+ Me.lstScenes.Name = "lstScenes"
+ Me.lstScenes.Size = New System.Drawing.Size(432, 126)
+ Me.lstScenes.TabIndex = 10
+ Me.lstScenes.UseCompatibleStateImageBehavior = False
+ Me.lstScenes.View = System.Windows.Forms.View.Details
+ '
+ 'colSceneName
+ '
+ Me.colSceneName.Text = "Scene file name"
+ Me.colSceneName.Width = 262
+ '
+ 'colSceneCreated
+ '
+ Me.colSceneCreated.Text = "Created on"
+ Me.colSceneCreated.Width = 138
+ '
+ 'lstImages
+ '
+ Me.lstImages.BackColor = System.Drawing.SystemColors.Menu
+ Me.lstImages.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colImageName, Me.colCreatedOn})
+ Me.lstImages.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lstImages.FullRowSelect = True
+ Me.lstImages.HideSelection = False
+ Me.lstImages.Location = New System.Drawing.Point(460, 221)
+ Me.lstImages.Name = "lstImages"
+ Me.lstImages.Size = New System.Drawing.Size(432, 183)
+ Me.lstImages.TabIndex = 9
+ Me.lstImages.UseCompatibleStateImageBehavior = False
+ Me.lstImages.View = System.Windows.Forms.View.Details
+ '
+ 'colImageName
+ '
+ Me.colImageName.Text = "Image file name"
+ Me.colImageName.Width = 258
+ '
+ 'colCreatedOn
+ '
+ Me.colCreatedOn.Text = "Created on"
+ Me.colCreatedOn.Width = 141
+ '
+ 'lstVideo
+ '
+ Me.lstVideo.BackColor = System.Drawing.SystemColors.Menu
+ Me.lstVideo.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colVideoName, Me.colCreatedOn2})
+ Me.lstVideo.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lstVideo.FullRowSelect = True
+ Me.lstVideo.HideSelection = False
+ Me.lstVideo.Location = New System.Drawing.Point(457, 452)
+ Me.lstVideo.Name = "lstVideo"
+ Me.lstVideo.Size = New System.Drawing.Size(435, 173)
+ Me.lstVideo.TabIndex = 9
+ Me.lstVideo.UseCompatibleStateImageBehavior = False
+ Me.lstVideo.View = System.Windows.Forms.View.Details
+ '
+ 'colVideoName
+ '
+ Me.colVideoName.Text = "Video file name"
+ Me.colVideoName.Width = 255
+ '
+ 'colCreatedOn2
+ '
+ Me.colCreatedOn2.Text = "Created on"
+ Me.colCreatedOn2.Width = 145
+ '
+ 'lstAllProjects3
+ '
+ Me.lstAllProjects3.BackColor = System.Drawing.SystemColors.Menu
+ Me.lstAllProjects3.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.colProjectName2, Me.colLastEdited2})
+ Me.lstAllProjects3.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lstAllProjects3.FullRowSelect = True
+ Me.lstAllProjects3.HideSelection = False
+ Me.lstAllProjects3.Location = New System.Drawing.Point(18, 51)
+ Me.lstAllProjects3.MultiSelect = False
+ Me.lstAllProjects3.Name = "lstAllProjects3"
+ Me.lstAllProjects3.Size = New System.Drawing.Size(427, 611)
+ Me.lstAllProjects3.TabIndex = 9
+ Me.lstAllProjects3.UseCompatibleStateImageBehavior = False
+ Me.lstAllProjects3.View = System.Windows.Forms.View.Details
+ '
+ 'colProjectName2
+ '
+ Me.colProjectName2.Text = "Project name"
+ Me.colProjectName2.Width = 280
+ '
+ 'colLastEdited2
+ '
+ Me.colLastEdited2.Text = "Last edited"
+ Me.colLastEdited2.Width = 160
+ '
+ 'tabColorScheme
+ '
+ Me.tabColorScheme.Controls.Add(Me.lblType)
+ Me.tabColorScheme.Controls.Add(Me.radSchemeTypeIntensity)
+ Me.tabColorScheme.Controls.Add(Me.radSchemeTypeField)
+ Me.tabColorScheme.Controls.Add(Me.btnLoadScheme)
+ Me.tabColorScheme.Controls.Add(Me.btbChooseFFolder)
+ Me.tabColorScheme.Controls.Add(Me.lblSchemeFolder)
+ Me.tabColorScheme.Controls.Add(Me.ListView1)
+ Me.tabColorScheme.Controls.Add(Me.txtSchemeFolder)
+ Me.tabColorScheme.Controls.Add(Me.txtCurrentColorScheme)
+ Me.tabColorScheme.Controls.Add(Me.lblCurrentCOlorScheme)
+ Me.tabColorScheme.Controls.Add(Me.lblColorSchemeEditor)
+ Me.tabColorScheme.Controls.Add(Me.btnColor9)
+ Me.tabColorScheme.Controls.Add(Me.btnColor8)
+ Me.tabColorScheme.Controls.Add(Me.btnColor7)
+ Me.tabColorScheme.Controls.Add(Me.btnColor6)
+ Me.tabColorScheme.Controls.Add(Me.btnColor5)
+ Me.tabColorScheme.Controls.Add(Me.btnColor4)
+ Me.tabColorScheme.Controls.Add(Me.btnColor3)
+ Me.tabColorScheme.Controls.Add(Me.btnCOlor2)
+ Me.tabColorScheme.Controls.Add(Me.btnColor1)
+ Me.tabColorScheme.Controls.Add(Me.lblColorPicker)
+ Me.tabColorScheme.Controls.Add(Me.Panel2)
+ Me.tabColorScheme.Controls.Add(Me.pnlScheme)
+ Me.tabColorScheme.Controls.Add(Me.btnDeleteColorScheme)
+ Me.tabColorScheme.Controls.Add(Me.btnRenameColorScheme)
+ Me.tabColorScheme.Controls.Add(Me.btnSaveAsColorScheme)
+ Me.tabColorScheme.Controls.Add(Me.btnSaveCurrentScheme)
+ Me.tabColorScheme.Location = New System.Drawing.Point(4, 34)
+ Me.tabColorScheme.Name = "tabColorScheme"
+ Me.tabColorScheme.Padding = New System.Windows.Forms.Padding(3)
+ Me.tabColorScheme.Size = New System.Drawing.Size(1742, 693)
+ Me.tabColorScheme.TabIndex = 0
+ Me.tabColorScheme.Text = " Colors "
+ Me.tabColorScheme.UseVisualStyleBackColor = True
+ '
+ 'lblType
+ '
+ Me.lblType.AutoSize = True
+ Me.lblType.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblType.Location = New System.Drawing.Point(23, 93)
+ Me.lblType.Name = "lblType"
+ Me.lblType.Size = New System.Drawing.Size(98, 18)
+ Me.lblType.TabIndex = 19
+ Me.lblType.Text = "Scheme type:"
+ '
+ 'radSchemeTypeIntensity
+ '
+ Me.radSchemeTypeIntensity.AutoSize = True
+ Me.radSchemeTypeIntensity.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.radSchemeTypeIntensity.Location = New System.Drawing.Point(197, 91)
+ Me.radSchemeTypeIntensity.Name = "radSchemeTypeIntensity"
+ Me.radSchemeTypeIntensity.Size = New System.Drawing.Size(79, 22)
+ Me.radSchemeTypeIntensity.TabIndex = 18
+ Me.radSchemeTypeIntensity.Text = "Intensity"
+ Me.radSchemeTypeIntensity.UseVisualStyleBackColor = True
+ '
+ 'radSchemeTypeField
+ '
+ Me.radSchemeTypeField.AutoSize = True
+ Me.radSchemeTypeField.Checked = True
+ Me.radSchemeTypeField.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.radSchemeTypeField.Location = New System.Drawing.Point(134, 91)
+ Me.radSchemeTypeField.Name = "radSchemeTypeField"
+ Me.radSchemeTypeField.Size = New System.Drawing.Size(57, 22)
+ Me.radSchemeTypeField.TabIndex = 18
+ Me.radSchemeTypeField.TabStop = True
+ Me.radSchemeTypeField.Text = "Field"
+ Me.radSchemeTypeField.UseVisualStyleBackColor = True
+ '
+ 'btnLoadScheme
+ '
+ Me.btnLoadScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnLoadScheme.Location = New System.Drawing.Point(27, 528)
+ Me.btnLoadScheme.Name = "btnLoadScheme"
+ Me.btnLoadScheme.Size = New System.Drawing.Size(88, 28)
+ Me.btnLoadScheme.TabIndex = 11
+ Me.btnLoadScheme.Text = "Load "
+ Me.btnLoadScheme.UseVisualStyleBackColor = True
+ '
+ 'btbChooseFFolder
+ '
+ Me.btbChooseFFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btbChooseFFolder.Location = New System.Drawing.Point(470, 125)
+ Me.btbChooseFFolder.Name = "btbChooseFFolder"
+ Me.btbChooseFFolder.Size = New System.Drawing.Size(89, 25)
+ Me.btbChooseFFolder.TabIndex = 10
+ Me.btbChooseFFolder.Text = "Choose..."
+ Me.btbChooseFFolder.UseVisualStyleBackColor = True
+ '
+ 'lblSchemeFolder
+ '
+ Me.lblSchemeFolder.AutoSize = True
+ Me.lblSchemeFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblSchemeFolder.Location = New System.Drawing.Point(24, 128)
+ Me.lblSchemeFolder.Name = "lblSchemeFolder"
+ Me.lblSchemeFolder.Size = New System.Drawing.Size(104, 18)
+ Me.lblSchemeFolder.TabIndex = 9
+ Me.lblSchemeFolder.Text = "Scheme folder"
+ '
+ 'ListView1
+ '
+ Me.ListView1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.ListView1.HideSelection = False
+ Me.ListView1.Location = New System.Drawing.Point(27, 157)
+ Me.ListView1.Name = "ListView1"
+ Me.ListView1.Size = New System.Drawing.Size(531, 365)
+ Me.ListView1.TabIndex = 8
+ Me.ListView1.UseCompatibleStateImageBehavior = False
+ '
+ 'txtSchemeFolder
+ '
+ Me.txtSchemeFolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.txtSchemeFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.txtSchemeFolder.Location = New System.Drawing.Point(134, 125)
+ Me.txtSchemeFolder.Name = "txtSchemeFolder"
+ Me.txtSchemeFolder.Size = New System.Drawing.Size(330, 22)
+ Me.txtSchemeFolder.TabIndex = 7
+ '
+ 'txtCurrentColorScheme
+ '
+ Me.txtCurrentColorScheme.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.txtCurrentColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.txtCurrentColorScheme.Location = New System.Drawing.Point(135, 56)
+ Me.txtCurrentColorScheme.Name = "txtCurrentColorScheme"
+ Me.txtCurrentColorScheme.Size = New System.Drawing.Size(299, 24)
+ Me.txtCurrentColorScheme.TabIndex = 7
+ '
+ 'lblCurrentCOlorScheme
+ '
+ Me.lblCurrentCOlorScheme.AutoSize = True
+ Me.lblCurrentCOlorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblCurrentCOlorScheme.Location = New System.Drawing.Point(23, 58)
+ Me.lblCurrentCOlorScheme.Name = "lblCurrentCOlorScheme"
+ Me.lblCurrentCOlorScheme.Size = New System.Drawing.Size(108, 18)
+ Me.lblCurrentCOlorScheme.TabIndex = 6
+ Me.lblCurrentCOlorScheme.Text = "Color Scheme:"
+ '
+ 'lblColorSchemeEditor
+ '
+ Me.lblColorSchemeEditor.AutoSize = True
+ Me.lblColorSchemeEditor.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblColorSchemeEditor.Location = New System.Drawing.Point(22, 12)
+ Me.lblColorSchemeEditor.Name = "lblColorSchemeEditor"
+ Me.lblColorSchemeEditor.Size = New System.Drawing.Size(204, 24)
+ Me.lblColorSchemeEditor.TabIndex = 5
+ Me.lblColorSchemeEditor.Text = "Color Scheme Editor"
+ '
+ 'btnColor9
+ '
+ Me.btnColor9.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor9.Location = New System.Drawing.Point(1054, 514)
+ Me.btnColor9.Name = "btnColor9"
+ Me.btnColor9.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor9.TabIndex = 4
+ Me.btnColor9.Text = "Color 9 ->"
+ Me.btnColor9.UseVisualStyleBackColor = True
+ '
+ 'btnColor8
+ '
+ Me.btnColor8.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor8.Location = New System.Drawing.Point(1055, 465)
+ Me.btnColor8.Name = "btnColor8"
+ Me.btnColor8.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor8.TabIndex = 4
+ Me.btnColor8.Text = "Color 8 ->"
+ Me.btnColor8.UseVisualStyleBackColor = True
+ '
+ 'btnColor7
+ '
+ Me.btnColor7.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor7.Location = New System.Drawing.Point(1055, 416)
+ Me.btnColor7.Name = "btnColor7"
+ Me.btnColor7.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor7.TabIndex = 4
+ Me.btnColor7.Text = "Color 7 ->"
+ Me.btnColor7.UseVisualStyleBackColor = True
+ '
+ 'btnColor6
+ '
+ Me.btnColor6.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor6.Location = New System.Drawing.Point(1055, 368)
+ Me.btnColor6.Name = "btnColor6"
+ Me.btnColor6.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor6.TabIndex = 4
+ Me.btnColor6.Text = "Color 6 ->"
+ Me.btnColor6.UseVisualStyleBackColor = True
+ '
+ 'btnColor5
+ '
+ Me.btnColor5.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor5.Location = New System.Drawing.Point(1055, 322)
+ Me.btnColor5.Name = "btnColor5"
+ Me.btnColor5.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor5.TabIndex = 4
+ Me.btnColor5.Text = "Color 5 ->"
+ Me.btnColor5.UseVisualStyleBackColor = True
+ '
+ 'btnColor4
+ '
+ Me.btnColor4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor4.Location = New System.Drawing.Point(1054, 273)
+ Me.btnColor4.Name = "btnColor4"
+ Me.btnColor4.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor4.TabIndex = 4
+ Me.btnColor4.Text = "Color 4 ->"
+ Me.btnColor4.UseVisualStyleBackColor = True
+ '
+ 'btnColor3
+ '
+ Me.btnColor3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor3.Location = New System.Drawing.Point(1054, 225)
+ Me.btnColor3.Name = "btnColor3"
+ Me.btnColor3.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor3.TabIndex = 4
+ Me.btnColor3.Text = "Color 3 ->"
+ Me.btnColor3.UseVisualStyleBackColor = True
+ '
+ 'btnCOlor2
+ '
+ Me.btnCOlor2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnCOlor2.Location = New System.Drawing.Point(1055, 176)
+ Me.btnCOlor2.Name = "btnCOlor2"
+ Me.btnCOlor2.Size = New System.Drawing.Size(78, 34)
+ Me.btnCOlor2.TabIndex = 4
+ Me.btnCOlor2.Text = "Color 2 ->"
+ Me.btnCOlor2.UseVisualStyleBackColor = True
+ '
+ 'btnColor1
+ '
+ Me.btnColor1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnColor1.Location = New System.Drawing.Point(1055, 128)
+ Me.btnColor1.Name = "btnColor1"
+ Me.btnColor1.Size = New System.Drawing.Size(78, 34)
+ Me.btnColor1.TabIndex = 4
+ Me.btnColor1.Text = "Color 1 ->"
+ Me.btnColor1.UseVisualStyleBackColor = True
+ '
+ 'lblColorPicker
+ '
+ Me.lblColorPicker.AutoSize = True
+ Me.lblColorPicker.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblColorPicker.Location = New System.Drawing.Point(596, 101)
+ Me.lblColorPicker.Name = "lblColorPicker"
+ Me.lblColorPicker.Size = New System.Drawing.Size(93, 20)
+ Me.lblColorPicker.TabIndex = 2
+ Me.lblColorPicker.Text = "Color Picker"
+ '
+ 'Panel2
+ '
+ Me.Panel2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.Panel2.Location = New System.Drawing.Point(598, 125)
+ Me.Panel2.Name = "Panel2"
+ Me.Panel2.Size = New System.Drawing.Size(445, 425)
+ Me.Panel2.TabIndex = 1
+ '
+ 'pnlScheme
+ '
+ Me.pnlScheme.Location = New System.Drawing.Point(1139, 139)
+ Me.pnlScheme.Name = "pnlScheme"
+ Me.pnlScheme.Size = New System.Drawing.Size(55, 399)
+ Me.pnlScheme.TabIndex = 1
+ '
+ 'btnDeleteColorScheme
+ '
+ Me.btnDeleteColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnDeleteColorScheme.Location = New System.Drawing.Point(470, 528)
+ Me.btnDeleteColorScheme.Name = "btnDeleteColorScheme"
+ Me.btnDeleteColorScheme.Size = New System.Drawing.Size(89, 28)
+ Me.btnDeleteColorScheme.TabIndex = 0
+ Me.btnDeleteColorScheme.Text = "Delete"
+ Me.btnDeleteColorScheme.UseVisualStyleBackColor = True
+ '
+ 'btnRenameColorScheme
+ '
+ Me.btnRenameColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnRenameColorScheme.Location = New System.Drawing.Point(376, 528)
+ Me.btnRenameColorScheme.Name = "btnRenameColorScheme"
+ Me.btnRenameColorScheme.Size = New System.Drawing.Size(88, 28)
+ Me.btnRenameColorScheme.TabIndex = 0
+ Me.btnRenameColorScheme.Text = "Rename"
+ Me.btnRenameColorScheme.UseVisualStyleBackColor = True
+ '
+ 'btnSaveAsColorScheme
+ '
+ Me.btnSaveAsColorScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnSaveAsColorScheme.Location = New System.Drawing.Point(215, 528)
+ Me.btnSaveAsColorScheme.Name = "btnSaveAsColorScheme"
+ Me.btnSaveAsColorScheme.Size = New System.Drawing.Size(88, 28)
+ Me.btnSaveAsColorScheme.TabIndex = 0
+ Me.btnSaveAsColorScheme.Text = "Save As"
+ Me.btnSaveAsColorScheme.UseVisualStyleBackColor = True
+ '
+ 'btnSaveCurrentScheme
+ '
+ Me.btnSaveCurrentScheme.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnSaveCurrentScheme.Location = New System.Drawing.Point(121, 528)
+ Me.btnSaveCurrentScheme.Name = "btnSaveCurrentScheme"
+ Me.btnSaveCurrentScheme.Size = New System.Drawing.Size(88, 28)
+ Me.btnSaveCurrentScheme.TabIndex = 0
+ Me.btnSaveCurrentScheme.Text = "Save "
+ Me.btnSaveCurrentScheme.UseVisualStyleBackColor = True
+ '
+ 'btnSaveConfiguration
+ '
+ Me.btnSaveConfiguration.BackColor = System.Drawing.Color.Azure
+ Me.btnSaveConfiguration.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnSaveConfiguration.Location = New System.Drawing.Point(1503, 840)
+ Me.btnSaveConfiguration.Name = "btnSaveConfiguration"
+ Me.btnSaveConfiguration.Size = New System.Drawing.Size(259, 53)
+ Me.btnSaveConfiguration.TabIndex = 2
+ Me.btnSaveConfiguration.Text = "Save changes to project"
+ Me.btnSaveConfiguration.UseVisualStyleBackColor = False
+ '
+ 'btnStartSimulation
+ '
+ Me.btnStartSimulation.BackColor = System.Drawing.Color.Azure
+ Me.btnStartSimulation.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnStartSimulation.Location = New System.Drawing.Point(18, 23)
+ Me.btnStartSimulation.Name = "btnStartSimulation"
+ Me.btnStartSimulation.Size = New System.Drawing.Size(216, 42)
+ Me.btnStartSimulation.TabIndex = 7
+ Me.btnStartSimulation.Text = "Start Simulation"
+ Me.btnStartSimulation.UseVisualStyleBackColor = False
+ '
+ 'btnPauzeResume
+ '
+ Me.btnPauzeResume.BackColor = System.Drawing.Color.Azure
+ Me.btnPauzeResume.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnPauzeResume.Location = New System.Drawing.Point(18, 71)
+ Me.btnPauzeResume.Name = "btnPauzeResume"
+ Me.btnPauzeResume.Size = New System.Drawing.Size(215, 46)
+ Me.btnPauzeResume.TabIndex = 2
+ Me.btnPauzeResume.Text = "Pauze simulation"
+ Me.btnPauzeResume.UseVisualStyleBackColor = False
+ '
+ 'MenuStrip1
+ '
+ Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.itemFile, Me.InfoToolStripMenuItem})
+ Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
+ Me.MenuStrip1.Name = "MenuStrip1"
+ Me.MenuStrip1.Size = New System.Drawing.Size(1781, 28)
+ Me.MenuStrip1.TabIndex = 1
+ Me.MenuStrip1.Text = "MenuStrip1"
+ '
+ 'itemFile
+ '
+ Me.itemFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.NewToolStripMenuItem, Me.OpenToolStripMenuItem, Me.ChooseProjectRootToolStripMenuItem, Me.SetCValueToolStripMenuItem, Me.SaveToolStripMenuItem, Me.ExitToolStripMenuItem})
+ Me.itemFile.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.itemFile.Name = "itemFile"
+ Me.itemFile.Size = New System.Drawing.Size(44, 24)
+ Me.itemFile.Text = "File"
+ '
+ 'NewToolStripMenuItem
+ '
+ Me.NewToolStripMenuItem.Name = "NewToolStripMenuItem"
+ Me.NewToolStripMenuItem.Size = New System.Drawing.Size(210, 24)
+ Me.NewToolStripMenuItem.Text = "New"
+ '
+ 'OpenToolStripMenuItem
+ '
+ Me.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem"
+ Me.OpenToolStripMenuItem.Size = New System.Drawing.Size(210, 24)
+ Me.OpenToolStripMenuItem.Text = "Open"
+ '
+ 'ChooseProjectRootToolStripMenuItem
+ '
+ Me.ChooseProjectRootToolStripMenuItem.Name = "ChooseProjectRootToolStripMenuItem"
+ Me.ChooseProjectRootToolStripMenuItem.Size = New System.Drawing.Size(210, 24)
+ Me.ChooseProjectRootToolStripMenuItem.Text = "Choose project root"
+ '
+ 'SetCValueToolStripMenuItem
+ '
+ Me.SetCValueToolStripMenuItem.Name = "SetCValueToolStripMenuItem"
+ Me.SetCValueToolStripMenuItem.Size = New System.Drawing.Size(210, 24)
+ Me.SetCValueToolStripMenuItem.Text = "Set c-value"
+ '
+ 'SaveToolStripMenuItem
+ '
+ Me.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem"
+ Me.SaveToolStripMenuItem.Size = New System.Drawing.Size(210, 24)
+ Me.SaveToolStripMenuItem.Text = "Save"
+ '
+ 'ExitToolStripMenuItem
+ '
+ Me.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"
+ Me.ExitToolStripMenuItem.Size = New System.Drawing.Size(210, 24)
+ Me.ExitToolStripMenuItem.Text = "Exit"
+ '
+ 'InfoToolStripMenuItem
+ '
+ Me.InfoToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.HelpToolStripMenuItem, Me.AboutToolStripMenuItem})
+ Me.InfoToolStripMenuItem.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.InfoToolStripMenuItem.Name = "InfoToolStripMenuItem"
+ Me.InfoToolStripMenuItem.Size = New System.Drawing.Size(47, 24)
+ Me.InfoToolStripMenuItem.Text = "Info"
+ '
+ 'HelpToolStripMenuItem
+ '
+ Me.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem"
+ Me.HelpToolStripMenuItem.Size = New System.Drawing.Size(119, 24)
+ Me.HelpToolStripMenuItem.Text = "Help"
+ '
+ 'AboutToolStripMenuItem
+ '
+ Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"
+ Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(119, 24)
+ Me.AboutToolStripMenuItem.Text = "About"
+ '
+ 'lblProjectName
+ '
+ Me.lblProjectName.AutoSize = True
+ Me.lblProjectName.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblProjectName.Location = New System.Drawing.Point(1101, 13)
+ Me.lblProjectName.Name = "lblProjectName"
+ Me.lblProjectName.Size = New System.Drawing.Size(96, 18)
+ Me.lblProjectName.TabIndex = 2
+ Me.lblProjectName.Text = "Project name"
+ '
+ 'txtProjectName
+ '
+ Me.txtProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.txtProjectName.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.txtProjectName.Location = New System.Drawing.Point(1203, 11)
+ Me.txtProjectName.Name = "txtProjectName"
+ Me.txtProjectName.ReadOnly = True
+ Me.txtProjectName.Size = New System.Drawing.Size(292, 24)
+ Me.txtProjectName.TabIndex = 3
+ '
+ 'txtRootFolder
+ '
+ Me.txtRootFolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.txtRootFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.txtRootFolder.Location = New System.Drawing.Point(145, 11)
+ Me.txtRootFolder.Name = "txtRootFolder"
+ Me.txtRootFolder.ReadOnly = True
+ Me.txtRootFolder.Size = New System.Drawing.Size(810, 24)
+ Me.txtRootFolder.TabIndex = 3
+ '
+ 'lblRootFolder
+ '
+ Me.lblRootFolder.AutoSize = True
+ Me.lblRootFolder.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.lblRootFolder.Location = New System.Drawing.Point(12, 13)
+ Me.lblRootFolder.Name = "lblRootFolder"
+ Me.lblRootFolder.Size = New System.Drawing.Size(127, 18)
+ Me.lblRootFolder.TabIndex = 2
+ Me.lblRootFolder.Text = "Project root folder"
+ '
+ 'btnBrowseRoot
+ '
+ Me.btnBrowseRoot.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnBrowseRoot.Location = New System.Drawing.Point(966, 8)
+ Me.btnBrowseRoot.Name = "btnBrowseRoot"
+ Me.btnBrowseRoot.Size = New System.Drawing.Size(124, 29)
+ Me.btnBrowseRoot.TabIndex = 4
+ Me.btnBrowseRoot.TabStop = False
+ Me.btnBrowseRoot.Text = "Browse root"
+ Me.btnBrowseRoot.UseVisualStyleBackColor = True
+ '
+ 'StatusStrip1
+ '
+ Me.StatusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripStatusLabel1})
+ Me.StatusStrip1.Location = New System.Drawing.Point(0, 967)
+ Me.StatusStrip1.Name = "StatusStrip1"
+ Me.StatusStrip1.Size = New System.Drawing.Size(1781, 22)
+ Me.StatusStrip1.TabIndex = 5
+ Me.StatusStrip1.Text = "StatusStrip1"
+ '
+ 'ToolStripStatusLabel1
+ '
+ Me.ToolStripStatusLabel1.Name = "ToolStripStatusLabel1"
+ Me.ToolStripStatusLabel1.Size = New System.Drawing.Size(120, 17)
+ Me.ToolStripStatusLabel1.Text = "ToolStripStatusLabel1"
+ '
+ 'grpNavigateTabs
+ '
+ Me.grpNavigateTabs.Controls.Add(Me.btnGotoPreview)
+ Me.grpNavigateTabs.Controls.Add(Me.btnGotoProbes)
+ Me.grpNavigateTabs.Controls.Add(Me.btnGotoSources)
+ Me.grpNavigateTabs.Controls.Add(Me.btnGotoConfiguration)
+ Me.grpNavigateTabs.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpNavigateTabs.Location = New System.Drawing.Point(511, 827)
+ Me.grpNavigateTabs.Name = "grpNavigateTabs"
+ Me.grpNavigateTabs.Size = New System.Drawing.Size(858, 76)
+ Me.grpNavigateTabs.TabIndex = 8
+ Me.grpNavigateTabs.TabStop = False
+ Me.grpNavigateTabs.Text = "Quick navigate to"
+ '
+ 'btnGotoPreview
+ '
+ Me.btnGotoPreview.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnGotoPreview.Location = New System.Drawing.Point(635, 27)
+ Me.btnGotoPreview.Name = "btnGotoPreview"
+ Me.btnGotoPreview.Size = New System.Drawing.Size(194, 31)
+ Me.btnGotoPreview.TabIndex = 0
+ Me.btnGotoPreview.Text = "Preview"
+ Me.btnGotoPreview.UseVisualStyleBackColor = True
+ '
+ 'btnGotoProbes
+ '
+ Me.btnGotoProbes.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnGotoProbes.Location = New System.Drawing.Point(431, 27)
+ Me.btnGotoProbes.Name = "btnGotoProbes"
+ Me.btnGotoProbes.Size = New System.Drawing.Size(198, 31)
+ Me.btnGotoProbes.TabIndex = 0
+ Me.btnGotoProbes.Text = "Probes"
+ Me.btnGotoProbes.UseVisualStyleBackColor = True
+ '
+ 'btnGotoSources
+ '
+ Me.btnGotoSources.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnGotoSources.Location = New System.Drawing.Point(228, 27)
+ Me.btnGotoSources.Name = "btnGotoSources"
+ Me.btnGotoSources.Size = New System.Drawing.Size(197, 31)
+ Me.btnGotoSources.TabIndex = 0
+ Me.btnGotoSources.Text = "Sources"
+ Me.btnGotoSources.UseVisualStyleBackColor = True
+ '
+ 'btnGotoConfiguration
+ '
+ Me.btnGotoConfiguration.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnGotoConfiguration.Location = New System.Drawing.Point(25, 27)
+ Me.btnGotoConfiguration.Name = "btnGotoConfiguration"
+ Me.btnGotoConfiguration.Size = New System.Drawing.Size(197, 31)
+ Me.btnGotoConfiguration.TabIndex = 0
+ Me.btnGotoConfiguration.Text = "Settings"
+ Me.btnGotoConfiguration.UseVisualStyleBackColor = True
+ '
+ 'grpSimulationControlButtons
+ '
+ Me.grpSimulationControlButtons.BackColor = System.Drawing.SystemColors.Control
+ Me.grpSimulationControlButtons.Controls.Add(Me.btnPauzeResume)
+ Me.grpSimulationControlButtons.Controls.Add(Me.btnStartSimulation)
+ Me.grpSimulationControlButtons.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpSimulationControlButtons.Location = New System.Drawing.Point(16, 827)
+ Me.grpSimulationControlButtons.Name = "grpSimulationControlButtons"
+ Me.grpSimulationControlButtons.Size = New System.Drawing.Size(262, 127)
+ Me.grpSimulationControlButtons.TabIndex = 9
+ Me.grpSimulationControlButtons.TabStop = False
+ Me.grpSimulationControlButtons.Text = "Simulation Control"
+ '
+ 'Panel1
+ '
+ Me.Panel1.BackColor = System.Drawing.Color.Azure
+ Me.Panel1.Controls.Add(Me.btnDescription)
+ Me.Panel1.Controls.Add(Me.txtRootFolder)
+ Me.Panel1.Controls.Add(Me.txtProjectName)
+ Me.Panel1.Controls.Add(Me.lblRootFolder)
+ Me.Panel1.Controls.Add(Me.lblProjectName)
+ Me.Panel1.Controls.Add(Me.btnBrowseRoot)
+ Me.Panel1.Location = New System.Drawing.Point(19, 33)
+ Me.Panel1.Name = "Panel1"
+ Me.Panel1.Size = New System.Drawing.Size(1734, 43)
+ Me.Panel1.TabIndex = 10
+ '
+ 'btnDescription
+ '
+ Me.btnDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnDescription.Location = New System.Drawing.Point(1536, 8)
+ Me.btnDescription.Name = "btnDescription"
+ Me.btnDescription.Size = New System.Drawing.Size(168, 29)
+ Me.btnDescription.TabIndex = 5
+ Me.btnDescription.Text = "Edit description"
+ Me.btnDescription.UseVisualStyleBackColor = True
+ '
+ 'grpShareImage
+ '
+ Me.grpShareImage.Controls.Add(Me.btnShareIntensityImage)
+ Me.grpShareImage.Controls.Add(Me.btnShareFieldImage)
+ Me.grpShareImage.Controls.Add(Me.btnShareSceneImage)
+ Me.grpShareImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.grpShareImage.Location = New System.Drawing.Point(295, 827)
+ Me.grpShareImage.Name = "grpShareImage"
+ Me.grpShareImage.Size = New System.Drawing.Size(199, 125)
+ Me.grpShareImage.TabIndex = 11
+ Me.grpShareImage.TabStop = False
+ Me.grpShareImage.Text = "Share with source / probe"
+ '
+ 'btnShareIntensityImage
+ '
+ Me.btnShareIntensityImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnShareIntensityImage.Location = New System.Drawing.Point(14, 86)
+ Me.btnShareIntensityImage.Name = "btnShareIntensityImage"
+ Me.btnShareIntensityImage.Size = New System.Drawing.Size(154, 27)
+ Me.btnShareIntensityImage.TabIndex = 0
+ Me.btnShareIntensityImage.Text = "Intensity image"
+ Me.btnShareIntensityImage.UseVisualStyleBackColor = True
+ '
+ 'btnShareFieldImage
+ '
+ Me.btnShareFieldImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnShareFieldImage.Location = New System.Drawing.Point(16, 53)
+ Me.btnShareFieldImage.Name = "btnShareFieldImage"
+ Me.btnShareFieldImage.Size = New System.Drawing.Size(154, 27)
+ Me.btnShareFieldImage.TabIndex = 0
+ Me.btnShareFieldImage.Text = "Field image"
+ Me.btnShareFieldImage.UseVisualStyleBackColor = True
+ '
+ 'btnShareSceneImage
+ '
+ Me.btnShareSceneImage.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnShareSceneImage.Location = New System.Drawing.Point(15, 21)
+ Me.btnShareSceneImage.Name = "btnShareSceneImage"
+ Me.btnShareSceneImage.Size = New System.Drawing.Size(155, 27)
+ Me.btnShareSceneImage.TabIndex = 0
+ Me.btnShareSceneImage.Text = "Scene image"
+ Me.btnShareSceneImage.UseVisualStyleBackColor = True
+ '
+ 'Form1
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(1781, 989)
+ Me.Controls.Add(Me.grpShareImage)
+ Me.Controls.Add(Me.Panel1)
+ Me.Controls.Add(Me.grpSimulationControlButtons)
+ Me.Controls.Add(Me.grpNavigateTabs)
+ Me.Controls.Add(Me.StatusStrip1)
+ Me.Controls.Add(Me.tabMainFunctions)
+ Me.Controls.Add(Me.MenuStrip1)
+ Me.Controls.Add(Me.btnSaveConfiguration)
+ Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
+ Me.MainMenuStrip = Me.MenuStrip1
+ Me.Name = "Form1"
+ Me.Text = "Wave Dude 2D V0.29"
+ Me.tabMainFunctions.ResumeLayout(False)
+ Me.tabConfiguration.ResumeLayout(False)
+ Me.grpProjects.ResumeLayout(False)
+ Me.grpSimulationSettings.ResumeLayout(False)
+ Me.grpSimulationSettings.PerformLayout()
+ CType(Me.numTimeDecayFactor, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numSimulationSteps, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numQuality, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numIntensityScaling, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numOffsetIntensity, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numOffsetField, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numFieldScaling, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numVisualizeEvery, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.grpSceneProperties.ResumeLayout(False)
+ Me.grpSceneProperties.PerformLayout()
+ CType(Me.numRefractiveIndex, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.picImagePreview, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numScaleImageSource, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.tabSourceList.ResumeLayout(False)
+ Me.tabSourceList.PerformLayout()
+ CType(Me.picPreviewSource, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.grpPlaceSource.ResumeLayout(False)
+ Me.pnlPosition.ResumeLayout(False)
+ Me.pnlPosition.PerformLayout()
+ CType(Me.numSourcePositionX, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numSourcePositionY, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.grpSourceDetails.ResumeLayout(False)
+ Me.grpSourceDetails.PerformLayout()
+ Me.grpComposite.ResumeLayout(False)
+ Me.grpComposite.PerformLayout()
+ CType(Me.numRandomizeOffWidth, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numRandomizePosition, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.NumRandomizePhase, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numRandomizeFrequency, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numSpacingSizeY, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numSpacingSizeX, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numArraySizeY, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numArraySizeX, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.grpSingleSource.ResumeLayout(False)
+ Me.grpSingleSource.PerformLayout()
+ CType(Me.numOffStateCycles, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numPhase, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numAmplitude, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numFrequency, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numPulseWidthCycles, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.tabProbeList.ResumeLayout(False)
+ Me.GroupBox2.ResumeLayout(False)
+ Me.GroupBox2.PerformLayout()
+ Me.grpProbe2.ResumeLayout(False)
+ Me.grpProbe2.PerformLayout()
+ CType(Me.numRunningWindow2, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numBPosY2, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numAPosY2, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numBPosX2, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numAPosX2, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.grpProbe1.ResumeLayout(False)
+ Me.grpProbe1.PerformLayout()
+ CType(Me.numRunningWindow, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numBPosY, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numAPosY, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numBPosX, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numAPosX, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.tabViewer.ResumeLayout(False)
+ Me.tabViewer.PerformLayout()
+ Me.pnlPreviewIntensityProps.ResumeLayout(False)
+ Me.pnlPreviewIntensityProps.PerformLayout()
+ CType(Me.numBrightnessIntensityOverlay, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numIntensityScaling2, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.Panel3.ResumeLayout(False)
+ Me.Panel3.PerformLayout()
+ CType(Me.numFieldScaling2, System.ComponentModel.ISupportInitialize).EndInit()
+ CType(Me.numBrightnessFieldOverlay, System.ComponentModel.ISupportInitialize).EndInit()
+ Me.tabOutput.ResumeLayout(False)
+ Me.tabOutput.PerformLayout()
+ Me.tabColorScheme.ResumeLayout(False)
+ Me.tabColorScheme.PerformLayout()
+ Me.MenuStrip1.ResumeLayout(False)
+ Me.MenuStrip1.PerformLayout()
+ Me.StatusStrip1.ResumeLayout(False)
+ Me.StatusStrip1.PerformLayout()
+ Me.grpNavigateTabs.ResumeLayout(False)
+ Me.grpSimulationControlButtons.ResumeLayout(False)
+ Me.Panel1.ResumeLayout(False)
+ Me.Panel1.PerformLayout()
+ Me.grpShareImage.ResumeLayout(False)
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+
+ Friend WithEvents tabMainFunctions As TabControl
+ Friend WithEvents tabColorScheme As TabPage
+ Friend WithEvents txtCurrentColorScheme As TextBox
+ Friend WithEvents lblCurrentCOlorScheme As Label
+ Friend WithEvents lblColorSchemeEditor As Label
+ Friend WithEvents btnColor5 As Button
+ Friend WithEvents btnColor4 As Button
+ Friend WithEvents btnColor3 As Button
+ Friend WithEvents btnCOlor2 As Button
+ Friend WithEvents btnColor1 As Button
+ Friend WithEvents lblColorPicker As Label
+ Friend WithEvents Panel2 As Panel
+ Friend WithEvents pnlScheme As Panel
+ Friend WithEvents btnSaveAsColorScheme As Button
+ Friend WithEvents btnSaveCurrentScheme As Button
+ Friend WithEvents tabConfiguration As TabPage
+ Friend WithEvents tabProbeList As TabPage
+ Friend WithEvents tabOutput As TabPage
+ Friend WithEvents tabViewer As TabPage
+ Friend WithEvents ListView1 As ListView
+ Friend WithEvents MenuStrip1 As MenuStrip
+ Friend WithEvents itemFile As ToolStripMenuItem
+ Friend WithEvents NewToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents OpenToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents SaveToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents ExitToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents lblSchemeFolder As Label
+ Friend WithEvents btnLoadScheme As Button
+ Friend WithEvents lblType As Label
+ Friend WithEvents radSchemeTypeIntensity As RadioButton
+ Friend WithEvents radSchemeTypeField As RadioButton
+ Friend WithEvents btbChooseFFolder As Button
+ Friend WithEvents txtSchemeFolder As TextBox
+ Friend WithEvents btnColor7 As Button
+ Friend WithEvents btnColor6 As Button
+ Friend WithEvents lblProjectName As Label
+ Friend WithEvents txtProjectName As TextBox
+ Friend WithEvents txtRootFolder As TextBox
+ Friend WithEvents lblRootFolder As Label
+ Friend WithEvents btnBrowseRoot As Button
+ Friend WithEvents btnSaveAs As Button
+ Friend WithEvents grpSceneProperties As GroupBox
+ Friend WithEvents txtDampingEdgeSize As TextBox
+ Friend WithEvents chkUseImageSources As CheckBox
+ Friend WithEvents chkDampingEdge As CheckBox
+ Friend WithEvents btnLoadSceneImage As Button
+ Friend WithEvents lblImageNameAndSize As Label
+ Friend WithEvents Label1 As Label
+ Friend WithEvents lblPix As Label
+ Friend WithEvents lblX As Label
+ Friend WithEvents txtYsize As TextBox
+ Friend WithEvents txtXSize As TextBox
+ Friend WithEvents radUserDefinedScene As RadioButton
+ Friend WithEvents picImagePreview As PictureBox
+ Friend WithEvents radUseSceneImage As RadioButton
+ Friend WithEvents tabSourceList As TabPage
+ Friend WithEvents btnSaveConfiguration As Button
+ Friend WithEvents grpSimulationSettings As GroupBox
+ Friend WithEvents numVisualizeEvery As NumericUpDown
+ Friend WithEvents Label4 As Label
+ Friend WithEvents lblVisualizeEvery As Label
+ Friend WithEvents lblSimulationSteps As Label
+ Friend WithEvents chkPreviewVideoIntensity As CheckBox
+ Friend WithEvents chkExportVideoIntensity As CheckBox
+ Friend WithEvents chkPreviewVideoField As CheckBox
+ Friend WithEvents chkExportVideoField As CheckBox
+ Friend WithEvents lblPreviewVideo As Label
+ Friend WithEvents lblExportVideo As Label
+ Friend WithEvents pnlPreviewIntensity As Panel
+ Friend WithEvents pnlPreviewField As Panel
+ Friend WithEvents cmbFieldColorScheme As ComboBox
+ Friend WithEvents Label3 As Label
+ Friend WithEvents Label2 As Label
+ Friend WithEvents cmbIntensityColorScheme As ComboBox
+ Friend WithEvents btnStartSimulation As Button
+ Friend WithEvents numFieldScaling As NumericUpDown
+ Friend WithEvents Label5 As Label
+ Friend WithEvents numIntensityScaling As NumericUpDown
+ Friend WithEvents numScaleIntensityValues As Label
+ Friend WithEvents btnEditObjectSourceList As Button
+ Friend WithEvents chkUseObjectSources As CheckBox
+ Friend WithEvents lblScaleImgSourceIntensity As Label
+ Friend WithEvents numScaleImageSource As NumericUpDown
+ Friend WithEvents numOffsetIntensity As NumericUpDown
+ Friend WithEvents numOffsetField As NumericUpDown
+ Friend WithEvents Label6 As Label
+ Friend WithEvents lblOffsetField As Label
+ Friend WithEvents btnViewIntensityVideo As Button
+ Friend WithEvents btnViewFieldVideo As Button
+ Friend WithEvents lblVideoQuality As Label
+ Friend WithEvents numQuality As NumericUpDown
+ Friend WithEvents chkUseGPU As CheckBox
+ Friend WithEvents Label7 As Label
+ Friend WithEvents StatusStrip1 As StatusStrip
+ Friend WithEvents ToolStripStatusLabel1 As ToolStripStatusLabel
+ Friend WithEvents btnPauzeResume As Button
+ Friend WithEvents pnlSourceImage As Panel
+ Friend WithEvents pnlProbeImage As Panel
+ Friend WithEvents grpProbe1 As GroupBox
+ Friend WithEvents radFullScale As RadioButton
+ Friend WithEvents radRunningScale As RadioButton
+ Friend WithEvents chkAutoScaleY As CheckBox
+ Friend WithEvents chkAutoScaleX As CheckBox
+ Friend WithEvents numBPosY As NumericUpDown
+ Friend WithEvents numAPosY As NumericUpDown
+ Friend WithEvents numBPosX As NumericUpDown
+ Friend WithEvents numAPosX As NumericUpDown
+ Friend WithEvents butPicPositions As Button
+ Friend WithEvents Label16 As Label
+ Friend WithEvents cmbPlaceOn As ComboBox
+ Friend WithEvents cmbMeasurement As ComboBox
+ Friend WithEvents Label13 As Label
+ Friend WithEvents Label15 As Label
+ Friend WithEvents cmbBoxSize As ComboBox
+ Friend WithEvents cmbProbeType As ComboBox
+ Friend WithEvents Label14 As Label
+ Friend WithEvents Label12 As Label
+ Friend WithEvents Label11 As Label
+ Friend WithEvents Label17 As Label
+ Friend WithEvents Label10 As Label
+ Friend WithEvents Label9 As Label
+ Friend WithEvents Label8 As Label
+ Friend WithEvents txtStartAfterStep As TextBox
+ Friend WithEvents chkStartAfterStep As CheckBox
+ Friend WithEvents Label19 As Label
+ Friend WithEvents Label18 As Label
+ Friend WithEvents txtMaxScaleY As TextBox
+ Friend WithEvents txtMinScaleY As TextBox
+ Friend WithEvents Label20 As Label
+ Friend WithEvents numRefractiveIndex As NumericUpDown
+ Friend WithEvents chkProbeOn1 As CheckBox
+ Friend WithEvents Label21 As Label
+ Friend WithEvents numRunningWindow As NumericUpDown
+ Friend WithEvents grpProbe2 As GroupBox
+ Friend WithEvents Label22 As Label
+ Friend WithEvents numRunningWindow2 As NumericUpDown
+ Friend WithEvents chkProbeOn2 As CheckBox
+ Friend WithEvents txtStartAfterStep2 As TextBox
+ Friend WithEvents chkStartAfterStep2 As CheckBox
+ Friend WithEvents Label23 As Label
+ Friend WithEvents Label24 As Label
+ Friend WithEvents txtMaxScaleY2 As TextBox
+ Friend WithEvents txtMinScaleY2 As TextBox
+ Friend WithEvents radFullScale2 As RadioButton
+ Friend WithEvents radRunningScale2 As RadioButton
+ Friend WithEvents chkAutoScaleY2 As CheckBox
+ Friend WithEvents chkAutoScaleX2 As CheckBox
+ Friend WithEvents numBPosY2 As NumericUpDown
+ Friend WithEvents numAPosY2 As NumericUpDown
+ Friend WithEvents numBPosX2 As NumericUpDown
+ Friend WithEvents numAPosX2 As NumericUpDown
+ Friend WithEvents butPicPositions2 As Button
+ Friend WithEvents Label25 As Label
+ Friend WithEvents cmbPlaceOn2 As ComboBox
+ Friend WithEvents cmbMeasurement2 As ComboBox
+ Friend WithEvents Label26 As Label
+ Friend WithEvents Label27 As Label
+ Friend WithEvents cmbBoxSize2 As ComboBox
+ Friend WithEvents cmbProbeType2 As ComboBox
+ Friend WithEvents Label28 As Label
+ Friend WithEvents Label29 As Label
+ Friend WithEvents Label30 As Label
+ Friend WithEvents Label31 As Label
+ Friend WithEvents Label32 As Label
+ Friend WithEvents Label33 As Label
+ Friend WithEvents Label34 As Label
+ Friend WithEvents btnDelete As Button
+ Friend WithEvents lstSources As ListBox
+ Friend WithEvents grpSourceDetails As GroupBox
+ Friend WithEvents lblPosition As Label
+ Friend WithEvents numSourcePositionY As NumericUpDown
+ Friend WithEvents numSourcePositionX As NumericUpDown
+ Friend WithEvents btnPickSourcePosition As Button
+ Friend WithEvents Label36 As Label
+ Friend WithEvents Label35 As Label
+ Friend WithEvents btnCopy As Button
+ Friend WithEvents grpSingleSource As GroupBox
+ Friend WithEvents Label43 As Label
+ Friend WithEvents Label42 As Label
+ Friend WithEvents Label41 As Label
+ Friend WithEvents Label40 As Label
+ Friend WithEvents radModePulsed As RadioButton
+ Friend WithEvents radModeContinuous As RadioButton
+ Friend WithEvents txtName As TextBox
+ Friend WithEvents cmbMainType As ComboBox
+ Friend WithEvents Label39 As Label
+ Friend WithEvents lblName As Label
+ Friend WithEvents Label38 As Label
+ Friend WithEvents numOffStateCycles As NumericUpDown
+ Friend WithEvents numAmplitude As NumericUpDown
+ Friend WithEvents numFrequency As NumericUpDown
+ Friend WithEvents numPulseWidthCycles As NumericUpDown
+ Friend WithEvents Label44 As Label
+ Friend WithEvents Label46 As Label
+ Friend WithEvents Label45 As Label
+ Friend WithEvents cmbPulseShape As ComboBox
+ Friend WithEvents grpComposite As GroupBox
+ Friend WithEvents numSpacingSizeX As NumericUpDown
+ Friend WithEvents numArraySizeX As NumericUpDown
+ Friend WithEvents numRandomizeFrequency As NumericUpDown
+ Friend WithEvents Label50 As Label
+ Friend WithEvents Label51 As Label
+ Friend WithEvents Label52 As Label
+ Friend WithEvents Label53 As Label
+ Friend WithEvents cmbCompositeProperties As ComboBox
+ Friend WithEvents numPhase As NumericUpDown
+ Friend WithEvents Label54 As Label
+ Friend WithEvents numSpacingSizeY As NumericUpDown
+ Friend WithEvents numArraySizeY As NumericUpDown
+ Friend WithEvents btnSaveSource As Button
+ Friend WithEvents numRandomizeOffWidth As NumericUpDown
+ Friend WithEvents numRandomizePosition As NumericUpDown
+ Friend WithEvents NumRandomizePhase As NumericUpDown
+ Friend WithEvents chkRandomizePhase As CheckBox
+ Friend WithEvents chkRandomizePosition As CheckBox
+ Friend WithEvents chkOffWidth As CheckBox
+ Friend WithEvents chkRandomizeFrequency As CheckBox
+ Friend WithEvents btnOpenVideoFolder As Button
+ Friend WithEvents txtDetachAfterSteps As TextBox
+ Friend WithEvents Label47 As Label
+ Friend WithEvents chkDetachSource As CheckBox
+ Friend WithEvents pnlPosition As Panel
+ Friend WithEvents lblLambdaIs As Label
+ Friend WithEvents chkSourceOn As CheckBox
+ Friend WithEvents btnRenameProject As Button
+ Friend WithEvents btnDeleteProject As Button
+ Friend WithEvents btnLoadProject As Button
+ Friend WithEvents ChooseProjectRootToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents SetCValueToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents btnExportIntensityFrame As Button
+ Friend WithEvents btnExportFieldFrame As Button
+ Friend WithEvents btnOpenImageFolder As Button
+ Friend WithEvents btnNew As Button
+ Friend WithEvents lblWarningIntensity As Label
+ Friend WithEvents lblWarningField As Label
+ Friend WithEvents grpNavigateTabs As GroupBox
+ Friend WithEvents grpSimulationControlButtons As GroupBox
+ Friend WithEvents btnGotoPreview As Button
+ Friend WithEvents btnGotoProbes As Button
+ Friend WithEvents btnGotoSources As Button
+ Friend WithEvents btnGotoConfiguration As Button
+ Friend WithEvents Panel1 As Panel
+ Friend WithEvents grpShareImage As GroupBox
+ Friend WithEvents btnShareIntensityImage As Button
+ Friend WithEvents btnShareFieldImage As Button
+ Friend WithEvents btnShareSceneImage As Button
+ Friend WithEvents btnNewProject As Button
+ Friend WithEvents btnColor9 As Button
+ Friend WithEvents btnColor8 As Button
+ Friend WithEvents grpProjects As GroupBox
+ Friend WithEvents grpPlaceSource As GroupBox
+ Friend WithEvents GroupBox2 As GroupBox
+ Friend WithEvents Label49 As Label
+ Friend WithEvents Label48 As Label
+ Friend WithEvents Label37 As Label
+ Friend WithEvents btnDeleteColorScheme As Button
+ Friend WithEvents btnRenameColorScheme As Button
+ Friend WithEvents Label56 As Label
+ Friend WithEvents Label55 As Label
+ Friend WithEvents lstAllProjects As ListView
+ Friend WithEvents colProjectName As ColumnHeader
+ Friend WithEvents colLastEdit As ColumnHeader
+ Friend WithEvents lstImages As ListView
+ Friend WithEvents colImageName As ColumnHeader
+ Friend WithEvents colCreatedOn As ColumnHeader
+ Friend WithEvents lstVideo As ListView
+ Friend WithEvents colVideoName As ColumnHeader
+ Friend WithEvents lstAllProjects3 As ListView
+ Friend WithEvents colProjectName2 As ColumnHeader
+ Friend WithEvents colLastEdited2 As ColumnHeader
+ Friend WithEvents btnDeleteScene As Button
+ Friend WithEvents btnLoadExternal As Button
+ Friend WithEvents pnlPreview As Panel
+ Friend WithEvents Label57 As Label
+ Friend WithEvents lstScenes As ListView
+ Friend WithEvents colSceneName As ColumnHeader
+ Friend WithEvents colSceneCreated As ColumnHeader
+ Friend WithEvents btnOpenImageFolder2 As Button
+ Friend WithEvents btnViewVIdeoInPlayer2 As Button
+ Friend WithEvents btnOpenVIdeoFolder2 As Button
+ Friend WithEvents lblPreview As Label
+ Friend WithEvents btnDeleteVideos As Button
+ Friend WithEvents btnDeleteImages As Button
+ Friend WithEvents btnCopyToClipboard As Button
+ Protected Friend WithEvents colCreatedOn2 As ColumnHeader
+ Friend WithEvents btnShareWithEditors As Button
+ Friend WithEvents chkUse4thOrderLaplacian As CheckBox
+ Friend WithEvents lblInfo As Label
+ Friend WithEvents btnRenameVideo As Button
+ Friend WithEvents picPreviewSource As PictureBox
+ Friend WithEvents chkAutoRescaleSourceOn As CheckBox
+ Friend WithEvents numSimulationSteps As NumericUpDown
+ Friend WithEvents Label59 As Label
+ Friend WithEvents Label58 As Label
+ Friend WithEvents Label60 As Label
+ Friend WithEvents Label61 As Label
+ Friend WithEvents numTimeDecayFactor As NumericUpDown
+ Friend WithEvents Label62 As Label
+ Friend WithEvents Label63 As Label
+ Friend WithEvents numFieldScaling2 As NumericUpDown
+ Friend WithEvents chkDiplayOverlayInField As CheckBox
+ Friend WithEvents Label64 As Label
+ Friend WithEvents numIntensityScaling2 As NumericUpDown
+ Friend WithEvents chkDiplayOverlayInIntensity As CheckBox
+ Friend WithEvents numBrightnessIntensityOverlay As NumericUpDown
+ Friend WithEvents numBrightnessFieldOverlay As NumericUpDown
+ Friend WithEvents Label66 As Label
+ Friend WithEvents Label65 As Label
+ Friend WithEvents pnlPreviewIntensityProps As Panel
+ Friend WithEvents chkExportVideoIntensity2 As CheckBox
+ Friend WithEvents Panel3 As Panel
+ Friend WithEvents chkExportVideoField2 As CheckBox
+ Friend WithEvents InfoToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents HelpToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents AboutToolStripMenuItem As ToolStripMenuItem
+ Friend WithEvents btnSaveConfiguration2 As Button
+ Friend WithEvents btnDescription As Button
+ Friend WithEvents btnPickRoot As Button
+End Class
diff --git a/2D_wave_sim_V01/Form1.Probes.vb b/2D_wave_sim_V01/Form1.Probes.vb
new file mode 100644
index 0000000..8e09590
--- /dev/null
+++ b/2D_wave_sim_V01/Form1.Probes.vb
@@ -0,0 +1,885 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Drawing
+Imports System.Drawing.Drawing2D
+Imports System.Globalization
+
+' ------------------------------------------------------------------ probes (Probes tab)
+'
+' A probe measures the field (amplitude) or the intensity while the simulation runs and shows the result in a little
+' graph box in the field or intensity picture:
+' Point (A) the value at A against the simulation step
+' Line (A-B) the values along the line A-B (position on the line on X) at the current step; it changes every step
+' The settings of the probe are kept in _probes (see ProbeSettings) and stored in the "probes" section of the project
+' file. Each probe has its own "On" checkbox (ProbeSettings.Active): when off, the probe is hidden - its marker,
+' graph box and burned-in overlay are all skipped - but it keeps being sampled, so switching it back on shows its
+' recorded history rather than starting from a blank graph.
+'
+' There are two independent probes, Probe 1 and Probe 2, each with its own group of controls (grpProbe1/grpProbe2).
+' _probeUi holds one ProbeControlSet per group, so the code that reads/writes a probe's settings and the events of
+' its controls can be shared between the two groups instead of being written out twice.
+'
+' The Probes tab shows a copy of a simulation picture (Preview tab, "Copy Image..." buttons), shared by both probes.
+' Each group has its own Pick button: it lets you click in that picture for that probe's position A, for a line
+' position B, and the top left corner of that probe's graph box.
+Partial Public Class Form1
+
+ ' the number of probe groups the controls support (Probe 1, Probe 2)
+ Private Const ProbeCount As Integer = 2
+
+ ' the probes of the project, always exactly ProbeCount entries, one per group of controls
+ Private _probes As List(Of ProbeSettings) = NewProbeList()
+
+ ' the controls of each probe group; built once in InitializeProbeControls
+ Private _probeUi As ProbeControlSet()
+
+ ' True while the code itself fills the probe controls (their change events are then ignored)
+ Private _loadingProbe As Boolean
+
+ ' picking positions in the picture: 0 = not picking, 1 = position A is next, 2 = position B is next (line only),
+ ' 3 = the top left corner of the graph box is next. _pickIndex is the probe (into _probes/_probeUi) being picked.
+ Private _pickStep As Integer
+ Private _pickIndex As Integer
+ Private _pickHover As Point?
+
+ ' the probes, the canvas and the number of steps of the run whose pictures are shown in the previews
+ Private _runProbes As List(Of ProbeSettings)
+ Private _runCanvas As Size
+ Private _runSteps As Integer
+ Private ReadOnly _probeTraces As New List(Of ProbeTrace)()
+
+ ''' <summary>
+ ''' The control set for a probe index, or Nothing while the form is still being constructed: InitializeComponent
+ ''' (which runs before InitializeProbeControls) sets some control values away from their .NET default, such as
+ ''' numRunningWindow's 500, and that alone fires the control's change event immediately, before _probeUi exists.
+ ''' The event handlers below go through this instead of indexing _probeUi directly, so that early firing is a
+ ''' harmless no-op instead of a NullReferenceException.
+ ''' </summary>
+ Private Function ProbeUi(index As Integer) As ProbeControlSet
+ If _probeUi Is Nothing Then Return Nothing
+ Return _probeUi(index)
+ End Function
+
+ Private Shared Function NewProbeList() As List(Of ProbeSettings)
+ Dim list As New List(Of ProbeSettings)()
+ For i As Integer = 0 To ProbeCount - 1
+ list.Add(New ProbeSettings())
+ Next
+ Return list
+ End Function
+
+ ''' <summary>Keeps _probes at exactly ProbeCount entries: pads with new (default) probes when a saved project has
+ ''' fewer (from before Probe 2 existed), trims extras when it somehow has more.</summary>
+ Private Sub NormalizeProbeCount()
+ While _probes.Count < ProbeCount
+ _probes.Add(New ProbeSettings())
+ End While
+ While _probes.Count > ProbeCount
+ _probes.RemoveAt(_probes.Count - 1)
+ End While
+ End Sub
+
+ ''' <summary>The controls of one probe's group box (Probe 1 or Probe 2), so the code that reads and writes a
+ ''' probe's settings, and the events of its controls, can be shared between the two groups.</summary>
+ Private NotInheritable Class ProbeControlSet
+ Public ReadOnly Index As Integer
+ Public ReadOnly Title As String
+ Public ReadOnly ChkOn As CheckBox
+ Public ReadOnly CmbPlaceOn As ComboBox
+ Public ReadOnly CmbMeasurement As ComboBox
+ Public ReadOnly CmbProbeType As ComboBox
+ Public ReadOnly CmbBoxSize As ComboBox
+ Public ReadOnly NumAPosX As NumericUpDown
+ Public ReadOnly NumAPosY As NumericUpDown
+ Public ReadOnly NumBPosX As NumericUpDown
+ Public ReadOnly NumBPosY As NumericUpDown
+ Public ReadOnly ButPick As Button
+ Public ReadOnly RadRunning As RadioButton
+ Public ReadOnly RadFull As RadioButton
+ Public ReadOnly ChkAutoX As CheckBox
+ Public ReadOnly ChkAutoY As CheckBox
+ Public ReadOnly TxtMinY As TextBox
+ Public ReadOnly TxtMaxY As TextBox
+ Public ReadOnly ChkStartAfter As CheckBox
+ Public ReadOnly TxtStartAfter As TextBox
+ Public ReadOnly NumRunningWindow As NumericUpDown
+
+ ''' <summary>The controls that only make sense for a line probe (position B and its labels); disabled for a point probe.</summary>
+ Public ReadOnly BOnlyControls As Control()
+
+ ''' <summary>The Pick button's own text ("Pick"), so it can be restored after showing "Cancel" while picking.</summary>
+ Public ReadOnly PickButtonText As String
+
+ Public Sub New(index As Integer, title As String, chkOn As CheckBox, cmbPlaceOn As ComboBox, cmbMeasurement As ComboBox,
+ cmbProbeType As ComboBox, cmbBoxSize As ComboBox, numAPosX As NumericUpDown, numAPosY As NumericUpDown,
+ numBPosX As NumericUpDown, numBPosY As NumericUpDown, butPick As Button, radRunning As RadioButton,
+ radFull As RadioButton, chkAutoX As CheckBox, chkAutoY As CheckBox, txtMinY As TextBox, txtMaxY As TextBox,
+ chkStartAfter As CheckBox, txtStartAfter As TextBox, numRunningWindow As NumericUpDown, bOnlyControls As Control())
+ Me.Index = index
+ Me.Title = title
+ Me.ChkOn = chkOn
+ Me.CmbPlaceOn = cmbPlaceOn
+ Me.CmbMeasurement = cmbMeasurement
+ Me.CmbProbeType = cmbProbeType
+ Me.CmbBoxSize = cmbBoxSize
+ Me.NumAPosX = numAPosX
+ Me.NumAPosY = numAPosY
+ Me.NumBPosX = numBPosX
+ Me.NumBPosY = numBPosY
+ Me.ButPick = butPick
+ Me.RadRunning = radRunning
+ Me.RadFull = radFull
+ Me.ChkAutoX = chkAutoX
+ Me.ChkAutoY = chkAutoY
+ Me.TxtMinY = txtMinY
+ Me.TxtMaxY = txtMaxY
+ Me.ChkStartAfter = chkStartAfter
+ Me.TxtStartAfter = txtStartAfter
+ Me.NumRunningWindow = numRunningWindow
+ Me.BOnlyControls = bOnlyControls
+ Me.PickButtonText = butPick.Text
+ End Sub
+ End Class
+
+ ' ---------------------------------------------------------------- setting up
+
+ Private Sub InitializeProbeControls()
+ _probeUi = New ProbeControlSet() {
+ New ProbeControlSet(index:=0, title:="Probe 1", chkOn:=chkProbeOn1, cmbPlaceOn:=cmbPlaceOn, cmbMeasurement:=cmbMeasurement,
+ cmbProbeType:=cmbProbeType, cmbBoxSize:=cmbBoxSize, numAPosX:=numAPosX, numAPosY:=numAPosY,
+ numBPosX:=numBPosX, numBPosY:=numBPosY, butPick:=butPicPositions, radRunning:=radRunningScale,
+ radFull:=radFullScale, chkAutoX:=chkAutoScaleX, chkAutoY:=chkAutoScaleY, txtMinY:=txtMinScaleY,
+ txtMaxY:=txtMaxScaleY, chkStartAfter:=chkStartAfterStep, txtStartAfter:=txtStartAfterStep,
+ numRunningWindow:=numRunningWindow, bOnlyControls:=New Control() {numBPosX, numBPosY, Label14, Label15, Label16}),
+ New ProbeControlSet(index:=1, title:="Probe 2", chkOn:=chkProbeOn2, cmbPlaceOn:=cmbPlaceOn2, cmbMeasurement:=cmbMeasurement2,
+ cmbProbeType:=cmbProbeType2, cmbBoxSize:=cmbBoxSize2, numAPosX:=numAPosX2, numAPosY:=numAPosY2,
+ numBPosX:=numBPosX2, numBPosY:=numBPosY2, butPick:=butPicPositions2, radRunning:=radRunningScale2,
+ radFull:=radFullScale2, chkAutoX:=chkAutoScaleX2, chkAutoY:=chkAutoScaleY2, txtMinY:=txtMinScaleY2,
+ txtMaxY:=txtMaxScaleY2, chkStartAfter:=chkStartAfterStep2, txtStartAfter:=txtStartAfterStep2,
+ numRunningWindow:=numRunningWindow2, bOnlyControls:=New Control() {numBPosX2, numBPosY2, Label28, Label27, Label25})
+ }
+
+ For Each ui As ProbeControlSet In _probeUi
+ For Each combo As ComboBox In New ComboBox() {ui.CmbPlaceOn, ui.CmbMeasurement, ui.CmbProbeType, ui.CmbBoxSize}
+ combo.DropDownStyle = ComboBoxStyle.DropDownList
+ Next
+
+ ' the choices are made here (not in the designer), in the order of the enumerations of ProbeSettings
+ ui.CmbPlaceOn.Items.Clear()
+ ui.CmbPlaceOn.Items.AddRange(New Object() {"Field", "Intensity"})
+ ui.CmbProbeType.Items.Clear()
+ ui.CmbProbeType.Items.AddRange(New Object() {"Point (A)", "Line (A-B)"})
+ ui.CmbBoxSize.Items.Clear()
+ ui.CmbBoxSize.Items.AddRange(New Object() {"Tiny (200 x 100)", "Small (300 x 150)", "Medium (400 x 200)", "Large (500 x 250)", "Extra Large (700 x 350)"})
+
+ For Each box As NumericUpDown In New NumericUpDown() {ui.NumAPosX, ui.NumAPosY, ui.NumBPosX, ui.NumBPosY}
+ box.DecimalPlaces = 0
+ box.Minimum = 0D
+ box.Maximum = CDec(SceneSettings.MaxCanvasSize - 1)
+ Next
+
+ ui.NumRunningWindow.DecimalPlaces = 0
+ ui.NumRunningWindow.Minimum = 10D
+ ui.NumRunningWindow.Maximum = CDec(ProbeSettings.MaxRunningWindow)
+ Next
+
+ ' the graphs and markers are drawn over the pictures (the pictures themselves stay clean)
+ AddHandler _picField.Paint, AddressOf PreviewPicture_Paint
+ AddHandler _picIntensity.Paint, AddressOf PreviewPicture_Paint
+ AddHandler _picProbe.Paint, AddressOf ProbePicture_Paint
+ AddHandler _picProbe.MouseClick, AddressOf ProbePicture_MouseClick
+ AddHandler _picProbe.MouseMove, AddressOf ProbePicture_MouseMove
+ AddHandler _picProbe.MouseLeave, AddressOf ProbePicture_MouseLeave
+
+ ShowProbesInControls()
+ End Sub
+
+ ''' <summary>Copies the values of both probes into their controls.</summary>
+ Private Sub ShowProbesInControls()
+ EndPick()
+ For Each ui As ProbeControlSet In _probeUi
+ ShowProbeInControls(ui)
+ Next
+ End Sub
+
+ ''' <summary>Copies the values of one probe into its group of controls.</summary>
+ Private Sub ShowProbeInControls(ui As ProbeControlSet)
+ Dim p As ProbeSettings = _probes(ui.Index)
+ p.Normalize()
+
+ _loadingProbe = True
+ Try
+ SetProbeRanges(ui)
+
+ ui.ChkOn.Checked = p.Active
+ ui.CmbPlaceOn.SelectedIndex = CInt(p.PlaceOn)
+ FillMeasurementCombo(ui, p)
+ ui.CmbProbeType.SelectedIndex = CInt(p.Kind)
+ ui.CmbBoxSize.SelectedIndex = CInt(p.BoxSize)
+
+ ui.NumAPosX.Value = ClampToRange(ui.NumAPosX, p.PosAX)
+ ui.NumAPosY.Value = ClampToRange(ui.NumAPosY, p.PosAY)
+ ui.NumBPosX.Value = ClampToRange(ui.NumBPosX, p.PosBX)
+ ui.NumBPosY.Value = ClampToRange(ui.NumBPosY, p.PosBY)
+
+ ui.RadRunning.Checked = (p.ScaleMode = ProbeScaleMode.Running)
+ ui.RadFull.Checked = (p.ScaleMode = ProbeScaleMode.Full)
+ ui.ChkAutoX.Checked = p.AutoScaleX
+ ui.ChkAutoY.Checked = p.AutoScaleY
+ ui.TxtMinY.Text = p.YMin.ToString("G6", CultureInfo.InvariantCulture)
+ ui.TxtMaxY.Text = p.YMax.ToString("G6", CultureInfo.InvariantCulture)
+ ui.ChkStartAfter.Checked = p.UseStartAfterStep
+ ui.TxtStartAfter.Text = p.StartAfterStep.ToString(CultureInfo.InvariantCulture)
+ ui.NumRunningWindow.Value = ClampToRange(ui.NumRunningWindow, p.RunningWindow)
+ Finally
+ _loadingProbe = False
+ End Try
+
+ UpdateProbeControlState(ui)
+ InvalidateProbePictures()
+ End Sub
+
+ ''' <summary>The measurements that fit the picture: only the amplitude on the field, intensity and integrated intensity on the intensity.</summary>
+ Private Sub FillMeasurementCombo(ui As ProbeControlSet, p As ProbeSettings)
+ ui.CmbMeasurement.Items.Clear()
+ If p.PlaceOn = ProbePlaceOn.Field Then
+ ui.CmbMeasurement.Items.Add("Amplitude")
+ ui.CmbMeasurement.SelectedIndex = 0
+ Else
+ ui.CmbMeasurement.Items.Add("Intensity")
+ ui.CmbMeasurement.Items.Add("Integrated intensity")
+ ui.CmbMeasurement.SelectedIndex = If(p.Measurement = ProbeMeasurement.IntegratedIntensity, 1, 0)
+ End If
+ End Sub
+
+ Private Shared Function MeasurementFromIndex(placeOn As ProbePlaceOn, index As Integer) As ProbeMeasurement
+ If placeOn = ProbePlaceOn.Field Then Return ProbeMeasurement.Amplitude
+ Return If(index = 1, ProbeMeasurement.IntegratedIntensity, ProbeMeasurement.Intensity)
+ End Function
+
+ ''' <summary>
+ ''' Position B is only used by a line; with a point only position A is available. The step axis (running or full
+ ''' scale, automatic X, running window) is only used by a point: the X axis of a line is the line itself. The
+ ''' manual Y range boxes are only usable when the Y axis is not scaled automatically, and the "start after step"
+ ''' box only when that is ticked.
+ ''' </summary>
+ Private Sub UpdateProbeControlState(ui As ProbeControlSet)
+ Dim isLine As Boolean = (_probes(ui.Index).Kind = ProbeKind.Line)
+ For Each c As Control In ui.BOnlyControls
+ c.Enabled = isLine
+ Next
+ For Each c As Control In New Control() {ui.RadRunning, ui.RadFull, ui.ChkAutoX, ui.NumRunningWindow}
+ c.Enabled = Not isLine
+ Next
+ ui.TxtMinY.Enabled = Not ui.ChkAutoY.Checked
+ ui.TxtMaxY.Enabled = Not ui.ChkAutoY.Checked
+ ui.TxtStartAfter.Enabled = ui.ChkStartAfter.Checked
+ End Sub
+
+ ''' <summary>The positions of both probes can be as large as the canvas of the scene (when that is known).</summary>
+ Private Sub SetProbeRanges()
+ If _probeUi Is Nothing Then Return
+ For Each ui As ProbeControlSet In _probeUi
+ SetProbeRanges(ui)
+ Next
+ End Sub
+
+ ''' <summary>The positions of one probe can be as large as the canvas of the scene (when that is known).</summary>
+ Private Sub SetProbeRanges(ui As ProbeControlSet)
+ Dim canvas As Size = EffectiveCanvas()
+ Dim maxX As Decimal = CDec(If(canvas.Width > 0, canvas.Width - 1, SceneSettings.MaxCanvasSize - 1))
+ Dim maxY As Decimal = CDec(If(canvas.Height > 0, canvas.Height - 1, SceneSettings.MaxCanvasSize - 1))
+
+ Dim wasLoading As Boolean = _loadingProbe
+ _loadingProbe = True
+ Try
+ ui.NumAPosX.Maximum = maxX
+ ui.NumBPosX.Maximum = maxX
+ ui.NumAPosY.Maximum = maxY
+ ui.NumBPosY.Maximum = maxY
+ Finally
+ _loadingProbe = wasLoading
+ End Try
+ End Sub
+
+ ''' <summary>Takes the values from one probe's controls into that probe.</summary>
+ Private Sub ReadProbeControls(ui As ProbeControlSet)
+ Dim p As ProbeSettings = _probes(ui.Index)
+
+ p.Active = ui.ChkOn.Checked
+ If ui.CmbPlaceOn.SelectedIndex >= 0 Then p.PlaceOn = CType(ui.CmbPlaceOn.SelectedIndex, ProbePlaceOn)
+ If ui.CmbMeasurement.SelectedIndex >= 0 Then p.Measurement = MeasurementFromIndex(p.PlaceOn, ui.CmbMeasurement.SelectedIndex)
+ If ui.CmbProbeType.SelectedIndex >= 0 Then p.Kind = CType(ui.CmbProbeType.SelectedIndex, ProbeKind)
+ If ui.CmbBoxSize.SelectedIndex >= 0 Then p.BoxSize = CType(ui.CmbBoxSize.SelectedIndex, ProbeBoxSize)
+
+ ui.NumAPosX.Validate()
+ ui.NumAPosY.Validate()
+ ui.NumBPosX.Validate()
+ ui.NumBPosY.Validate()
+ p.PosAX = CInt(ui.NumAPosX.Value)
+ p.PosAY = CInt(ui.NumAPosY.Value)
+ p.PosBX = CInt(ui.NumBPosX.Value)
+ p.PosBY = CInt(ui.NumBPosY.Value)
+
+ p.ScaleMode = If(ui.RadFull.Checked, ProbeScaleMode.Full, ProbeScaleMode.Running)
+ p.AutoScaleX = ui.ChkAutoX.Checked
+ p.AutoScaleY = ui.ChkAutoY.Checked
+
+ If Not ui.ChkAutoY.Checked Then
+ Dim yMin As Double
+ Dim yMax As Double
+ If Double.TryParse(ui.TxtMinY.Text, NumberStyles.Float, CultureInfo.InvariantCulture, yMin) Then p.YMin = yMin
+ If Double.TryParse(ui.TxtMaxY.Text, NumberStyles.Float, CultureInfo.InvariantCulture, yMax) Then p.YMax = yMax
+ End If
+
+ p.UseStartAfterStep = ui.ChkStartAfter.Checked
+ Dim startStep As Integer
+ If Integer.TryParse(ui.TxtStartAfter.Text, NumberStyles.Integer, CultureInfo.InvariantCulture, startStep) Then p.StartAfterStep = startStep
+
+ ui.NumRunningWindow.Validate()
+ p.RunningWindow = CInt(ui.NumRunningWindow.Value)
+
+ p.Normalize()
+ End Sub
+
+ ' ---------------------------------------------------------------- events of the controls (Probe 1)
+
+ Private Sub ProbeCombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbPlaceOn.SelectedIndexChanged,
+ cmbMeasurement.SelectedIndexChanged, cmbProbeType.SelectedIndexChanged, cmbBoxSize.SelectedIndexChanged
+ HandleProbeComboChanged(ProbeUi(0), sender)
+ End Sub
+
+ Private Sub ProbePosition_ValueChanged(sender As Object, e As EventArgs) Handles numAPosX.ValueChanged, numAPosY.ValueChanged,
+ numBPosX.ValueChanged, numBPosY.ValueChanged
+ HandleProbePositionChanged(ProbeUi(0))
+ End Sub
+
+ Private Sub ProbeOn_CheckedChanged(sender As Object, e As EventArgs) Handles chkProbeOn1.CheckedChanged
+ HandleProbeOnChanged(ProbeUi(0))
+ End Sub
+
+ Private Sub ProbeTextBox_KeyDown(sender As Object, e As KeyEventArgs) Handles txtMinScaleY.KeyDown, txtMaxScaleY.KeyDown,
+ txtStartAfterStep.KeyDown
+ HandleProbeTextBoxKeyDown(ProbeUi(0), e)
+ End Sub
+
+ Private Sub ProbeScaleMode_CheckedChanged(sender As Object, e As EventArgs) Handles radRunningScale.CheckedChanged, radFullScale.CheckedChanged
+ HandleProbeScaleModeChanged(ProbeUi(0))
+ End Sub
+
+ Private Sub ProbeAutoScale_CheckedChanged(sender As Object, e As EventArgs) Handles chkAutoScaleX.CheckedChanged, chkAutoScaleY.CheckedChanged
+ HandleProbeAutoScaleChanged(ProbeUi(0))
+ End Sub
+
+ Private Sub ProbeYRange_Validated(sender As Object, e As EventArgs) Handles txtMinScaleY.Validated, txtMaxScaleY.Validated
+ HandleProbeControlApplied(ProbeUi(0))
+ End Sub
+
+ Private Sub ProbeStartAfterStep_CheckedChanged(sender As Object, e As EventArgs) Handles chkStartAfterStep.CheckedChanged
+ HandleProbeStartAfterStepChanged(ProbeUi(0))
+ End Sub
+
+ Private Sub ProbeStartAfterStep_Validated(sender As Object, e As EventArgs) Handles txtStartAfterStep.Validated
+ HandleProbeControlApplied(ProbeUi(0))
+ End Sub
+
+ Private Sub ProbeRunningWindow_ValueChanged(sender As Object, e As EventArgs) Handles numRunningWindow.ValueChanged
+ HandleProbeControlApplied(ProbeUi(0))
+ End Sub
+
+ ' ---------------------------------------------------------------- events of the controls (Probe 2), same handling as Probe 1
+
+ Private Sub ProbeCombo2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbPlaceOn2.SelectedIndexChanged,
+ cmbMeasurement2.SelectedIndexChanged, cmbProbeType2.SelectedIndexChanged, cmbBoxSize2.SelectedIndexChanged
+ HandleProbeComboChanged(ProbeUi(1), sender)
+ End Sub
+
+ Private Sub ProbePosition2_ValueChanged(sender As Object, e As EventArgs) Handles numAPosX2.ValueChanged, numAPosY2.ValueChanged,
+ numBPosX2.ValueChanged, numBPosY2.ValueChanged
+ HandleProbePositionChanged(ProbeUi(1))
+ End Sub
+
+ Private Sub ProbeOn2_CheckedChanged(sender As Object, e As EventArgs) Handles chkProbeOn2.CheckedChanged
+ HandleProbeOnChanged(ProbeUi(1))
+ End Sub
+
+ Private Sub ProbeTextBox2_KeyDown(sender As Object, e As KeyEventArgs) Handles txtMinScaleY2.KeyDown, txtMaxScaleY2.KeyDown,
+ txtStartAfterStep2.KeyDown
+ HandleProbeTextBoxKeyDown(ProbeUi(1), e)
+ End Sub
+
+ Private Sub ProbeScaleMode2_CheckedChanged(sender As Object, e As EventArgs) Handles radRunningScale2.CheckedChanged, radFullScale2.CheckedChanged
+ HandleProbeScaleModeChanged(ProbeUi(1))
+ End Sub
+
+ Private Sub ProbeAutoScale2_CheckedChanged(sender As Object, e As EventArgs) Handles chkAutoScaleX2.CheckedChanged, chkAutoScaleY2.CheckedChanged
+ HandleProbeAutoScaleChanged(ProbeUi(1))
+ End Sub
+
+ Private Sub ProbeYRange2_Validated(sender As Object, e As EventArgs) Handles txtMinScaleY2.Validated, txtMaxScaleY2.Validated
+ HandleProbeControlApplied(ProbeUi(1))
+ End Sub
+
+ Private Sub ProbeStartAfterStep2_CheckedChanged(sender As Object, e As EventArgs) Handles chkStartAfterStep2.CheckedChanged
+ HandleProbeStartAfterStepChanged(ProbeUi(1))
+ End Sub
+
+ Private Sub ProbeStartAfterStep2_Validated(sender As Object, e As EventArgs) Handles txtStartAfterStep2.Validated
+ HandleProbeControlApplied(ProbeUi(1))
+ End Sub
+
+ Private Sub ProbeRunningWindow2_ValueChanged(sender As Object, e As EventArgs) Handles numRunningWindow2.ValueChanged
+ HandleProbeControlApplied(ProbeUi(1))
+ End Sub
+
+ ' ---------------------------------------------------------------- shared handling of one probe (given its control set)
+
+ Private Sub HandleProbeComboChanged(ui As ProbeControlSet, sender As Object)
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ If sender Is ui.CmbProbeType AndAlso _pickStep <> 0 AndAlso _pickIndex = ui.Index Then EndPick() ' the number of clicks depends on the type; only cancel a pick that belongs to this probe
+
+ If sender Is ui.CmbPlaceOn AndAlso ui.CmbPlaceOn.SelectedIndex >= 0 Then
+ ' the measurements that are possible depend on the picture
+ Dim p As ProbeSettings = _probes(ui.Index)
+ p.PlaceOn = CType(ui.CmbPlaceOn.SelectedIndex, ProbePlaceOn)
+ p.Normalize()
+ _loadingProbe = True
+ Try
+ FillMeasurementCombo(ui, p)
+ Finally
+ _loadingProbe = False
+ End Try
+ End If
+
+ ReadProbeControls(ui)
+ UpdateProbeControlState(ui)
+ ProbeSettingsChanged()
+ End Sub
+
+ Private Sub HandleProbePositionChanged(ui As ProbeControlSet)
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ Dim p As ProbeSettings = _probes(ui.Index)
+ p.PosAX = CInt(ui.NumAPosX.Value)
+ p.PosAY = CInt(ui.NumAPosY.Value)
+ p.PosBX = CInt(ui.NumBPosX.Value)
+ p.PosBY = CInt(ui.NumBPosY.Value)
+ ProbeSettingsChanged()
+ End Sub
+
+ Private Sub HandleProbeOnChanged(ui As ProbeControlSet)
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ _probes(ui.Index).Active = ui.ChkOn.Checked
+ ProbeSettingsChanged()
+ End Sub
+
+ ''' <summary>
+ ''' Enter in a probe text box applies the value right away (like losing focus does), instead of just beeping;
+ ''' these are single line boxes, so Enter never inserts an actual line break.
+ ''' </summary>
+ Private Sub HandleProbeTextBoxKeyDown(ui As ProbeControlSet, e As KeyEventArgs)
+ If e.KeyCode <> Keys.Enter Then Return
+ e.SuppressKeyPress = True
+ e.Handled = True
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ ReadProbeControls(ui)
+ ProbeSettingsChanged()
+ End Sub
+
+ Private Sub HandleProbeScaleModeChanged(ui As ProbeControlSet)
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ _probes(ui.Index).ScaleMode = If(ui.RadFull.Checked, ProbeScaleMode.Full, ProbeScaleMode.Running)
+ ProbeSettingsChanged()
+ End Sub
+
+ Private Sub HandleProbeAutoScaleChanged(ui As ProbeControlSet)
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ Dim p As ProbeSettings = _probes(ui.Index)
+ Dim wasAutoY As Boolean = p.AutoScaleY
+ p.AutoScaleX = ui.ChkAutoX.Checked
+ p.AutoScaleY = ui.ChkAutoY.Checked
+
+ ' switching the automatic value axis off keeps the range that is shown now, ready to fine-tune by hand
+ If wasAutoY AndAlso Not p.AutoScaleY Then
+ FreezeValueRange(ui, p)
+ _loadingProbe = True
+ Try
+ ui.TxtMinY.Text = p.YMin.ToString("G6", CultureInfo.InvariantCulture)
+ ui.TxtMaxY.Text = p.YMax.ToString("G6", CultureInfo.InvariantCulture)
+ Finally
+ _loadingProbe = False
+ End Try
+ End If
+ UpdateProbeControlState(ui)
+ ProbeSettingsChanged()
+ End Sub
+
+ ''' <summary>The shared tail of the Validated/ValueChanged handlers: re-read this probe's controls and mark the change.</summary>
+ Private Sub HandleProbeControlApplied(ui As ProbeControlSet)
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ ReadProbeControls(ui)
+ ProbeSettingsChanged()
+ End Sub
+
+ Private Sub HandleProbeStartAfterStepChanged(ui As ProbeControlSet)
+ If ui Is Nothing OrElse _loadingProbe Then Return
+ _probes(ui.Index).UseStartAfterStep = ui.ChkStartAfter.Checked
+ UpdateProbeControlState(ui)
+ ProbeSettingsChanged()
+ End Sub
+
+ ''' <summary>Makes the current value range of the graph the fixed range.</summary>
+ Private Sub FreezeValueRange(ui As ProbeControlSet, p As ProbeSettings)
+ Dim i As Integer = ui.Index
+ If _probeTraces.Count <= i OrElse _runProbes Is Nothing OrElse _runProbes.Count <= i Then Return
+ If _runProbes(i).Kind <> p.Kind Then Return
+
+ Dim trace As ProbeTrace = _probeTraces(i)
+ If p.Kind = ProbeKind.Line Then
+ ' a line probe shows nothing at all before the start step: nothing to freeze
+ If p.UseStartAfterStep AndAlso trace.StepsSampled < p.StartAfterStep Then Return
+ If trace.Profile Is Nothing Then Return
+ ElseIf trace.Series.Count = 0 Then
+ Return
+ End If
+
+ Dim automatic As ProbeSettings = p.Clone()
+ automatic.AutoScaleY = True
+ Dim x0, x1, y0, y1 As Double
+ ProbeGraphPainter.ComputeRanges(automatic, trace, _runSteps, x0, x1, y0, y1)
+ If y1 > y0 Then
+ p.YMin = y0
+ p.YMax = y1
+ End If
+ End Sub
+
+ Private Sub ProbeSettingsChanged()
+ MarkProjectChanged()
+ InvalidateProbePictures()
+ End Sub
+
+ Private Sub InvalidateProbePictures()
+ If _picProbe IsNot Nothing Then _picProbe.Invalidate()
+ If _picField IsNot Nothing Then _picField.Invalidate()
+ If _picIntensity IsNot Nothing Then _picIntensity.Invalidate()
+ End Sub
+
+ Private Sub ProbeTabChanged(sender As Object, e As EventArgs) Handles tabMainFunctions.SelectedIndexChanged
+ EndPick()
+ SetProbeRanges()
+ If tabMainFunctions.SelectedTab Is tabProbeList Then
+ AutoLoadSceneImageIfEmpty(_picProbe)
+ End If
+ End Sub
+
+ ' ---------------------------------------------------------------- picking positions in the picture
+
+ Private Sub butPicPositions_Click(sender As Object, e As EventArgs) Handles butPicPositions.Click
+ StartOrCancelPick(ProbeUi(0))
+ End Sub
+
+ Private Sub butPicPositions2_Click(sender As Object, e As EventArgs) Handles butPicPositions2.Click
+ StartOrCancelPick(ProbeUi(1))
+ End Sub
+
+ ''' <summary>Pressing a group's own Pick button while it is already picking cancels it; pressing it while the
+ ''' other probe is being picked cancels that one and starts picking this probe instead.</summary>
+ Private Sub StartOrCancelPick(ui As ProbeControlSet)
+ If ui Is Nothing Then Return
+ Dim wasPickingThis As Boolean = (_pickStep <> 0 AndAlso _pickIndex = ui.Index)
+ EndPick()
+ If Not wasPickingThis Then StartPick(ui)
+ End Sub
+
+ ''' <summary>
+ ''' When there is no picture yet to pick from (no simulation has run), makes a plain black one at the canvas size
+ ''' that the Configuration tab currently specifies (the scene image's size, or the user defined width/height), so
+ ''' a probe position can still be picked before ever running a simulation. Replaced by the real picture as soon as
+ ''' one is copied over from the Preview tab.
+ ''' </summary>
+ Private Sub EnsureProbePicture()
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 OrElse canvas.Height <= 0 Then Return
+
+ Dim placeholder As New Bitmap(canvas.Width, canvas.Height)
+ Using g As Graphics = Graphics.FromImage(placeholder)
+ g.Clear(Color.Black)
+ End Using
+ _picProbe.Image = placeholder
+ End Sub
+
+ Private Sub StartPick(ui As ProbeControlSet)
+ If _picProbe.Image Is Nothing Then EnsureProbePicture()
+ If _picProbe.Image Is Nothing Then
+ MessageBox.Show(Me, "There is no picture to pick from yet, and the canvas size is not known either" & vbCrLf &
+ "(choose a scene image, or a user defined width and height, on the Configuration tab first).",
+ "Probe positions", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ _pickIndex = ui.Index
+ _pickStep = 1
+ _pickHover = Nothing
+ _picProbe.Cursor = Cursors.Cross
+ ui.ButPick.Text = "Cancel"
+ ShowPickInstruction()
+ End Sub
+
+ Private Sub ShowPickInstruction()
+ Dim ui As ProbeControlSet = _probeUi(_pickIndex)
+ Select Case _pickStep
+ Case 1
+ ToolStripStatusLabel1.Text = If(_probes(_pickIndex).Kind = ProbeKind.Line,
+ ui.Title & ": click in the picture for position A, the start of the line (press Cancel to stop picking).",
+ ui.Title & ": click in the picture for the position of the probe (press Cancel to stop picking).")
+ Case 2
+ ToolStripStatusLabel1.Text = ui.Title & ": click in the picture for position B, the end of the line."
+ Case 3
+ ToolStripStatusLabel1.Text = ui.Title & ": click in the picture for the top left corner of the graph box."
+ Case Else
+ ToolStripStatusLabel1.Text = ""
+ End Select
+ End Sub
+
+ Private Sub EndPick()
+ Dim wasPicking As Boolean = (_pickStep <> 0)
+ If wasPicking Then _probeUi(_pickIndex).ButPick.Text = _probeUi(_pickIndex).PickButtonText
+ _pickStep = 0
+ _pickHover = Nothing
+ If _picProbe IsNot Nothing Then
+ _picProbe.Cursor = Cursors.Default
+ _picProbe.Invalidate()
+ End If
+ If wasPicking Then ToolStripStatusLabel1.Text = ""
+ End Sub
+
+ Private Sub ProbePicture_MouseClick(sender As Object, e As MouseEventArgs)
+ If _pickStep = 0 OrElse e.Button <> MouseButtons.Left Then Return
+ Dim ui As ProbeControlSet = _probeUi(_pickIndex)
+
+ Dim x As Integer
+ Dim y As Integer
+ If Not TryPictureToCanvas(_picProbe, e.Location, x, y) Then Return
+
+ Select Case _pickStep
+ Case 1
+ ui.NumAPosX.Value = ClampToRange(ui.NumAPosX, x)
+ ui.NumAPosY.Value = ClampToRange(ui.NumAPosY, y)
+ _pickStep = If(_probes(_pickIndex).Kind = ProbeKind.Line, 2, 3)
+ ShowPickInstruction()
+ Case 2
+ ui.NumBPosX.Value = ClampToRange(ui.NumBPosX, x)
+ ui.NumBPosY.Value = ClampToRange(ui.NumBPosY, y)
+ _pickStep = 3
+ ShowPickInstruction()
+ Case Else
+ _probes(_pickIndex).BoxX = x
+ _probes(_pickIndex).BoxY = y
+ ProbeSettingsChanged()
+ EndPick()
+ ToolStripStatusLabel1.Text = ""
+ End Select
+ _picProbe.Invalidate()
+ End Sub
+
+ ''' <summary>While the corner of the graph box is picked, the box follows the mouse.</summary>
+ Private Sub ProbePicture_MouseMove(sender As Object, e As MouseEventArgs)
+ If _pickStep <> 3 Then Return
+ _pickHover = e.Location
+ _picProbe.Invalidate()
+ End Sub
+
+ Private Sub ProbePicture_MouseLeave(sender As Object, e As EventArgs)
+ If _pickHover.HasValue Then
+ _pickHover = Nothing
+ _picProbe.Invalidate()
+ End If
+ End Sub
+
+ ''' <summary>The simulation pixel that is under a point of a picture box; False when the point is outside the picture.</summary>
+ Private Function TryPictureToCanvas(box As PictureBox, point As Point, ByRef x As Integer, ByRef y As Integer) As Boolean
+ If box.Image Is Nothing Then Return False
+
+ Dim area As RectangleF = ZoomedImageRectangle(box)
+ If area.Width <= 0 OrElse area.Height <= 0 OrElse Not area.Contains(point.X, point.Y) Then Return False
+
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 Then canvas = box.Image.Size
+
+ x = CInt(Math.Floor((point.X - area.X) / area.Width * canvas.Width))
+ y = CInt(Math.Floor((point.Y - area.Y) / area.Height * canvas.Height))
+ x = Math.Max(0, Math.Min(canvas.Width - 1, x))
+ y = Math.Max(0, Math.Min(canvas.Height - 1, y))
+ Return True
+ End Function
+
+ ''' <summary>The rectangle (in the client area of the picture box) in which the picture is shown (SizeMode Zoom).</summary>
+ Private Shared Function ZoomedImageRectangle(box As PictureBox) As RectangleF
+ Dim img As Image = box.Image
+ If img Is Nothing OrElse img.Width <= 0 OrElse img.Height <= 0 Then Return RectangleF.Empty
+
+ Dim cw As Single = box.ClientSize.Width
+ Dim ch As Single = box.ClientSize.Height
+ Dim scale As Single = Math.Min(cw / img.Width, ch / img.Height)
+ Dim w As Single = img.Width * scale
+ Dim h As Single = img.Height * scale
+ Return New RectangleF((cw - w) / 2.0F, (ch - h) / 2.0F, w, h)
+ End Function
+
+ ''' <summary>A rectangle in scene pixels on the screen: the picture is shown in area, the scene has canvas pixels.</summary>
+ Private Shared Function ToScreen(r As Rectangle, area As RectangleF, sx As Single, sy As Single) As Rectangle
+ Return New Rectangle(CInt(Math.Round(area.X + r.X * sx)), CInt(Math.Round(area.Y + r.Y * sy)),
+ CInt(Math.Round(r.Width * sx)), CInt(Math.Round(r.Height * sy)))
+ End Function
+
+ ' ---------------------------------------------------------------- drawing over the pictures
+
+ ''' <summary>The markers and graphs of the run over the field or intensity picture of the Preview tab.</summary>
+ Private Sub PreviewPicture_Paint(sender As Object, e As PaintEventArgs)
+ Dim box As PictureBox = DirectCast(sender, PictureBox)
+ If box.Image Is Nothing OrElse _runProbes Is Nothing OrElse _runCanvas.Width <= 0 Then Return
+
+ Dim place As ProbePlaceOn = If(box Is _picField, ProbePlaceOn.Field, ProbePlaceOn.Intensity)
+ Dim area As RectangleF = ZoomedImageRectangle(box)
+ If area.Width <= 0 Then Return
+ Dim sx As Single = area.Width / _runCanvas.Width
+ Dim sy As Single = area.Height / _runCanvas.Height
+
+ For i As Integer = 0 To _runProbes.Count - 1
+ ' what is measured comes from the run; how the graph looks can be changed while it runs
+ Dim probe As ProbeSettings = _runProbes(i).Clone()
+ If i < _probes.Count Then probe.CopyDisplayFrom(_probes(i))
+ If probe.PlaceOn <> place OrElse Not probe.Active Then Continue For
+
+ ProbeGraphPainter.DrawMarkers(e.Graphics, probe, i, area.X, area.Y, sx, sy)
+
+ Dim trace As ProbeTrace = Nothing
+ If i < _probeTraces.Count Then trace = _probeTraces(i)
+ Dim rect As Rectangle = ToScreen(ProbeGraphPainter.BoxInCanvas(probe, _runCanvas.Width, _runCanvas.Height), area, sx, sy)
+ ProbeGraphPainter.DrawGraph(e.Graphics, rect, probe.Title(i), probe, trace, _runSteps)
+ Next
+ End Sub
+
+ ''' <summary>The markers of both probes, and the graph box outline of whichever one is being edited or positioned, over
+ ''' the picture on the Probes tab. A switched off probe ("On" unchecked) is hidden here too - the only exception is
+ ''' while you are actively picking its position or graph box, so you can still see what you are placing.</summary>
+ Private Sub ProbePicture_Paint(sender As Object, e As PaintEventArgs)
+ If _picProbe.Image Is Nothing Then Return
+
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 Then canvas = _picProbe.Image.Size
+ Dim area As RectangleF = ZoomedImageRectangle(_picProbe)
+ If area.Width <= 0 Then Return
+ Dim sx As Single = area.Width / canvas.Width
+ Dim sy As Single = area.Height / canvas.Height
+
+ For i As Integer = 0 To _probes.Count - 1
+ Dim probe As ProbeSettings = _probes(i)
+ Dim isBeingPicked As Boolean = (_pickStep <> 0 AndAlso _pickIndex = i)
+ If Not probe.Active AndAlso Not isBeingPicked Then Continue For
+
+ ProbeGraphPainter.DrawMarkers(e.Graphics, probe, i, area.X, area.Y, sx, sy)
+
+ ' while the corner of this probe's box is being picked, the box follows the mouse
+ Dim shown As ProbeSettings = probe
+ If _pickStep = 3 AndAlso _pickIndex = i AndAlso _pickHover.HasValue Then
+ Dim cx As Integer
+ Dim cy As Integer
+ If TryPictureToCanvas(_picProbe, _pickHover.Value, cx, cy) Then
+ shown = probe.Clone()
+ shown.BoxX = cx
+ shown.BoxY = cy
+ End If
+ End If
+
+ Dim rect As Rectangle = ToScreen(ProbeGraphPainter.BoxInCanvas(shown, canvas.Width, canvas.Height), area, sx, sy)
+ Using fill As New SolidBrush(Color.FromArgb(40, 255, 208, 64))
+ e.Graphics.FillRectangle(fill, rect)
+ End Using
+ Using pen As New Pen(Color.FromArgb(230, 255, 208, 64), 1.5F)
+ pen.DashStyle = DashStyle.Dash
+ e.Graphics.DrawRectangle(pen, rect)
+ End Using
+ Using font As New Font("Segoe UI", 12.0F, FontStyle.Bold, GraphicsUnit.Pixel)
+ Using brush As New SolidBrush(Color.FromArgb(240, 255, 208, 64))
+ e.Graphics.DrawString(probe.Title(i), font, brush, rect.X + 4, rect.Y + 3)
+ End Using
+ End Using
+ Next
+ End Sub
+
+ ' ---------------------------------------------------------------- probes in a simulation run
+
+ Private Sub LoadProbesFromProject()
+ If _project Is Nothing Then Return
+ _probes = ProbeSettings.ListFromConfig(_project.Config)
+ NormalizeProbeCount()
+ ShowProbesInControls()
+ End Sub
+
+ Private Sub ResetProbes()
+ _probes = NewProbeList()
+ ShowProbesInControls()
+ End Sub
+
+ ''' <summary>Copies of the probes for a run.</summary>
+ Private Function ProbesForRun() As List(Of ProbeSettings)
+ For Each ui As ProbeControlSet In _probeUi
+ ReadProbeControls(ui)
+ Next
+ Dim list As New List(Of ProbeSettings)()
+ For Each p As ProbeSettings In _probes
+ list.Add(p.Clone())
+ Next
+ Return list
+ End Function
+
+ ''' <summary>A run starts: the graphs start empty.</summary>
+ Private Sub BeginProbeRun(probes As List(Of ProbeSettings), canvas As Size, steps As Integer)
+ _runProbes = probes
+ _runCanvas = canvas
+ _runSteps = steps
+
+ _probeTraces.Clear()
+ If probes IsNot Nothing Then
+ For i As Integer = 0 To probes.Count - 1
+ _probeTraces.Add(New ProbeTrace())
+ Next
+ End If
+ InvalidateProbePictures()
+ End Sub
+
+ ''' <summary>New values of the probes arrive from the running simulation.</summary>
+ Private Sub ShowProbeSamples(runner As SimulationRunner, update As ProbeUpdate)
+ If runner IsNot _runner OrElse IsDisposed Then Return
+
+ For i As Integer = 0 To Math.Min(update.Samples.Length, _probeTraces.Count) - 1
+ _probeTraces(i).Series.Add(update.Samples(i))
+ If update.Profiles(i) IsNot Nothing Then _probeTraces(i).SetProfile(update.Profiles(i), update.Lengths(i))
+ _probeTraces(i).StepsSampled = update.StepsDone
+ Next
+ If _picField IsNot Nothing Then _picField.Invalidate()
+ If _picIntensity IsNot Nothing Then _picIntensity.Invalidate()
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Form1.Source.vb b/2D_wave_sim_V01/Form1.Source.vb
new file mode 100644
index 0000000..0914e1b
--- /dev/null
+++ b/2D_wave_sim_V01/Form1.Source.vb
@@ -0,0 +1,913 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Drawing
+Imports System.Globalization
+
+' ------------------------------------------------------------------ object sources (Sources tab)
+'
+' An object source is a point (or, for a composite source, an X-Y array of points) that drives the field directly,
+' as opposed to the image-derived sources (the green channel of the scene image). Unlike an image source it has its
+' own frequency, amplitude and phase, and it can be continuous or pulsed (on for a number of cycles, then off for a
+' number of cycles). A composite source is a set of point sources built from the same base ("single source")
+' parameters, optionally randomized per element.
+'
+' Editing a source is a two step process:
+' 1. txtName/cmbMainType/grpSingleSource/grpComposite describe the source; the position is typed or picked with
+' the Pick button in the picture (a copy of a Preview tab picture, "Copy Image to probe and source tab"). A
+' freshly created source has no position yet (SourceSettings.HasPosition is False) - the picture shows no
+' marker for it until one is picked or typed, so an unpositioned source is never mistaken for one at (0, 0)
+' or wherever the numeric fields default to.
+' 2. "Save source" resolves those parameters - for a composite source, including a fresh random draw when
+' "Inherit + randomize" is chosen - into a fixed list of point-source elements (_editing.Elements), then adds
+' the result to lstSources (a new source) or updates the selected one. Only saved sources are used in a
+' simulation (when "Use object sources" is ticked in the scene properties) - the engine always runs the
+' already-generated element list, never re-randomizing, so a run is reproducible.
+' Selecting a source in lstSources loads it straight into the editor (there is no separate Edit step/button).
+' New and Copy load a (blank, respectively copied) source into the editor and clear the list selection; neither
+' touches lstSources itself until Save is pressed, which adds or updates the entry.
+Partial Public Class Form1
+
+ ' the sources of the project
+ Private _sources As New List(Of SourceSettings)()
+
+ ' the source currently shown in the editor: -1 while creating a new one (New or Copy), otherwise its index in _sources
+ Private _currentSourceIndex As Integer = -1
+
+ ' the source being built in the editor; GenerateElements fills _editing.Elements, SaveSource commits it to _sources
+ Private _editing As New SourceSettings()
+
+ ' True while the code itself fills the editor controls (their change events are then ignored)
+ Private _loadingSource As Boolean
+
+ ' True while the list is being rebuilt, or its selection set, by code rather than by the user clicking in it -
+ ' so lstSources_SelectedIndexChanged does not reload the editor for that (see RefreshSourceList)
+ Private _syncingSourceList As Boolean
+
+ ' True while waiting for a click in the picture for the source position
+ Private _sourcePicking As Boolean
+ Private _pickSourceButtonText As String = "Pick"
+
+ Private ReadOnly _sourceRandom As New Random()
+
+ ' btnSaveSource's own Designer BackColor, captured once at startup so ClearSourceDirty can restore exactly that
+ ' (rather than a hardcoded color) once the pending changes it warns about are saved
+ Private _sourceSaveButtonDefaultBackColor As Color
+
+ ' ---------------------------------------------------------------- setting up
+
+ Private Sub InitializeSourceControls()
+ _pickSourceButtonText = btnPickSourcePosition.Text
+ _sourceSaveButtonDefaultBackColor = btnSaveSource.BackColor
+ WireSourceDirtyTracking(grpSourceDetails)
+
+ numSourcePositionX.DecimalPlaces = 0
+ numSourcePositionX.Minimum = 0D
+ numSourcePositionX.Maximum = CDec(SceneSettings.MaxCanvasSize - 1)
+ numSourcePositionY.DecimalPlaces = 0
+ numSourcePositionY.Minimum = 0D
+ numSourcePositionY.Maximum = CDec(SceneSettings.MaxCanvasSize - 1)
+
+ ' Minimum (1) and Maximum (999) are both odd, and Increment is 2, so the up/down spinner buttons can only
+ ' ever land on an odd array size - see ArraySize_Validating for what catches an even value typed in
+ ' directly (the spinner can't produce one, but the keyboard can).
+ numArraySizeX.DecimalPlaces = 0
+ numArraySizeX.Minimum = 1D
+ numArraySizeX.Maximum = 999D
+ numArraySizeX.Increment = 2D
+ numArraySizeY.DecimalPlaces = 0
+ numArraySizeY.Minimum = 1D
+ numArraySizeY.Maximum = 999D
+ numArraySizeY.Increment = 2D
+
+ numSpacingSizeX.DecimalPlaces = 0
+ numSpacingSizeX.Minimum = 0D
+ numSpacingSizeX.Maximum = CDec(SceneSettings.MaxCanvasSize)
+ numSpacingSizeY.DecimalPlaces = 0
+ numSpacingSizeY.Minimum = 0D
+ numSpacingSizeY.Maximum = CDec(SceneSettings.MaxCanvasSize)
+
+ numAmplitude.DecimalPlaces = 0
+ numPulseWidthCycles.DecimalPlaces = 0
+ If numPulseWidthCycles.Minimum < 1D Then numPulseWidthCycles.Minimum = 1D
+ If numPulseWidthCycles.Maximum < 100D Then numPulseWidthCycles.Maximum = 1000000D
+ numOffStateCycles.DecimalPlaces = 0
+ numRandomizeFrequency.DecimalPlaces = 0
+ numRandomizeOffWidth.DecimalPlaces = 0
+ numRandomizePosition.DecimalPlaces = 0
+ NumRandomizePhase.DecimalPlaces = 0
+
+ AddHandler _picSource.Paint, AddressOf SourcePicture_Paint
+ AddHandler _picSource.MouseClick, AddressOf SourcePicture_MouseClick
+
+ ' owner-drawn so a switched-off source (chkSourceOn unchecked) can be shown greyed out in the list -
+ ' it stays fully selectable, only its text color changes (see lstSources_DrawItem)
+ lstSources.DrawMode = DrawMode.OwnerDrawFixed
+
+ RefreshSourceList()
+ ShowSourceInControls(_editing)
+ ClearSourceDirty()
+ UpdateListButtonState()
+ End Sub
+
+ ''' <summary>Loads the project's sources and shows the first one (if any) selected and loaded into the editor,
+ ''' rather than always starting the editor on a blank "new source" template - so opening a project that already
+ ''' has sources shows one of them, not a to-be-inserted one. "First" is whichever GenerateElements/save order the
+ ''' list is in; there is no separate "last edited" tracking kept across a save/reload to prefer instead.</summary>
+ Private Sub LoadSourcesFromProject()
+ If _project Is Nothing Then Return
+ _sources = SourceSettings.ListFromConfig(_project.Config)
+ If _sources.Count > 0 Then
+ _currentSourceIndex = 0
+ _editing = _sources(0).Clone()
+ Else
+ _currentSourceIndex = -1
+ _editing = New SourceSettings()
+ End If
+ RefreshSourceList()
+ _syncingSourceList = True
+ Try
+ lstSources.SelectedIndex = _currentSourceIndex
+ Finally
+ _syncingSourceList = False
+ End Try
+ ShowSourceInControls(_editing)
+ ClearSourceDirty()
+ UpdateListButtonState()
+ End Sub
+
+ Private Sub ResetSources()
+ _sources = New List(Of SourceSettings)()
+ _currentSourceIndex = -1
+ _editing = New SourceSettings()
+ RefreshSourceList()
+ If _picSource IsNot Nothing Then
+ ShowSourceInControls(_editing)
+ ClearSourceDirty()
+ End If
+ UpdateListButtonState()
+ End Sub
+
+ ''' <summary>The elements of every saved source, for a simulation run; Nothing when object sources are switched off or there are none.</summary>
+ Private Function SourcesForRun() As List(Of SourceElement)
+ If _scene Is Nothing OrElse Not _scene.UseObjectSources OrElse _sources.Count = 0 Then Return Nothing
+
+ Dim result As New List(Of SourceElement)()
+ For Each s As SourceSettings In _sources
+ ' switched off (chkSourceOn unchecked): keep the source and its parameters, just leave it out of the
+ ' run entirely, so it neither drives the field nor gets in the way of waves passing through it
+ If Not s.SourceOn Then Continue For
+ If s.Elements Is Nothing OrElse s.Elements.Count = 0 Then
+ ' a source saved before it was ever generated (should not normally happen) - generate it now, once
+ s.GenerateElements(_sourceRandom)
+ End If
+ result.AddRange(s.Elements)
+ Next
+ Return result
+ End Function
+
+ ' ---------------------------------------------------------------- the list
+
+ Private Sub RefreshSourceList()
+ Dim selected As Integer = lstSources.SelectedIndex
+ _syncingSourceList = True
+ Try
+ lstSources.Items.Clear()
+ For Each s As SourceSettings In _sources
+ lstSources.Items.Add(SourceListText(s))
+ Next
+ If selected >= 0 AndAlso selected < lstSources.Items.Count Then lstSources.SelectedIndex = selected
+ Finally
+ _syncingSourceList = False
+ End Try
+ End Sub
+
+ Private Shared Function SourceListText(s As SourceSettings) As String
+ If s.MainType = SourceMainType.Composite Then
+ Return s.Name & " (composite, " & s.ArraySizeX.ToString(CultureInfo.InvariantCulture) & " x " &
+ s.ArraySizeY.ToString(CultureInfo.InvariantCulture) & ")"
+ End If
+ Return s.Name & " (single)"
+ End Function
+
+ ''' <summary>Draws a switched-off source (chkSourceOn unchecked) greyed out; it stays fully selectable, only the
+ ''' text color changes, so the selection highlight still shows normally.</summary>
+ Private Sub lstSources_DrawItem(sender As Object, e As DrawItemEventArgs) Handles lstSources.DrawItem
+ If e.Index < 0 OrElse e.Index >= lstSources.Items.Count Then Return
+ e.DrawBackground()
+
+ Dim isOff As Boolean = (e.Index < _sources.Count AndAlso Not _sources(e.Index).SourceOn)
+ Dim textColor As Color = If(isOff, Color.Gray, e.ForeColor)
+
+ Using brush As New SolidBrush(textColor)
+ e.Graphics.DrawString(lstSources.Items(e.Index).ToString(), e.Font, brush, e.Bounds)
+ End Using
+ e.DrawFocusRectangle()
+ End Sub
+
+ ''' <summary>Selecting a source loads it straight into the editor; clearing the selection (New/Copy, or the
+ ''' list becoming empty) shows a blank/default source instead. Programmatic selection changes (RefreshSourceList,
+ ''' btnSaveSource_Click) set _syncingSourceList first so they do not re-trigger this.</summary>
+ Private Sub lstSources_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstSources.SelectedIndexChanged
+ UpdateListButtonState()
+ If _syncingSourceList Then Return
+
+ EndSourcePick()
+ If lstSources.SelectedIndex < 0 Then
+ _currentSourceIndex = -1
+ _editing = New SourceSettings()
+ Else
+ _currentSourceIndex = lstSources.SelectedIndex
+ _editing = _sources(_currentSourceIndex).Clone()
+ End If
+ ShowSourceInControls(_editing)
+ ClearSourceDirty()
+ If _picSource IsNot Nothing Then _picSource.Invalidate()
+ picPreviewSource.Invalidate()
+ ToolStripStatusLabel1.Text = If(_currentSourceIndex >= 0,
+ "Editing '" & _editing.Name & "': press Save source to keep the changes.",
+ "")
+ End Sub
+
+ Private Sub UpdateListButtonState()
+ Dim hasSelection As Boolean = (lstSources.SelectedIndex >= 0)
+ btnCopy.Enabled = hasSelection
+ btnDelete.Enabled = hasSelection
+ End Sub
+
+ Private Sub btnNew_Click(sender As Object, e As EventArgs) Handles btnNew.Click
+ EndSourcePick()
+ _syncingSourceList = True
+ Try
+ lstSources.SelectedIndex = -1
+ Finally
+ _syncingSourceList = False
+ End Try
+ _currentSourceIndex = -1
+ _editing = New SourceSettings()
+ _editing.Name = "Source " & (_sources.Count + 1).ToString(CultureInfo.InvariantCulture)
+ ShowSourceInControls(_editing)
+ MarkSourceDirty() ' not saved yet - pressing Save source is what actually adds it
+ UpdateListButtonState()
+ If _picSource IsNot Nothing Then _picSource.Invalidate()
+ picPreviewSource.Invalidate()
+ ToolStripStatusLabel1.Text = "New source: fill in its properties, then press Save source."
+ txtName.Focus()
+ txtName.SelectAll()
+ End Sub
+
+ Private Sub btnCopy_Click(sender As Object, e As EventArgs) Handles btnCopy.Click
+ If lstSources.SelectedIndex < 0 Then Return
+ EndSourcePick()
+ Dim sourceName As String = _sources(lstSources.SelectedIndex).Name
+ _editing = _sources(lstSources.SelectedIndex).Clone()
+ _editing.Name = _editing.Name & " copy"
+ _syncingSourceList = True
+ Try
+ lstSources.SelectedIndex = -1
+ Finally
+ _syncingSourceList = False
+ End Try
+ _currentSourceIndex = -1
+ ShowSourceInControls(_editing)
+ MarkSourceDirty() ' not saved yet - pressing Save source is what actually adds it
+ UpdateListButtonState()
+ If _picSource IsNot Nothing Then _picSource.Invalidate()
+ picPreviewSource.Invalidate()
+ ToolStripStatusLabel1.Text = "Copy of '" & sourceName & "': change it and press Save source to add it as a new source."
+ txtName.Focus()
+ txtName.SelectAll()
+ End Sub
+
+ Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
+ If lstSources.SelectedIndex < 0 Then Return
+ Dim index As Integer = lstSources.SelectedIndex
+ Dim name As String = _sources(index).Name
+ Dim answer As DialogResult = MessageBox.Show(Me, "Delete the source '" & name & "'?", "Delete source",
+ MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return
+
+ _sources.RemoveAt(index)
+ If _currentSourceIndex = index Then
+ _currentSourceIndex = -1
+ _editing = New SourceSettings()
+ ShowSourceInControls(_editing)
+ ClearSourceDirty()
+ ElseIf _currentSourceIndex > index Then
+ _currentSourceIndex -= 1
+ End If
+ RefreshSourceList()
+ UpdateListButtonState()
+ MarkProjectChanged()
+ If _picSource IsNot Nothing Then _picSource.Invalidate()
+ picPreviewSource.Invalidate()
+ ToolStripStatusLabel1.Text = "Source '" & name & "' deleted."
+ End Sub
+
+ Private Sub btnSaveSource_Click(sender As Object, e As EventArgs) Handles btnSaveSource.Click
+ CommitSourceEdits()
+ End Sub
+
+ ''' <summary>
+ ''' Reads the editor into _editing, (re)generates its elements and writes the result back to _sources - updating
+ ''' the entry at _currentSourceIndex when one is selected, or adding a new entry otherwise - then clears the
+ ''' "unsaved changes" indicator on btnSaveSource. Shared by "Save source" itself and by completing a position
+ ''' pick for an already-selected source (see SourcePicture_MouseClick/EndSourcePick), so picking a new position
+ ''' for an existing source is never left stale until a separate press of Save source. Returns False (without
+ ''' committing anything) when the source has no name yet, same as "Save source" always required.
+ ''' </summary>
+ Private Function CommitSourceEdits() As Boolean
+ ReadSourceControls(_editing)
+ If _editing.Name.Trim().Length = 0 Then
+ MessageBox.Show(Me, "Give the source a name first.", "Save source", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ txtName.Focus()
+ Return False
+ End If
+
+ ' always (re)generate the elements from the current editor values, so a changed position (or any other
+ ' parameter) is never left stale in a source that already had elements from an earlier generate/save
+ _editing.GenerateElements(_sourceRandom)
+
+ If _currentSourceIndex >= 0 AndAlso _currentSourceIndex < _sources.Count Then
+ _sources(_currentSourceIndex) = _editing
+ Else
+ _sources.Add(_editing)
+ _currentSourceIndex = _sources.Count - 1
+ End If
+
+ RefreshSourceList()
+ _syncingSourceList = True
+ Try
+ lstSources.SelectedIndex = _currentSourceIndex
+ Finally
+ _syncingSourceList = False
+ End Try
+ UpdateListButtonState()
+ MarkProjectChanged()
+ If _picSource IsNot Nothing Then _picSource.Invalidate()
+ picPreviewSource.Invalidate()
+ ToolStripStatusLabel1.Text = "Source '" & _editing.Name & "' saved (" & _editing.Elements.Count.ToString(CultureInfo.InvariantCulture) & " element(s))."
+
+ ' the editor keeps editing the source that was just saved, so pressing Save again updates it in place
+ _editing = _editing.Clone()
+ ClearSourceDirty()
+ Return True
+ End Function
+
+ ' ---------------------------------------------------------------- the editor
+
+ ''' <summary>Copies a source's values into the editor controls.</summary>
+ Private Sub ShowSourceInControls(s As SourceSettings)
+ s.Normalize()
+ _loadingSource = True
+ Try
+ txtName.Text = s.Name
+ cmbMainType.SelectedIndex = CInt(s.MainType)
+ chkSourceOn.Checked = s.SourceOn
+ chkDetachSource.Checked = s.DetachSource
+ txtDetachAfterSteps.Text = s.DetachAfterSteps.ToString(CultureInfo.InvariantCulture)
+ numSourcePositionX.Value = ClampToRange(numSourcePositionX, s.PosX)
+ numSourcePositionY.Value = ClampToRange(numSourcePositionY, s.PosY)
+
+ numFrequency.Value = ClampToRange(numFrequency, s.Frequency)
+ numAmplitude.Value = ClampToRange(numAmplitude, s.Amplitude)
+ numPhase.Value = ClampToRange(numPhase, s.PhaseDeg)
+ radModePulsed.Checked = (s.Mode = SourceMode.Pulsed)
+ radModeContinuous.Checked = (s.Mode = SourceMode.Continuous)
+ cmbPulseShape.SelectedIndex = CInt(s.PulseShape)
+ numPulseWidthCycles.Value = ClampToRange(numPulseWidthCycles, s.PulseWidthCycles)
+ numOffStateCycles.Value = ClampToRange(numOffStateCycles, s.OffStateCycles)
+
+ numArraySizeX.Value = ClampToRange(numArraySizeX, s.ArraySizeX)
+ numArraySizeY.Value = ClampToRange(numArraySizeY, s.ArraySizeY)
+ numSpacingSizeX.Value = ClampToRange(numSpacingSizeX, s.SpacingX)
+ numSpacingSizeY.Value = ClampToRange(numSpacingSizeY, s.SpacingY)
+
+ ' the three "amount" fields below are clamped against the just-loaded values above (see
+ ' UpdateRandomizeLimits) - called explicitly here rather than relying only on the ValueChanged handler
+ ' further down, since a value that happens to equal what a control already shows does not raise that event
+ UpdateRandomizeLimits()
+
+ cmbCompositeProperties.SelectedIndex = CInt(s.CompositeMode)
+ chkRandomizeFrequency.Checked = s.RandomizeFrequency
+ numRandomizeFrequency.Value = ClampToRange(numRandomizeFrequency, s.RandomizeFrequencyAmount)
+ chkRandomizePhase.Checked = s.RandomizePhase
+ NumRandomizePhase.Value = ClampToRange(NumRandomizePhase, s.RandomizePhaseAmount)
+ chkOffWidth.Checked = s.RandomizeOffWidth
+ numRandomizeOffWidth.Value = ClampToRange(numRandomizeOffWidth, s.RandomizeOffWidthAmount)
+ chkRandomizePosition.Checked = s.RandomizePosition
+ numRandomizePosition.Value = ClampToRange(numRandomizePosition, s.RandomizePositionAmount)
+ Finally
+ _loadingSource = False
+ End Try
+
+ UpdateSourceControlState()
+ UpdateLambdaLabel()
+ End Sub
+
+ ' ---------------------------------------------------------------- unsaved-changes indicator (btnSaveSource)
+
+ ''' <summary>
+ ''' Wires every input control inside grpSourceDetails - recursively, since it nests grpSingleSource and
+ ''' grpComposite - to MarkSourceDirty, so any change the user makes to a source's properties there turns
+ ''' btnSaveSource orange until the change is saved (see MarkSourceDirty/ClearSourceDirty). Called once, from
+ ''' InitializeSourceControls. The source's position (numSourcePositionX/Y, in grpPlaceSource, not grpSourceDetails)
+ ''' is deliberately not included here: picking or typing a position is committed through its own path instead
+ ''' (SourcePicture_MouseClick/SourcePosition_ValueChanged).
+ ''' </summary>
+ Private Sub WireSourceDirtyTracking(container As Control)
+ For Each child As Control In container.Controls
+ If TypeOf child Is TextBox Then
+ AddHandler DirectCast(child, TextBox).TextChanged, AddressOf SourceDetail_Changed
+ ElseIf TypeOf child Is NumericUpDown Then
+ AddHandler DirectCast(child, NumericUpDown).ValueChanged, AddressOf SourceDetail_Changed
+ ElseIf TypeOf child Is CheckBox Then
+ AddHandler DirectCast(child, CheckBox).CheckedChanged, AddressOf SourceDetail_Changed
+ ElseIf TypeOf child Is RadioButton Then
+ AddHandler DirectCast(child, RadioButton).CheckedChanged, AddressOf SourceDetail_Changed
+ ElseIf TypeOf child Is ComboBox Then
+ AddHandler DirectCast(child, ComboBox).SelectedIndexChanged, AddressOf SourceDetail_Changed
+ End If
+
+ If child.HasChildren Then WireSourceDirtyTracking(child)
+ Next
+ End Sub
+
+ ''' <summary>Common handler for every control wired by WireSourceDirtyTracking. Ignored while the code itself is
+ ''' filling the controls (ShowSourceInControls sets _loadingSource first), so only an actual user edit counts.</summary>
+ Private Sub SourceDetail_Changed(sender As Object, e As EventArgs)
+ If _loadingSource Then Return
+ MarkSourceDirty()
+ End Sub
+
+ ''' <summary>Flags that grpSourceDetails has changes not yet saved to the selected (or not yet added) source.</summary>
+ Private Sub MarkSourceDirty()
+ btnSaveSource.BackColor = Color.Orange
+ End Sub
+
+ ''' <summary>Restores btnSaveSource to its own Designer color, once its pending changes are saved (or discarded
+ ''' by loading a different/blank source into the editor).</summary>
+ Private Sub ClearSourceDirty()
+ btnSaveSource.BackColor = _sourceSaveButtonDefaultBackColor
+ End Sub
+
+ ''' <summary>Reads the editor controls into a source.</summary>
+ Private Sub ReadSourceControls(target As SourceSettings)
+ target.Name = txtName.Text.Trim()
+ target.MainType = If(cmbMainType.SelectedIndex = 1, SourceMainType.Composite, SourceMainType.Simple)
+ target.SourceOn = chkSourceOn.Checked
+ target.DetachSource = chkDetachSource.Checked
+ Dim detachAfter As Integer
+ If Integer.TryParse(txtDetachAfterSteps.Text.Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, detachAfter) AndAlso detachAfter >= 0 Then
+ target.DetachAfterSteps = detachAfter
+ End If
+ target.PosX = CInt(numSourcePositionX.Value)
+ target.PosY = CInt(numSourcePositionY.Value)
+
+ target.Frequency = CInt(numFrequency.Value)
+ target.Amplitude = CInt(numAmplitude.Value)
+ target.PhaseDeg = CInt(numPhase.Value)
+ target.Mode = If(radModePulsed.Checked, SourceMode.Pulsed, SourceMode.Continuous)
+ target.PulseShape = If(cmbPulseShape.SelectedIndex = 1, SourcePulseShape.SmoothedSquare, SourcePulseShape.Gaussian)
+ target.PulseWidthCycles = CInt(numPulseWidthCycles.Value)
+ target.OffStateCycles = CInt(numOffStateCycles.Value)
+
+ target.ArraySizeX = CInt(numArraySizeX.Value)
+ target.ArraySizeY = CInt(numArraySizeY.Value)
+ target.SpacingX = CInt(numSpacingSizeX.Value)
+ target.SpacingY = CInt(numSpacingSizeY.Value)
+ target.CompositeMode = If(cmbCompositeProperties.SelectedIndex = 1, SourceCompositeMode.InheritAndRandomize, SourceCompositeMode.InheritFromSingle)
+ target.RandomizeFrequency = chkRandomizeFrequency.Checked
+ target.RandomizeFrequencyAmount = CInt(numRandomizeFrequency.Value)
+ target.RandomizePhase = chkRandomizePhase.Checked
+ target.RandomizePhaseAmount = CInt(NumRandomizePhase.Value)
+ target.RandomizeOffWidth = chkOffWidth.Checked
+ target.RandomizeOffWidthAmount = CInt(numRandomizeOffWidth.Value)
+ target.RandomizePosition = chkRandomizePosition.Checked
+ target.RandomizePositionAmount = CInt(numRandomizePosition.Value)
+ target.Normalize()
+ End Sub
+
+ ''' <summary>Enables the controls that apply to the chosen main type / mode / composite mode.</summary>
+ Private Sub UpdateSourceControlState()
+ Dim isComposite As Boolean = (cmbMainType.SelectedIndex = 1)
+ grpComposite.Enabled = isComposite
+
+ Dim isPulsed As Boolean = radModePulsed.Checked
+ cmbPulseShape.Enabled = isPulsed
+ numPulseWidthCycles.Enabled = isPulsed
+ numOffStateCycles.Enabled = isPulsed
+
+ txtDetachAfterSteps.Enabled = chkDetachSource.Checked
+
+ Dim randomizeOn As Boolean = isComposite AndAlso (cmbCompositeProperties.SelectedIndex = 1)
+ cmbCompositeProperties.Enabled = isComposite
+ numArraySizeX.Enabled = isComposite
+ numArraySizeY.Enabled = isComposite
+ numSpacingSizeX.Enabled = isComposite
+ numSpacingSizeY.Enabled = isComposite
+
+ chkRandomizeFrequency.Enabled = randomizeOn
+ chkRandomizePhase.Enabled = randomizeOn
+ chkOffWidth.Enabled = randomizeOn
+ chkRandomizePosition.Enabled = randomizeOn
+ numRandomizeFrequency.Enabled = randomizeOn AndAlso chkRandomizeFrequency.Checked
+ NumRandomizePhase.Enabled = randomizeOn AndAlso chkRandomizePhase.Checked
+ numRandomizeOffWidth.Enabled = randomizeOn AndAlso chkOffWidth.Checked
+ numRandomizePosition.Enabled = randomizeOn AndAlso chkRandomizePosition.Checked
+ End Sub
+
+ Private Sub SourceMainType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbMainType.SelectedIndexChanged, cmbCompositeProperties.SelectedIndexChanged
+ If _loadingSource Then Return
+ UpdateSourceControlState()
+ End Sub
+
+ Private Sub SourceMode_CheckedChanged(sender As Object, e As EventArgs) Handles radModePulsed.CheckedChanged, radModeContinuous.CheckedChanged
+ If _loadingSource Then Return
+ UpdateSourceControlState()
+ End Sub
+
+ ''' <summary>Keeps lblLambdaIs in sync with numFrequency - not guarded by _loadingSource, since it must also
+ ''' refresh when a source is loaded into the editor (ShowSourceInControls), not only on a user edit.</summary>
+ Private Sub SourceFrequency_ValueChanged(sender As Object, e As EventArgs) Handles numFrequency.ValueChanged
+ UpdateLambdaLabel()
+ End Sub
+
+ ''' <summary>
+ ''' Shows an estimated wavelength for the current numFrequency value in lblLambdaIs, as "λ=xx,x px" (using the
+ ''' current culture's decimal separator). lambda = c / f: f is the cyclic frequency (cycles/step) that a
+ ''' source's Level (1-255, the numFrequency control) maps to via SourceFrequencyScale - the same formula the
+ ''' engine itself uses (WaveSimulator/GpuWaveSimulator: level/255*0.5*SourceFrequencyScale is the *angular*
+ ''' frequency in rad/step, so dividing by 2*pi gives cycles/step) - and c is the propagation speed set via
+ ''' File > Set c-value (SimulationSettings.WaveSpeedC), in simulation pixels per step. This is only ever an
+ ''' estimate/display value: the real per-pixel wave speed the simulation actually uses comes from the scene's
+ ''' refractive index instead (see SceneData.C2) and is not necessarily uniform.
+ ''' </summary>
+ Private Sub UpdateLambdaLabel()
+ If lblLambdaIs Is Nothing Then Return
+
+ Dim level As Integer = CInt(numFrequency.Value)
+ Dim scale As Double = If(_simulation IsNot Nothing, _simulation.SourceFrequencyScale, 2.0)
+ Dim omega As Double = level / 255.0 * 0.5 * scale
+ Dim cyclesPerStep As Double = omega / (2.0 * Math.PI)
+
+ If cyclesPerStep <= 0.0 Then
+ lblLambdaIs.Text = "λ= - px"
+ Return
+ End If
+
+ Dim c As Double = If(_simulation IsNot Nothing, _simulation.WaveSpeedC, 0.563)
+ Dim lambda As Double = c / cyclesPerStep
+ ' the current culture's own decimal separator (a comma in nl-NL, for instance), not a fixed "."
+ lblLambdaIs.Text = "λ=" & lambda.ToString("0.0", CultureInfo.CurrentCulture) & " px"
+ End Sub
+
+ Private Sub SourceDetach_CheckedChanged(sender As Object, e As EventArgs) Handles chkDetachSource.CheckedChanged
+ If _loadingSource Then Return
+ UpdateSourceControlState()
+ End Sub
+
+ Private Sub SourceRandomizeCheck_CheckedChanged(sender As Object, e As EventArgs) Handles chkRandomizeFrequency.CheckedChanged,
+ chkRandomizePhase.CheckedChanged, chkOffWidth.CheckedChanged, chkRandomizePosition.CheckedChanged
+ If _loadingSource Then Return
+ UpdateSourceControlState()
+ End Sub
+
+ ''' <summary>Keeps the three randomize "amount" fields' Maximum in step with the single-source values they are
+ ''' added to (see UpdateRandomizeLimits) whenever one of those values changes - not guarded by _loadingSource,
+ ''' since ShowSourceInControls also relies on this to be current before it sets the amount fields' Value
+ ''' (though it additionally calls UpdateRandomizeLimits directly itself, since a value that happens to already
+ ''' match a control's current Value does not raise ValueChanged).</summary>
+ Private Sub SourceRandomizeLimitInput_ValueChanged(sender As Object, e As EventArgs) Handles numFrequency.ValueChanged,
+ numOffStateCycles.ValueChanged, numArraySizeX.ValueChanged, numArraySizeY.ValueChanged,
+ numSpacingSizeX.ValueChanged, numSpacingSizeY.ValueChanged
+ UpdateRandomizeLimits()
+ End Sub
+
+ ''' <summary>
+ ''' Caps how large a "randomize amount" can be set to, so GenerateElements' Vinherited +/- amount (SourceSettings)
+ ''' can never be forced to clip against a hard limit and so end up biased instead of a true symmetric spread:
+ ''' - frequency (numRandomizeFrequency): the source's Level must stay within 1-255, so the amount cannot
+ ''' exceed the smaller of (Frequency - 1) and (255 - Frequency).
+ ''' - off-width cycles (numRandomizeOffWidth): GenerateElements floors the result at 1 cycle, so the amount
+ ''' cannot exceed (OffStateCycles - 1).
+ ''' - position (numRandomizePosition): position has no natural upper/lower bound the way frequency and
+ ''' off-width do, so instead the amount is capped at half the array's own spacing along whichever axis
+ ''' (or axes) actually separate elements (ArraySizeX/Y > 1) - a randomized element's jitter can then never
+ ''' overshoot as far as a neighboring (unrandomized) grid position. An array that is only one element wide
+ ''' in both directions (ArraySizeX = ArraySizeY = 1, no neighbor to protect against) is left unbounded.
+ ''' Phase (NumRandomizePhase) is not limited here: its result is already clamped to -180..180 in GenerateElements,
+ ''' and since +/-180 degrees is the same angle either way, that clipping does not bias the result the way it
+ ''' would for frequency or off-width.
+ ''' Lowering a Maximum below a field's current Value clamps that Value down to it automatically (standard
+ ''' NumericUpDown behavior), so the amount fields never need to be set here, only their Maximum.
+ ''' </summary>
+ Private Sub UpdateRandomizeLimits()
+ Dim frequency As Integer = CInt(numFrequency.Value)
+ numRandomizeFrequency.Maximum = CDec(Math.Max(0, Math.Min(frequency - 1, 255 - frequency)))
+
+ Dim offWidth As Integer = CInt(numOffStateCycles.Value)
+ numRandomizeOffWidth.Maximum = CDec(Math.Max(0, offWidth - 1))
+
+ Dim cols As Integer = CInt(numArraySizeX.Value)
+ Dim rows As Integer = CInt(numArraySizeY.Value)
+ If cols <= 1 AndAlso rows <= 1 Then
+ numRandomizePosition.Maximum = CDec(SceneSettings.MaxCanvasSize)
+ Else
+ ' the smallest spacing among the axes that actually separate elements (Count > 1), without relying on
+ ' System.Linq (not imported by this file) for a two/one-element Min()
+ Dim relevantSpacing As New List(Of Integer)()
+ If cols > 1 Then relevantSpacing.Add(CInt(numSpacingSizeX.Value))
+ If rows > 1 Then relevantSpacing.Add(CInt(numSpacingSizeY.Value))
+ Dim minSpacing As Integer = relevantSpacing(0)
+ For i As Integer = 1 To relevantSpacing.Count - 1
+ If relevantSpacing(i) < minSpacing Then minSpacing = relevantSpacing(i)
+ Next
+ numRandomizePosition.Maximum = CDec(Math.Max(0, minSpacing \ 2))
+ End If
+ End Sub
+
+ ''' <summary>
+ ''' numArraySizeX/numArraySizeY must stay odd: an even-sized array has its centre between two pixels instead
+ ''' of on one, which (especially at small spacings) places the whole array off-grid in an irregular way. The
+ ''' spinner buttons can never produce an even value (Minimum/Maximum are both odd and Increment is 2 - see
+ ''' InitializeSourceControls), but typing a value directly can, so this catches that on Validating (the point
+ ''' where a typed value is finalized - on Tab/click-away, or on Enter via the global NumericUpDown_KeyDown
+ ''' hook that moves focus off the control) and bumps it up by one, with a warning so the change is not a
+ ''' silent surprise. Not guarded by _loadingSource: Validating only fires from an actual focus change, never
+ ''' from a plain Value assignment in code (e.g. ShowSourceInControls loading a project), so it can only ever
+ ''' be the user's own keyboard entry.
+ ''' </summary>
+ Private Sub ArraySize_Validating(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles numArraySizeX.Validating, numArraySizeY.Validating
+ Dim box As NumericUpDown = DirectCast(sender, NumericUpDown)
+ Dim value As Integer = CInt(box.Value)
+ If value Mod 2 <> 0 Then Return
+
+ Dim corrected As Integer = Math.Min(CInt(box.Maximum), value + 1)
+ box.Value = CDec(corrected)
+ MessageBox.Show(Me, "Use uneven numbers only - the array size has been increased to " &
+ corrected.ToString(CultureInfo.InvariantCulture) & ".",
+ "Array size", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End Sub
+
+ Private Sub SourceTabChanged(sender As Object, e As EventArgs) Handles tabMainFunctions.SelectedIndexChanged
+ EndSourcePick()
+ If tabMainFunctions.SelectedTab Is tabSourceList Then
+ AutoLoadSceneImageIfEmpty(_picSource)
+ SyncSourceListSelectionToEditor()
+ End If
+ End Sub
+
+ ''' <summary>Makes lstSources' highlighted item and grpSourceDetails agree with the source actually loaded in
+ ''' the editor (_editing/_currentSourceIndex - the last source that was selected or edited) whenever the tab
+ ''' is opened. Without this, coming back from another tab could show some list item highlighted (left over
+ ''' from before, or the list's own default) while the detail controls still showed a different source, or one
+ ''' that no longer matched the highlighted entry at all.</summary>
+ Private Sub SyncSourceListSelectionToEditor()
+ _syncingSourceList = True
+ Try
+ If _currentSourceIndex >= 0 AndAlso _currentSourceIndex < lstSources.Items.Count Then
+ lstSources.SelectedIndex = _currentSourceIndex
+ Else
+ lstSources.SelectedIndex = -1
+ End If
+ Finally
+ _syncingSourceList = False
+ End Try
+ ShowSourceInControls(_editing)
+ End Sub
+
+ ' ---------------------------------------------------------------- picking the position in the picture
+
+ Private Sub PickSourcePosition_Click(sender As Object, e As EventArgs) Handles btnPickSourcePosition.Click
+ If _sourcePicking Then
+ EndSourcePick()
+ Else
+ StartSourcePick()
+ End If
+ End Sub
+
+ Private Sub StartSourcePick()
+ If _picSource.Image Is Nothing Then EnsureSourcePicture()
+ If _picSource.Image Is Nothing Then
+ MessageBox.Show(Me, "There is no picture to pick from yet, and the canvas size is not known either" & vbCrLf &
+ "(choose a scene image, or a user defined width and height, on the Configuration tab first).",
+ "Source position", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ _sourcePicking = True
+ _picSource.Cursor = Cursors.Cross
+ btnPickSourcePosition.Text = "Cancel"
+ ToolStripStatusLabel1.Text = "Click in the picture for the position of the source (press Cancel to stop picking)."
+ End Sub
+
+ ''' <summary>
+ ''' When there is no picture yet to pick from (no simulation has run), makes a plain black one at the canvas size
+ ''' that the Configuration tab currently specifies (the scene image's size, or the user defined width/height), so
+ ''' a source position can still be picked before ever running a simulation. Replaced by the real picture as soon
+ ''' as one is copied over from the Preview tab.
+ ''' </summary>
+ Private Sub EnsureSourcePicture()
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 OrElse canvas.Height <= 0 Then Return
+
+ Dim placeholder As New Bitmap(canvas.Width, canvas.Height)
+ Using g As Graphics = Graphics.FromImage(placeholder)
+ g.Clear(Color.Black)
+ End Using
+ _picSource.Image = placeholder
+ End Sub
+
+ Private Sub EndSourcePick()
+ If Not _sourcePicking Then Return
+ _sourcePicking = False
+ btnPickSourcePosition.Text = _pickSourceButtonText
+ If _picSource IsNot Nothing Then _picSource.Cursor = Cursors.Default
+ ToolStripStatusLabel1.Text = ""
+ End Sub
+
+ Private Sub SourcePicture_MouseClick(sender As Object, e As MouseEventArgs)
+ If Not _sourcePicking OrElse e.Button <> MouseButtons.Left Then Return
+
+ Dim x As Integer
+ Dim y As Integer
+ If Not TryPictureToCanvas(_picSource, e.Location, x, y) Then Return
+
+ numSourcePositionX.Value = ClampToRange(numSourcePositionX, x)
+ numSourcePositionY.Value = ClampToRange(numSourcePositionY, y)
+ ' SourcePosition_ValueChanged (below) updates _editing and invalidates the picture even when the values above
+ ' did not actually change (e.g. clicking back on the same pixel), so do it here too, explicitly
+ If Not _loadingSource Then
+ _editing.PosX = x
+ _editing.PosY = y
+ _editing.HasPosition = True
+ _picSource.Invalidate()
+ End If
+ EndSourcePick()
+
+ ' picking a position for a source that is already in the list commits the editor's current data (the
+ ' picked position and anything else changed since the last save) straight to it, the same as pressing Save
+ ' source - so the pick is never left stale waiting for a separate save. A brand new/copied source (not
+ ' selected in the list yet) is left as before: still just a live, unsaved position until Save source is
+ ' pressed, since adding it here could otherwise silently add an incomplete/unnamed source to the list.
+ If _currentSourceIndex >= 0 Then CommitSourceEdits()
+ End Sub
+
+ ''' <summary>Keeps the live marker in the picture in sync while typing a new position, same as picking one does.</summary>
+ Private Sub SourcePosition_ValueChanged(sender As Object, e As EventArgs) Handles numSourcePositionX.ValueChanged, numSourcePositionY.ValueChanged
+ If _loadingSource Then Return
+ _editing.PosX = CInt(numSourcePositionX.Value)
+ _editing.PosY = CInt(numSourcePositionY.Value)
+ _editing.HasPosition = True
+ If _picSource IsNot Nothing Then _picSource.Invalidate()
+ End Sub
+
+ ' ---------------------------------------------------------------- drawing over the picture
+
+ ''' <summary>A marker for every saved source, and for the source being edited when it is not saved yet.</summary>
+ Private Sub SourcePicture_Paint(sender As Object, e As PaintEventArgs)
+ If _picSource.Image Is Nothing Then Return
+
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 Then canvas = _picSource.Image.Size
+ Dim area As RectangleF = ZoomedImageRectangle(_picSource)
+ If area.Width <= 0 Then Return
+ Dim sx As Single = area.Width / canvas.Width
+ Dim sy As Single = area.Height / canvas.Height
+
+ For i As Integer = 0 To _sources.Count - 1
+ Dim isCurrent As Boolean = (i = _currentSourceIndex)
+ ' the source being edited is shown at its live (not yet saved) position, so moving it in the picture or
+ ' the X/Y boxes is reflected immediately instead of only after Save source
+ Dim shown As SourceSettings = If(isCurrent, _editing, _sources(i))
+ If shown.HasPosition Then DrawSourceMarker(e.Graphics, shown, area, sx, sy, isCurrent)
+ Next
+
+ ' the source being created or copied (not in _sources yet) is shown too, so its position can be seen while picking -
+ ' but only once it actually has one (Pick or a typed X/Y), never at the unset default
+ If _currentSourceIndex < 0 AndAlso _editing.HasPosition Then DrawSourceMarker(e.Graphics, _editing, area, sx, sy, True)
+ End Sub
+
+ Private Shared Sub DrawSourceMarker(g As Graphics, s As SourceSettings, area As RectangleF, sx As Single, sy As Single, isCurrent As Boolean)
+ Dim color As Color = If(isCurrent, Color.FromArgb(230, 255, 208, 64), Color.FromArgb(200, 64, 180, 255))
+ Dim radius As Single = If(isCurrent, 5.0F, 4.0F)
+
+ Dim px As Single = area.X + s.PosX * sx
+ Dim py As Single = area.Y + s.PosY * sy
+ Using pen As New Pen(color, If(isCurrent, 2.0F, 1.5F))
+ g.DrawEllipse(pen, px - radius, py - radius, radius * 2.0F, radius * 2.0F)
+ g.DrawLine(pen, px - radius - 3.0F, py, px + radius + 3.0F, py)
+ g.DrawLine(pen, px, py - radius - 3.0F, px, py + radius + 3.0F)
+ End Using
+ Using font As New Font("Segoe UI", 11.0F, FontStyle.Bold, GraphicsUnit.Pixel)
+ Using brush As New SolidBrush(color)
+ g.DrawString(s.Name, font, brush, px + radius + 4.0F, py - radius - 2.0F)
+ End Using
+ End Using
+ End Sub
+
+ ' ---------------------------------------------------------------- source configuration preview (picPreviewSource)
+
+ ''' <summary>
+ ''' Shows the layout of the source currently loaded in the editor (_editing) as white dots on a black background.
+ ''' The source picture above is at canvas scale, so a source - especially a composite source's individual
+ ''' elements - can be too small or too close together to make out there. chkAutoRescaleSourceOn (checked by
+ ''' default) picks which of two views this shows instead:
+ ''' - checked: zooms in on just the elements themselves (centered, scaled to fill the box, each shown as a
+ ''' several-pixel dot so it stays visible), so their relative arrangement is always visible regardless of
+ ''' where the source sits on the canvas or how tightly its array is spaced.
+ ''' - unchecked: the true, unscaled size - one simulation pixel is one screen pixel, and each element is drawn
+ ''' as exactly that: a single pixel, the same size it actually is in the simulation - so a composite source's
+ ''' real physical footprint (how many actual simulation pixels its array spans) can be judged directly.
+ ''' Either way it shows _editing.Elements - the last generated list - so it is blank for a brand new/copied
+ ''' source until it is generated by Save source, and otherwise reflects whatever was last saved (or, for the
+ ''' source just saved, just regenerated). Kept in sync by a picPreviewSource.Invalidate() call everywhere
+ ''' _editing/the currently edited source changes (loading a different one, New/Copy/Delete, and Save source) -
+ ''' the same places _picSource.Invalidate() is called for the position marker above - and by
+ ''' chkAutoRescaleSourceOn_CheckedChanged when the view itself is switched.
+ ''' </summary>
+ Private Sub picPreviewSource_Paint(sender As Object, e As PaintEventArgs) Handles picPreviewSource.Paint
+ e.Graphics.Clear(Color.Black)
+
+ Dim elements As List(Of SourceElement) = If(_editing IsNot Nothing, _editing.Elements, Nothing)
+ If elements Is Nothing OrElse elements.Count = 0 Then Return
+
+ Dim minX As Integer = elements(0).PosX
+ Dim maxX As Integer = elements(0).PosX
+ Dim minY As Integer = elements(0).PosY
+ Dim maxY As Integer = elements(0).PosY
+ For Each el As SourceElement In elements
+ If el.PosX < minX Then minX = el.PosX
+ If el.PosX > maxX Then maxX = el.PosX
+ If el.PosY < minY Then minY = el.PosY
+ If el.PosY > maxY Then maxY = el.PosY
+ Next
+
+ Dim boxW As Single = picPreviewSource.ClientSize.Width
+ Dim boxH As Single = picPreviewSource.ClientSize.Height
+ If boxW <= 0.0F OrElse boxH <= 0.0F Then Return
+
+ Dim centerX As Single = (minX + maxX) / 2.0F
+ Dim centerY As Single = (minY + maxY) / 2.0F
+
+ Dim autoRescale As Boolean = (chkAutoRescaleSourceOn Is Nothing) OrElse chkAutoRescaleSourceOn.Checked
+ Dim scale As Single
+ If autoRescale Then
+ ' a single element (or several coinciding at the same spot) has no span to scale to - fall back to a
+ ' fixed half-extent instead of dividing by zero, so it still just shows one dot in the middle of the box
+ Dim halfExtent As Single = Math.Max(maxX - minX, maxY - minY) / 2.0F
+ If halfExtent <= 0.0F Then halfExtent = 1.0F
+
+ Const marginFraction As Single = 0.15F ' keeps outer dots from touching/clipping at the edge of the box
+ Dim usable As Single = Math.Min(boxW, boxH) * (1.0F - 2.0F * marginFraction)
+ scale = usable / (halfExtent * 2.0F)
+ Else
+ scale = 1.0F ' true size: one simulation pixel is one screen pixel
+ End If
+
+ Const dotRadius As Single = 3.0F
+ Using brush As New SolidBrush(Color.White)
+ For Each el As SourceElement In elements
+ Dim px As Single = boxW / 2.0F + (el.PosX - centerX) * scale
+ Dim py As Single = boxH / 2.0F + (el.PosY - centerY) * scale
+ If autoRescale Then
+ e.Graphics.FillEllipse(brush, px - dotRadius, py - dotRadius, dotRadius * 2.0F, dotRadius * 2.0F)
+ Else
+ e.Graphics.FillRectangle(brush, px, py, 1.0F, 1.0F)
+ End If
+ Next
+ End Using
+ End Sub
+
+ ''' <summary>Redraws at the (centered, rescaled) size whenever the box itself is resized - same idea as any other
+ ''' owner-drawn control that scales to its client area.</summary>
+ Private Sub picPreviewSource_SizeChanged(sender As Object, e As EventArgs) Handles picPreviewSource.SizeChanged
+ picPreviewSource.Invalidate()
+ End Sub
+
+ ''' <summary>Switches picPreviewSource between the auto-rescaled and true-size views (see picPreviewSource_Paint).</summary>
+ Private Sub chkAutoRescaleSourceOn_CheckedChanged(sender As Object, e As EventArgs) Handles chkAutoRescaleSourceOn.CheckedChanged
+ picPreviewSource.Invalidate()
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Form1.resx b/2D_wave_sim_V01/Form1.resx
new file mode 100644
index 0000000..0e07e99
--- /dev/null
+++ b/2D_wave_sim_V01/Form1.resx
@@ -0,0 +1,748 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="StatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>132, 17</value>
+ </metadata>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ 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
+</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/2D_wave_sim_V01/Form1.vb b/2D_wave_sim_V01/Form1.vb
new file mode 100644
index 0000000..57e2137
--- /dev/null
+++ b/2D_wave_sim_V01/Form1.vb
@@ -0,0 +1,4339 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Drawing
+Imports System.Drawing.Drawing2D
+Imports System.Drawing.Imaging
+Imports System.Globalization
+Imports System.IO
+Imports System.Runtime.InteropServices
+Imports System.Windows.Forms
+
+Public Class Form1
+
+ ' ------------------------------------------------------------------ state of the ColorScheme tab
+
+ ' all schemes found in the chosen folder
+ Private _schemes As New List(Of ColorScheme)()
+
+ ' the scheme that is being edited (a working copy; Nothing until one has been loaded)
+ Private _current As ColorScheme
+ Private _dirty As Boolean
+
+ ' the scheme that is selected in the list and only previewed (Nothing when no list item is selected)
+ Private _previewScheme As ColorScheme
+
+ ' the stop (0 to ColorScheme.StopCount - 1) that the picker is editing, -1 for none
+ Private _selectedStop As Integer = -1
+
+ ' True while the code itself changes the radio buttons (so their events are ignored)
+ Private _updatingRadios As Boolean
+
+ Private _stopButtons As Button()
+ Private _picker As ColorPickerControl
+ Private ReadOnly _thumbs As New ImageList()
+
+ ' lstAllProjects's current sort (Configuration tab project list): which column, and which direction. Column 0
+ ' is colProjectName, column 1 is colLastEdit. Defaults to "last edited, newest first", per column 1 descending.
+ Private _projectSortColumn As Integer = 1
+ Private _projectSortAscending As Boolean = False
+
+ ' lstAllProjects3's own sort state (Outputs tab) - same idea, kept separate since it is an independent list.
+ Private _outputProjectSortColumn As Integer = 1
+ Private _outputProjectSortAscending As Boolean = False
+
+ ' ListView1's own sort state (color scheme list, tabColorSchemes): which column, and which direction. Column 0
+ ' is the "Scheme" (name) column, column 2 is "Type" (field/intensity); column 1 ("Kind") is not sortable.
+ ' Defaults to "type, then name", ascending - the standard order asked for.
+ Private _schemeSortColumn As Integer = 2
+ Private _schemeSortAscending As Boolean = True
+
+ ' The PictureBox that shows the selected scene/image in pnlPreview (Outputs tab) - built in code in Form1_Load
+ ' the same way _picker is built for Panel2, since pnlPreview is a plain, empty Panel.
+ Private _outputPreviewPic As PictureBox
+
+ ' True while pnlPreview shows a video's thumbnail rather than an actual scene/output image - see
+ ' SetOutputPreviewImage and UpdateShareWithEditorsButton (btnShareWithEditors is disabled for a video, since
+ ' its thumbnail has a different size than the simulation and would not make sense on the Sources/Probes tabs).
+ Private _outputPreviewIsVideo As Boolean
+
+ ' lstScenes/lstImages/lstVideo's own sort state (Outputs tab): which column (0 = name, 1 = created on) and
+ ' which direction, one pair per list since they sort independently. All three default to "created on, newest
+ ' first", per column 1 descending - the same idea as _projectSortColumn/_outputProjectSortColumn above.
+ Private _sceneSortColumn As Integer = 1
+ Private _sceneSortAscending As Boolean = False
+ Private _imageSortColumn As Integer = 1
+ Private _imageSortAscending As Boolean = False
+ Private _videoSortColumn As Integer = 1
+ Private _videoSortAscending As Boolean = False
+
+ ' The ImageList keeps using the bitmaps that were added to it (it re-creates its native image list from
+ ' them, e.g. after Clear or when the ListView on a hidden tab is created). They must therefore stay
+ ' alive until the list is rebuilt or the form is closed, and must not be disposed right after Add.
+ Private ReadOnly _thumbBitmaps As New List(Of Bitmap)()
+
+ Private Const ThumbWidth As Integer = 120
+ Private Const ThumbHeight As Integer = 16
+
+ ' ------------------------------------------------------------------ state of the project
+
+ ' the open project (Nothing when none is open) and the settings of the program itself
+ Private _project As Project
+ Private _settings As New AppSettings()
+
+ ' ------------------------------------------------------------------ form events
+
+ Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+ ' one button per stop, in scale order (Color 1 = first entry ... last button = last entry)
+ _stopButtons = New Button() {btnColor1, btnCOlor2, btnColor3, btnColor4, btnColor5, btnColor6, btnColor7, btnColor8, btnColor9}
+ Debug.Assert(_stopButtons.Length = ColorScheme.StopCount, "The number of Color buttons must equal ColorScheme.StopCount.")
+ For Each btn As Button In _stopButtons
+ btn.UseVisualStyleBackColor = False
+ btn.FlatStyle = FlatStyle.Flat
+ btn.FlatAppearance.BorderSize = 1
+ btn.FlatAppearance.BorderColor = Color.Black
+ Next
+
+ ' scheme list: thumbnail + name, grouped by category
+ _thumbs.ImageSize = New Size(ThumbWidth, ThumbHeight)
+ _thumbs.ColorDepth = ColorDepth.Depth32Bit
+ ListView1.View = View.Details
+ ListView1.FullRowSelect = True
+ ListView1.MultiSelect = False
+ ListView1.HideSelection = False
+ ListView1.HeaderStyle = ColumnHeaderStyle.Clickable
+ ListView1.SmallImageList = _thumbs
+ ListView1.Columns.Clear()
+ ListView1.Columns.Add("Scheme", 250)
+ ListView1.Columns.Add("Kind", 55)
+ ListView1.Columns.Add("Type", 62)
+ UpdateSchemeListSortHeaders()
+
+ ' scheme bar and picker
+ pnlScheme.BorderStyle = BorderStyle.FixedSingle
+ Panel2.BorderStyle = BorderStyle.FixedSingle
+ _picker = New ColorPickerControl()
+ _picker.Dock = DockStyle.Fill
+ Panel2.Controls.Add(_picker)
+ AddHandler _picker.ColorChanged, AddressOf Picker_ColorChanged
+
+ txtCurrentColorScheme.ReadOnly = True
+
+ ' tabMainFunctions: owner-drawn only so a disabled tab's own label can be shown in a lighter gray
+ ' (WinForms does not do this by itself - a disabled TabPage still draws its label at full strength) -
+ ' see tabMainFunctions_DrawItem.
+ tabMainFunctions.DrawMode = TabDrawMode.OwnerDrawFixed
+
+ ' lstAllProjects (Configuration tab project list): sortable by clicking colProjectName/colLastEdit, see
+ ' lstAllProjects_ColumnClick. Show the initial sort direction in the header the same way a click would.
+ UpdateProjectListSortHeaders()
+
+ ' the program's own scheme folder (ColorSchemeList in the project, or next to the exe when deployed)
+ txtSchemeFolder.Text = ColorSchemeStore.FindDefaultFolder()
+ If Directory.Exists(txtSchemeFolder.Text) Then LoadSchemeList()
+
+ RefreshEditorState()
+
+ ' lblInfo (Settings tab): a clickable "hyperlink" style label - see lblInfo_Click for what it shows
+ lblInfo.ForeColor = Color.Blue
+ lblInfo.Cursor = Cursors.Hand
+
+ InitializeSceneControls()
+ InitializeSimulationControls()
+ InitializeProbeControls()
+ InitializeSourceControls()
+
+ ' btnPickRoot must stay clickable even when no project root is known yet (that is the one situation it
+ ' exists for), but the Designer put it inside grpProjects, and WinForms disables an enabled child along
+ ' with a disabled parent - grpProjects.Enabled = False (UpdateProjectAccess, no root) would silently
+ ' swallow its clicks right when they matter most. Move it onto tabConfiguration itself, in the same
+ ' screen position, so it is never caught by that.
+ Dim rootButtonSpot As Point = grpProjects.Location
+ rootButtonSpot.Offset(btnPickRoot.Location)
+ grpProjects.Controls.Remove(btnPickRoot)
+ tabConfiguration.Controls.Add(btnPickRoot)
+ btnPickRoot.Location = rootButtonSpot
+ btnPickRoot.BringToFront()
+
+ InitializeProject()
+ InitializeOutputsTab()
+
+ ' Enter in a NumericUpDown's edit box otherwise just beeps (Windows beeps on an unhandled Enter
+ ' keystroke) and leaves the typed value sitting there uncommitted - HookNumericUpDownEnterKey wires
+ ' every NumericUpDown on the form, wherever it lives, to NumericUpDown_KeyDown instead.
+ HookNumericUpDownEnterKey(Me)
+ End Sub
+
+ ''' <summary>Wires every NumericUpDown found anywhere under root (recursing into GroupBox/TabPage/Panel/...
+ ''' containers) to NumericUpDown_KeyDown, so Enter commits the typed value and moves on instead of beeping.
+ ''' Called once, from Form1_Load, on the whole form - a plain loop over Controls rather than a fixed list, so
+ ''' it also covers any NumericUpDown added later without needing to come back and wire it up by hand.</summary>
+ Private Sub HookNumericUpDownEnterKey(root As Control)
+ For Each child As Control In root.Controls
+ Dim box As NumericUpDown = TryCast(child, NumericUpDown)
+ If box IsNot Nothing Then AddHandler box.KeyDown, AddressOf NumericUpDown_KeyDown
+ If child.HasChildren Then HookNumericUpDownEnterKey(child)
+ Next
+ End Sub
+
+ ''' <summary>Enter in a NumericUpDown: stops the beep (e.SuppressKeyPress - Enter is not a character its
+ ''' edit box accepts, which is what Windows was beeping about) and moves focus on to the next control, the
+ ''' same as Tab would - which also commits whatever was typed, since a NumericUpDown parses/clamps its text
+ ''' on losing focus regardless of how focus was lost.</summary>
+ Private Sub NumericUpDown_KeyDown(sender As Object, e As KeyEventArgs)
+ If e.KeyCode <> Keys.Enter Then Return
+ e.SuppressKeyPress = True
+ e.Handled = True
+ Dim box As Control = TryCast(sender, Control)
+ If box IsNot Nothing Then Me.SelectNextControl(box, True, True, True, True)
+ End Sub
+
+ Private Sub Form1_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
+ ClearPreviews()
+
+ For Each thumb As Bitmap In _thumbBitmaps
+ thumb.Dispose()
+ Next
+ _thumbBitmaps.Clear()
+
+ ReplaceSceneImage(Nothing)
+ DisposeEmptyPreview()
+ ClearOutputPreview()
+ End Sub
+
+ Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
+ If Not ConfirmSaveProject() Then
+ e.Cancel = True
+ Return
+ End If
+
+ If _runner IsNot Nothing Then
+ Dim running As DialogResult = MessageBox.Show(Me, "A simulation is running. Stop it and close the program?",
+ "Simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
+ If running <> DialogResult.Yes Then
+ e.Cancel = True
+ Return
+ End If
+ ' the runner closes the video files before it ends
+ _runner.Cancel()
+ _runner.WaitForExit(15000)
+ End If
+
+ If _dirty Then
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "The current color scheme has unsaved changes. Close anyway?",
+ "Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then e.Cancel = True
+ End If
+ End Sub
+
+ ' ------------------------------------------------------------------ project name and folder
+ '
+ ' A project is a folder inside the root folder; the folder name is the project name (txtProjectName).
+ ' The main folder of a project holds configuration.json and the standard subfolders (see ProjectStore).
+ '
+ ' The settings on the tabs are kept in memory and only written to configuration.json by "Save project"
+ ' and "Save as". _project is Nothing for a new project that has not been saved yet.
+
+ ' True when there are changes that are not saved in configuration.json
+ Private _projectDirty As Boolean
+
+ ' btnPickRoot (grpProjects) blinks light blue, slowly, while no project root is known yet - e.g. right after
+ ' installing on a different computer, when AppSettings.ProjectRoot is still empty and nothing on the Sources/
+ ' Probes/Viewer tabs works yet. UpdateProjectAccess starts/stops this alongside the rest of the "has a root"
+ ' state; RootBlinkTimer_Tick does the actual blinking.
+ Private WithEvents _rootBlinkTimer As New Timer() With {.Interval = 700}
+ Private _rootBlinkOn As Boolean
+
+ ''' <summary>Enables/disables everything that depends on a project root being chosen and/or an actual, named
+ ''' project being the current one. grpProjects and the Outputs tab (its own project list, not necessarily the
+ ''' one that is open) only need a root. The scene/simulation groups, the Sources/Probes/Viewer tabs, most of
+ ''' "Quick navigate to" (all but btnGotoConfiguration, which jumps to the always-available Configuration tab),
+ ''' "Simulation Control", "Share with source / probe" and Save all need a real project. The Configuration tab
+ ''' (where the root and the project list themselves live) and the color scheme tab manage the application's
+ ''' own settings, not a project's, so they are never restricted. Disabling
+ ''' a TabPage here is not enough by itself to keep the user out of it - see tabMainFunctions_Selecting, which
+ ''' refuses to switch to a disabled tab at all instead of just showing its (disabled) contents.</summary>
+ Private Sub UpdateProjectAccess()
+ Dim hasRoot As Boolean = _settings.ProjectRoot.Length > 0
+ Dim hasProject As Boolean = _project IsNot Nothing
+
+ grpProjects.Enabled = hasRoot
+ tabOutput.Enabled = hasRoot
+
+ ' btnPickRoot (moved onto tabConfiguration itself in Form1_Load, so grpProjects.Enabled above cannot
+ ' disable it) blinks light blue, slowly, for exactly the situation it exists for: no project root known
+ ' yet - a fresh install on another computer, before AppSettings.ProjectRoot is set and everything else
+ ' on screen is still disabled.
+ If hasRoot Then
+ _rootBlinkTimer.Stop()
+ _rootBlinkOn = False
+ btnPickRoot.UseVisualStyleBackColor = True
+ Else
+ _rootBlinkTimer.Start()
+ End If
+
+ grpSceneProperties.Enabled = hasProject
+ grpSimulationSettings.Enabled = hasProject
+ tabSourceList.Enabled = hasProject
+ tabProbeList.Enabled = hasProject
+ tabViewer.Enabled = hasProject
+
+ ' grpNavigateTabs itself stays enabled: btnGotoConfiguration jumps to the always-available Configuration
+ ' tab, so only the other three "quick navigate" buttons need a real project.
+ btnGotoPreview.Enabled = hasProject
+ btnGotoProbes.Enabled = hasProject
+ btnGotoSources.Enabled = hasProject
+
+ grpSimulationControlButtons.Enabled = hasProject
+ grpShareImage.Enabled = hasProject
+ btnSaveConfiguration.Enabled = hasProject
+ btnSaveConfiguration2.Enabled = hasProject
+ btnSaveAs.Enabled = hasProject
+ btnDescription.Enabled = hasProject
+
+ ' Changing a TabPage's Enabled does not by itself repaint the tab strip, so a label's color
+ ' (tabMainFunctions_DrawItem) would otherwise stay stuck at its old, disabled gray until something
+ ' unrelated forced a redraw (resizing the window, switching tabs, ...) - force it here instead.
+ tabMainFunctions.Invalidate()
+ End Sub
+
+ ''' <summary>Toggles btnPickRoot between light blue and its normal color (UpdateProjectAccess starts/stops
+ ''' this timer, only while no project root is known yet).</summary>
+ Private Sub RootBlinkTimer_Tick(sender As Object, e As EventArgs) Handles _rootBlinkTimer.Tick
+ _rootBlinkOn = Not _rootBlinkOn
+ btnPickRoot.UseVisualStyleBackColor = False
+ btnPickRoot.BackColor = If(_rootBlinkOn, Color.LightBlue, SystemColors.Control)
+ End Sub
+
+ ''' <summary>A disabled TabPage (UpdateProjectAccess) still lets itself be clicked into and shows its
+ ''' (disabled) contents unless refused here - WinForms' TabControl has no built-in notion of a locked tab.</summary>
+ Private Sub tabMainFunctions_Selecting(sender As Object, e As TabControlCancelEventArgs) Handles tabMainFunctions.Selecting
+ If e.TabPage.Enabled Then Return
+ e.Cancel = True
+ MessageBox.Show(Me, "Please open or create a project first.", "No project", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End Sub
+
+ ''' <summary>Draws each tab's own label - needed only so a disabled tab's label can be shown in a lighter
+ ''' gray than an enabled one's (Form1_Load sets tabMainFunctions.DrawMode to OwnerDrawFixed for this).</summary>
+ Private Sub tabMainFunctions_DrawItem(sender As Object, e As DrawItemEventArgs) Handles tabMainFunctions.DrawItem
+ Dim page As TabPage = tabMainFunctions.TabPages(e.Index)
+ Dim tabRect As Rectangle = tabMainFunctions.GetTabRect(e.Index)
+
+ ' the selected tab a shade lighter than the rest, so which one is open is still visible without the
+ ' native visual style this drawing replaces
+ Dim backColor As Color = If(e.Index = tabMainFunctions.SelectedIndex, SystemColors.Window, SystemColors.Control)
+ Using backBrush As New SolidBrush(backColor)
+ e.Graphics.FillRectangle(backBrush, tabRect)
+ End Using
+
+ Dim textColor As Color = If(page.Enabled, SystemColors.ControlText, Color.Silver)
+ Dim flags As TextFormatFlags = TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter Or TextFormatFlags.SingleLine
+ TextRenderer.DrawText(e.Graphics, page.Text, tabMainFunctions.Font, tabRect, textColor, flags)
+ End Sub
+
+ ''' <summary>Startup: nothing from any previous project is filled into the form. Only the chosen project
+ ''' root folder (AppSettings.ProjectRoot) is restored, if one was already chosen on an earlier run - everything
+ ''' that needs a root or a real project stays disabled until then (UpdateProjectAccess).</summary>
+ Private Sub InitializeProject()
+ _settings = AppSettings.Load()
+
+ txtRootFolder.Text = _settings.ProjectRoot
+ txtProjectName.Text = ""
+
+ UpdateProjectAccess()
+
+ UpdateTitle()
+ RefreshProjectList()
+ End Sub
+
+ ''' <summary>File > Open: browse directly to the main folder of a project and open it, without going through
+ ''' the project list (browsing for the project ROOT folder instead is btnBrowseRoot / File > Choose project
+ ''' root / double-clicking txtRootFolder - see ChooseProjectRootToolStripMenuItem_Click).</summary>
+ Private Sub OpenProject_Click(sender As Object, e As EventArgs) Handles OpenToolStripMenuItem.Click
+ Try
+ Dim folder As String = BrowseForFolder("Choose the main folder of the project (the folder that contains configuration.json)",
+ txtRootFolder.Text.Trim(), False)
+ If folder.Length = 0 Then Return
+ If Not ConfirmSaveProject() Then Return
+
+ SetCurrentProject(ProjectStore.Open(folder))
+ Catch ex As Exception
+ MessageBox.Show(Me, "The project could not be opened:" & vbCrLf & vbCrLf & ex.Message,
+ "Open project", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ''' <summary>Save project (buttons and File > Save): creates the project (folders and configuration file) when it is new, otherwise overwrites its configuration file.</summary>
+ Private Sub SaveProject_Click(sender As Object, e As EventArgs) Handles btnSaveConfiguration.Click, SaveToolStripMenuItem.Click
+ SaveProject()
+ End Sub
+
+ ''' <summary>
+ ''' Save as: a simple name prompt (PromptForText, the same small dialog btnRenameProject uses), not a file
+ ''' dialog - the new project always goes into the current root folder (txtRootFolder), never somewhere else,
+ ''' and there is no file extension to worry about (a project is just a folder, see ProjectStore). Saving under
+ ''' a name that already exists in the root is not refused up front: SaveProjectTo itself asks to overwrite in
+ ''' that case, same as plain Save would for an existing project.
+ ''' </summary>
+ Private Sub SaveAs_Click(sender As Object, e As EventArgs) Handles btnSaveAs.Click
+ Dim root As String = txtRootFolder.Text.Trim()
+ If root.Length = 0 Then
+ MessageBox.Show(Me, "Enter a root folder first (double-click the box to browse).", "Save project as",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim projectName As String = txtProjectName.Text.Trim()
+ If Not PromptForText("Save project as", "New project name (saved in the current root folder):", projectName, projectName) Then Return
+ projectName = projectName.Trim()
+
+ Dim problem As String = ProjectStore.ValidateName(projectName)
+ If problem.Length > 0 Then
+ MessageBox.Show(Me, problem, "Save project as", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ SaveProjectTo(root, projectName)
+ End Sub
+
+ ''' <summary>Opens frmDescription so the user can add/edit a free-form description of the current project,
+ ''' stored in the project's own configuration.json (ProjectConfig.Description) - saved to disk immediately
+ ''' on OK, the same as btnRenameProject's rename takes effect right away rather than waiting for "Save
+ ''' project". Only enabled while a real (saved) project is open (UpdateProjectAccess) - a new, unsaved
+ ''' project has no configuration.json yet to hold it.</summary>
+ Private Sub btnDescription_Click(sender As Object, e As EventArgs) Handles btnDescription.Click
+ If _project Is Nothing Then Return
+ Using dlg As New frmDescription()
+ dlg.DescriptionText = _project.Config.Description
+ If dlg.ShowDialog(Me) = DialogResult.OK Then
+ _project.Config.Description = dlg.DescriptionText
+ _project.Save()
+ End If
+ End Using
+ End Sub
+
+ Private Sub ExitProgram_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click
+ Close()
+ End Sub
+
+ ' Info menu (added on tabMainFunctions's menu strip): Help opens a page describing the program's tabs and
+ ' controls, About shows the program name/version. Both are plain, self-built forms (HelpForm.vb, AboutForm.vb).
+
+ Private Sub HelpToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HelpToolStripMenuItem.Click
+ Using dlg As New HelpForm()
+ dlg.ShowDialog(Me)
+ End Using
+ End Sub
+
+ Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
+ Using dlg As New AboutForm()
+ dlg.ShowDialog(Me)
+ End Using
+ End Sub
+
+ ''' <summary>File > Choose project root, the btnBrowseRoot button, btnPickRoot (the blinking button that is
+ ''' always reachable even with no root yet - see Form1_Load/UpdateProjectAccess), and double-clicking the
+ ''' (read-only) root folder box: all four let the user pick the folder that contains the project folders
+ ''' (txtRootFolder just displays it - AppSettings.ProjectRoot is the real, persisted value, restored again on
+ ''' the next start). Once a root is chosen, grpProjects and the Outputs tab become usable and the project
+ ''' list is (re)populated.</summary>
+ Private Sub ChooseProjectRootToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ChooseProjectRootToolStripMenuItem.Click, btnBrowseRoot.Click, btnPickRoot.Click, txtRootFolder.DoubleClick
+ Dim start As String = If(_settings.ProjectRoot.Length > 0, _settings.ProjectRoot, txtRootFolder.Text.Trim())
+ Dim chosen As String = BrowseForFolder("Choose the root folder that contains your project folders", start, True)
+ If chosen.Length = 0 Then Return
+
+ _settings.ProjectRoot = chosen
+ _settings.Save()
+ txtRootFolder.Text = chosen
+ UpdateProjectAccess()
+ RefreshProjectList()
+ End Sub
+
+ ''' <summary>lblInfo (Settings tab): a clickable "hyperlink" style label (see Form1_Load for its Cursor/ForeColor)
+ ''' that explains the 4th order Laplacian option and why it needs a different "Set c-value" (File menu).</summary>
+ Private Sub lblInfo_Click(sender As Object, e As EventArgs) Handles lblInfo.Click
+ MessageBox.Show(Me,
+ "The standard 3rd order Laplacian processing inherently leads to large dispersion, meaning that longer " &
+ "wavelengths propagate faster through the medium. Choosing 4th order processing (including sub-step sampling) " &
+ "reduces this effect significantly. However, processing is somewhat slower. Another effect of 4th order " &
+ "processing is that it requires a different propagation speed (c). The value can be specified per project and set in the File menu. " &
+ "For 4th order processing choose 1.00 for c. For standard processing, this value can be quite a bit " &
+ "different. For example, with standard processing for waves with a frequency of 100, c = 0.56, leading in " &
+ "this case to a wavelength of only 9 pixels (instead of 15). Because of the dispersion present in standard " &
+ "processing, the exact value of c is strongly dependent on the frequency. (lower frequencies -> higher c " &
+ "value; higher frequencies -> lower c value).",
+ "4th order Laplacian and wave speed (c)", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End Sub
+
+ ''' <summary>File > Set c-value: shows the current wave propagation speed c (SimulationSettings.WaveSpeedC) and
+ ''' lets it be changed. c is only used to estimate a source's wavelength (lblLambdaIs on the Sources tab).</summary>
+ Private Sub SetCValueToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SetCValueToolStripMenuItem.Click
+ Dim newValue As Double
+ If PromptForCValue(_simulation.WaveSpeedC, newValue) Then
+ If newValue <> _simulation.WaveSpeedC Then
+ _simulation.WaveSpeedC = newValue
+ MarkProjectChanged()
+ End If
+ UpdateLambdaLabel()
+ End If
+ End Sub
+
+ ''' <summary>
+ ''' A small modal dialog, built entirely in code (no Designer file needed), to view and change the wave
+ ''' propagation speed c. Returns True (with the chosen value in result) when the user pressed OK.
+ ''' </summary>
+ Private Function PromptForCValue(current As Double, ByRef result As Double) As Boolean
+ Using dlg As New Form()
+ dlg.Text = "Set c-value"
+ dlg.FormBorderStyle = FormBorderStyle.FixedDialog
+ dlg.StartPosition = FormStartPosition.CenterParent
+ dlg.MinimizeBox = False
+ dlg.MaximizeBox = False
+ dlg.ShowInTaskbar = False
+ dlg.ClientSize = New Size(340, 116)
+
+ Dim lbl As New Label()
+ lbl.Text = "Wave propagation speed c (in pixels per step)" & vbCrLf &
+ "(lambda = c / frequency)." & vbCrLf &
+ "Only used to estimate a source's wavelength in screen pixels"
+ lbl.SetBounds(12, 10, 316, 44)
+
+ Dim num As New NumericUpDown()
+ num.DecimalPlaces = 3
+ num.Minimum = 0.001D
+ num.Maximum = 1000000D
+ num.Increment = 0.1D
+ num.SetBounds(12, 60, 110, 22)
+ Dim clamped As Double = Math.Max(CDbl(num.Minimum), Math.Min(CDbl(num.Maximum), current))
+ num.Value = CDec(clamped)
+
+ Dim btnOk As New Button()
+ btnOk.Text = "OK"
+ btnOk.DialogResult = DialogResult.OK
+ btnOk.SetBounds(152, 80, 84, 26)
+
+ Dim btnCancel As New Button()
+ btnCancel.Text = "Cancel"
+ btnCancel.DialogResult = DialogResult.Cancel
+ btnCancel.SetBounds(244, 80, 84, 26)
+
+ dlg.Controls.AddRange(New Control() {lbl, num, btnOk, btnCancel})
+ dlg.AcceptButton = btnOk
+ dlg.CancelButton = btnCancel
+
+ If dlg.ShowDialog(Me) = DialogResult.OK Then
+ result = CDbl(num.Value)
+ Return True
+ End If
+ End Using
+ result = current
+ Return False
+ End Function
+
+ ''' <summary>
+ ''' A small modal dialog, built entirely in code (no Designer file needed), that asks for one line of text -
+ ''' used to rename a project. Returns True (with the typed text in result) when the user pressed OK.
+ ''' </summary>
+ Private Function PromptForText(title As String, prompt As String, defaultValue As String, ByRef result As String) As Boolean
+ Using dlg As New Form()
+ dlg.Text = title
+ dlg.FormBorderStyle = FormBorderStyle.FixedDialog
+ dlg.StartPosition = FormStartPosition.CenterParent
+ dlg.MinimizeBox = False
+ dlg.MaximizeBox = False
+ dlg.ShowInTaskbar = False
+ dlg.ClientSize = New Size(340, 110)
+
+ Dim lbl As New Label()
+ lbl.Text = prompt
+ lbl.SetBounds(12, 10, 316, 20)
+
+ Dim txt As New TextBox()
+ txt.SetBounds(12, 34, 316, 22)
+ txt.Text = defaultValue
+ txt.SelectAll()
+
+ Dim btnOk As New Button()
+ btnOk.Text = "OK"
+ btnOk.DialogResult = DialogResult.OK
+ btnOk.SetBounds(152, 68, 84, 26)
+
+ Dim btnCancel As New Button()
+ btnCancel.Text = "Cancel"
+ btnCancel.DialogResult = DialogResult.Cancel
+ btnCancel.SetBounds(244, 68, 84, 26)
+
+ dlg.Controls.AddRange(New Control() {lbl, txt, btnOk, btnCancel})
+ dlg.AcceptButton = btnOk
+ dlg.CancelButton = btnCancel
+ dlg.ActiveControl = txt
+
+ If dlg.ShowDialog(Me) = DialogResult.OK Then
+ result = txt.Text
+ Return True
+ End If
+ End Using
+ result = defaultValue
+ Return False
+ End Function
+
+ ''' <summary>Saves the project in the folder root\name shown in the boxes. Returns False when nothing was saved.</summary>
+ Private Function SaveProject() As Boolean
+ Dim root As String = txtRootFolder.Text.Trim()
+ Dim projectName As String = txtProjectName.Text.Trim()
+
+ If root.Length = 0 Then
+ MessageBox.Show(Me, "Enter a root folder first (double-click the box to browse).", "Save project",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ txtRootFolder.Focus()
+ Return False
+ End If
+
+ Dim problem As String = ProjectStore.ValidateName(projectName)
+ If problem.Length > 0 Then
+ MessageBox.Show(Me, problem, "Save project", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ txtProjectName.Focus()
+ Return False
+ End If
+
+ Return SaveProjectTo(root, projectName)
+ End Function
+
+ ''' <summary>
+ ''' Saves the current settings as the project root\projectName:
+ ''' the open project itself: its configuration file is overwritten;
+ ''' another existing project: after confirmation its configuration file is overwritten;
+ ''' a folder that does not exist yet: the project folder, its subfolders and the configuration file are created.
+ ''' </summary>
+ Private Function SaveProjectTo(root As String, projectName As String) As Boolean
+ Try
+ Dim rootFull As String = ProjectStore.NormalizeFolder(root)
+ Dim folder As String = Path.Combine(rootFull, projectName)
+ Dim previous As Project = _project
+ Dim target As Project
+
+ If previous IsNot Nothing AndAlso String.Equals(folder, previous.FolderPath, StringComparison.OrdinalIgnoreCase) Then
+ target = previous
+ ElseIf ProjectStore.IsProjectFolder(folder) Then
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "A project named '" & projectName & "' already exists in the root folder" & vbCrLf & rootFull & vbCrLf & vbCrLf &
+ "Overwrite its configuration with the current settings?",
+ "Save project", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return False
+ target = ProjectStore.Open(folder)
+ Else
+ If Not Directory.Exists(rootFull) Then
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "The root folder does not exist:" & vbCrLf & rootFull & vbCrLf & vbCrLf & "Create it?",
+ "Save project", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
+ If answer <> DialogResult.Yes Then Return False
+ End If
+ target = ProjectStore.Create(rootFull, projectName)
+ End If
+
+ PrepareSceneImageFor(target, previous)
+ _scene.ToConfig(target.Config)
+ _simulation.ToConfig(target.Config)
+ ProbeSettings.ListToConfig(_probes, target.Config)
+ SourceSettings.ListToConfig(_sources, target.Config)
+ target.Save()
+
+ SetCurrentProject(target)
+ Return True
+ Catch ex As Exception
+ MessageBox.Show(Me, "The project could not be saved:" & vbCrLf & vbCrLf & ex.Message,
+ "Save project", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return False
+ End Try
+ End Function
+
+ ''' <summary>
+ ''' Makes the scene image path in _scene right for the project it is saved in: an image that does not already lie
+ ''' inside the target project's own folder (the previous project's folder, or anywhere else) is copied into the
+ ''' target's scene_images folder. This is the same copy that btnLOadSceneImage_Click already does when a project
+ ''' exists; this one catches an image that was picked before the (new) project was ever saved.
+ ''' </summary>
+ Private Sub PrepareSceneImageFor(target As Project, previous As Project)
+ If _scene.ImageFile.Length = 0 OrElse Object.ReferenceEquals(target, previous) Then Return
+
+ Dim oldFolder As String = If(previous Is Nothing, "", previous.FolderPath)
+ Dim fullPath As String = SceneSettings.ToFullPath(oldFolder, _scene.ImageFile)
+
+ If File.Exists(fullPath) AndAlso Not IsInsideFolder(fullPath, target.FolderPath) Then
+ fullPath = CopyIntoSceneImageFolder(target, fullPath)
+ End If
+
+ _scene.ImageFile = SceneSettings.ToStoredPath(target.FolderPath, fullPath)
+ End Sub
+
+ ''' <summary>True when fullPath lies inside folder (or one of its subfolders).</summary>
+ Private Shared Function IsInsideFolder(fullPath As String, folder As String) As Boolean
+ If String.IsNullOrEmpty(folder) Then Return False
+ Dim prefix As String = folder.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) & Path.DirectorySeparatorChar
+ Return Path.GetFullPath(fullPath).StartsWith(Path.GetFullPath(prefix), StringComparison.OrdinalIgnoreCase)
+ End Function
+
+ ''' <summary>
+ ''' Copies an image file into the scene_images folder of a project and returns the full path of the copy. A different
+ ''' file with the same name is not overwritten: the copy then gets a number. A copy that is already there (the same
+ ''' file, same size) is reused instead of copied again.
+ ''' </summary>
+ Private Shared Function CopyIntoSceneImageFolder(project As Project, fullPath As String) As String
+ Directory.CreateDirectory(project.SceneImageFolder)
+ Dim fileName As String = Path.GetFileName(fullPath)
+ Dim copy As String = Path.Combine(project.SceneImageFolder, fileName)
+
+ Dim counter As Integer = 2
+ Do While File.Exists(copy) AndAlso New FileInfo(copy).Length <> New FileInfo(fullPath).Length
+ copy = Path.Combine(project.SceneImageFolder, Path.GetFileNameWithoutExtension(fileName) & " (" &
+ counter.ToString(CultureInfo.InvariantCulture) & ")" & Path.GetExtension(fileName))
+ counter += 1
+ Loop
+ If Not File.Exists(copy) Then File.Copy(fullPath, copy)
+ Return copy
+ End Function
+
+ ''' <summary>
+ ''' Asks what to do with unsaved changes before they would be lost. Returns False when the user cancels
+ ''' (or saving failed), True when it is fine to continue.
+ ''' </summary>
+ Private Function ConfirmSaveProject() As Boolean
+ ' Nothing to save when no named project exists yet (a project only exists once it has been loaded from
+ ' the list or created and named through btnNewProject's dialog) - there is no such thing as an
+ ' "unsaved new project" to ask about any more.
+ If _project Is Nothing OrElse Not _projectDirty Then Return True
+
+ Dim answer As DialogResult = MessageBox.Show(Me, "There are unsaved changes in the project '" & _project.Name & "'. Save them first?",
+ "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
+ Select Case answer
+ Case DialogResult.Yes
+ Return SaveProject()
+ Case DialogResult.No
+ Return True
+ Case Else
+ Return False
+ End Select
+ End Function
+
+ ''' <summary>Resets the in-memory project state (scene, simulation, probes, sources) to blank defaults.
+ ''' Does not touch grpSceneProperties/grpSimulationSettings/grpProjects.Enabled - a caller that goes on to
+ ''' make a real, named project current (SetCurrentProject) re-enables them there; a caller that ends up with
+ ''' no project at all (e.g. deleting the one that was open) should instead disable them, since - per the
+ ''' startup design - there is no such thing as an editable "new project" that does not exist on disk yet.</summary>
+ Private Sub StartNewProject()
+ _project = Nothing
+ _scene = New SceneSettings()
+ ' chkDampingEdge and chkUseObjectSources have no software-chosen default of their own (see their
+ ' comments in SceneSettings.vb) - a new project starts at whatever the controls' own Designer values are
+ _scene.DampingEdgeEnabled = chkDampingEdge.Checked
+ _scene.UseObjectSources = chkUseObjectSources.Checked
+ ReplaceSceneImage(Nothing)
+ txtProjectName.Text = ""
+ ShowSceneInControls()
+ _simulation = New SimulationSettings()
+ ' numSimulationSteps and numTimeDecayFactor have no software-chosen default of their own (see their
+ ' comments in SimulationSettings.vb) - a new project starts at whatever the controls' own Designer
+ ' values are
+ _simulation.Steps = CInt(numSimulationSteps.Value)
+ _simulation.TimeDecayFactor = CDbl(numTimeDecayFactor.Value)
+ ShowSimulationInControls()
+ ResetProbes()
+ ResetSources()
+ _fieldVideoFile = ""
+ _intensityVideoFile = ""
+ UpdateVideoButtons()
+ _projectDirty = False
+ UpdateTitle()
+ txtProjectName.Focus()
+ End Sub
+
+ ''' <summary>Makes a saved project the current one: shows it in the boxes and remembers it for the next start.
+ ''' Also called by SaveProjectTo for a plain "Save project" of the project that is already open (target and
+ ''' the previous _project are then the same folder) - the preview-clearing below must only run when the
+ ''' project is actually changing, or every "Save configuration" would blank the Sources/Probes tab's picture
+ ''' (see ClearPreviewImage's comment) even though nothing about that picture is out of date.</summary>
+ Private Sub SetCurrentProject(opened As Project)
+ Dim isDifferentProject As Boolean = _project Is Nothing OrElse
+ Not String.Equals(_project.FolderPath, opened.FolderPath, StringComparison.OrdinalIgnoreCase)
+
+ _project = opened
+ txtRootFolder.Text = opened.RootFolder
+ txtProjectName.Text = opened.Name
+ UpdateProjectAccess()
+
+ _settings.LastRootFolder = opened.RootFolder
+ _settings.LastProjectName = opened.Name
+ _settings.Save()
+
+ If isDifferentProject Then
+ ' a preview picture (Sources/Probes tab) loaded for the previous project has no relevance to this one -
+ ' clear it so the tab shows this project's own scene image (or a blank placeholder) the next time it is
+ ' visited, rather than a leftover picture from whatever was open before (AutoLoadSceneImageIfEmpty only
+ ' fills a picture that is empty, so a stale one left behind would otherwise never be replaced)
+ ClearPreviewImage(_picSource)
+ ClearPreviewImage(_picProbe)
+ End If
+
+ LoadSceneFromProject()
+ _simulation = SimulationSettings.FromConfig(_project.Config)
+ ShowSimulationInControls()
+ LoadProbesFromProject()
+ LoadSourcesFromProject()
+ _projectDirty = False
+ UpdateTitle()
+ RefreshProjectList()
+ End Sub
+
+ ''' <summary>Disposes and clears a preview picture's image (Sources/Probes tab), if it has one.</summary>
+ Private Sub ClearPreviewImage(pic As PictureBox)
+ If pic Is Nothing OrElse pic.Image Is Nothing Then Return
+ Dim old As Image = pic.Image
+ pic.Image = Nothing
+ old.Dispose()
+ pic.Invalidate()
+ End Sub
+
+ ''' <summary>Something in the project was changed and is not saved yet.</summary>
+ Private Sub MarkProjectChanged()
+ If _loadingScene OrElse _loadingSim OrElse _loadingProbe OrElse _loadingSource Then Return
+ _projectDirty = True
+ UpdateTitle()
+ End Sub
+
+ Private Sub UpdateTitle()
+ Dim projectLabel As String = If(_project Is Nothing, "(new project)", _project.Name)
+ Text = "2D wave simulation - " & projectLabel & If(_projectDirty, " *", "") & If(_simStatus.Length > 0, " | " & _simStatus, "")
+ End Sub
+
+ ''' <summary>
+ ''' Lets the user choose a folder: type or paste a full path directly into the box, or click "Browse..." for
+ ''' the usual Windows tree picker - rooted at "This PC" rather than the Desktop, so every drive (C:\, D:\, a
+ ''' network drive, anywhere) is one click away instead of buried under Desktop. This replaces a plain
+ ''' FolderBrowserDialog call, which on this machine shows no address bar to type a path into and makes other
+ ''' drives awkward to reach from its Desktop-rooted tree. Returns the chosen folder, or an empty string when
+ ''' cancelled; when allowNewFolder is False, OK is refused until the typed/picked path actually exists (a new,
+ ''' not-yet-created one is fine when allowNewFolder is True - the caller decides whether/how to create it).
+ ''' </summary>
+ Private Function BrowseForFolder(description As String, startFolder As String, allowNewFolder As Boolean) As String
+ Using dlg As New Form()
+ dlg.Text = "Choose a folder"
+ dlg.FormBorderStyle = FormBorderStyle.FixedDialog
+ dlg.StartPosition = FormStartPosition.CenterParent
+ dlg.MinimizeBox = False
+ dlg.MaximizeBox = False
+ dlg.ShowInTaskbar = False
+ dlg.ClientSize = New Size(480, 124)
+
+ Dim lbl As New Label()
+ lbl.Text = description
+ lbl.SetBounds(12, 10, 456, 34)
+
+ Dim txt As New TextBox()
+ txt.SetBounds(12, 50, 362, 22)
+ txt.Text = startFolder
+
+ Dim btnBrowse As New Button()
+ btnBrowse.Text = "Browse..."
+ btnBrowse.SetBounds(380, 49, 88, 24)
+ AddHandler btnBrowse.Click, Sub(sender As Object, e As EventArgs)
+ Using pick As New FolderBrowserDialog()
+ pick.Description = description
+ pick.ShowNewFolderButton = allowNewFolder
+ ' MyComputer (not the default Desktop) so every drive is a
+ ' top-level node, reachable in one click instead of nested
+ ' under Desktop/This PC
+ pick.RootFolder = Environment.SpecialFolder.MyComputer
+ If Directory.Exists(txt.Text.Trim()) Then pick.SelectedPath = txt.Text.Trim()
+ If pick.ShowDialog(dlg) = DialogResult.OK Then
+ txt.Text = pick.SelectedPath
+ txt.SelectAll()
+ End If
+ End Using
+ End Sub
+
+ Dim btnOk As New Button()
+ btnOk.Text = "OK"
+ btnOk.SetBounds(228, 86, 84, 26)
+ AddHandler btnOk.Click, Sub(sender As Object, e As EventArgs)
+ Dim path As String = txt.Text.Trim()
+ If path.Length = 0 Then
+ MessageBox.Show(dlg, "Enter or browse to a folder first.", "Choose a folder",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ If Not allowNewFolder AndAlso Not Directory.Exists(path) Then
+ MessageBox.Show(dlg, "This folder does not exist:" & vbCrLf & path,
+ "Choose a folder", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ dlg.DialogResult = DialogResult.OK
+ dlg.Close()
+ End Sub
+
+ Dim btnCancel As New Button()
+ btnCancel.Text = "Cancel"
+ btnCancel.DialogResult = DialogResult.Cancel
+ btnCancel.SetBounds(320, 86, 84, 26)
+
+ dlg.Controls.AddRange(New Control() {lbl, txt, btnBrowse, btnOk, btnCancel})
+ dlg.AcceptButton = btnOk
+ dlg.CancelButton = btnCancel
+ dlg.ActiveControl = txt
+
+ If dlg.ShowDialog(Me) = DialogResult.OK Then Return txt.Text.Trim()
+ End Using
+ Return ""
+ End Function
+
+ ' ------------------------------------------------------------------ the project list (Configuration tab)
+ '
+ ' lstAllProjects lists every project found directly inside the chosen project root folder (File > Choose project
+ ' root, AppSettings.ProjectRoot) - a quick way to switch projects without browsing to their folder every
+ ' time. New creates another project there; Load/Delete/Rename act on the selected entry.
+ '
+ ' Two columns, colProjectName and colLastEdit ("last edited" = the last write time of that project's
+ ' configuration.json). Clicking either header sorts by it (lstAllProjects_ColumnClick), toggling direction on a
+ ' repeat click of the same header - the usual Explorer/Excel convention. Each row's Tag holds a
+ ' ProjectListEntry so the raw name and date stay available without re-parsing the displayed text.
+
+ ''' <summary>One row in lstAllProjects, kept in ListViewItem.Tag.</summary>
+ Private NotInheritable Class ProjectListEntry
+ Public ReadOnly Name As String
+ Public ReadOnly LastModified As DateTime
+
+ Public Sub New(name As String, lastModified As DateTime)
+ Me.Name = name
+ Me.LastModified = lastModified
+ End Sub
+ End Class
+
+ ''' <summary>Reads every project under AppSettings.ProjectRoot into a ProjectListEntry (name plus the last
+ ''' write time of its configuration.json). Shared by lstAllProjects (Configuration tab) and lstAllProjects3
+ ''' (Outputs tab) - see the "the Outputs tab" section further down.</summary>
+ Private Function BuildProjectEntries() As List(Of ProjectListEntry)
+ Dim entries As New List(Of ProjectListEntry)()
+ For Each name As String In ProjectStore.ListProjects(_settings.ProjectRoot)
+ Dim folder As String = ProjectStore.FolderPathFor(_settings.ProjectRoot, name)
+ Dim configPath As String = Path.Combine(folder, ProjectConfig.FileName)
+ Dim lastModified As DateTime = If(File.Exists(configPath), File.GetLastWriteTime(configPath), Directory.GetLastWriteTime(folder))
+ entries.Add(New ProjectListEntry(name, lastModified))
+ Next
+ Return entries
+ End Function
+
+ ''' <summary>Sorts the project entries in place, by name (sortColumn 0) or last-edited (sortColumn 1).</summary>
+ Private Sub SortProjectEntries(entries As List(Of ProjectListEntry), sortColumn As Integer, ascending As Boolean)
+ Dim result As Comparison(Of ProjectListEntry)
+ If sortColumn = 0 Then
+ result = Function(a As ProjectListEntry, b As ProjectListEntry) String.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)
+ Else
+ result = Function(a As ProjectListEntry, b As ProjectListEntry) DateTime.Compare(a.LastModified, b.LastModified)
+ End If
+ entries.Sort(result)
+ If Not ascending Then entries.Reverse()
+ End Sub
+
+ ''' <summary>Fills a two-column (name, last edited) project ListView from the given, already-sorted entries.</summary>
+ Private Sub PopulateProjectListView(list As ListView, entries As List(Of ProjectListEntry))
+ list.BeginUpdate()
+ Try
+ list.Items.Clear()
+ For Each entry As ProjectListEntry In entries
+ Dim item As New ListViewItem(entry.Name)
+ item.SubItems.Add(entry.LastModified.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture))
+ item.Tag = entry
+ list.Items.Add(item)
+ Next
+ Finally
+ list.EndUpdate()
+ End Try
+ End Sub
+
+ ''' <summary>The plain project name selected in a project ListView (lstAllProjects or lstAllProjects3), or ""
+ ''' when nothing is selected there.</summary>
+ Private Function SelectedProjectName(list As ListView) As String
+ If list.SelectedItems.Count = 0 Then Return ""
+ Dim entry As ProjectListEntry = TryCast(list.SelectedItems(0).Tag, ProjectListEntry)
+ Return If(entry IsNot Nothing, entry.Name, "")
+ End Function
+
+ ''' <summary>Selects, in a project ListView, the row for the project with the given name (case-insensitive), if any.</summary>
+ Private Sub SelectProjectInList(list As ListView, name As String)
+ If name.Length = 0 Then Return
+ For Each item As ListViewItem In list.Items
+ Dim entry As ProjectListEntry = DirectCast(item.Tag, ProjectListEntry)
+ If String.Equals(entry.Name, name, StringComparison.OrdinalIgnoreCase) Then
+ item.Selected = True
+ item.EnsureVisible()
+ Return
+ End If
+ Next
+ End Sub
+
+ ''' <summary>Repopulates lstAllProjects from AppSettings.ProjectRoot, sorted per _projectSortColumn/Ascending.
+ ''' Keeps the current selection, by name, when that project is still in the refreshed list.</summary>
+ Private Sub RefreshProjectList()
+ Dim selectedName As String = SelectedProjectName(lstAllProjects)
+
+ Dim entries As List(Of ProjectListEntry) = BuildProjectEntries()
+ SortProjectEntries(entries, _projectSortColumn, _projectSortAscending)
+ PopulateProjectListView(lstAllProjects, entries)
+
+ UpdateProjectListSortHeaders()
+ SelectProjectInList(lstAllProjects, selectedName)
+ UpdateProjectListButtons()
+ End Sub
+
+ ''' <summary>Clicking a column header sorts by it; clicking the same header again reverses the direction.</summary>
+ Private Sub lstAllProjects_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstAllProjects.ColumnClick
+ If e.Column = _projectSortColumn Then
+ _projectSortAscending = Not _projectSortAscending
+ Else
+ _projectSortColumn = e.Column
+ _projectSortAscending = True
+ End If
+ RefreshProjectList()
+ End Sub
+
+ ''' <summary>Marks the currently sorted column's header with a small arrow, the way a sortable list usually does.</summary>
+ Private Sub UpdateProjectListSortHeaders()
+ Dim arrow As String = If(_projectSortAscending, " ^", " v")
+ colProjectName.Text = "Project name" & If(_projectSortColumn = 0, arrow, "")
+ colLastEdit.Text = "Last edited" & If(_projectSortColumn = 1, arrow, "")
+ End Sub
+
+ ''' <summary>New needs a chosen project root; Load/Delete/Rename only make sense with something selected.</summary>
+ Private Sub UpdateProjectListButtons()
+ Dim hasSelection As Boolean = (lstAllProjects.SelectedItems.Count > 0)
+ btnNewProject.Enabled = (_settings IsNot Nothing) AndAlso (_settings.ProjectRoot.Length > 0)
+ btnLoadProject.Enabled = hasSelection
+ btnDeleteProject.Enabled = hasSelection
+ btnRenameProject.Enabled = hasSelection
+ End Sub
+
+ ''' <summary>
+ ''' Creates a new, empty project (folders and configuration.json, default settings) in the chosen project
+ ''' root, under a name the user types in a dialog, and makes it the current project. Never overwrites an
+ ''' existing project: a name already used there is refused and the dialog reopens so a different name can be
+ ''' chosen. Asks to save unsaved changes in the current project first, like Load. Shared by the button and
+ ''' File > New - there is no such thing as a "new project" until it has actually been named and created here,
+ ''' so File > New no longer leaves an unnamed, un-saved project open for editing.
+ ''' </summary>
+ Private Sub btnNewProject2_Click(sender As Object, e As EventArgs) Handles btnNewProject.Click, NewToolStripMenuItem.Click
+ If _settings.ProjectRoot.Length = 0 Then
+ MessageBox.Show(Me, "Choose a project root folder first (File > Choose project root).", "New project",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ If Not ConfirmSaveProject() Then Return
+
+ Dim name As String = ""
+ Do
+ If Not PromptForText("New project", "Name for the new project:", name, name) Then Return
+ name = name.Trim()
+
+ Dim problem As String = ProjectStore.ValidateName(name)
+ If problem.Length > 0 Then
+ MessageBox.Show(Me, problem, "New project", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Continue Do
+ End If
+ If ProjectStore.IsProjectFolder(ProjectStore.FolderPathFor(_settings.ProjectRoot, name)) Then
+ MessageBox.Show(Me, "A project named '" & name & "' already exists in this root folder. Choose a different name.",
+ "New project", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Continue Do
+ End If
+
+ Try
+ Dim created As Project = ProjectStore.Create(_settings.ProjectRoot, name)
+ StartNewProject()
+
+ ' Write the just-computed defaults (StartNewProject read numSimulationSteps/numTimeDecayFactor
+ ' etc. from their Designer values) into the new project's configuration.json before
+ ' SetCurrentProject reads it back - otherwise, since a freshly created project has no "steps" or
+ ' "time_decay_factor" key yet, FromConfig would fall back to its own hardcoded legacy-compatibility
+ ' defaults (for an older project saved before these settings existed) instead, silently discarding
+ ' the Designer values StartNewProject just set.
+ _scene.ToConfig(created.Config)
+ _simulation.ToConfig(created.Config)
+ ProbeSettings.ListToConfig(_probes, created.Config)
+ SourceSettings.ListToConfig(_sources, created.Config)
+ created.Save()
+
+ SetCurrentProject(created)
+ ToolStripStatusLabel1.Text = "Project '" & name & "' created."
+ Return
+ Catch ex As Exception
+ MessageBox.Show(Me, "The project could not be created:" & vbCrLf & vbCrLf & ex.Message,
+ "New project", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Continue Do
+ End Try
+ Loop
+ End Sub
+
+ Private Sub lstAllProjects_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstAllProjects.SelectedIndexChanged
+ UpdateProjectListButtons()
+ End Sub
+
+ ''' <summary>Double-clicking a project in the list loads it, the same as pressing Load.</summary>
+ Private Sub lstAllProjects_DoubleClick(sender As Object, e As EventArgs) Handles lstAllProjects.DoubleClick
+ btnLoadProject_Click(sender, e)
+ End Sub
+
+ ''' <summary>The project folder for the entry currently selected in lstAllProjects, or "" when nothing is selected.</summary>
+ Private Function SelectedProjectFolder() As String
+ Dim name As String = SelectedProjectName(lstAllProjects)
+ If name.Length = 0 Then Return ""
+ Return ProjectStore.FolderPathFor(_settings.ProjectRoot, name)
+ End Function
+
+ ''' <summary>True when the given project folder is the one currently open, and a simulation is running for
+ ''' it - Delete and Rename refuse in that case, since the run may still be writing files into that folder.</summary>
+ Private Function IsOpenProjectRunning(folder As String) As Boolean
+ Return (_project IsNot Nothing) AndAlso (_runner IsNot Nothing) AndAlso
+ String.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase)
+ End Function
+
+ ''' <summary>Loads the project selected in lstAllProjects - the same as "Open existing", just picked from the
+ ''' list instead of browsed to. Asks to save unsaved changes in the current project first, like every other
+ ''' action that replaces it (ConfirmSaveProject).</summary>
+ Private Sub btnLoadProject_Click(sender As Object, e As EventArgs) Handles btnLoadProject.Click
+ Dim folder As String = SelectedProjectFolder()
+ If folder.Length = 0 Then Return
+
+ Try
+ If Not ConfirmSaveProject() Then Return
+ SetCurrentProject(ProjectStore.Open(folder))
+ Catch ex As Exception
+ MessageBox.Show(Me, "The project could not be opened:" & vbCrLf & vbCrLf & ex.Message,
+ "Load project", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ''' <summary>Deletes the project selected in lstAllProjects, after confirmation. Refuses while a simulation
+ ''' for that same project is still running. Clears the editor to a new, unsaved project when the deleted
+ ''' project was the one currently open, since its folder is gone.</summary>
+ Private Sub btnDeleteProject_Click(sender As Object, e As EventArgs) Handles btnDeleteProject.Click
+ Dim name As String = SelectedProjectName(lstAllProjects)
+ Dim folder As String = SelectedProjectFolder()
+ If folder.Length = 0 Then Return
+
+ If IsOpenProjectRunning(folder) Then
+ MessageBox.Show(Me, "A simulation is running for this project. Stop it first.", "Delete project",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim message As String = "Permanently delete the project '" & name & "' and everything in its folder?" & vbCrLf & vbCrLf & folder
+
+ ' the assets folder is where the user keeps their own third-party files (e.g. a Photoshop source file) -
+ ' point this out explicitly, since deleting the project deletes those too, and they have no other copy here
+ Dim assetCount As Integer = CountFilesIn(Path.Combine(folder, ProjectStore.AssetsFolderName))
+ If assetCount > 0 Then
+ message &= vbCrLf & vbCrLf & "This includes " & assetCount.ToString(CultureInfo.InvariantCulture) &
+ " file(s) in its assets folder - copy them elsewhere first if you want to keep them."
+ End If
+
+ Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete project", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return
+
+ Dim wasOpenProject As Boolean = (_project IsNot Nothing) AndAlso String.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase)
+ Try
+ ProjectStore.Delete(folder)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The project could not be deleted:" & vbCrLf & vbCrLf & ex.Message,
+ "Delete project", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ RefreshProjectList()
+ Return
+ End Try
+
+ If wasOpenProject Then
+ StartNewProject()
+ UpdateProjectAccess()
+ End If
+ RefreshProjectList()
+ ToolStripStatusLabel1.Text = "Project '" & name & "' deleted."
+ End Sub
+
+ ''' <summary>The number of files in folderPath (recursively), or 0 when it does not exist or cannot be read.</summary>
+ Private Shared Function CountFilesIn(folderPath As String) As Integer
+ If Not Directory.Exists(folderPath) Then Return 0
+ Try
+ Return Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories).Length
+ Catch ex As Exception When TypeOf ex Is IOException OrElse TypeOf ex Is UnauthorizedAccessException
+ Return 0
+ End Try
+ End Function
+
+ ''' <summary>
+ ''' Renames the project selected in lstAllProjects. ProjectStore.Rename checks the new name and refuses a
+ ''' collision with an existing project (or any other file/folder with that name); if the renamed project was
+ ''' the one currently open, it is reopened under its new name and folder so the editor and the title bar stay
+ ''' in sync (a project's name is always just its folder name - see Project.Name).
+ ''' </summary>
+ Private Sub btnRenameProject_Click(sender As Object, e As EventArgs) Handles btnRenameProject.Click
+ Dim name As String = SelectedProjectName(lstAllProjects)
+ Dim folder As String = SelectedProjectFolder()
+ If folder.Length = 0 Then Return
+
+ If IsOpenProjectRunning(folder) Then
+ MessageBox.Show(Me, "A simulation is running for this project. Stop it first.", "Rename project",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim newName As String = name
+ If Not PromptForText("Rename project", "New name for '" & name & "':", name, newName) Then Return
+ newName = newName.Trim()
+ If newName = name Then Return
+
+ Dim wasOpenProject As Boolean = (_project IsNot Nothing) AndAlso String.Equals(_project.FolderPath, folder, StringComparison.OrdinalIgnoreCase)
+ Try
+ Dim newFolder As String = ProjectStore.Rename(folder, newName)
+ If wasOpenProject Then SetCurrentProject(ProjectStore.Open(newFolder))
+
+ RefreshProjectList()
+ SelectProjectInList(lstAllProjects, newName)
+ ToolStripStatusLabel1.Text = "Project '" & name & "' renamed to '" & newName & "'."
+ Catch ex As Exception
+ MessageBox.Show(Me, "The project could not be renamed:" & vbCrLf & vbCrLf & ex.Message,
+ "Rename project", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ' ------------------------------------------------------------------ the Outputs tab (project browser)
+ '
+ ' lstAllProjects3 lists every project the same way lstAllProjects does (see BuildProjectEntries and friends,
+ ' above); clicking a project fills lstScenes/lstImages/lstVideo from that project's scene_images/output_frames
+ ' /output_video folders. Clicking a scene or image shows it in pnlPreview (a PictureBox built in code, see
+ ' Form1_Load, since pnlPreview is a plain empty Panel). Each of the three file lists has its own name/"Created
+ ' on" column-click sort, the same idea as lstAllProjects/lstAllProjects3 (see FillFileList and friends below).
+ '
+ ' lstVideo shows just the file name and its creation date as text - no per-row thumbnail. Selecting exactly
+ ' one video instead shows a thumbnail-sized preview of it in pnlPreview, using the same operating-system shell
+ ' thumbnail cache Explorer itself uses (GetShellThumbnail, further down) rather than an actual video component
+ ' (there is no dependency-free way to decode/play a frame with just System.Drawing/System.Windows.Forms).
+ ' Selecting more than one video (lstVideo allows multi-select, for the delete button) clears the preview
+ ' instead, since a thumbnail can only stand for one file at a time.
+
+ Private Shared ReadOnly SceneImageExtensions As String() = {".png", ".jpg", ".jpeg", ".bmp", ".tif", ".tiff", ".gif"}
+ Private Shared ReadOnly OutputImageExtensions As String() = {".png"}
+ Private Shared ReadOnly OutputVideoExtensions As String() = {".mp4", ".avi"}
+
+ ''' <summary>Sets up the PictureBox for pnlPreview and does the tab's first population. Called once, from
+ ''' Form1_Load.</summary>
+ Private Sub InitializeOutputsTab()
+ _outputPreviewPic = New PictureBox()
+ _outputPreviewPic.Dock = DockStyle.Fill
+ _outputPreviewPic.SizeMode = PictureBoxSizeMode.Zoom
+ pnlPreview.Controls.Add(_outputPreviewPic)
+
+ RefreshOutputProjectList()
+ UpdateShareWithEditorsButton()
+ End Sub
+
+ ''' <summary>Repopulates lstAllProjects3, sorted per _outputProjectSortColumn/Ascending, and selects a project
+ ''' afterwards: preferredName when one is given (used to default to the currently open project when the tab is
+ ''' focused - see tabMainFunctions_SelectedIndexChanged), otherwise whatever was already selected there, when
+ ''' that project is still in the refreshed list.</summary>
+ Private Sub RefreshOutputProjectList(Optional preferredName As String = "")
+ Dim selectedName As String = If(preferredName.Length > 0, preferredName, SelectedProjectName(lstAllProjects3))
+
+ Dim entries As List(Of ProjectListEntry) = BuildProjectEntries()
+ SortProjectEntries(entries, _outputProjectSortColumn, _outputProjectSortAscending)
+ PopulateProjectListView(lstAllProjects3, entries)
+
+ UpdateOutputProjectSortHeaders()
+ SelectProjectInList(lstAllProjects3, selectedName)
+ End Sub
+
+ ''' <summary>Clicking a column header sorts by it; clicking the same header again reverses the direction.</summary>
+ Private Sub lstAllProjects3_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstAllProjects3.ColumnClick
+ If e.Column = _outputProjectSortColumn Then
+ _outputProjectSortAscending = Not _outputProjectSortAscending
+ Else
+ _outputProjectSortColumn = e.Column
+ _outputProjectSortAscending = True
+ End If
+ RefreshOutputProjectList()
+ End Sub
+
+ Private Sub UpdateOutputProjectSortHeaders()
+ Dim arrow As String = If(_outputProjectSortAscending, " ^", " v")
+ colProjectName2.Text = "Project name" & If(_outputProjectSortColumn = 0, arrow, "")
+ colLastEdited2.Text = "Last edited" & If(_outputProjectSortColumn = 1, arrow, "")
+ End Sub
+
+ ''' <summary>The folder of the project currently selected in lstAllProjects3, or "" when nothing is selected.</summary>
+ Private Function SelectedOutputProjectFolder() As String
+ Dim name As String = SelectedProjectName(lstAllProjects3)
+ If name.Length = 0 Then Return ""
+ Return ProjectStore.FolderPathFor(_settings.ProjectRoot, name)
+ End Function
+
+ ''' <summary>Clicking a project fills the three file lists from its output folders and clears the preview
+ ''' (the previously selected scene/image no longer applies to the newly selected project).</summary>
+ Private Sub lstAllProjects3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstAllProjects3.SelectedIndexChanged
+ RefreshOutputFileLists()
+ End Sub
+
+ ''' <summary>Refills lstScenes/lstImages/lstVideo from whichever project is currently selected in
+ ''' lstAllProjects3, and clears the preview and the Copy-to-clipboard button. Used both after picking a
+ ''' different project and after anything that changes the files themselves (delete, load external) - in
+ ''' both cases the previous selection no longer applies, so there is nothing to preserve here (contrast
+ ''' RefillSceneList/RefillImageList/RefillVideoList, used by the column-click sort handlers, which do keep
+ ''' the selection).</summary>
+ Private Sub RefreshOutputFileLists()
+ Dim folder As String = SelectedOutputProjectFolder()
+
+ FillFileList(lstScenes, folder, ProjectStore.SceneImageFolderName, SceneImageExtensions, _sceneSortColumn, _sceneSortAscending)
+ FillFileList(lstImages, folder, ProjectStore.OutputFramesFolderName, OutputImageExtensions, _imageSortColumn, _imageSortAscending)
+ FillFileList(lstVideo, folder, ProjectStore.OutputVideoFolderName, OutputVideoExtensions, _videoSortColumn, _videoSortAscending)
+ UpdateFileListSortHeaders(colSceneName, "Scene file name", colSceneCreated, "Created on", _sceneSortColumn, _sceneSortAscending)
+ UpdateFileListSortHeaders(colImageName, "Image file name", colCreatedOn, "Created on", _imageSortColumn, _imageSortAscending)
+ UpdateFileListSortHeaders(colVideoName, "Video file name", colCreatedOn2, "Created on", _videoSortColumn, _videoSortAscending)
+ ClearOutputPreview()
+ UpdateCopyToClipboardButton()
+ End Sub
+
+ ''' <summary>Fills a ListView with the matching files of one project subfolder: just the file name when the
+ ''' list has one column, plus a "Created on" sub-item when it has two (lstScenes, lstImages, lstVideo all do).
+ ''' sortColumn/sortAscending pick the order: 0 sorts by file name, 1 (only meaningful when there is a
+ ''' "Created on" column) sorts by creation date. Each item's Tag is the file's full path, for ShowOutputPreview
+ ''' /lstVideo_SelectedIndexChanged (and the delete/open/view buttons) to read back.</summary>
+ Private Sub FillFileList(list As ListView, projectFolder As String, subfolderName As String, extensions As String(),
+ sortColumn As Integer, sortAscending As Boolean)
+ list.BeginUpdate()
+ Try
+ list.Items.Clear()
+ If projectFolder.Length = 0 Then Return
+
+ Dim folder As String = Path.Combine(projectFolder, subfolderName)
+ If Not Directory.Exists(folder) Then Return
+
+ Dim files As New List(Of String)(Directory.GetFiles(folder))
+ files.RemoveAll(Function(f As String) Array.IndexOf(extensions, Path.GetExtension(f).ToLowerInvariant()) < 0)
+
+ Dim byCreatedDate As Boolean = (list.Columns.Count > 1) AndAlso (sortColumn = 1)
+ files.Sort(Function(a As String, b As String) CompareFileEntries(a, b, byCreatedDate, sortAscending))
+
+ For Each f As String In files
+ Dim item As New ListViewItem(Path.GetFileName(f))
+ If list.Columns.Count > 1 Then
+ item.SubItems.Add(File.GetCreationTime(f).ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture))
+ End If
+ item.Tag = f
+ list.Items.Add(item)
+ Next
+ Finally
+ list.EndUpdate()
+ End Try
+ End Sub
+
+ ''' <summary>Compares two files by name (the usual case) or by creation date, ascending or descending - the
+ ''' sort FillFileList applies.</summary>
+ Private Shared Function CompareFileEntries(a As String, b As String, byCreatedDate As Boolean, ascending As Boolean) As Integer
+ Dim result As Integer
+ If byCreatedDate Then
+ result = File.GetCreationTime(a).CompareTo(File.GetCreationTime(b))
+ Else
+ result = String.Compare(Path.GetFileName(a), Path.GetFileName(b), StringComparison.OrdinalIgnoreCase)
+ End If
+ If Not ascending Then result = -result
+ Return result
+ End Function
+
+ ''' <summary>Sets a name column's and a "Created on" column's header text, with a sort-direction arrow appended
+ ''' to whichever one is currently sorted (sortColumn 0 = name, 1 = created on). Always sets both from their
+ ''' base label, so the arrow never compounds across repeated calls.</summary>
+ Private Sub UpdateFileListSortHeaders(nameColumn As ColumnHeader, nameLabel As String, dateColumn As ColumnHeader, dateLabel As String,
+ sortColumn As Integer, ascending As Boolean)
+ Dim arrow As String = If(ascending, " ^", " v")
+ nameColumn.Text = nameLabel & If(sortColumn = 0, arrow, "")
+ dateColumn.Text = dateLabel & If(sortColumn = 1, arrow, "")
+ End Sub
+
+ ''' <summary>The full paths (ListViewItem.Tag) of a file list's currently selected item(s), so a sort refill
+ ''' can restore the selection afterwards (see ReselectFiles).</summary>
+ Private Function SelectedFilePaths(list As ListView) As List(Of String)
+ Dim result As New List(Of String)()
+ For Each item As ListViewItem In list.SelectedItems
+ Dim p As String = TryCast(item.Tag, String)
+ If Not String.IsNullOrEmpty(p) Then result.Add(p)
+ Next
+ Return result
+ End Function
+
+ ''' <summary>Re-selects whichever of a file list's items still have one of the given paths as their Tag - used
+ ''' after a sort refill to keep the same file(s) selected even though the rows have moved.</summary>
+ Private Sub ReselectFiles(list As ListView, paths As List(Of String))
+ If paths.Count = 0 Then Return
+ For Each item As ListViewItem In list.Items
+ Dim p As String = TryCast(item.Tag, String)
+ If p IsNot Nothing AndAlso paths.Contains(p, StringComparer.OrdinalIgnoreCase) Then item.Selected = True
+ Next
+ End Sub
+
+ ''' <summary>Re-sorts lstScenes per _sceneSortColumn/Ascending, keeping the current selection.</summary>
+ Private Sub RefillSceneList()
+ Dim selected As List(Of String) = SelectedFilePaths(lstScenes)
+ FillFileList(lstScenes, SelectedOutputProjectFolder(), ProjectStore.SceneImageFolderName, SceneImageExtensions,
+ _sceneSortColumn, _sceneSortAscending)
+ UpdateFileListSortHeaders(colSceneName, "Scene file name", colSceneCreated, "Created on", _sceneSortColumn, _sceneSortAscending)
+ ReselectFiles(lstScenes, selected)
+ End Sub
+
+ ''' <summary>Re-sorts lstImages per _imageSortColumn/Ascending, keeping the current selection.</summary>
+ Private Sub RefillImageList()
+ Dim selected As List(Of String) = SelectedFilePaths(lstImages)
+ FillFileList(lstImages, SelectedOutputProjectFolder(), ProjectStore.OutputFramesFolderName, OutputImageExtensions,
+ _imageSortColumn, _imageSortAscending)
+ UpdateFileListSortHeaders(colImageName, "Image file name", colCreatedOn, "Created on", _imageSortColumn, _imageSortAscending)
+ ReselectFiles(lstImages, selected)
+ End Sub
+
+ ''' <summary>Re-sorts lstVideo per _videoSortColumn/Ascending, keeping the current selection.</summary>
+ Private Sub RefillVideoList()
+ Dim selected As List(Of String) = SelectedFilePaths(lstVideo)
+ FillFileList(lstVideo, SelectedOutputProjectFolder(), ProjectStore.OutputVideoFolderName, OutputVideoExtensions,
+ _videoSortColumn, _videoSortAscending)
+ UpdateFileListSortHeaders(colVideoName, "Video file name", colCreatedOn2, "Created on", _videoSortColumn, _videoSortAscending)
+ ReselectFiles(lstVideo, selected)
+ End Sub
+
+ ''' <summary>Clicking a column header sorts that list by it; clicking the same header again reverses the
+ ''' direction - the same idea as lstAllProjects/lstAllProjects3's ColumnClick handlers.</summary>
+ Private Sub lstScenes_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstScenes.ColumnClick
+ ToggleFileSort(_sceneSortColumn, _sceneSortAscending, e.Column)
+ RefillSceneList()
+ End Sub
+
+ Private Sub lstImages_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstImages.ColumnClick
+ ToggleFileSort(_imageSortColumn, _imageSortAscending, e.Column)
+ RefillImageList()
+ End Sub
+
+ Private Sub lstVideo_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles lstVideo.ColumnClick
+ ToggleFileSort(_videoSortColumn, _videoSortAscending, e.Column)
+ RefillVideoList()
+ End Sub
+
+ ''' <summary>Shared toggle logic for the three ColumnClick handlers above: same column clicked again reverses
+ ''' direction, a different column switches to it (ascending).</summary>
+ Private Shared Sub ToggleFileSort(ByRef sortColumn As Integer, ByRef sortAscending As Boolean, clickedColumn As Integer)
+ If clickedColumn = sortColumn Then
+ sortAscending = Not sortAscending
+ Else
+ sortColumn = clickedColumn
+ sortAscending = True
+ End If
+ End Sub
+
+ ''' <summary>True while ClearOtherFileListSelections is clearing the other two file lists' selections, so
+ ''' those lists' own SelectedIndexChanged handlers (fired by that clearing) do nothing instead of clearing
+ ''' each other right back or re-touching the preview - see ClearOtherFileListSelections.</summary>
+ Private _clearingFileListSelection As Boolean
+
+ ''' <summary>Deselects lstScenes/lstImages/lstVideo except for "active" (the one the user just clicked in), so
+ ''' only one of the three ever shows a selection at a time - otherwise it is unclear which list's item
+ ''' pnlPreview is actually showing. The Projects list (lstAllProjects3) is not one of these three and keeps
+ ''' its own selection regardless.</summary>
+ Private Sub ClearOtherFileListSelections(active As ListView)
+ _clearingFileListSelection = True
+ Try
+ If Not active Is lstScenes Then lstScenes.SelectedItems.Clear()
+ If Not active Is lstImages Then lstImages.SelectedItems.Clear()
+ If Not active Is lstVideo Then lstVideo.SelectedItems.Clear()
+ Finally
+ _clearingFileListSelection = False
+ End Try
+ End Sub
+
+ Private Sub lstScenes_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstScenes.SelectedIndexChanged
+ If _clearingFileListSelection Then Return
+ ClearOtherFileListSelections(lstScenes)
+ ShowOutputPreview(lstScenes)
+ End Sub
+
+ Private Sub lstImages_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstImages.SelectedIndexChanged
+ If _clearingFileListSelection Then Return
+ ClearOtherFileListSelections(lstImages)
+ ShowOutputPreview(lstImages)
+ UpdateCopyToClipboardButton()
+ End Sub
+
+ ''' <summary>Loads the selected item's file (its Tag, from FillFileList) into pnlPreview.</summary>
+ Private Sub ShowOutputPreview(list As ListView)
+ If list.SelectedItems.Count = 0 Then Return
+ Dim imagePath As String = TryCast(list.SelectedItems(0).Tag, String)
+ If String.IsNullOrEmpty(imagePath) OrElse Not File.Exists(imagePath) Then
+ ClearOutputPreview()
+ Return
+ End If
+
+ Try
+ SetOutputPreviewImage(LoadImageCopy(imagePath))
+ Catch ex As Exception
+ ClearOutputPreview()
+ End Try
+ End Sub
+
+ ''' <summary>Shows a thumbnail-sized preview of the single selected video in pnlPreview, via the operating
+ ''' system's own shell thumbnail cache (GetShellThumbnail, further down) - there is no dependency-free way to
+ ''' decode/draw an actual video frame. Selecting zero or more than one video (lstVideo allows multi-select)
+ ''' clears the preview instead, since a single thumbnail cannot stand in for several files.</summary>
+ Private Sub lstVideo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lstVideo.SelectedIndexChanged
+ If _clearingFileListSelection Then Return
+ ClearOtherFileListSelections(lstVideo)
+
+ If lstVideo.SelectedItems.Count <> 1 Then
+ ClearOutputPreview()
+ Return
+ End If
+
+ Dim videoPath As String = TryCast(lstVideo.SelectedItems(0).Tag, String)
+ If String.IsNullOrEmpty(videoPath) OrElse Not File.Exists(videoPath) Then
+ ClearOutputPreview()
+ Return
+ End If
+
+ Try
+ Dim width As Integer = Math.Max(64, _outputPreviewPic.ClientSize.Width)
+ Dim height As Integer = Math.Max(64, _outputPreviewPic.ClientSize.Height)
+ SetOutputPreviewImage(GetShellThumbnail(videoPath, width, height), isVideo:=True)
+ Catch ex As Exception
+ ClearOutputPreview()
+ End Try
+ End Sub
+
+ ''' <summary>Shows an image in pnlPreview, disposing whatever was shown there before. isVideo marks whether
+ ''' this is a video's thumbnail rather than an actual scene/output image - see _outputPreviewIsVideo.</summary>
+ Private Sub SetOutputPreviewImage(image As Image, Optional isVideo As Boolean = False)
+ Dim old As Image = _outputPreviewPic.Image
+ _outputPreviewPic.Image = image
+ If old IsNot Nothing Then old.Dispose()
+
+ _outputPreviewIsVideo = isVideo
+ UpdateShareWithEditorsButton()
+ End Sub
+
+ Private Sub ClearOutputPreview()
+ If _outputPreviewPic IsNot Nothing Then SetOutputPreviewImage(Nothing)
+ End Sub
+
+ ' ---- the tab's buttons
+
+ ''' <summary>
+ ''' Deletes the scene image(s) selected in lstScenes, after confirmation. When the project browsed here is the
+ ''' one currently open in the editor, and one of the selected files is its scene image in use
+ ''' (radUseSceneImage/_scene.ImageFile), an extra line warns about that before asking to confirm; if the user
+ ''' still goes ahead, radUserDefinedScene is checked afterwards for that project - exactly what clicking it
+ ''' by hand does (see SceneMode_CheckedChanged) - so the editor is not left pointing at a deleted file.
+ ''' </summary>
+ Private Sub btnDeleteScene_Click(sender As Object, e As EventArgs) Handles btnDeleteScene.Click
+ If lstScenes.SelectedItems.Count = 0 Then
+ MessageBox.Show(Me, "Select a scene image in the list first.", "Delete scene",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim paths As New List(Of String)()
+ For Each item As ListViewItem In lstScenes.SelectedItems
+ paths.Add(DirectCast(item.Tag, String))
+ Next
+
+ Dim isOpenProject As Boolean = (_project IsNot Nothing) AndAlso
+ String.Equals(_project.FolderPath, SelectedOutputProjectFolder(), StringComparison.OrdinalIgnoreCase)
+ Dim currentImagePath As String = If(isOpenProject AndAlso _scene.UseImage,
+ SceneSettings.ToFullPath(_project.FolderPath, _scene.ImageFile), "")
+ Dim usesCurrentImage As Boolean = currentImagePath.Length > 0 AndAlso
+ paths.Exists(Function(p As String) String.Equals(p, currentImagePath, StringComparison.OrdinalIgnoreCase))
+
+ Dim message As String = If(paths.Count = 1,
+ "Permanently delete '" & Path.GetFileName(paths(0)) & "'?",
+ "Permanently delete these " & paths.Count.ToString(CultureInfo.InvariantCulture) & " scene images?")
+ If usesCurrentImage Then
+ message &= vbCrLf & vbCrLf & "This is the scene image currently used by the open project. Deleting it " &
+ "will switch the scene to ""User defined"" instead."
+ End If
+
+ Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete scene", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return
+
+ Dim errors As New List(Of String)()
+ For Each p As String In paths
+ Try
+ File.Delete(p)
+ Catch ex As Exception
+ errors.Add(Path.GetFileName(p) & ": " & ex.Message)
+ End Try
+ Next
+
+ If usesCurrentImage Then radUserDefinedScene.Checked = True
+
+ RefreshOutputFileLists()
+ ShowDeleteErrorsIfAny(errors, "Delete scene")
+ End Sub
+
+ ''' <summary>Same as "Load scene image" on the Configuration tab (btnLoadSceneImage): browses for an image and
+ ''' sets it as the currently open project's scene image. Refreshes lstScenes afterwards when the project
+ ''' browsed here happens to be that same open project, so a newly copied-in file shows up right away.</summary>
+ Private Sub btnLoadExternal_Click(sender As Object, e As EventArgs) Handles btnLoadExternal.Click
+ btnLOadSceneImage_Click(sender, e)
+
+ If _project IsNot Nothing AndAlso
+ String.Equals(_project.FolderPath, SelectedOutputProjectFolder(), StringComparison.OrdinalIgnoreCase) Then
+ RefreshOutputFileLists()
+ End If
+ End Sub
+
+ ''' <summary>Deletes the image(s) selected in lstImages, after confirmation.</summary>
+ Private Sub btnDeleteImages_Click(sender As Object, e As EventArgs) Handles btnDeleteImages.Click
+ DeleteSelectedImages()
+ End Sub
+
+ ''' <summary>Same as btnDeleteImages, so the Del key does the same thing as the button.</summary>
+ Private Sub lstImages_KeyDown(sender As Object, e As KeyEventArgs) Handles lstImages.KeyDown
+ If e.KeyCode = Keys.Delete Then
+ e.Handled = True
+ DeleteSelectedImages()
+ End If
+ End Sub
+
+ Private Sub DeleteSelectedImages()
+ If lstImages.SelectedItems.Count = 0 Then
+ MessageBox.Show(Me, "Select one or more images in the list first.", "Delete images",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim count As Integer = lstImages.SelectedItems.Count
+ Dim message As String = If(count = 1,
+ "Permanently delete '" & lstImages.SelectedItems(0).Text & "'?",
+ "Permanently delete these " & count.ToString(CultureInfo.InvariantCulture) & " images?")
+ Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete images", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return
+
+ Dim errors As New List(Of String)()
+ For Each item As ListViewItem In lstImages.SelectedItems
+ Dim path As String = DirectCast(item.Tag, String)
+ Try
+ File.Delete(path)
+ Catch ex As Exception
+ errors.Add(item.Text & ": " & ex.Message)
+ End Try
+ Next
+
+ RefreshOutputFileLists()
+ ShowDeleteErrorsIfAny(errors, "Delete images")
+ End Sub
+
+ ''' <summary>Copies the single selected image in lstImages to the clipboard (for pasting into Paint,
+ ''' Photoshop, and so on). Only enabled while exactly one image is selected - see UpdateCopyToClipboardButton.</summary>
+ Private Sub btnCopyToClipboard_Click(sender As Object, e As EventArgs) Handles btnCopyToClipboard.Click
+ If lstImages.SelectedItems.Count <> 1 Then Return
+ Dim imagePath As String = TryCast(lstImages.SelectedItems(0).Tag, String)
+ If String.IsNullOrEmpty(imagePath) OrElse Not File.Exists(imagePath) Then Return
+
+ Try
+ Using bmp As Bitmap = LoadImageCopy(imagePath)
+ Clipboard.SetImage(bmp)
+ End Using
+ ToolStripStatusLabel1.Text = "Copied '" & Path.GetFileName(imagePath) & "' to the clipboard."
+ Catch ex As Exception
+ MessageBox.Show(Me, "The image could not be copied to the clipboard:" & vbCrLf & vbCrLf & ex.Message,
+ "Copy to clipboard", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ''' <summary>btnCopyToClipboard only makes sense for exactly one selected image.</summary>
+ Private Sub UpdateCopyToClipboardButton()
+ btnCopyToClipboard.Enabled = (lstImages.SelectedItems.Count = 1)
+ End Sub
+
+ ''' <summary>Opens the selected project's output_frames folder in Explorer, in "Large icons" view (see
+ ''' OpenFolderInExplorer).</summary>
+ Private Sub btnOpenImageFolder2_Click(sender As Object, e As EventArgs) Handles btnOpenImageFolder2.Click
+ Dim projectFolder As String = SelectedOutputProjectFolder()
+ If projectFolder.Length = 0 Then
+ MessageBox.Show(Me, "Select a project in the list first.", "Open image folder",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ Try
+ OpenFolderInExplorer(Path.Combine(projectFolder, ProjectStore.OutputFramesFolderName), FVM_ICON)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The image folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open image folder",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ''' <summary>Deletes the video(s) selected in lstVideo, after confirmation.</summary>
+ Private Sub btnDeleteVideos_Click(sender As Object, e As EventArgs) Handles btnDeleteVideos.Click
+ DeleteSelectedVideos()
+ End Sub
+
+ ''' <summary>Same as btnDeleteVideos, so the Del key does the same thing as the button.</summary>
+ Private Sub lstVideo_KeyDown(sender As Object, e As KeyEventArgs) Handles lstVideo.KeyDown
+ If e.KeyCode = Keys.Delete Then
+ e.Handled = True
+ DeleteSelectedVideos()
+ End If
+ End Sub
+
+ Private Sub DeleteSelectedVideos()
+ If lstVideo.SelectedItems.Count = 0 Then
+ MessageBox.Show(Me, "Select one or more videos in the list first.", "Delete videos",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim count As Integer = lstVideo.SelectedItems.Count
+ Dim message As String = If(count = 1,
+ "Permanently delete '" & lstVideo.SelectedItems(0).Text & "'?",
+ "Permanently delete these " & count.ToString(CultureInfo.InvariantCulture) & " videos?")
+ Dim answer As DialogResult = MessageBox.Show(Me, message, "Delete videos", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return
+
+ Dim errors As New List(Of String)()
+ For Each item As ListViewItem In lstVideo.SelectedItems
+ Dim path As String = DirectCast(item.Tag, String)
+ Try
+ File.Delete(path)
+ Catch ex As Exception
+ errors.Add(item.Text & ": " & ex.Message)
+ End Try
+ Next
+
+ RefreshOutputFileLists()
+ ShowDeleteErrorsIfAny(errors, "Delete videos")
+ End Sub
+
+ ''' <summary>Opens the video selected in lstVideo with whatever program Windows uses for it - same as
+ ''' btnViewFieldVideo/btnViewIntensityVideo on the Preview tab (OpenVideo).</summary>
+ Private Sub btnViewVIdeoInPlayer2_Click(sender As Object, e As EventArgs) Handles btnViewVIdeoInPlayer2.Click
+ If lstVideo.SelectedItems.Count = 0 Then
+ MessageBox.Show(Me, "Select a video in the list first.", "View in player",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ OpenVideo(DirectCast(lstVideo.SelectedItems(0).Tag, String))
+ End Sub
+
+ ''' <summary>Double-clicking a video in lstVideo opens it in the player, same as btnViewVIdeoInPlayer2.</summary>
+ Private Sub lstVideo_DoubleClick(sender As Object, e As EventArgs) Handles lstVideo.DoubleClick
+ If lstVideo.SelectedItems.Count = 0 Then Return
+ OpenVideo(DirectCast(lstVideo.SelectedItems(0).Tag, String))
+ End Sub
+
+ ''' <summary>Renames the video file selected in lstVideo (exactly one), using a popup entry box - same
+ ''' PromptForText dialog as btnRenameProject.</summary>
+ Private Sub btnRenameVideo_Click(sender As Object, e As EventArgs) Handles btnRenameVideo.Click
+ If lstVideo.SelectedItems.Count <> 1 Then
+ MessageBox.Show(Me, "Select a single video in the list first.", "Rename video",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim oldPath As String = DirectCast(lstVideo.SelectedItems(0).Tag, String)
+ Dim oldName As String = Path.GetFileName(oldPath)
+
+ Dim newName As String = oldName
+ If Not PromptForText("Rename video", "New name for '" & oldName & "':", oldName, newName) Then Return
+ newName = newName.Trim()
+ If newName.Length = 0 OrElse newName = oldName Then Return
+ If newName.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0 Then
+ MessageBox.Show(Me, "That name contains characters that are not allowed in a file name.", "Rename video",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return
+ End If
+
+ Dim newPath As String = Path.Combine(Path.GetDirectoryName(oldPath), newName)
+ If File.Exists(newPath) Then
+ MessageBox.Show(Me, "A file named '" & newName & "' already exists.", "Rename video",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return
+ End If
+
+ Try
+ File.Move(oldPath, newPath)
+ RefreshOutputFileLists()
+ Catch ex As Exception
+ MessageBox.Show(Me, "The video could not be renamed:" & vbCrLf & vbCrLf & ex.Message, "Rename video",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ''' <summary>Opens the selected project's output_video folder in Explorer, in "Details" view - same as
+ ''' btnOpenVideoFolder on the Preview tab (OpenFolderInExplorer).</summary>
+ Private Sub btnOpenVIdeoFolder2_Click(sender As Object, e As EventArgs) Handles btnOpenVIdeoFolder2.Click
+ Dim projectFolder As String = SelectedOutputProjectFolder()
+ If projectFolder.Length = 0 Then
+ MessageBox.Show(Me, "Select a project in the list first.", "Open video folder",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ Try
+ OpenFolderInExplorer(Path.Combine(projectFolder, ProjectStore.OutputVideoFolderName), FVM_DETAILS)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The video folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open video folder",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ''' <summary>Puts a copy of whatever pnlPreview currently shows (a scene or an output image) into pnlSourceImage
+ ''' and pnlProbeImage - the same thing btnShareFieldImage/btnShareIntensityImage do for the live preview on the
+ ''' Preview tab (CopyPreviewToTabs, further down). Only enabled for a scene/image preview - see
+ ''' UpdateShareWithEditorsButton.</summary>
+ Private Sub btnShareWithEditors_Click(sender As Object, e As EventArgs) Handles btnShareWithEditors.Click
+ CopyPreviewToTabs(_outputPreviewPic)
+ End Sub
+
+ ''' <summary>btnShareWithEditors only makes sense for a scene/output image preview: a video's thumbnail has a
+ ''' different size than the simulation, so it is disabled while pnlPreview shows one (or nothing at all).</summary>
+ Private Sub UpdateShareWithEditorsButton()
+ btnShareWithEditors.Enabled = (Not _outputPreviewIsVideo) AndAlso (_outputPreviewPic IsNot Nothing) AndAlso
+ (_outputPreviewPic.Image IsNot Nothing)
+ End Sub
+
+ ''' <summary>Shared tail end of the three delete buttons: reports any files that could not be deleted (e.g.
+ ''' because they were open elsewhere), after the list has already been refreshed with whatever did succeed.</summary>
+ Private Sub ShowDeleteErrorsIfAny(errors As List(Of String), title As String)
+ If errors.Count = 0 Then Return
+ MessageBox.Show(Me, "Some files could not be deleted:" & vbCrLf & vbCrLf & String.Join(vbCrLf, errors),
+ title, MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Sub
+
+ ' ---- the video preview thumbnail, via the Windows shell (no video codec of our own)
+
+ ' Windows shell thumbnail interop (IShellItemImageFactory) - plain P/Invoke/COM interop against shell32.dll
+ ' and gdi32.dll, no NuGet package or project reference needed, but genuine COM interop nonetheless, which
+ ' could not be exercised on an actual Windows machine while writing it. GetShellThumbnail is written so a
+ ' wrong detail here surfaces as "no thumbnail for this file" (via the Try/Catch in lstVideo_SelectedIndexChanged)
+ ' rather than a crash - if the preview comes out consistently missing for videos, this is the place to revisit.
+
+ <StructLayout(LayoutKind.Sequential)>
+ Private Structure NativeSize
+ Public cx As Integer
+ Public cy As Integer
+ End Structure
+
+ <Flags>
+ Private Enum ThumbnailOptions As Integer
+ None = &H0
+ BiggerSizeOk = &H1
+ ThumbnailOnly = &H8
+ End Enum
+
+ <ComImport(), Guid("bcc18b79-ba16-442f-80c4-8a59c30c463b"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
+ Private Interface IShellItemImageFactory
+ Sub GetImage(<[In]> size As NativeSize, <[In]> flags As ThumbnailOptions, <Out> ByRef phbm As IntPtr)
+ End Interface
+
+ <DllImport("shell32.dll", CharSet:=CharSet.Unicode, PreserveSig:=False)>
+ Private Shared Sub SHCreateItemFromParsingName(
+ <MarshalAs(UnmanagedType.LPWStr)> path As String,
+ pbc As IntPtr,
+ <[In]> ByRef riid As Guid,
+ <MarshalAs(UnmanagedType.Interface)> <Out> ByRef ppv As Object)
+ End Sub
+
+ <DllImport("gdi32.dll")>
+ Private Shared Function DeleteObject(hObject As IntPtr) As Boolean
+ End Function
+
+ ''' <summary>Asks Windows for the same thumbnail Explorer would show for this file, at roughly the given size.
+ ''' Returns Nothing, never throws, when the shell has no thumbnail for it.</summary>
+ Private Shared Function GetShellThumbnail(filePath As String, width As Integer, height As Integer) As Bitmap
+ Dim riid As Guid = GetType(IShellItemImageFactory).GUID
+ Dim obj As Object = Nothing
+ SHCreateItemFromParsingName(filePath, IntPtr.Zero, riid, obj)
+ Dim factory As IShellItemImageFactory = TryCast(obj, IShellItemImageFactory)
+ If factory Is Nothing Then Return Nothing
+
+ Dim hbmp As IntPtr = IntPtr.Zero
+ Try
+ Dim size As New NativeSize With {.cx = width, .cy = height}
+ factory.GetImage(size, ThumbnailOptions.ThumbnailOnly Or ThumbnailOptions.BiggerSizeOk, hbmp)
+ If hbmp = IntPtr.Zero Then Return Nothing
+ Using raw As Bitmap = CType(Image.FromHbitmap(hbmp), Bitmap)
+ Return New Bitmap(raw)
+ End Using
+ Finally
+ If hbmp <> IntPtr.Zero Then DeleteObject(hbmp)
+ Marshal.ReleaseComObject(factory)
+ End Try
+ End Function
+
+ ' ------------------------------------------------------------------ scene properties (Configuration tab)
+ '
+ ' The settings are kept in _scene and stored in the "scene" section of the project's configuration file
+ ' (see SceneSettings) when the project is saved.
+
+ Private _scene As New SceneSettings()
+
+ ' True while the code itself fills the controls (their change events are then ignored)
+ Private _loadingScene As Boolean
+
+ ' the scene image (Nothing when none is loaded) and the generated picture of an empty user defined canvas
+ Private _sceneImage As Bitmap
+ Private _emptyPreview As Bitmap
+
+ Private ReadOnly _sceneTip As New ToolTip()
+
+ Private Sub InitializeSceneControls()
+ picImagePreview.BorderStyle = BorderStyle.FixedSingle
+ picImagePreview.BackColor = SystemColors.ControlLight
+ picImagePreview.SizeMode = PictureBoxSizeMode.Zoom
+
+ lblImageNameAndSize.AutoSize = False
+ lblImageNameAndSize.AutoEllipsis = True
+ lblImageNameAndSize.Size = New Size(470, 20)
+
+ txtXSize.MaxLength = 5
+ txtYsize.MaxLength = 5
+ txtDampingEdgeSize.MaxLength = 4
+
+ ' amplitude factor of the sources in the scene image
+ numScaleImageSource.Minimum = 0D
+ numScaleImageSource.Maximum = CDec(SceneSettings.MaxImageSourceScale)
+
+ ' No ShowSceneInControls() here: grpSceneProperties is disabled until a real project exists
+ ' (UpdateProjectAccess). Populating it now from a blank _scene would overwrite whatever defaults the
+ ' Designer gave these controls before StartNewProject/SetCurrentProject ever get a chance to read them
+ ' back out (see the matching comment in InitializeSimulationControls, where this actually matters -
+ ' numSimulationSteps' Designer default of 3000).
+ End Sub
+
+ ''' <summary>Reads the scene settings of the current project (and its image) and shows them.</summary>
+ Private Sub LoadSceneFromProject()
+ If _project Is Nothing Then Return
+
+ _scene = SceneSettings.FromConfig(_project.Config)
+
+ ReplaceSceneImage(Nothing)
+ If _scene.ImageFile.Length > 0 Then
+ Dim fullPath As String = SceneSettings.ToFullPath(_project.FolderPath, _scene.ImageFile)
+ If File.Exists(fullPath) Then
+ Try
+ ReplaceSceneImage(LoadImageCopy(fullPath))
+ Catch ex As Exception
+ ' the image label tells that the image could not be loaded
+ End Try
+ End If
+ End If
+
+ ShowSceneInControls()
+ End Sub
+
+ ''' <summary>Copies the values of _scene into the controls.</summary>
+ Private Sub ShowSceneInControls()
+ _loadingScene = True
+ Try
+ radUseSceneImage.Checked = _scene.UseImage
+ radUserDefinedScene.Checked = Not _scene.UseImage
+ txtXSize.Text = _scene.UserWidth.ToString(CultureInfo.InvariantCulture)
+ txtYsize.Text = _scene.UserHeight.ToString(CultureInfo.InvariantCulture)
+ chkDampingEdge.Checked = _scene.DampingEdgeEnabled
+ txtDampingEdgeSize.Text = _scene.DampingEdgeSize.ToString(CultureInfo.InvariantCulture)
+ chkUseImageSources.Checked = _scene.UseSources
+ numScaleImageSource.Value = ClampToRange(numScaleImageSource, _scene.ImageSourceScale)
+ chkUseObjectSources.Checked = _scene.UseObjectSources
+ numRefractiveIndex.Value = ClampToRange(numRefractiveIndex, _scene.BackgroundRefractiveIndex)
+ txtXSize.ForeColor = SystemColors.WindowText
+ txtYsize.ForeColor = SystemColors.WindowText
+ Finally
+ _loadingScene = False
+ End Try
+
+ UpdateSceneControlState()
+ UpdateScenePreview()
+ ShowDampingValidity()
+ End Sub
+
+ ''' <summary>Enables the controls that belong to the chosen canvas type and to the damping edge check box.</summary>
+ Private Sub UpdateSceneControlState()
+ Dim useImage As Boolean = _scene.UseImage
+ btnLoadSceneImage.Enabled = useImage
+ lblImageNameAndSize.Enabled = useImage
+
+ txtXSize.Enabled = Not useImage
+ txtYsize.Enabled = Not useImage
+ lblX.Enabled = Not useImage
+ lblPix.Enabled = Not useImage
+ numRefractiveIndex.Enabled = Not useImage ' a scene image has its own refractive index per pixel
+ Label20.Enabled = Not useImage
+
+ txtDampingEdgeSize.Enabled = _scene.DampingEdgeEnabled
+ Label1.Enabled = _scene.DampingEdgeEnabled
+
+ numScaleImageSource.Enabled = _scene.UseSources
+ lblScaleImgSourceIntensity.Enabled = _scene.UseSources
+ End Sub
+
+ ' ---- preview
+
+ Private Sub UpdateScenePreview()
+ UpdateImageLabel()
+
+ If _scene.UseImage Then
+ picImagePreview.SizeMode = PictureBoxSizeMode.Zoom
+ picImagePreview.Image = _sceneImage
+ DisposeEmptyPreview()
+ Else
+ ' user defined canvas: an empty picture with the proportions of the canvas
+ picImagePreview.SizeMode = PictureBoxSizeMode.CenterImage
+ Dim fresh As Bitmap = MakeEmptyCanvasPreview(_scene.UserWidth, _scene.UserHeight)
+ picImagePreview.Image = fresh
+ DisposeEmptyPreview()
+ _emptyPreview = fresh
+ End If
+ End Sub
+
+ Private Sub UpdateImageLabel()
+ If _scene.ImageFile.Length = 0 Then
+ lblImageNameAndSize.Text = "(no image loaded)"
+ ElseIf _sceneImage Is Nothing Then
+ lblImageNameAndSize.Text = "(image not found or not readable: " & Path.GetFileName(_scene.ImageFile) & ")"
+ Else
+ lblImageNameAndSize.Text = Path.GetFileName(_scene.ImageFile) & " (" &
+ _sceneImage.Width.ToString(CultureInfo.InvariantCulture) & " x " &
+ _sceneImage.Height.ToString(CultureInfo.InvariantCulture) & " px)"
+ End If
+ End Sub
+
+ Private Function MakeEmptyCanvasPreview(canvasWidth As Integer, canvasHeight As Integer) As Bitmap
+ Dim boxW As Integer = Math.Max(16, picImagePreview.ClientSize.Width - 8)
+ Dim boxH As Integer = Math.Max(16, picImagePreview.ClientSize.Height - 8)
+ Dim scale As Double = Math.Min(boxW / CDbl(canvasWidth), boxH / CDbl(canvasHeight))
+ Dim w As Integer = Math.Max(2, CInt(Math.Round(canvasWidth * scale)))
+ Dim h As Integer = Math.Max(2, CInt(Math.Round(canvasHeight * scale)))
+
+ Dim bmp As New Bitmap(w, h, PixelFormat.Format32bppArgb)
+ Using g As Graphics = Graphics.FromImage(bmp)
+ g.Clear(Color.White)
+ Using pen As New Pen(Color.Gray)
+ g.DrawRectangle(pen, 0, 0, w - 1, h - 1)
+ End Using
+ Using f As New Font("Microsoft Sans Serif", 9.0F), sf As New StringFormat()
+ sf.Alignment = StringAlignment.Center
+ sf.LineAlignment = StringAlignment.Center
+ g.DrawString(canvasWidth.ToString(CultureInfo.InvariantCulture) & " x " &
+ canvasHeight.ToString(CultureInfo.InvariantCulture) & " px (empty scene)",
+ f, Brushes.Gray, New RectangleF(0, 0, w, h), sf)
+ End Using
+ End Using
+ Return bmp
+ End Function
+
+ Private Sub DisposeEmptyPreview()
+ If _emptyPreview IsNot Nothing Then
+ _emptyPreview.Dispose()
+ _emptyPreview = Nothing
+ End If
+ End Sub
+
+ ''' <summary>Makes newImage the scene image and disposes the previous one.</summary>
+ Private Sub ReplaceSceneImage(newImage As Bitmap)
+ Dim old As Bitmap = _sceneImage
+ _sceneImage = newImage
+ If old IsNot Nothing Then
+ If Object.ReferenceEquals(picImagePreview.Image, old) Then picImagePreview.Image = Nothing
+ old.Dispose()
+ End If
+ UpdateGlowEdgesImage()
+ End Sub
+
+ ''' <summary>Disposes _glowEdgesImage and its cached resized copy (GetGlowOverlayResized) and sets both to
+ ''' Nothing, without touching _sceneImage - used both by UpdateGlowEdgesImage (about to rebuild it from the
+ ''' scene image) and by SceneMode_CheckedChanged (switching to radUserDefinedScene, where the overlay should
+ ''' disappear even though _sceneImage itself is kept around in case the user switches back).</summary>
+ Private Sub ClearGlowEdgesImage()
+ If _glowEdgesImage IsNot Nothing Then
+ _glowEdgesImage.Dispose()
+ _glowEdgesImage = Nothing
+ End If
+ If _glowOverlayCache IsNot Nothing Then
+ _glowOverlayCache.Dispose()
+ _glowOverlayCache = Nothing
+ End If
+ End Sub
+
+ ''' <summary>
+ ''' Rebuilds _glowEdgesImage (the "glowing edges" picture used as the Field/Intensity preview overlay - see
+ ''' ComputeGlowingEdges) from the current scene image. Called from ReplaceSceneImage, so this runs every time
+ ''' the scene image itself changes, and from SceneMode_CheckedChanged when switching back to
+ ''' radUseSceneImage. Also refreshes whatever is currently shown on the Field/Intensity previews, so a
+ ''' checked overlay updates immediately rather than only on the next simulation frame.
+ ''' </summary>
+ Private Sub UpdateGlowEdgesImage()
+ ClearGlowEdgesImage()
+ If _sceneImage IsNot Nothing Then _glowEdgesImage = ComputeGlowingEdges(_sceneImage)
+
+ RefreshPreviewOverlay(_picField, FieldOverlayGain())
+ RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())
+ End Sub
+
+ ''' <summary>How strongly to blend the glow-edges overlay into the Field preview: 0 when
+ ''' chkDiplayOverlayInField is unchecked (no overlay at all), otherwise numBrightnessFieldOverlay's value -
+ ''' see ComposeGlowOverlay's gain parameter.</summary>
+ Private Function FieldOverlayGain() As Double
+ Return If(chkDiplayOverlayInField.Checked, CDbl(numBrightnessFieldOverlay.Value), 0.0)
+ End Function
+
+ ''' <summary>The Intensity preview's counterpart to FieldOverlayGain.</summary>
+ Private Function IntensityOverlayGain() As Double
+ Return If(chkDiplayOverlayInIntensity.Checked, CDbl(numBrightnessIntensityOverlay.Value), 0.0)
+ End Function
+
+ ''' <summary>
+ ''' Builds a "glowing edges" picture of source: a same-size picture that is black except along its edges
+ ''' (fast color changes), where each of the three color channels is set to how sharp the change in THAT
+ ''' channel is there (a Sobel gradient magnitude, scaled and clamped to a byte). This is deliberately done
+ ''' per channel rather than as a single grayscale edge strength, so e.g. a hard red-to-black edge lights up
+ ''' mostly in red - keeping a hint of the original colors in the edge lines, the way Photoshop's "Glowing
+ ''' Edges" filter does. The GlowScale constant below is the one tunable "how bright" knob - a typical hard
+ ''' (full black-to-white) edge produces a raw Sobel magnitude of up to about 1442, and GlowScale brings that
+ ''' into the 0-255 byte range without every ordinary edge saturating to pure white; ask if this should be
+ ''' stronger/weaker. The outermost ring of pixels is left black (there is no full 3x3 neighborhood there).
+ ''' </summary>
+ Private Shared Function ComputeGlowingEdges(source As Bitmap) As Bitmap
+ Const GlowScale As Double = 0.25
+
+ Dim w As Integer = source.Width
+ Dim h As Integer = source.Height
+ Dim result As New Bitmap(w, h, PixelFormat.Format24bppRgb)
+ Using g As Graphics = Graphics.FromImage(result)
+ g.Clear(Color.Black)
+ End Using
+ If w < 3 OrElse h < 3 Then Return result ' too small for a 3x3 kernel - stays plain black
+
+ ' normalize the source into a plain 24bppRgb picture first (it may be indexed, 32bppArgb, ...)
+ Using normalized As New Bitmap(w, h, PixelFormat.Format24bppRgb)
+ Using g As Graphics = Graphics.FromImage(normalized)
+ g.DrawImageUnscaled(source, 0, 0)
+ End Using
+
+ Dim rect As New Rectangle(0, 0, w, h)
+ Dim srcData As BitmapData = normalized.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)
+ Dim dstData As BitmapData = result.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb)
+ Try
+ Dim srcStride As Integer = srcData.Stride
+ Dim dstStride As Integer = dstData.Stride
+ Dim srcBytes(srcStride * h - 1) As Byte
+ Dim dstBytes(dstStride * h - 1) As Byte
+ Marshal.Copy(srcData.Scan0, srcBytes, 0, srcBytes.Length)
+
+ ' 24bppRgb stores each pixel as three bytes, in B,G,R order
+ For y As Integer = 1 To h - 2
+ Dim rowUp As Integer = (y - 1) * srcStride
+ Dim rowMid As Integer = y * srcStride
+ Dim rowDown As Integer = (y + 1) * srcStride
+ Dim dstRow As Integer = y * dstStride
+ For x As Integer = 1 To w - 2
+ Dim cUp As Integer = rowUp + (x - 1) * 3
+ Dim cMid As Integer = rowMid + (x - 1) * 3
+ Dim cDown As Integer = rowDown + (x - 1) * 3
+ Dim dstOffset As Integer = dstRow + x * 3
+
+ For channel As Integer = 0 To 2
+ Dim p00 As Integer = srcBytes(cUp + channel)
+ Dim p01 As Integer = srcBytes(cUp + 3 + channel)
+ Dim p02 As Integer = srcBytes(cUp + 6 + channel)
+ Dim p10 As Integer = srcBytes(cMid + channel)
+ Dim p12 As Integer = srcBytes(cMid + 6 + channel)
+ Dim p20 As Integer = srcBytes(cDown + channel)
+ Dim p21 As Integer = srcBytes(cDown + 3 + channel)
+ Dim p22 As Integer = srcBytes(cDown + 6 + channel)
+
+ Dim gx As Integer = (p02 + 2 * p12 + p22) - (p00 + 2 * p10 + p20)
+ Dim gy As Integer = (p20 + 2 * p21 + p22) - (p00 + 2 * p01 + p02)
+ Dim magnitude As Double = Math.Sqrt(CDbl(gx) * gx + CDbl(gy) * gy) * GlowScale
+ dstBytes(dstOffset + channel) = CByte(Math.Min(255.0, magnitude))
+ Next
+ Next
+ Next
+
+ Marshal.Copy(dstBytes, 0, dstData.Scan0, dstBytes.Length)
+ Finally
+ normalized.UnlockBits(srcData)
+ result.UnlockBits(dstData)
+ End Try
+ End Using
+
+ Return result
+ End Function
+
+ ''' <summary>The glow-edges picture (_glowEdgesImage), resized to match a preview frame's size - cached and
+ ''' only rebuilt when that size changes, since the preview panels can ask for it on every single visualized
+ ''' step of a running simulation. Returns Nothing when there is no glow-edges picture (no scene image).</summary>
+ Private Function GetGlowOverlayResized(targetSize As Size) As Bitmap
+ If _glowEdgesImage Is Nothing Then Return Nothing
+ If _glowOverlayCache IsNot Nothing AndAlso _glowOverlayCacheSize.Equals(targetSize) Then Return _glowOverlayCache
+
+ If _glowOverlayCache IsNot Nothing Then _glowOverlayCache.Dispose()
+ Dim resized As New Bitmap(Math.Max(1, targetSize.Width), Math.Max(1, targetSize.Height), PixelFormat.Format24bppRgb)
+ Using g As Graphics = Graphics.FromImage(resized)
+ g.Clear(Color.Black)
+ g.InterpolationMode = InterpolationMode.HighQualityBilinear
+ g.DrawImage(_glowEdgesImage, New Rectangle(Point.Empty, targetSize))
+ End Using
+ _glowOverlayCache = resized
+ _glowOverlayCacheSize = targetSize
+ Return _glowOverlayCache
+ End Function
+
+ ''' <summary>Returns a new bitmap: a copy of frame with the glow-edges overlay (ComputeGlowingEdges,
+ ''' GetGlowOverlayResized) additively blended on top, each of the overlay's bytes multiplied by gain first
+ ''' (numBrightnessFieldOverlay/numBrightnessIntensityOverlay - 1 leaves ComputeGlowingEdges' own brightness
+ ''' as is, above 1 brightens the overlay, 0 removes it entirely). Multiplying (rather than e.g. adding a flat
+ ''' offset) is what keeps a still-black background black at any gain - 0 times anything is still 0 - while
+ ''' scaling up faint edges where the color change was small, which is the actual complaint this is for: a
+ ''' plain "brightness" slider that also lifted the black background to gray would defeat its own purpose
+ ''' here. The overlay's black pixels (no edge there) leave frame untouched, and its bright pixels brighten
+ ''' frame, clamped at 255 per channel. frame itself is never modified. Falls back to a plain copy of frame
+ ''' when there is no glow-edges picture to blend in.</summary>
+ Private Function ComposeGlowOverlay(frame As Bitmap, gain As Double) As Bitmap
+ Dim overlay As Bitmap = GetGlowOverlayResized(frame.Size)
+ Dim composed As New Bitmap(frame)
+ If overlay Is Nothing Then Return composed
+ Dim clampedGain As Double = Math.Max(0.0, gain)
+
+ Dim bytesPerDstPixel As Integer = Bitmap.GetPixelFormatSize(composed.PixelFormat) \ 8
+ If bytesPerDstPixel < 3 Then Return composed ' an indexed/unexpected format we can't safely blend into
+
+ Dim rect As New Rectangle(0, 0, frame.Width, frame.Height)
+ Dim dstData As BitmapData = composed.LockBits(rect, ImageLockMode.ReadWrite, composed.PixelFormat)
+ Dim srcData As BitmapData = overlay.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)
+ Try
+ Dim dstStride As Integer = dstData.Stride
+ Dim srcStride As Integer = srcData.Stride
+ Dim h As Integer = frame.Height
+ Dim w As Integer = frame.Width
+ Dim dstBytes(dstStride * h - 1) As Byte
+ Dim srcBytes(srcStride * h - 1) As Byte
+ Marshal.Copy(dstData.Scan0, dstBytes, 0, dstBytes.Length)
+ Marshal.Copy(srcData.Scan0, srcBytes, 0, srcBytes.Length)
+
+ For y As Integer = 0 To h - 1
+ Dim dRow As Integer = y * dstStride
+ Dim sRow As Integer = y * srcStride
+ For x As Integer = 0 To w - 1
+ Dim d As Integer = dRow + x * bytesPerDstPixel
+ Dim s As Integer = sRow + x * 3
+ ' both layouts are B,G,R... (composed may have a 4th, alpha byte - left untouched)
+ dstBytes(d) = CByte(Math.Min(255.0, CDbl(dstBytes(d)) + CDbl(srcBytes(s)) * clampedGain))
+ dstBytes(d + 1) = CByte(Math.Min(255.0, CDbl(dstBytes(d + 1)) + CDbl(srcBytes(s + 1)) * clampedGain))
+ dstBytes(d + 2) = CByte(Math.Min(255.0, CDbl(dstBytes(d + 2)) + CDbl(srcBytes(s + 2)) * clampedGain))
+ Next
+ Next
+
+ Marshal.Copy(dstBytes, 0, dstData.Scan0, dstBytes.Length)
+ Finally
+ composed.UnlockBits(dstData)
+ overlay.UnlockBits(srcData)
+ End Try
+
+ Return composed
+ End Function
+
+ ''' <summary>
+ ''' Shows frame in box, replacing/disposing whatever was shown before, and additively blends in the
+ ''' glow-edges overlay (ComposeGlowOverlay) when gain is above 0. box.Tag always holds the frame exactly as
+ ''' produced (never itself modified), so the overlay can be added, removed, or re-scaled again later purely
+ ''' from what is already shown - see RefreshPreviewOverlay - without needing a fresh frame from a run that
+ ''' may by then be paused or already finished.
+ ''' </summary>
+ Private Sub SetPreviewFrame(box As PictureBox, frame As Bitmap, gain As Double)
+ Dim oldImage As Image = box.Image
+ Dim oldRaw As Bitmap = TryCast(box.Tag, Bitmap)
+
+ box.Tag = frame
+ box.Image = If(gain > 0.0 AndAlso _glowEdgesImage IsNot Nothing, ComposeGlowOverlay(frame, gain), DirectCast(frame, Image))
+
+ If oldImage IsNot Nothing AndAlso Not Object.ReferenceEquals(oldImage, oldRaw) Then oldImage.Dispose()
+ If oldRaw IsNot Nothing Then oldRaw.Dispose()
+ End Sub
+
+ ''' <summary>Re-applies (or removes, or re-scales) the glow-edges overlay on whatever box is currently
+ ''' showing, using the raw frame kept in box.Tag (see SetPreviewFrame) - so this works without needing a new
+ ''' frame from a running simulation. Used when a "Display overlay" checkbox or its brightness box is
+ ''' changed, and when the glow-edges picture itself changes (UpdateGlowEdgesImage). Does nothing when box
+ ''' has nothing shown yet.</summary>
+ Private Sub RefreshPreviewOverlay(box As PictureBox, gain As Double)
+ If box Is Nothing Then Return
+ Dim raw As Bitmap = TryCast(box.Tag, Bitmap)
+ If raw Is Nothing Then Return
+
+ Dim oldImage As Image = box.Image
+ box.Image = If(gain > 0.0 AndAlso _glowEdgesImage IsNot Nothing, ComposeGlowOverlay(raw, gain), DirectCast(raw, Image))
+ If oldImage IsNot Nothing AndAlso Not Object.ReferenceEquals(oldImage, raw) Then oldImage.Dispose()
+ End Sub
+
+ Private Sub chkDiplayOverlayInField_CheckedChanged(sender As Object, e As EventArgs) Handles chkDiplayOverlayInField.CheckedChanged
+ RefreshPreviewOverlay(_picField, FieldOverlayGain())
+ End Sub
+
+ Private Sub chkDiplayOverlayInIntensity_CheckedChanged(sender As Object, e As EventArgs) Handles chkDiplayOverlayInIntensity.CheckedChanged
+ RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())
+ End Sub
+
+ ''' <summary>numBrightnessFieldOverlay/numBrightnessIntensityOverlay (Viewer tab, next to the "Display
+ ''' overlay" checkboxes) scale the glow-edges overlay's own brightness - 1 is the Designer default (no
+ ''' change), higher brightens faint edges, 0 is the same as unchecking the overlay entirely. See
+ ''' ComposeGlowOverlay's gain parameter for why a multiplier (not a flat offset) is used.</summary>
+ Private Sub numBrightnessFieldOverlay_ValueChanged(sender As Object, e As EventArgs) Handles numBrightnessFieldOverlay.ValueChanged
+ RefreshPreviewOverlay(_picField, FieldOverlayGain())
+ End Sub
+
+ Private Sub numBrightnessIntensityOverlay_ValueChanged(sender As Object, e As EventArgs) Handles numBrightnessIntensityOverlay.ValueChanged
+ RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())
+ End Sub
+
+ ''' <summary>Reads an image file into memory (the file is not kept open or locked).</summary>
+ Private Shared Function LoadImageCopy(fullPath As String) As Bitmap
+ Using fs As New FileStream(fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
+ Using source As Image = Image.FromStream(fs)
+ Return New Bitmap(source)
+ End Using
+ End Using
+ End Function
+
+ ''' <summary>The canvas size that the simulation would use now, or an empty size when it is not known (no image).</summary>
+ Private Function EffectiveCanvas() As Size
+ If _scene.UseImage Then
+ If _sceneImage Is Nothing Then Return Size.Empty
+ Return _sceneImage.Size
+ End If
+ Return New Size(_scene.UserWidth, _scene.UserHeight)
+ End Function
+
+ ''' <summary>
+ ''' Loads the scene image (as chosen on the Configuration tab) into pic, or - when no scene image is loaded (a
+ ''' user defined canvas, or the image could not be read) - a plain black image sized to the current canvas
+ ''' (EffectiveCanvas). Used by the "Import scene image" buttons on the Sources and Probes tabs.
+ ''' </summary>
+ Private Sub ImportSceneImageInto(pic As PictureBox)
+ Dim old As Image = pic.Image
+ Dim fresh As Bitmap
+
+ If _scene.UseImage AndAlso _sceneImage IsNot Nothing Then
+ fresh = New Bitmap(_sceneImage)
+ Else
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 OrElse canvas.Height <= 0 Then
+ MessageBox.Show(Me, "The canvas size is not known yet" & vbCrLf &
+ "(choose a scene image, or a user defined width and height, on the Configuration tab first).",
+ "Import scene image", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ fresh = New Bitmap(canvas.Width, canvas.Height)
+ Using g As Graphics = Graphics.FromImage(fresh)
+ g.Clear(Color.Black)
+ End Using
+ End If
+
+ pic.Image = fresh
+ pic.Invalidate()
+ If old IsNot Nothing Then old.Dispose()
+ End Sub
+
+ ''' <summary>
+ ''' Loads the scene image (as chosen on the Configuration tab), or a black placeholder sized to the current
+ ''' canvas when there is none, into pic - but only when pic does not already have an image. Called when the
+ ''' Sources or Probes tab is opened or switched to, so there is always something to see and pick a position in
+ ''' without an explicit "Import scene image" first, while never overwriting a picture the user already loaded
+ ''' or that a simulation run already produced.
+ ''' </summary>
+ Private Sub AutoLoadSceneImageIfEmpty(pic As PictureBox)
+ If pic Is Nothing OrElse pic.Image IsNot Nothing Then Return
+
+ If _scene.UseImage AndAlso _sceneImage IsNot Nothing Then
+ pic.Image = New Bitmap(_sceneImage)
+ pic.Invalidate()
+ Return
+ End If
+
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 OrElse canvas.Height <= 0 Then Return ' canvas size not known yet - nothing to show
+
+ Dim placeholder As New Bitmap(canvas.Width, canvas.Height)
+ Using g As Graphics = Graphics.FromImage(placeholder)
+ g.Clear(Color.Black)
+ End Using
+ pic.Image = placeholder
+ pic.Invalidate()
+ End Sub
+
+ ' ---- validation
+
+ Private Shared Function TryParseInt(text As String, minValue As Integer, maxValue As Integer, ByRef value As Integer) As Boolean
+ If Integer.TryParse(text.Trim(), NumberStyles.None, CultureInfo.InvariantCulture, value) Then
+ Return value >= minValue AndAlso value <= maxValue
+ End If
+ Return False
+ End Function
+
+ ''' <summary>Empty when the text is a usable damping edge size, otherwise a message.</summary>
+ Private Function DampingProblem(text As String, ByRef value As Integer) As String
+ If Not TryParseInt(text, 1, SceneSettings.MaxDampingEdgeSize, value) Then
+ Return "Enter a whole number of pixels, 1 or more."
+ End If
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width > 0 AndAlso 2 * value >= Math.Min(canvas.Width, canvas.Height) Then
+ Return "The damping edge must be less than half of the smaller canvas side (" &
+ Math.Min(canvas.Width, canvas.Height).ToString(CultureInfo.InvariantCulture) & " px)."
+ End If
+ Return ""
+ End Function
+
+ ''' <summary>Shows the damping edge size in red when it does not fit the canvas.</summary>
+ Private Sub ShowDampingValidity()
+ Dim value As Integer
+ If DampingProblem(txtDampingEdgeSize.Text, value).Length = 0 Then
+ txtDampingEdgeSize.ForeColor = SystemColors.WindowText
+ Else
+ txtDampingEdgeSize.ForeColor = Color.Red
+ End If
+ End Sub
+
+ ' ---- events
+
+ ''' <summary>Switching to radUserDefinedScene drops the glow-edges overlay (ClearGlowEdgesImage) - without it,
+ ''' a "Display overlay" checkbox left checked on the Preview tab would otherwise keep showing the old scene
+ ''' image's overlay, which no longer corresponds to anything in a user-defined scene, and that stale overlay
+ ''' would then also be baked into any picture shared afterwards into the Sources/Probes tabs (CopyPreviewToTabs).
+ ''' _sceneImage itself is kept (not disposed) so switching back to radUseSceneImage restores the overlay too,
+ ''' via UpdateGlowEdgesImage, without needing to reload the image file.</summary>
+ Private Sub SceneMode_CheckedChanged(sender As Object, e As EventArgs) Handles radUseSceneImage.CheckedChanged, radUserDefinedScene.CheckedChanged
+ If _loadingScene Then Return
+ Dim button As RadioButton = DirectCast(sender, RadioButton)
+ If Not button.Checked Then Return
+
+ _scene.UseImage = Object.ReferenceEquals(button, radUseSceneImage)
+ If _scene.UseImage Then
+ UpdateGlowEdgesImage()
+ Else
+ ClearGlowEdgesImage()
+ RefreshPreviewOverlay(_picField, FieldOverlayGain())
+ RefreshPreviewOverlay(_picIntensity, IntensityOverlayGain())
+ End If
+ UpdateSceneControlState()
+ UpdateScenePreview()
+ ShowDampingValidity()
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub btnLOadSceneImage_Click(sender As Object, e As EventArgs) Handles btnLoadSceneImage.Click
+ Dim projectFolder As String = If(_project Is Nothing, "", _project.FolderPath)
+
+ Using dlg As New OpenFileDialog()
+ dlg.Title = "Choose the scene image"
+ dlg.Filter = "Images (*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff;*.gif)|*.png;*.jpg;*.jpeg;*.bmp;*.tif;*.tiff;*.gif|All files (*.*)|*.*"
+ If _project IsNot Nothing Then
+ If Directory.Exists(_project.SceneImageFolder) Then
+ dlg.InitialDirectory = _project.SceneImageFolder
+ Else
+ dlg.InitialDirectory = _project.FolderPath
+ End If
+ End If
+ If dlg.ShowDialog(Me) <> DialogResult.OK Then Return
+
+ Dim loaded As Bitmap = Nothing
+ Try
+ loaded = LoadImageCopy(dlg.FileName)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The file could not be read as an image:" & vbCrLf & vbCrLf & ex.Message,
+ "Scene image", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return
+ End Try
+
+ ReplaceSceneImage(loaded)
+
+ ' an image from outside the project's own folder is copied in, so the project does not depend on a file
+ ' elsewhere on disk; the copy is what gets used and saved from here on
+ Dim imagePath As String = dlg.FileName
+ If _project IsNot Nothing AndAlso Not IsInsideFolder(imagePath, _project.FolderPath) Then
+ imagePath = CopyIntoSceneImageFolder(_project, imagePath)
+ End If
+
+ _scene.ImageFile = SceneSettings.ToStoredPath(projectFolder, imagePath)
+ _scene.UseImage = True
+ End Using
+
+ _loadingScene = True
+ Try
+ radUseSceneImage.Checked = True
+ Finally
+ _loadingScene = False
+ End Try
+
+ UpdateSceneControlState()
+ UpdateScenePreview()
+ ShowDampingValidity()
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub CanvasSize_TextChanged(sender As Object, e As EventArgs) Handles txtXSize.TextChanged, txtYsize.TextChanged
+ If _loadingScene Then Return
+ Dim box As TextBox = DirectCast(sender, TextBox)
+ Dim value As Integer
+
+ If TryParseInt(box.Text, SceneSettings.MinCanvasSize, SceneSettings.MaxCanvasSize, value) Then
+ box.ForeColor = SystemColors.WindowText
+ _sceneTip.Hide(box)
+ If Object.ReferenceEquals(box, txtXSize) Then
+ _scene.UserWidth = value
+ Else
+ _scene.UserHeight = value
+ End If
+ UpdateScenePreview()
+ ShowDampingValidity()
+ MarkProjectChanged()
+ Else
+ box.ForeColor = Color.Red
+ _sceneTip.Show("Enter a whole number of pixels from " & SceneSettings.MinCanvasSize.ToString(CultureInfo.InvariantCulture) &
+ " to " & SceneSettings.MaxCanvasSize.ToString(CultureInfo.InvariantCulture) & ".",
+ box, 0, box.Height + 2, 3000)
+ End If
+ End Sub
+
+ Private Sub chkDampingEdge_CheckedChanged(sender As Object, e As EventArgs) Handles chkDampingEdge.CheckedChanged
+ If _loadingScene Then Return
+ _scene.DampingEdgeEnabled = chkDampingEdge.Checked
+ UpdateSceneControlState()
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub DampingSize_TextChanged(sender As Object, e As EventArgs) Handles txtDampingEdgeSize.TextChanged
+ If _loadingScene Then Return
+ Dim value As Integer
+ Dim problem As String = DampingProblem(txtDampingEdgeSize.Text, value)
+
+ If problem.Length = 0 Then
+ _scene.DampingEdgeSize = value
+ txtDampingEdgeSize.ForeColor = SystemColors.WindowText
+ _sceneTip.Hide(txtDampingEdgeSize)
+ MarkProjectChanged()
+ Else
+ txtDampingEdgeSize.ForeColor = Color.Red
+ _sceneTip.Show(problem, txtDampingEdgeSize, 0, txtDampingEdgeSize.Height + 2, 3000)
+ End If
+ End Sub
+
+ ''' <summary>When a size box is left its text is put back to the last valid value, and the scene is saved.</summary>
+ Private Sub SceneText_Leave(sender As Object, e As EventArgs) Handles txtXSize.Leave, txtYsize.Leave, txtDampingEdgeSize.Leave
+ Dim box As TextBox = DirectCast(sender, TextBox)
+ _sceneTip.Hide(box)
+
+ _loadingScene = True
+ Try
+ If Object.ReferenceEquals(box, txtXSize) Then
+ box.Text = _scene.UserWidth.ToString(CultureInfo.InvariantCulture)
+ ElseIf Object.ReferenceEquals(box, txtYsize) Then
+ box.Text = _scene.UserHeight.ToString(CultureInfo.InvariantCulture)
+ Else
+ box.Text = _scene.DampingEdgeSize.ToString(CultureInfo.InvariantCulture)
+ End If
+ box.ForeColor = SystemColors.WindowText
+ Finally
+ _loadingScene = False
+ End Try
+
+ ShowDampingValidity()
+ End Sub
+
+ Private Sub chkUseSources_CheckedChanged(sender As Object, e As EventArgs) Handles chkUseImageSources.CheckedChanged
+ If _loadingScene Then Return
+ _scene.UseSources = chkUseImageSources.Checked
+ UpdateSceneControlState()
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub chkUseObjectSources_CheckedChanged(sender As Object, e As EventArgs) Handles chkUseObjectSources.CheckedChanged
+ If _loadingScene Then Return
+ _scene.UseObjectSources = chkUseObjectSources.Checked
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub ImageSourceScale_ValueChanged(sender As Object, e As EventArgs) Handles numScaleImageSource.ValueChanged
+ If _loadingScene Then Return
+ _scene.ImageSourceScale = CDbl(numScaleImageSource.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub RefractiveIndex_ValueChanged(sender As Object, e As EventArgs) Handles numRefractiveIndex.ValueChanged
+ If _loadingScene Then Return
+ _scene.BackgroundRefractiveIndex = CDbl(numRefractiveIndex.Value)
+ MarkProjectChanged()
+ End Sub
+
+ ''' <summary>The value limited to the range of the numeric box.</summary>
+ Private Shared Function ClampToRange(box As NumericUpDown, value As Double) As Decimal
+ Dim v As Decimal = If(value < CDbl(box.Minimum), box.Minimum, If(value > CDbl(box.Maximum), box.Maximum, CDec(value)))
+ Return v
+ End Function
+
+ Private Sub btnEditSourceList_Click(sender As Object, e As EventArgs) Handles btnEditObjectSourceList.Click
+ tabMainFunctions.SelectedTab = tabSourceList
+ End Sub
+
+ ' ------------------------------------------------------------------ scheme folder and list
+
+ Private Sub btbChooseFFolder_Click(sender As Object, e As EventArgs) Handles btbChooseFFolder.Click
+ Using dlg As New FolderBrowserDialog()
+ dlg.Description = "Choose the folder that contains the color scheme (.json) files"
+ If Directory.Exists(txtSchemeFolder.Text) Then dlg.SelectedPath = txtSchemeFolder.Text
+ If dlg.ShowDialog(Me) = DialogResult.OK Then
+ txtSchemeFolder.Text = dlg.SelectedPath
+ LoadSchemeList()
+ End If
+ End Using
+ End Sub
+
+ Private Sub txtSchemeFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles txtSchemeFolder.KeyDown
+ If e.KeyCode = Keys.Enter Then
+ e.SuppressKeyPress = True
+ LoadSchemeList()
+ End If
+ End Sub
+
+ ''' <summary>Reads all schemes from the folder in txtSchemeFolder and fills the list.</summary>
+ Private Sub LoadSchemeList()
+ Dim folder As String = txtSchemeFolder.Text.Trim()
+ If Not Directory.Exists(folder) Then
+ MessageBox.Show(Me, "The folder '" & folder & "' does not exist.", "Color schemes",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return
+ End If
+
+ Dim errors As New List(Of String)()
+ _schemes = ColorSchemeStore.LoadFolder(folder, errors)
+ SortSchemes(_schemes, _schemeSortColumn, _schemeSortAscending)
+
+ ListView1.BeginUpdate()
+ Try
+ ListView1.Items.Clear()
+ _thumbs.Images.Clear()
+ For Each old As Bitmap In _thumbBitmaps
+ old.Dispose()
+ Next
+ _thumbBitmaps.Clear()
+
+ For Each scheme As ColorScheme In _schemes
+ Dim thumb As Bitmap = MakeThumbnail(scheme)
+ _thumbBitmaps.Add(thumb)
+ _thumbs.Images.Add(thumb)
+
+ Dim item As New ListViewItem(scheme.Name, _thumbs.Images.Count - 1)
+ item.SubItems.Add(If(scheme.HasStops, ColorScheme.StopCount.ToString() & "-stop", "table"))
+ item.SubItems.Add(If(String.IsNullOrEmpty(scheme.SchemeType), "-", scheme.SchemeType))
+ item.Tag = scheme
+ ListView1.Items.Add(item)
+ Next
+ Finally
+ ListView1.EndUpdate()
+ End Try
+
+ UpdateSchemeListSortHeaders()
+
+ If errors.Count > 0 Then
+ Dim shown As Integer = Math.Min(errors.Count, 8)
+ Dim text As String = String.Join(vbCrLf, errors.GetRange(0, shown))
+ If errors.Count > shown Then text &= vbCrLf & "... and " & (errors.Count - shown).ToString() & " more"
+ MessageBox.Show(Me, "Some files could not be read as color schemes:" & vbCrLf & vbCrLf & text,
+ "Color schemes", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End If
+
+ RefreshSchemeCombos()
+
+ _previewScheme = Nothing
+ RefreshEditorState()
+ End Sub
+
+ ''' <summary>Sorts schemes in place: by name (sortColumn 0), or by type then name (sortColumn 2, or anything
+ ''' else) - "type then name" is also the tie-break used within a column-0 (name) sort's reversed order, same
+ ''' as SortProjectEntries's style.</summary>
+ Private Sub SortSchemes(schemes As List(Of ColorScheme), sortColumn As Integer, ascending As Boolean)
+ Dim result As Comparison(Of ColorScheme)
+ If sortColumn = 0 Then
+ result = Function(a As ColorScheme, b As ColorScheme) String.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)
+ Else
+ result = Function(a As ColorScheme, b As ColorScheme)
+ Dim c As Integer = String.Compare(a.SchemeType, b.SchemeType, StringComparison.OrdinalIgnoreCase)
+ If c <> 0 Then Return c
+ Return String.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase)
+ End Function
+ End If
+ schemes.Sort(result)
+ If Not ascending Then schemes.Reverse()
+ End Sub
+
+ ''' <summary>Clicking the Scheme or Type header sorts by it; clicking the same header again reverses the
+ ''' direction. The Kind column (1) is not sortable.</summary>
+ Private Sub ListView1_ColumnClick(sender As Object, e As ColumnClickEventArgs) Handles ListView1.ColumnClick
+ If e.Column <> 0 AndAlso e.Column <> 2 Then Return
+ If e.Column = _schemeSortColumn Then
+ _schemeSortAscending = Not _schemeSortAscending
+ Else
+ _schemeSortColumn = e.Column
+ _schemeSortAscending = True
+ End If
+ LoadSchemeList()
+ End Sub
+
+ ''' <summary>Marks the currently sorted column's header with a small arrow, the way lstAllProjects does.</summary>
+ Private Sub UpdateSchemeListSortHeaders()
+ If ListView1.Columns.Count < 3 Then Return
+ Dim arrow As String = If(_schemeSortAscending, " ^", " v")
+ ListView1.Columns(0).Text = "Scheme" & If(_schemeSortColumn = 0, arrow, "")
+ ListView1.Columns(2).Text = "Type" & If(_schemeSortColumn = 2, arrow, "")
+ End Sub
+
+ Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
+ If ListView1.SelectedItems.Count = 0 Then
+ _previewScheme = Nothing
+ Else
+ _previewScheme = DirectCast(ListView1.SelectedItems(0).Tag, ColorScheme)
+ End If
+ RefreshEditorState()
+ End Sub
+
+ Private Sub ListView1_DoubleClick(sender As Object, e As EventArgs) Handles ListView1.DoubleClick
+ LoadPreviewedScheme()
+ End Sub
+
+ ' ------------------------------------------------------------------ load / keep
+
+ Private Sub btnLoadScheme_Click(sender As Object, e As EventArgs) Handles btnLoadScheme.Click
+ If _previewScheme Is Nothing Then
+ MessageBox.Show(Me, "Select a scheme in the list first.", "Load scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ LoadPreviewedScheme()
+ End Sub
+
+ ' Escape in the list ends the preview and shows the current scheme again
+ Private Sub ListView1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListView1.KeyDown
+ If e.KeyCode = Keys.Escape Then
+ ListView1.SelectedItems.Clear()
+ e.Handled = True
+ End If
+ End Sub
+
+ ''' <summary>Makes a working copy of the previewed scheme the current scheme. Returns False if cancelled.</summary>
+ Private Function LoadPreviewedScheme() As Boolean
+ If _previewScheme Is Nothing Then Return False
+ If Not ConfirmDiscardChanges() Then Return False
+
+ Dim source As ColorScheme = _previewScheme
+ _current = source.Clone(source.Name)
+ _current.FilePath = source.FilePath
+ _dirty = False
+ _selectedStop = -1
+
+ ListView1.SelectedItems.Clear() ' ends the preview; also refreshes the display
+ RefreshEditorState()
+ Return True
+ End Function
+
+ Private Function ConfirmDiscardChanges() As Boolean
+ If Not _dirty Then Return True
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "The current color scheme '" & _current.Name & "' has unsaved changes. Discard them?",
+ "Unsaved changes", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ Return answer = DialogResult.Yes
+ End Function
+
+ ' ------------------------------------------------------------------ editing the stops
+
+ Private Sub StopButton_Click(sender As Object, e As EventArgs) Handles btnColor1.Click, btnCOlor2.Click, btnColor3.Click, btnColor4.Click, btnColor5.Click, btnColor6.Click, btnColor7.Click, btnColor9.Click, btnColor8.Click
+ Dim index As Integer = Array.IndexOf(_stopButtons, DirectCast(sender, Button))
+ If index < 0 Then Return
+
+ ' clicking a Color button while a list item is only previewed loads that scheme first
+ If _previewScheme IsNot Nothing Then
+ If Not LoadPreviewedScheme() Then Return
+ End If
+ If _current Is Nothing Then Return
+
+ ' an imported scheme is a full table without stops: editing it means making a stop-based approximation
+ If Not _current.HasStops Then
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "The scheme '" & _current.Name & "' is a full table of 255 colors without " &
+ ColorScheme.StopCount.ToString() & " editable stops." & vbCrLf & vbCrLf &
+ "Editing it creates a smooth " & ColorScheme.StopCount.ToString() & "-stop approximation as a new, " &
+ "unsaved scheme (the original file stays unchanged). Continue?",
+ "Edit scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
+ If answer <> DialogResult.Yes Then Return
+ _current = _current.ToStopScheme(_current.Name & " (" & ColorScheme.StopCount.ToString() & "-stop)")
+ _dirty = True
+ End If
+
+ _selectedStop = index
+ Dim c As Color = _current.Stops(index)
+ _picker.OriginalColor = c
+ _picker.SelectedColor = c
+ RefreshEditorState()
+ End Sub
+
+ Private Sub Picker_ColorChanged(sender As Object, e As EventArgs)
+ If _current Is Nothing OrElse Not _current.HasStops OrElse _selectedStop < 0 Then Return
+ _current.SetStop(_selectedStop, _picker.SelectedColor)
+ _dirty = True
+ RefreshEditorState()
+ End Sub
+
+ ' ------------------------------------------------------------------ save
+
+ Private Sub btnSaveCurrentScheme_Click(sender As Object, e As EventArgs) Handles btnSaveCurrentScheme.Click
+ If _current Is Nothing Then Return
+ If String.IsNullOrEmpty(_current.FilePath) Then
+ SaveAsNew()
+ Return
+ End If
+ Try
+ ColorSchemeStore.Save(_current, _current.FilePath)
+ _dirty = False
+ Catch ex As Exception
+ MessageBox.Show(Me, "The scheme could not be saved:" & vbCrLf & ex.Message, "Save scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Return
+ End Try
+ ReloadListAfterSave()
+ End Sub
+
+ Private Sub btnSaveAsColorScheme_Click(sender As Object, e As EventArgs) Handles btnSaveAsColorScheme.Click
+ SaveAsNew()
+ End Sub
+
+ Private Sub SaveAsNew()
+ If _current Is Nothing Then Return
+
+ Dim folder As String = txtSchemeFolder.Text.Trim()
+ If Not Directory.Exists(folder) Then
+ MessageBox.Show(Me, "Choose an existing scheme folder first.", "Save scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim newName As String = Microsoft.VisualBasic.Interaction.InputBox(
+ "Name for the new color scheme:", "Save as new scheme", _current.Name).Trim()
+ If newName.Length = 0 Then Return
+
+ Dim target As String = ColorSchemeStore.PathFor(folder, newName)
+ If File.Exists(target) Then
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "A scheme file named '" & Path.GetFileName(target) & "' already exists. Overwrite it?",
+ "Save scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return
+ End If
+
+ Try
+ Dim copy As ColorScheme = _current.Clone(newName)
+ If copy.HasStops AndAlso String.IsNullOrEmpty(copy.Category) Then copy.Category = "custom"
+ ColorSchemeStore.Save(copy, target)
+ _current = copy
+ _dirty = False
+ Catch ex As Exception
+ MessageBox.Show(Me, "The scheme could not be saved:" & vbCrLf & ex.Message, "Save scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Return
+ End Try
+ ReloadListAfterSave()
+ End Sub
+
+ Private Sub ReloadListAfterSave()
+ LoadSchemeList()
+ End Sub
+
+ ' ------------------------------------------------------------------ rename / delete (list toolbar)
+
+ ''' <summary>
+ ''' Renames the color scheme selected in the list (btnRenameColorScheme). Works directly on the scheme's JSON
+ ''' file: writes a new file under the new name and removes the old one. If the renamed scheme is also the one
+ ''' currently loaded in the editor (_current), that in-memory copy is renamed too, so a later Save does not
+ ''' resurrect the old file under the old name.
+ ''' </summary>
+ Private Sub btnRenameColorScheme_Click(sender As Object, e As EventArgs) Handles btnRenameColorScheme.Click
+ If _previewScheme Is Nothing Then
+ MessageBox.Show(Me, "Select a scheme in the list first.", "Rename color scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ Dim scheme As ColorScheme = _previewScheme
+ Dim oldName As String = scheme.Name
+ Dim oldPath As String = scheme.FilePath
+
+ Dim newName As String = oldName
+ If Not PromptForText("Rename color scheme", "New name for '" & oldName & "':", oldName, newName) Then Return
+ newName = newName.Trim()
+ If newName.Length = 0 OrElse newName = oldName Then Return
+
+ Dim folder As String = If(String.IsNullOrEmpty(oldPath), txtSchemeFolder.Text.Trim(), Path.GetDirectoryName(oldPath))
+ Dim newPath As String = ColorSchemeStore.PathFor(folder, newName)
+
+ If Not String.Equals(newPath, oldPath, StringComparison.OrdinalIgnoreCase) AndAlso File.Exists(newPath) Then
+ MessageBox.Show(Me, "A scheme file named '" & Path.GetFileName(newPath) & "' already exists.",
+ "Rename color scheme", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return
+ End If
+
+ Try
+ scheme.Name = newName
+ ColorSchemeStore.Save(scheme, newPath)
+ If Not String.IsNullOrEmpty(oldPath) AndAlso Not String.Equals(oldPath, newPath, StringComparison.OrdinalIgnoreCase) AndAlso File.Exists(oldPath) Then
+ File.Delete(oldPath)
+ End If
+
+ If _current IsNot Nothing AndAlso Not String.IsNullOrEmpty(oldPath) AndAlso
+ String.Equals(_current.FilePath, oldPath, StringComparison.OrdinalIgnoreCase) Then
+ _current.Name = newName
+ _current.FilePath = newPath
+ End If
+ Catch ex As Exception
+ MessageBox.Show(Me, "The scheme could not be renamed:" & vbCrLf & ex.Message, "Rename color scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Error)
+ Return
+ End Try
+
+ LoadSchemeList()
+ SelectSchemeInList(newName)
+ ToolStripStatusLabel1.Text = "Color scheme '" & oldName & "' renamed to '" & newName & "'."
+ End Sub
+
+ ''' <summary>
+ ''' Permanently deletes the color scheme selected in the list (btnDeleteColorScheme), after asking for
+ ''' confirmation. If the deleted scheme is also the one currently loaded in the editor, the editor keeps its
+ ''' in-memory copy on screen (nothing changes there) but that copy no longer has a file to save back over -
+ ''' the next save falls through to "save as new" instead.
+ ''' </summary>
+ Private Sub btnDeleteColorScheme_Click(sender As Object, e As EventArgs) Handles btnDeleteColorScheme.Click
+ If _previewScheme Is Nothing Then
+ MessageBox.Show(Me, "Select a scheme in the list first.", "Delete color scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ Dim scheme As ColorScheme = _previewScheme
+ Dim name As String = scheme.Name
+ Dim path As String = scheme.FilePath
+
+ If String.IsNullOrEmpty(path) OrElse Not File.Exists(path) Then
+ MessageBox.Show(Me, "That scheme has no file on disk (nothing to delete).", "Delete color scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "Permanently delete the color scheme '" & name & "'?" & vbCrLf & vbCrLf & path,
+ "Delete color scheme", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
+ If answer <> DialogResult.Yes Then Return
+
+ Try
+ File.Delete(path)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The scheme could not be deleted:" & vbCrLf & ex.Message, "Delete color scheme",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return
+ End Try
+
+ If _current IsNot Nothing AndAlso String.Equals(_current.FilePath, path, StringComparison.OrdinalIgnoreCase) Then
+ _current.FilePath = Nothing
+ End If
+
+ _previewScheme = Nothing
+ LoadSchemeList()
+ ToolStripStatusLabel1.Text = "Color scheme '" & name & "' deleted."
+ End Sub
+
+ ''' <summary>Selects, in ListView1, the item for the scheme with the given name (case-insensitive), if any.</summary>
+ Private Sub SelectSchemeInList(name As String)
+ For Each item As ListViewItem In ListView1.Items
+ Dim scheme As ColorScheme = TryCast(item.Tag, ColorScheme)
+ If scheme IsNot Nothing AndAlso String.Equals(scheme.Name, name, StringComparison.OrdinalIgnoreCase) Then
+ item.Selected = True
+ item.EnsureVisible()
+ Exit For
+ End If
+ Next
+ End Sub
+
+ ' ------------------------------------------------------------------ scheme type (field / intensity)
+
+ ' The radio buttons say what the current scheme is meant for. The choice is saved in the scheme file
+ ' as "scheme_type": "field" or "scheme_type": "intensity" and is shown again when the file is loaded.
+ Private Sub SchemeType_CheckedChanged(sender As Object, e As EventArgs) Handles radSchemeTypeField.CheckedChanged, radSchemeTypeIntensity.CheckedChanged
+ If _updatingRadios Then Return
+ If _current Is Nothing OrElse _previewScheme IsNot Nothing Then Return
+
+ Dim radio As RadioButton = DirectCast(sender, RadioButton)
+ If Not radio.Checked Then Return ' only react to the button that became checked
+
+ Dim newType As String = If(radio Is radSchemeTypeField, ColorScheme.SchemeTypeField, ColorScheme.SchemeTypeIntensity)
+ If _current.SchemeType <> newType Then
+ _current.SchemeType = newType
+ _dirty = True
+ RefreshEditorState()
+ End If
+ End Sub
+
+ ' ------------------------------------------------------------------ display
+
+ ''' <summary>The scheme shown in the scheme bar: the previewed one, otherwise the current one.</summary>
+ Private Function DisplayedScheme() As ColorScheme
+ If _previewScheme IsNot Nothing Then Return _previewScheme
+ Return _current
+ End Function
+
+ ''' <summary>Brings the buttons, texts, picker and scheme bar in line with the current state.</summary>
+ Private Sub RefreshEditorState()
+ Dim previewing As Boolean = (_previewScheme IsNot Nothing)
+ Dim shown As ColorScheme = DisplayedScheme()
+ Dim hasCurrent As Boolean = (_current IsNot Nothing)
+ Dim editing As Boolean = hasCurrent AndAlso Not previewing AndAlso _selectedStop >= 0
+
+ If hasCurrent Then
+ txtCurrentColorScheme.Text = _current.Name & If(_dirty, " (unsaved changes)", "")
+ Else
+ txtCurrentColorScheme.Text = "(none loaded)"
+ End If
+
+ For k As Integer = 0 To ColorScheme.StopCount - 1
+ Dim btn As Button = _stopButtons(k)
+ btn.Enabled = (shown IsNot Nothing)
+ If shown IsNot Nothing Then
+ Dim c As Color = StopColorOf(shown, k)
+ btn.BackColor = c
+ btn.ForeColor = ContrastColor(c)
+ Else
+ btn.BackColor = SystemColors.Control
+ btn.ForeColor = SystemColors.ControlText
+ End If
+ btn.FlatAppearance.BorderSize = If(editing AndAlso k = _selectedStop, 4, 1)
+ Next
+
+ _picker.Enabled = editing
+ If editing Then
+ lblColorPicker.Text = "Color Picker - editing Color " & (_selectedStop + 1).ToString() & StopRole(_selectedStop)
+ Else
+ lblColorPicker.Text = "Color Picker (click a Color button to edit it)"
+ End If
+
+ btnLoadScheme.Enabled = previewing
+ btnSaveCurrentScheme.Enabled = hasCurrent AndAlso _dirty
+ btnSaveAsColorScheme.Enabled = hasCurrent
+
+ ' radio buttons show the type of the displayed scheme; they can only be changed for the current scheme
+ _updatingRadios = True
+ Try
+ Dim shownType As String = If(shown Is Nothing, "", shown.SchemeType)
+ radSchemeTypeField.Checked = (shownType = ColorScheme.SchemeTypeField)
+ radSchemeTypeIntensity.Checked = (shownType = ColorScheme.SchemeTypeIntensity)
+ radSchemeTypeField.Enabled = hasCurrent AndAlso Not previewing
+ radSchemeTypeIntensity.Enabled = hasCurrent AndAlso Not previewing
+ Finally
+ _updatingRadios = False
+ End Try
+
+ pnlScheme.Invalidate()
+ End Sub
+
+ Private Sub pnlScheme_Paint(sender As Object, e As PaintEventArgs) Handles pnlScheme.Paint
+ Dim scheme As ColorScheme = DisplayedScheme()
+ Dim g As Graphics = e.Graphics
+ Dim r As Rectangle = pnlScheme.ClientRectangle
+ If scheme Is Nothing Then
+ g.Clear(SystemColors.ControlLight)
+ Return
+ End If
+
+ ' vertical gradient: top = entry 0 (Color 1), bottom = entry 254 (last Color), middle = entry 127 (centre Color)
+ Using strip As New Bitmap(1, ColorScheme.EntryCount, PixelFormat.Format32bppArgb)
+ For i As Integer = 0 To ColorScheme.EntryCount - 1
+ strip.SetPixel(0, i, scheme.GetEntry(i))
+ Next
+ g.InterpolationMode = InterpolationMode.NearestNeighbor
+ g.PixelOffsetMode = PixelOffsetMode.Half
+ g.DrawImage(strip, r)
+ End Using
+
+ ' tick marks at the stop positions (dark and light so they show on any color)
+ Dim editingHere As Boolean = (_previewScheme Is Nothing AndAlso _selectedStop >= 0)
+ For k As Integer = 0 To ColorScheme.StopCount - 1
+ Dim y As Integer = CInt(Math.Round(k * (r.Height - 1) / CDbl(ColorScheme.StopCount - 1)))
+ Dim selected As Boolean = editingHere AndAlso k = _selectedStop
+ Dim tick As Integer = If(selected, r.Width, 9)
+ Dim thick As Integer = If(selected, 3, 1)
+ Using darkPen As New Pen(Color.Black, CSng(thick + 2))
+ g.DrawLine(darkPen, 0, y, tick, y)
+ g.DrawLine(darkPen, r.Width - tick, y, r.Width, y)
+ End Using
+ Using lightPen As New Pen(Color.White, CSng(thick))
+ g.DrawLine(lightPen, 0, y, tick, y)
+ g.DrawLine(lightPen, r.Width - tick, y, r.Width, y)
+ End Using
+ Next
+
+ ' scale labels that depend on the scheme type
+ If scheme.SchemeType = ColorScheme.SchemeTypeField Then
+ DrawScaleLabel(g, r, "-1", 0, scheme)
+ DrawScaleLabel(g, r, "0", ColorScheme.EntryCount \ 2, scheme)
+ DrawScaleLabel(g, r, "+1", ColorScheme.EntryCount - 1, scheme)
+ ElseIf scheme.SchemeType = ColorScheme.SchemeTypeIntensity Then
+ DrawScaleLabel(g, r, "0", 0, scheme)
+ DrawScaleLabel(g, r, "max", ColorScheme.EntryCount - 1, scheme)
+ End If
+ End Sub
+
+ ''' <summary>Draws a small label on the scheme bar at the height of a table entry, readable on any color.</summary>
+ Private Sub DrawScaleLabel(g As Graphics, bar As Rectangle, text As String, entryIndex As Integer, scheme As ColorScheme)
+ Dim textSize As Size = TextRenderer.MeasureText(g, text, pnlScheme.Font)
+ Dim y As Integer = CInt(Math.Round(entryIndex * (bar.Height - 1) / CDbl(ColorScheme.EntryCount - 1)))
+ Dim top As Integer = y - textSize.Height \ 2
+ If top < 12 Then top = 12 ' keep clear of the end ticks
+ If top + textSize.Height > bar.Height - 12 Then top = bar.Height - 12 - textSize.Height
+ Dim box As New Rectangle(0, top, bar.Width, textSize.Height)
+ TextRenderer.DrawText(g, text, pnlScheme.Font, box, ContrastColor(scheme.GetEntry(entryIndex)),
+ TextFormatFlags.HorizontalCenter Or TextFormatFlags.VerticalCenter)
+ End Sub
+
+ ' ------------------------------------------------------------------ helpers
+
+ Private Shared Function StopColorOf(scheme As ColorScheme, k As Integer) As Color
+ If scheme.HasStops Then Return scheme.Stops(k)
+ Return scheme.SampleAt(k * (ColorScheme.EntryCount - 1) / CDbl(ColorScheme.StopCount - 1))
+ End Function
+
+ Private Shared Function StopRole(k As Integer) As String
+ If k = 0 Then Return " (start of the scale)"
+ If k = ColorScheme.StopCount - 1 Then Return " (end of the scale)"
+ If ColorScheme.StopCount Mod 2 = 1 AndAlso k = ColorScheme.StopCount \ 2 Then Return " (centre = zero field)"
+ Return ""
+ End Function
+
+ Private Shared Function ContrastColor(c As Color) As Color
+ Dim lum As Double = 0.299 * c.R + 0.587 * c.G + 0.114 * c.B
+ If lum > 140.0 Then Return Color.Black
+ Return Color.White
+ End Function
+
+ ''' <summary>A horizontal preview of a scheme for the list: left = entry 0, right = entry 254.</summary>
+ Private Shared Function MakeThumbnail(scheme As ColorScheme) As Bitmap
+ Dim bmp As New Bitmap(ThumbWidth, ThumbHeight, PixelFormat.Format32bppArgb)
+ Using g As Graphics = Graphics.FromImage(bmp)
+ For x As Integer = 0 To ThumbWidth - 1
+ Dim index As Integer = CInt(Math.Round(x * (ColorScheme.EntryCount - 1) / CDbl(ThumbWidth - 1)))
+ Using br As New SolidBrush(scheme.GetEntry(index))
+ g.FillRectangle(br, x, 0, 1, ThumbHeight)
+ End Using
+ Next
+ g.DrawRectangle(Pens.Gray, 0, 0, ThumbWidth - 1, ThumbHeight - 1)
+ End Using
+ Return bmp
+ End Function
+
+ ' ------------------------------------------------------------------ simulation
+ '
+ ' The settings on the Configuration tab (steps, video export, previews, color schemes) are kept in _simulation
+ ' and saved in configuration.json with the project. "Start simulation" hands a copy of everything to a
+ ' SimulationRunner, which does the work on a background thread. The runner reports back through events;
+ ' PostToUi passes them on to this thread.
+
+ Private _simulation As New SimulationSettings()
+
+ ' True while the code fills the controls, so that their events do not change the settings
+ Private _loadingSim As Boolean
+
+ ' The running simulation (Nothing when none runs) and the progress text shown in the title bar
+ Private _runner As SimulationRunner
+ Private _simStatus As String = ""
+
+ ' The videos of the last finished run (empty = none) and the settings of the run that is running or ran last
+ Private _fieldVideoFile As String = ""
+ Private _intensityVideoFile As String = ""
+ Private _runInfo As String = ""
+
+ ' state of the running simulation: paused, a stop was asked, and the last progress text
+ Private _paused As Boolean
+ Private _stopRequested As Boolean
+ Private _progressText As String = ""
+ Private _lastStepsDone As Integer
+
+ ' the color tables of the run that is running or ran last (for a still export while paused, so it matches the
+ ' colors of the live preview), and a full-resolution snapshot of its last frame (for a still export once the
+ ' run has fully stopped - see SimulationResult.LastFieldFrame/LastIntensityFrame)
+ Private _lastFieldLut As Integer()
+ Private _lastIntensityLut As Integer()
+ Private _lastFullFieldFrame As Bitmap
+ Private _lastFullIntensityFrame As Bitmap
+
+ ' The pictures on the Preview tab
+ Private _picField As PictureBox
+ Private _picIntensity As PictureBox
+
+ ' the "glowing edges" picture of the scene image (ComputeGlowingEdges), same size as _sceneImage, rebuilt
+ ' whenever the scene image changes (see ReplaceSceneImage/UpdateGlowEdgesImage); Nothing when there is no
+ ' scene image. Optionally overlaid on the Field/Intensity previews - chkDiplayOverlayInField/
+ ' chkDiplayOverlayInIntensity say whether to, per preview - see ComposeGlowOverlay/RefreshPreviewOverlay.
+ Private _glowEdgesImage As Bitmap
+
+ ' _glowEdgesImage resized to whatever size a preview frame last asked for (GetGlowOverlayResized) - rebuilding
+ ' this by resampling the full scene-image-sized picture on every single visualized step of a run would be
+ ' wasteful, so it is cached until either the target size or _glowEdgesImage itself changes.
+ Private _glowOverlayCache As Bitmap
+ Private _glowOverlayCacheSize As Size
+
+ ' The pictures on the Sources and Probes tabs (copies of a preview picture, for later evaluation)
+ Private _picSource As PictureBox
+ Private _picProbe As PictureBox
+
+ ' True once a simulation has run (and ended), so that the stop button becomes a restart button
+ Private _hasRun As Boolean
+
+ Private Sub InitializeSimulationControls()
+ numVisualizeEvery.Minimum = 1
+
+ ' brightness factors of the field and intensity pictures (render_field / render_intensity in the Python code)
+ numFieldScaling.Minimum = 0.1D
+ numFieldScaling.Maximum = 1000D
+ numIntensityScaling.Minimum = 0.1D
+ numIntensityScaling.Maximum = 1000D
+
+ ' numFieldScaling2/numIntensityScaling2 (Viewer tab) are a second set of controls for the very same
+ ' FieldBrightness/IntensityBrightness values as numFieldScaling/numIntensityScaling (Configuration tab) -
+ ' see numScaleFieldValues_ValueChanged/numScaleIntensity_ValueChanged and their "2" counterparts, which
+ ' keep both pairs in sync. Match the originals' range/precision so a value entered in either pair means
+ ' the same thing and is not rejected/rounded differently by the other.
+ numFieldScaling2.Minimum = numFieldScaling.Minimum
+ numFieldScaling2.Maximum = numFieldScaling.Maximum
+ numFieldScaling2.DecimalPlaces = numFieldScaling.DecimalPlaces
+ numFieldScaling2.Increment = numFieldScaling.Increment
+ numIntensityScaling2.Minimum = numIntensityScaling.Minimum
+ numIntensityScaling2.Maximum = numIntensityScaling.Maximum
+ numIntensityScaling2.DecimalPlaces = numIntensityScaling.DecimalPlaces
+ numIntensityScaling2.Increment = numIntensityScaling.Increment
+
+ ' offsets (black levels of the color tables): 2 decimals, otherwise the default of -0.05 would be rounded
+ For Each box As NumericUpDown In New NumericUpDown() {numOffsetField, numOffsetIntensity}
+ box.DecimalPlaces = 2
+ box.Minimum = -1D
+ box.Maximum = 1D
+ box.Increment = 0.01D
+ Next
+
+ numQuality.Minimum = 1D
+ numQuality.Maximum = 100D
+ numQuality.DecimalPlaces = 0
+
+ ' the summary of a run is shown in the status bar, its details in the tooltip
+ StatusStrip1.ShowItemToolTips = True
+ ToolStripStatusLabel1.Spring = True
+ ToolStripStatusLabel1.TextAlign = ContentAlignment.MiddleLeft
+ ToolStripStatusLabel1.Text = ""
+
+ UpdateRunButtons()
+
+ btnViewIntensityVideo.Text = "View intensity video in media player"
+ UpdateVideoButtons()
+ cmbFieldColorScheme.DropDownStyle = ComboBoxStyle.DropDownList
+ cmbIntensityColorScheme.DropDownStyle = ComboBoxStyle.DropDownList
+
+ _picField = MakePreviewBox(pnlPreviewField)
+ _picIntensity = MakePreviewBox(pnlPreviewIntensity)
+ _picSource = MakePreviewBox(pnlSourceImage)
+ _picProbe = MakePreviewBox(pnlProbeImage)
+ UpdateCopyButtons()
+
+ ' warn, in lblWarningField/lblWarningIntensity, when the last (or next) run will not export that video -
+ ' shown/hidden per video in UpdateSimulationControlState; these are Designer labels placed in the clear,
+ ' not (like the dynamic label this used to be) a control positioned over other controls at runtime
+ lblWarningField.Text = "Field video not exported"
+ lblWarningField.ForeColor = Color.DarkBlue
+ lblWarningIntensity.Text = "Intensity video not exported"
+ lblWarningIntensity.ForeColor = Color.DarkBlue
+
+ ' No ShowSimulationInControls() here: grpSimulationSettings is disabled until a real project exists
+ ' (UpdateProjectAccess). Steps and TimeDecayFactor have no software default of their own any more (see
+ ' their comments in SimulationSettings.vb) - populating the controls now, from the blank _simulation this
+ ' form starts with, would clamp numSimulationSteps/numTimeDecayFactor down from their Designer defaults
+ ' (3000 and 10) to their Minimum before StartNewProject ever gets a chance to read the Designer value back
+ ' out of them. StartNewProject/SetCurrentProject call ShowSimulationInControls() themselves once a real
+ ' project exists.
+ End Sub
+
+ ''' <summary>Puts a picture box that fills the panel (the picture is shown as large as fits) in a preview panel.</summary>
+ Private Shared Function MakePreviewBox(host As Panel) As PictureBox
+ host.BackColor = Color.Black
+ Dim box As New PictureBox()
+ box.Dock = DockStyle.Fill
+ box.SizeMode = PictureBoxSizeMode.Zoom
+ box.BackColor = Color.Black
+ host.Controls.Add(box)
+ Return box
+ End Function
+
+ ''' <summary>Copies the values of _simulation into the controls.</summary>
+ Private Sub ShowSimulationInControls()
+ _loadingSim = True
+ Try
+ ' the range of the numeric box is set in the designer; keep the settings inside it
+ Dim every As Integer = Math.Max(CInt(numVisualizeEvery.Minimum), Math.Min(CInt(numVisualizeEvery.Maximum), _simulation.VisualizeEvery))
+ _simulation.VisualizeEvery = every
+
+ numSimulationSteps.Value = ClampToRange(numSimulationSteps, _simulation.Steps)
+ numVisualizeEvery.Value = every
+
+ numFieldScaling.Value = ClampToRange(numFieldScaling, _simulation.FieldBrightness)
+ numIntensityScaling.Value = ClampToRange(numIntensityScaling, _simulation.IntensityBrightness)
+ numFieldScaling2.Value = ClampToRange(numFieldScaling2, _simulation.FieldBrightness)
+ numIntensityScaling2.Value = ClampToRange(numIntensityScaling2, _simulation.IntensityBrightness)
+ numQuality.Value = ClampToRange(numQuality, _simulation.VideoQuality)
+ numOffsetField.Value = ClampToRange(numOffsetField, _simulation.FieldBlackLevel)
+ numOffsetIntensity.Value = ClampToRange(numOffsetIntensity, _simulation.IntensityBlackLevel)
+ numTimeDecayFactor.Value = ClampToRange(numTimeDecayFactor, _simulation.TimeDecayFactor)
+
+ chkExportVideoField.Checked = _simulation.ExportField
+ chkExportVideoIntensity.Checked = _simulation.ExportIntensity
+ chkExportVideoField2.Checked = _simulation.ExportField
+ chkExportVideoIntensity2.Checked = _simulation.ExportIntensity
+ chkPreviewVideoField.Checked = _simulation.PreviewField
+ chkPreviewVideoIntensity.Checked = _simulation.PreviewIntensity
+ chkUseGPU.Checked = _simulation.UseGpu
+ chkUse4thOrderLaplacian.Checked = _simulation.Use4thOrderLaplacian
+
+ FillSchemeCombo(cmbFieldColorScheme, ColorScheme.SchemeTypeField, _simulation.FieldColorScheme)
+ FillSchemeCombo(cmbIntensityColorScheme, ColorScheme.SchemeTypeIntensity, _simulation.IntensityColorScheme)
+ Finally
+ _loadingSim = False
+ End Try
+
+ UpdateSimulationControlState()
+ End Sub
+
+ ''' <summary>A color scheme combo box is only useful when the field (or intensity) is exported or previewed.</summary>
+ Private Sub UpdateSimulationControlState()
+ cmbFieldColorScheme.Enabled = chkExportVideoField.Checked OrElse chkPreviewVideoField.Checked
+ cmbIntensityColorScheme.Enabled = chkExportVideoIntensity.Checked OrElse chkPreviewVideoIntensity.Checked
+
+ ' the quality only matters for exported videos
+ Dim exporting As Boolean = chkExportVideoField.Checked OrElse chkExportVideoIntensity.Checked
+ numQuality.Enabled = exporting
+ lblVideoQuality.Enabled = exporting
+ lblWarningField.Visible = Not chkExportVideoField.Checked
+ lblWarningIntensity.Visible = Not chkExportVideoIntensity.Checked
+ End Sub
+
+ ''' <summary>Fills the two color scheme combo boxes again from the loaded schemes (after loading or saving schemes).</summary>
+ Private Sub RefreshSchemeCombos()
+ Dim wasLoading As Boolean = _loadingSim
+ _loadingSim = True
+ Try
+ FillSchemeCombo(cmbFieldColorScheme, ColorScheme.SchemeTypeField, _simulation.FieldColorScheme)
+ FillSchemeCombo(cmbIntensityColorScheme, ColorScheme.SchemeTypeIntensity, _simulation.IntensityColorScheme)
+ Finally
+ _loadingSim = wasLoading
+ End Try
+ End Sub
+
+ ''' <summary>Lists the schemes of one type (field or intensity); schemes without a type are left out.</summary>
+ Private Sub FillSchemeCombo(combo As ComboBox, schemeType As String, selectedName As String)
+ combo.BeginUpdate()
+ Try
+ combo.Items.Clear()
+ Dim selected As ColorScheme = Nothing
+ For Each scheme As ColorScheme In _schemes
+ If String.Equals(scheme.SchemeType, schemeType, StringComparison.OrdinalIgnoreCase) Then
+ combo.Items.Add(scheme)
+ If String.Equals(scheme.Name, selectedName, StringComparison.OrdinalIgnoreCase) Then selected = scheme
+ End If
+ Next
+ If selected IsNot Nothing Then
+ combo.SelectedItem = selected
+ Else
+ combo.SelectedIndex = -1
+ End If
+ Finally
+ combo.EndUpdate()
+ End Try
+ End Sub
+
+ Private Function FindScheme(name As String, schemeType As String) As ColorScheme
+ For Each scheme As ColorScheme In _schemes
+ If String.Equals(scheme.Name, name, StringComparison.OrdinalIgnoreCase) AndAlso
+ String.Equals(scheme.SchemeType, schemeType, StringComparison.OrdinalIgnoreCase) Then Return scheme
+ Next
+ Return Nothing
+ End Function
+
+ ' ---- events of the settings controls
+
+ Private Sub tabMainFunctions_SelectedIndexChanged(sender As Object, e As EventArgs) Handles tabMainFunctions.SelectedIndexChanged
+ ' cmbFieldColorScheme/cmbIntensityColorScheme live on the Configuration tab. Schemes may have been added,
+ ' renamed or deleted on the Color Scheme tab since these were last filled - or even just added to the
+ ' folder from outside the app - so re-read the scheme folder from disk (RefreshSchemeCombos alone only
+ ' refills the combos from the in-memory list, which can be stale) rather than assume it is still current.
+ If tabMainFunctions.SelectedTab Is tabConfiguration Then
+ Dim folder As String = txtSchemeFolder.Text.Trim()
+ If Directory.Exists(folder) Then
+ LoadSchemeList()
+ Else
+ RefreshSchemeCombos()
+ End If
+ End If
+
+ ' lstAllProjects3 (Outputs tab) has the same staleness problem - a project may have appeared, been
+ ' renamed or been deleted since it was last filled, so re-read it fresh on every arrival too. Default the
+ ' selection to whichever project is currently open in the editor (falls back to the previous selection,
+ ' or none, when no project is open - see RefreshOutputProjectList).
+ If tabMainFunctions.SelectedTab Is tabOutput Then
+ RefreshOutputProjectList(If(_project IsNot Nothing, _project.Name, ""))
+ End If
+ End Sub
+
+ ''' <summary>numSimulationSteps replaces the old cmbSimulationSteps combo box, so the number of steps is no
+ ''' longer limited to a fixed preset list - the range (currently 1 to 50,000) is set in the Designer, and the
+ ''' control itself never allows an out-of-range or non-integer value, so unlike the old free-text combo this
+ ''' needs no separate parsing/validation/error-coloring here.</summary>
+ Private Sub numSimulationSteps_ValueChanged(sender As Object, e As EventArgs) Handles numSimulationSteps.ValueChanged
+ If _loadingSim Then Return
+ _simulation.Steps = CInt(numSimulationSteps.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub numVisualizeEvery_ValueChanged(sender As Object, e As EventArgs) Handles numVisualizeEvery.ValueChanged
+ If _loadingSim Then Return
+ _simulation.VisualizeEvery = CInt(numVisualizeEvery.Value)
+ MarkProjectChanged()
+ End Sub
+
+ ''' <summary>Copies a value into a NumericUpDown that mirrors another one (numFieldScaling/numFieldScaling2,
+ ''' numIntensityScaling/numIntensityScaling2 - Configuration tab and Viewer tab controls for the very same
+ ''' setting), without re-triggering that control's own ValueChanged - every simulation control's ValueChanged
+ ''' already checks _loadingSim first, so reusing it here as the reentrancy guard stops the two controls from
+ ''' setting each other back and forth.</summary>
+ Private Sub SetLinkedScalingValue(box As NumericUpDown, value As Decimal)
+ Dim clamped As Decimal = If(value < box.Minimum, box.Minimum, If(value > box.Maximum, box.Maximum, value))
+ If box.Value = clamped Then Return
+ Dim wasLoading As Boolean = _loadingSim
+ _loadingSim = True
+ Try
+ box.Value = clamped
+ Finally
+ _loadingSim = wasLoading
+ End Try
+ End Sub
+
+ ''' <summary>Copies a checked state into a CheckBox that mirrors another one (chkExportVideoField/
+ ''' chkExportVideoField2, chkExportVideoIntensity/chkExportVideoIntensity2 - Configuration tab and Viewer tab
+ ''' controls for the very same setting) - the same _loadingSim reentrancy-guard idea as SetLinkedScalingValue,
+ ''' for a CheckBox's Checked instead of a NumericUpDown's Value.</summary>
+ Private Sub SetLinkedCheckedValue(box As CheckBox, value As Boolean)
+ If box.Checked = value Then Return
+ Dim wasLoading As Boolean = _loadingSim
+ _loadingSim = True
+ Try
+ box.Checked = value
+ Finally
+ _loadingSim = wasLoading
+ End Try
+ End Sub
+
+ Private Sub numScaleFieldValues_ValueChanged(sender As Object, e As EventArgs) Handles numFieldScaling.ValueChanged
+ If _loadingSim Then Return
+ _simulation.FieldBrightness = CDbl(numFieldScaling.Value)
+ SetLinkedScalingValue(numFieldScaling2, numFieldScaling.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub numScaleFieldValues2_ValueChanged(sender As Object, e As EventArgs) Handles numFieldScaling2.ValueChanged
+ If _loadingSim Then Return
+ _simulation.FieldBrightness = CDbl(numFieldScaling2.Value)
+ SetLinkedScalingValue(numFieldScaling, numFieldScaling2.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub numQuality_ValueChanged(sender As Object, e As EventArgs) Handles numQuality.ValueChanged
+ If _loadingSim Then Return
+ _simulation.VideoQuality = CInt(numQuality.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub numOffsetField_ValueChanged(sender As Object, e As EventArgs) Handles numOffsetField.ValueChanged
+ If _loadingSim Then Return
+ _simulation.FieldBlackLevel = CDbl(numOffsetField.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub numOffsetIntensity_ValueChanged(sender As Object, e As EventArgs) Handles numOffsetIntensity.ValueChanged
+ If _loadingSim Then Return
+ _simulation.IntensityBlackLevel = CDbl(numOffsetIntensity.Value)
+ MarkProjectChanged()
+ End Sub
+
+ ''' <summary>"Intensity decay factor" - see SimulationSettings.TimeDecayFactor's comment.</summary>
+ Private Sub numTimeDecayFactor_ValueChanged(sender As Object, e As EventArgs) Handles numTimeDecayFactor.ValueChanged
+ If _loadingSim Then Return
+ _simulation.TimeDecayFactor = CDbl(numTimeDecayFactor.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub numScaleIntensity_ValueChanged(sender As Object, e As EventArgs) Handles numIntensityScaling.ValueChanged
+ If _loadingSim Then Return
+ _simulation.IntensityBrightness = CDbl(numIntensityScaling.Value)
+ SetLinkedScalingValue(numIntensityScaling2, numIntensityScaling.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub numScaleIntensity2_ValueChanged(sender As Object, e As EventArgs) Handles numIntensityScaling2.ValueChanged
+ If _loadingSim Then Return
+ _simulation.IntensityBrightness = CDbl(numIntensityScaling2.Value)
+ SetLinkedScalingValue(numIntensityScaling, numIntensityScaling2.Value)
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub SimulationOption_CheckedChanged(sender As Object, e As EventArgs) Handles chkExportVideoField.CheckedChanged,
+ chkExportVideoIntensity.CheckedChanged, chkPreviewVideoField.CheckedChanged, chkPreviewVideoIntensity.CheckedChanged
+ If _loadingSim Then Return
+ _simulation.ExportField = chkExportVideoField.Checked
+ _simulation.ExportIntensity = chkExportVideoIntensity.Checked
+ _simulation.PreviewField = chkPreviewVideoField.Checked
+ _simulation.PreviewIntensity = chkPreviewVideoIntensity.Checked
+ SetLinkedCheckedValue(chkExportVideoField2, chkExportVideoField.Checked)
+ SetLinkedCheckedValue(chkExportVideoIntensity2, chkExportVideoIntensity.Checked)
+ UpdateSimulationControlState()
+ MarkProjectChanged()
+ End Sub
+
+ ''' <summary>chkExportVideoField2/chkExportVideoIntensity2 (Viewer tab) mirror chkExportVideoField/
+ ''' chkExportVideoIntensity (Configuration tab) - the same pair-linking pattern as numFieldScaling/
+ ''' numFieldScaling2 (SetLinkedScalingValue/SetLinkedCheckedValue).</summary>
+ Private Sub chkExportVideoField2_CheckedChanged(sender As Object, e As EventArgs) Handles chkExportVideoField2.CheckedChanged
+ If _loadingSim Then Return
+ _simulation.ExportField = chkExportVideoField2.Checked
+ SetLinkedCheckedValue(chkExportVideoField, chkExportVideoField2.Checked)
+ UpdateSimulationControlState()
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub chkExportVideoIntensity2_CheckedChanged(sender As Object, e As EventArgs) Handles chkExportVideoIntensity2.CheckedChanged
+ If _loadingSim Then Return
+ _simulation.ExportIntensity = chkExportVideoIntensity2.Checked
+ SetLinkedCheckedValue(chkExportVideoIntensity, chkExportVideoIntensity2.Checked)
+ UpdateSimulationControlState()
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub chkUseGPU_CheckedChanged(sender As Object, e As EventArgs) Handles chkUseGPU.CheckedChanged
+ If _loadingSim Then Return
+ _simulation.UseGpu = chkUseGPU.Checked
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub chkUse4thOrderLaplacian_CheckedChanged(sender As Object, e As EventArgs) Handles chkUse4thOrderLaplacian.CheckedChanged
+ If _loadingSim Then Return
+ _simulation.Use4thOrderLaplacian = chkUse4thOrderLaplacian.Checked
+ MarkProjectChanged()
+ End Sub
+
+ Private Sub SchemeCombo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbFieldColorScheme.SelectedIndexChanged,
+ cmbIntensityColorScheme.SelectedIndexChanged
+ If _loadingSim Then Return
+ Dim combo As ComboBox = DirectCast(sender, ComboBox)
+ Dim scheme As ColorScheme = TryCast(combo.SelectedItem, ColorScheme)
+ If scheme Is Nothing Then Return
+
+ If combo Is cmbFieldColorScheme Then
+ _simulation.FieldColorScheme = scheme.Name
+ Else
+ _simulation.IntensityColorScheme = scheme.Name
+ End If
+ MarkProjectChanged()
+ End Sub
+
+ ' ---- start and stop
+
+ Private Sub btnStartSimulation_Click(sender As Object, e As EventArgs) Handles btnStartSimulation.Click
+ If _runner IsNot Nothing Then
+ ' the button is also a stop button while a simulation runs
+ RequestStop()
+ Return
+ End If
+ StartSimulation()
+ End Sub
+
+ ' ---- sharing a picture with the Sources and Probes tabs (grpShareImage, Preview tab)
+
+ ''' <summary>Puts a copy of the current scene image (or the black placeholder when there is none) in
+ ''' pnlSourceImage and pnlProbeImage - the same picture the "Import scene image" buttons on those tabs load,
+ ''' just from here instead.</summary>
+ Private Sub btnShareSceneImage_Click(sender As Object, e As EventArgs) Handles btnShareSceneImage.Click
+ ImportSceneImageInto(_picSource)
+ ImportSceneImageInto(_picProbe)
+ End Sub
+
+ Private Sub btnShareFieldImage_Click(sender As Object, e As EventArgs) Handles btnShareFieldImage.Click
+ CopyPreviewToTabs(_picField)
+ End Sub
+
+ Private Sub btnShareIntensityImage_Click(sender As Object, e As EventArgs) Handles btnShareIntensityImage.Click
+ CopyPreviewToTabs(_picIntensity)
+ End Sub
+
+ ''' <summary>Puts a copy of the picture that is shown in a preview on the Sources tab and on the Probes tab -
+ ''' source.Image exactly as currently displayed, glow-edges overlay baked in when "Display overlay" happens
+ ''' to be checked for that preview (SetPreviewFrame/RefreshPreviewOverlay), and not when it is not.</summary>
+ Private Sub CopyPreviewToTabs(source As PictureBox)
+ Dim shown As Image = source.Image
+ If shown Is Nothing Then Return
+
+ For Each target As PictureBox In New PictureBox() {_picSource, _picProbe}
+ Dim copy As New Bitmap(shown)
+ Dim old As Image = target.Image
+ target.Image = copy
+ If old IsNot Nothing Then old.Dispose()
+ Next
+ End Sub
+
+ ''' <summary>The field/intensity share buttons are only on when their preview shows a picture; btnShareSceneImage
+ ''' is not gated the same way, matching "Import scene image" on the Sources/Probes tabs, which always works
+ ''' (it falls back to a black placeholder when there is no scene image).</summary>
+ Private Sub UpdateCopyButtons()
+ btnShareFieldImage.Enabled = (_picField IsNot Nothing) AndAlso (_picField.Image IsNot Nothing)
+ btnShareIntensityImage.Enabled = (_picIntensity IsNot Nothing) AndAlso (_picIntensity.Image IsNot Nothing)
+ UpdateExportButtons()
+ End Sub
+
+ ''' <summary>
+ ''' The "Export current Field/Intensity frame" buttons are only on while the simulation is not actively
+ ''' running (paused, or fully stopped) and there is something to export: either a live, paused engine
+ ''' (RenderCurrentFrame), a full-resolution snapshot cached from the last run (_lastFullFieldFrame /
+ ''' _lastFullIntensityFrame), or at least the picture currently shown in the preview.
+ ''' </summary>
+ Private Sub UpdateExportButtons()
+ Dim canExport As Boolean = _paused OrElse _runner Is Nothing
+ btnExportFieldFrame.Enabled = canExport AndAlso
+ (_lastFullFieldFrame IsNot Nothing OrElse ((_picField IsNot Nothing) AndAlso (_picField.Image IsNot Nothing)))
+ btnExportIntensityFrame.Enabled = canExport AndAlso
+ (_lastFullIntensityFrame IsNot Nothing OrElse ((_picIntensity IsNot Nothing) AndAlso (_picIntensity.Image IsNot Nothing)))
+ End Sub
+
+ Private Sub btnPauzeResume_Click(sender As Object, e As EventArgs) Handles btnPauzeResume.Click
+ If _runner Is Nothing OrElse _stopRequested Then Return
+
+ If _paused Then
+ _paused = False
+ _simStatus = _progressText
+ ToolStripStatusLabel1.Text = "Simulation running..."
+ _runner.ResumeRun()
+ ' back to the Preview tab, so the user follows the simulation again
+ tabMainFunctions.SelectedTab = tabViewer
+ Else
+ _paused = True
+ _simStatus = "paused - " & _progressText
+ ToolStripStatusLabel1.Text = "Simulation paused (press Resume to continue, or Stop to finish and save the videos)"
+ _runner.PauseRun()
+ End If
+ UpdateRunButtons()
+ UpdateTitle()
+ End Sub
+
+ ' ---- grpNavigateTabs (Preview tab): jump straight to another tab
+
+ Private Sub btnGotoConfiguration_Click(sender As Object, e As EventArgs) Handles btnGotoConfiguration.Click
+ tabMainFunctions.SelectedTab = tabConfiguration
+ End Sub
+
+ Private Sub btnGotoSources_Click(sender As Object, e As EventArgs) Handles btnGotoSources.Click
+ tabMainFunctions.SelectedTab = tabSourceList
+ End Sub
+
+ Private Sub btnGotoProbes_Click(sender As Object, e As EventArgs) Handles btnGotoProbes.Click
+ tabMainFunctions.SelectedTab = tabProbeList
+ End Sub
+
+ Private Sub btnGotoPreview_Click(sender As Object, e As EventArgs) Handles btnGotoPreview.Click
+ tabMainFunctions.SelectedTab = tabViewer
+ End Sub
+
+ ''' <summary>
+ ''' Stops the run after the current step. The runner then closes the videos properly and reports that it is
+ ''' finished, which switches on the buttons that open the videos.
+ ''' </summary>
+ Private Sub RequestStop()
+ If _runner Is Nothing OrElse _stopRequested Then Return
+
+ _stopRequested = True
+ _paused = False
+ _runner.Cancel()
+ btnStartSimulation.Enabled = False
+ btnStartSimulation.Text = "Stopping..."
+ _simStatus = "stopping..."
+ ToolStripStatusLabel1.Text = "Stopping the simulation and closing the video files..."
+ UpdateRunButtons()
+ UpdateTitle()
+ End Sub
+
+ ''' <summary>
+ ''' The pause button on the Preview tab is only on while a simulation runs. btnStartSimulation is also the
+ ''' stop/restart button (see its own Click handler) and keeps its own Text/Enabled state (RequestStop,
+ ''' StartSimulation, OnSimulationFinished) - there used to be a separate btnStopSimulation for that, removed
+ ''' as redundant once btnStartSimulation started doing double duty.
+ ''' </summary>
+ Private Sub UpdateRunButtons()
+ Dim running As Boolean = (_runner IsNot Nothing) AndAlso Not _stopRequested
+ ' Not actually disabling the button here: with its custom Azure BackColor, Windows' own disabled-button
+ ' rendering draws the text with a strange two-tone (etched) effect instead of plain gray. So the button
+ ' stays enabled and its color is set by hand instead - btnPauzeResume_Click already ignores clicks while
+ ' no simulation is running, so behaviorally it is still "disabled".
+ btnPauzeResume.ForeColor = If(running, SystemColors.ControlText, Color.Gray)
+ btnPauzeResume.Text = If(_paused, "Resume simulation", "Pause simulation")
+ UpdateExportButtons()
+ End Sub
+
+ Private Sub ShowSimulationProblem(message As String)
+ MessageBox.Show(Me, message, "Start simulation", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ End Sub
+
+ ''' <summary>
+ ''' Takes the values from the controls, so the run always uses what is on the screen (also a value that was
+ ''' typed in but not confirmed yet is used).
+ ''' </summary>
+ Private Sub ReadSimulationControls()
+ numVisualizeEvery.Validate()
+ numFieldScaling.Validate()
+ numIntensityScaling.Validate()
+ numFieldScaling2.Validate()
+ numIntensityScaling2.Validate()
+ numOffsetField.Validate()
+ numOffsetIntensity.Validate()
+ numQuality.Validate()
+ numScaleImageSource.Validate()
+ numTimeDecayFactor.Validate()
+
+ _simulation.VisualizeEvery = CInt(numVisualizeEvery.Value)
+ _simulation.FieldBrightness = CDbl(numFieldScaling.Value)
+ _simulation.IntensityBrightness = CDbl(numIntensityScaling.Value)
+ _simulation.FieldBlackLevel = CDbl(numOffsetField.Value)
+ _simulation.IntensityBlackLevel = CDbl(numOffsetIntensity.Value)
+ _simulation.VideoQuality = CInt(numQuality.Value)
+ _simulation.TimeDecayFactor = CDbl(numTimeDecayFactor.Value)
+ _simulation.ExportField = chkExportVideoField.Checked
+ _simulation.ExportIntensity = chkExportVideoIntensity.Checked
+ _simulation.PreviewField = chkPreviewVideoField.Checked
+ _simulation.PreviewIntensity = chkPreviewVideoIntensity.Checked
+ _simulation.UseGpu = chkUseGPU.Checked
+ _simulation.Use4thOrderLaplacian = chkUse4thOrderLaplacian.Checked
+ _scene.ImageSourceScale = CDbl(numScaleImageSource.Value)
+ End Sub
+
+ ''' <summary>Checks the settings, builds the job and starts the runner.</summary>
+ Private Sub StartSimulation()
+ ReadSimulationControls()
+ Dim settings As SimulationSettings = _simulation
+ Dim needField As Boolean = settings.ExportField OrElse settings.PreviewField
+ Dim needIntensity As Boolean = settings.ExportIntensity OrElse settings.PreviewIntensity
+ Dim export As Boolean = settings.ExportField OrElse settings.ExportIntensity
+ Dim preview As Boolean = settings.PreviewField OrElse settings.PreviewIntensity
+
+ If Not (needField OrElse needIntensity) Then
+ ShowSimulationProblem("Nothing to do: tick at least one of the export or preview options.")
+ Return
+ End If
+
+ ' numSimulationSteps (a NumericUpDown) never holds an out-of-range or non-integer value, so unlike the old
+ ' cmbSimulationSteps combo box this needs no parsing/validation here
+ settings.Steps = CInt(numSimulationSteps.Value)
+
+ ' the videos are written in the output folder of the project, so the project has to exist on disk
+ If export AndAlso _project Is Nothing Then
+ Dim answer As DialogResult = MessageBox.Show(Me,
+ "The videos are saved in the output folder of the project, so the project must be saved first." & vbCrLf & vbCrLf &
+ "Save the project now?", "Start simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
+ If answer <> DialogResult.Yes Then Return
+ If Not SaveProject() Then Return
+ settings = _simulation
+ End If
+
+ ' the canvas
+ Dim canvas As Size = EffectiveCanvas()
+ If canvas.Width <= 0 Then
+ ShowSimulationProblem("There is no scene yet: load a scene image in the Scene properties, or define a canvas size.")
+ Return
+ End If
+
+ Dim damping As Integer = 0
+ If _scene.DampingEdgeEnabled Then
+ Dim problem As String = DampingProblem(txtDampingEdgeSize.Text, damping)
+ If problem.Length > 0 Then
+ ShowSimulationProblem("The damping edge cannot be used: " & problem)
+ txtDampingEdgeSize.Focus()
+ Return
+ End If
+ End If
+
+ ' without any source (image or object) nothing happens
+ Dim useSources As Boolean = _scene.UseSources
+ Dim hasImageSources As Boolean = _scene.UseImage AndAlso useSources AndAlso SceneData.CountSources(_sceneImage) > 0
+ Dim hasObjectSources As Boolean = _scene.UseObjectSources AndAlso _sources.Count > 0
+ Dim noSources As String = ""
+ If Not hasImageSources AndAlso Not hasObjectSources Then
+ Dim reasons As New List(Of String)()
+ If _scene.UseImage Then
+ If Not useSources Then
+ reasons.Add("image sources are switched off in the Scene properties")
+ ElseIf SceneData.CountSources(_sceneImage) = 0 Then
+ reasons.Add("the scene image has no sources (no pixels with a green value above 0)")
+ End If
+ End If
+ If Not _scene.UseObjectSources Then
+ reasons.Add("object sources are switched off in the Scene properties")
+ ElseIf _sources.Count = 0 Then
+ reasons.Add("there are no object sources yet (add one on the Sources tab)")
+ End If
+ noSources = "This scene has no sources yet: " & String.Join("; ", reasons) & ". The field will stay empty."
+ End If
+ If noSources.Length > 0 Then
+ Dim answer As DialogResult = MessageBox.Show(Me, noSources & vbCrLf & vbCrLf & "Run the simulation anyway?",
+ "Start simulation", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
+ If answer <> DialogResult.Yes Then Return
+ End If
+
+ ' color tables
+ Dim fieldLut As Integer() = Nothing
+ Dim intensityLut As Integer() = Nothing
+ If needField Then
+ Dim scheme As ColorScheme = FindScheme(settings.FieldColorScheme, ColorScheme.SchemeTypeField)
+ If scheme Is Nothing Then
+ ShowSimulationProblem("Choose a color scheme for the field first.")
+ cmbFieldColorScheme.Focus()
+ Return
+ End If
+ fieldLut = ColorLut.Build(scheme, False, settings.FieldBlackLevel).Argb
+ End If
+ If needIntensity Then
+ Dim scheme As ColorScheme = FindScheme(settings.IntensityColorScheme, ColorScheme.SchemeTypeIntensity)
+ If scheme Is Nothing Then
+ ShowSimulationProblem("Choose a color scheme for the intensity first.")
+ cmbIntensityColorScheme.Focus()
+ Return
+ End If
+ intensityLut = ColorLut.Build(scheme, False, settings.IntensityBlackLevel).Argb
+ End If
+
+ ' the job: the runner works on copies, so the settings can be edited while it runs
+ Dim job As New SimulationJob()
+ If _scene.UseImage Then
+ job.Image = New Bitmap(_sceneImage)
+ Else
+ job.Width = canvas.Width
+ job.Height = canvas.Height
+ job.BackgroundRefractiveIndex = _scene.BackgroundRefractiveIndex
+ End If
+ job.UseSources = useSources
+ job.SourceAmplitude = _scene.ImageSourceScale
+ job.DampingEdge = damping
+ job.Settings = settings.Clone()
+ job.FieldLut = fieldLut
+ job.IntensityLut = intensityLut
+ _lastFieldLut = fieldLut
+ _lastIntensityLut = intensityLut
+ job.PreviewWidth = Math.Max(16, Math.Min(pnlPreviewField.ClientSize.Width, pnlPreviewIntensity.ClientSize.Width))
+ job.PreviewHeight = Math.Max(16, Math.Min(pnlPreviewField.ClientSize.Height, pnlPreviewIntensity.ClientSize.Height))
+ job.Probes = ProbesForRun()
+ job.ObjectSources = SourcesForRun()
+
+ ' the glow-edges overlay (Viewer tab) is only ever needed by the runner to bake into an exported video -
+ ' the live preview blends its own copy in locally (ShowPreview/ComposeGlowOverlay), which can track the
+ ' checkbox/brightness box live while this, like Settings, is frozen at the start of the run
+ job.FieldOverlayGain = FieldOverlayGain()
+ job.IntensityOverlayGain = IntensityOverlayGain()
+ If export AndAlso _glowEdgesImage IsNot Nothing AndAlso (job.FieldOverlayGain > 0.0 OrElse job.IntensityOverlayGain > 0.0) Then
+ job.GlowOverlay = New Bitmap(_glowEdgesImage)
+ End If
+
+ If export Then
+ Try
+ Directory.CreateDirectory(_project.OutputVideoFolder)
+ Catch ex As Exception
+ If job.Image IsNot Nothing Then job.Image.Dispose()
+ If job.GlowOverlay IsNot Nothing Then job.GlowOverlay.Dispose()
+ ShowSimulationProblem("The output folder could not be created:" & vbCrLf & _project.OutputVideoFolder & vbCrLf & vbCrLf & ex.Message)
+ Return
+ End Try
+ Dim suffix As String = NextNumericSuffix(_project.OutputVideoFolder).ToString("D4", CultureInfo.InvariantCulture)
+ If settings.ExportField Then
+ job.FieldVideoPath = Path.Combine(_project.OutputVideoFolder, _project.Name & "_field_" & suffix & ".mp4")
+ End If
+ If settings.ExportIntensity Then
+ job.IntensityVideoPath = Path.Combine(_project.OutputVideoFolder, _project.Name & "_intensity_" & suffix & ".mp4")
+ End If
+ End If
+
+ ' go
+ ClearPreviews()
+ BeginProbeRun(job.Probes, canvas, settings.Steps)
+ _fieldVideoFile = ""
+ _intensityVideoFile = ""
+ UpdateVideoButtons()
+ _runInfo = "Field: brightness " & settings.FieldBrightness.ToString("0.0#", CultureInfo.CurrentCulture) &
+ ", offset " & settings.FieldBlackLevel.ToString("0.0#", CultureInfo.CurrentCulture) &
+ vbCrLf & "Intensity: brightness " & settings.IntensityBrightness.ToString("0.0#", CultureInfo.CurrentCulture) &
+ ", offset " & settings.IntensityBlackLevel.ToString("0.0#", CultureInfo.CurrentCulture) &
+ vbCrLf & "Image source scale: " & _scene.ImageSourceScale.ToString("0.0#", CultureInfo.CurrentCulture)
+ If preview Then tabMainFunctions.SelectedTab = tabViewer
+
+ Dim runner As New SimulationRunner(job)
+ AddHandler runner.ProgressChanged, Sub(done As Integer, total As Integer) PostToUi(Sub() ShowProgress(runner, done, total))
+ AddHandler runner.EngineReady, Sub(description As String, note As String) PostToUi(Sub() ShowEngine(runner, description, note))
+ AddHandler runner.ProbesUpdated, Sub(update As ProbeUpdate) PostToUi(Sub() ShowProbeSamples(runner, update))
+ AddHandler runner.PreviewReady, Sub(isField As Boolean, frame As Bitmap) PostToUi(Sub() ShowPreview(runner, isField, frame))
+ AddHandler runner.Finished, Sub(result As SimulationResult) PostToUi(Sub() OnSimulationFinished(runner, result))
+
+ _runner = runner
+ btnStartSimulation.Text = "Stop Simulation"
+ _simStatus = "starting..."
+ _progressText = "starting..."
+ _paused = False
+ _stopRequested = False
+ UpdateRunButtons()
+ ToolStripStatusLabel1.Text = "Simulation running..."
+ ToolStripStatusLabel1.ToolTipText = ""
+ UpdateTitle()
+ runner.Start()
+ End Sub
+
+ ' ---- messages from the runner (they arrive on the worker thread)
+
+ Private Sub PostToUi(work As Action)
+ If IsDisposed OrElse Not IsHandleCreated Then Return
+ Try
+ BeginInvoke(work)
+ Catch ex As InvalidOperationException
+ ' the window is gone (this includes ObjectDisposedException)
+ End Try
+ End Sub
+
+ Private Sub ShowProgress(runner As SimulationRunner, done As Integer, total As Integer)
+ If runner IsNot _runner OrElse _simStatus = "stopping..." Then Return
+ _lastStepsDone = done
+ Dim percent As Integer = CInt(100L * done \ Math.Max(1, total))
+ _progressText = "step " & done.ToString("N0", CultureInfo.CurrentCulture) & " of " & total.ToString("N0", CultureInfo.CurrentCulture) &
+ " (" & percent.ToString(CultureInfo.InvariantCulture) & "%)"
+ _simStatus = If(_paused, "paused - ", "") & _progressText
+ UpdateTitle()
+ End Sub
+
+ ''' <summary>Tells in the status bar where the simulation runs (CPU or GPU), and why the GPU is not used if it was asked for.</summary>
+ Private Sub ShowEngine(runner As SimulationRunner, description As String, note As String)
+ If runner IsNot _runner OrElse IsDisposed Then Return
+ Dim text As String = "Simulation running on " & description
+ If note.Length > 0 Then text &= " - " & note
+ ToolStripStatusLabel1.Text = text
+ ToolStripStatusLabel1.ToolTipText = text
+ End Sub
+
+ Private Sub ShowPreview(runner As SimulationRunner, isField As Boolean, frame As Bitmap)
+ If runner IsNot _runner OrElse IsDisposed Then
+ frame.Dispose()
+ runner.PreviewShown()
+ Return
+ End If
+
+ Dim box As PictureBox = If(isField, _picField, _picIntensity)
+ Dim gain As Double = If(isField, FieldOverlayGain(), IntensityOverlayGain())
+ SetPreviewFrame(box, frame, gain)
+ UpdateCopyButtons()
+ runner.PreviewShown()
+ End Sub
+
+ Private Sub OnSimulationFinished(runner As SimulationRunner, result As SimulationResult)
+ If runner IsNot _runner OrElse IsDisposed Then Return
+
+ _runner = Nothing
+ _hasRun = True
+ _paused = False
+ _stopRequested = False
+ _lastStepsDone = result.StepsDone
+ UpdateRunButtons()
+ _simStatus = ""
+ btnStartSimulation.Text = "Start Simulation"
+ btnStartSimulation.Enabled = True
+ UpdateTitle()
+
+ _fieldVideoFile = result.FieldFile
+ _intensityVideoFile = result.IntensityFile
+ UpdateVideoButtons()
+
+ ' a full-resolution snapshot of the last frame, for a still export once nothing is running any more
+ Dim oldField As Bitmap = _lastFullFieldFrame
+ _lastFullFieldFrame = result.LastFieldFrame
+ If oldField IsNot Nothing Then oldField.Dispose()
+ Dim oldIntensity As Bitmap = _lastFullIntensityFrame
+ _lastFullIntensityFrame = result.LastIntensityFrame
+ If oldIntensity IsNot Nothing Then oldIntensity.Dispose()
+ UpdateExportButtons()
+
+ Dim time As String = result.Elapsed.ToString("hh\:mm\:ss", CultureInfo.InvariantCulture)
+ Dim files As String = ""
+ If result.Files.Count > 0 Then
+ files = vbCrLf & vbCrLf & "Videos (in " & Path.GetDirectoryName(result.Files(0)) & "):"
+ For Each videoFile As String In result.Files
+ files &= vbCrLf & Path.GetFileName(videoFile)
+ Next
+ End If
+ If result.Status <> SimulationStatus.Failed AndAlso result.Message.Length > 0 Then
+ files &= vbCrLf & vbCrLf & result.Message
+ End If
+ If result.Engine.Length > 0 Then
+ files &= vbCrLf & vbCrLf & "Engine: " & result.Engine
+ If result.EngineNote.Length > 0 Then files &= vbCrLf & result.EngineNote
+ End If
+ files &= vbCrLf & vbCrLf & _runInfo
+ Dim stepsText As String = result.StepsDone.ToString("N0", CultureInfo.CurrentCulture)
+
+ ' the summary goes in the status bar (the details in its tooltip); only a failure gets a message box
+ Dim summary As String
+ Select Case result.Status
+ Case SimulationStatus.Completed
+ summary = "Simulation completed: " & stepsText & " steps in " & time
+ Case SimulationStatus.Cancelled
+ summary = "Simulation stopped after " & stepsText & " steps (" & time & ")"
+ Case Else
+ summary = "Simulation failed after " & stepsText & " steps"
+ End Select
+ If result.Elapsed.TotalSeconds > 0.5 AndAlso result.StepsDone > 0 Then
+ summary &= " - " & (result.StepsDone / result.Elapsed.TotalSeconds).ToString("0.0", CultureInfo.CurrentCulture) & " steps/s"
+ End If
+ If result.Engine.Length > 0 Then
+ summary &= " - " & result.Engine
+ If result.EngineNote.Length > 0 Then summary &= " (" & result.EngineNote & ")"
+ End If
+ If result.Files.Count > 0 Then
+ Dim names As New List(Of String)()
+ For Each videoFile As String In result.Files
+ names.Add(Path.GetFileName(videoFile))
+ Next
+ summary &= " - video: " & String.Join(", ", names)
+ End If
+ If result.Status <> SimulationStatus.Failed AndAlso result.Message.Length > 0 Then
+ summary &= " - MP4 (H.264) was not available, the videos are .avi files"
+ End If
+
+ ToolStripStatusLabel1.Text = summary
+ ToolStripStatusLabel1.ToolTipText = summary & files
+
+ If result.Status = SimulationStatus.Failed Then
+ MessageBox.Show(Me, "The simulation failed after " & stepsText & " steps:" & vbCrLf & vbCrLf & result.Message & files,
+ "Simulation", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End If
+ End Sub
+
+ ' ---- the videos of the last run
+
+ ''' <summary>The buttons under the previews are on when the video of the last run exists.</summary>
+ Private Sub UpdateVideoButtons()
+ btnViewFieldVideo.Enabled = _fieldVideoFile.Length > 0 AndAlso File.Exists(_fieldVideoFile)
+ btnViewIntensityVideo.Enabled = _intensityVideoFile.Length > 0 AndAlso File.Exists(_intensityVideoFile)
+ End Sub
+
+ Private Sub btnViewFieldVideo_Click(sender As Object, e As EventArgs) Handles btnViewFieldVideo.Click
+ OpenVideo(_fieldVideoFile)
+ End Sub
+
+ Private Sub btnViewIntensityVideo_Click(sender As Object, e As EventArgs) Handles btnViewIntensityVideo.Click
+ OpenVideo(_intensityVideoFile)
+ End Sub
+
+ ''' <summary>Opens a video with the program that Windows uses for this kind of file.</summary>
+ Private Sub OpenVideo(videoFile As String)
+ If videoFile.Length = 0 OrElse Not File.Exists(videoFile) Then
+ MessageBox.Show(Me, "The video file does not exist (any more):" & vbCrLf & videoFile, "Video",
+ MessageBoxButtons.OK, MessageBoxIcon.Information)
+ UpdateVideoButtons()
+ Return
+ End If
+ Try
+ Dim info As New ProcessStartInfo(videoFile)
+ info.UseShellExecute = True
+ Process.Start(info)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The video could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Video",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ Private Sub btnOpenVideoFolder_Click(sender As Object, e As EventArgs) Handles btnOpenVideoFolder.Click
+ OpenVideoFolder()
+ End Sub
+
+ Private Sub btnOpenImageFolder_Click(sender As Object, e As EventArgs) Handles btnOpenImageFolder.Click
+ OpenFramesFolder()
+ End Sub
+
+ ' ---- exporting a single still frame (Preview tab)
+
+ Private Sub btnExportFieldFrame_Click(sender As Object, e As EventArgs) Handles btnExportFieldFrame.Click
+ ExportFrame(True)
+ End Sub
+
+ Private Sub btnExportIntensityFrame_Click(sender As Object, e As EventArgs) Handles btnExportIntensityFrame.Click
+ ExportFrame(False)
+ End Sub
+
+ ''' <summary>
+ ''' Saves the current Field or Intensity picture, at full simulation resolution, as a PNG in the project's
+ ''' output frames folder. Only enabled (see UpdateExportButtons) while nothing is actively running: while
+ ''' paused, a fresh frame is rendered straight from the live, paused engine (full resolution - not the
+ ''' downscaled picture the preview shows); once the run has fully stopped, the last full-resolution frame it
+ ''' produced just before closing is used instead (_lastFullFieldFrame/_lastFullIntensityFrame), since the
+ ''' engine itself no longer exists by then.
+ ''' </summary>
+ Private Sub ExportFrame(isField As Boolean)
+ Dim frame As Bitmap = Nothing
+ Dim disposeFrame As Boolean = False
+
+ If _runner IsNot Nothing AndAlso _paused Then
+ Dim lut As Integer() = If(isField, _lastFieldLut, _lastIntensityLut)
+ Dim brightness As Single = CSng(If(isField, _simulation.FieldBrightness, _simulation.IntensityBrightness))
+ frame = _runner.RenderCurrentFrame(isField, lut, brightness)
+ disposeFrame = True
+ End If
+
+ If frame Is Nothing Then frame = If(isField, _lastFullFieldFrame, _lastFullIntensityFrame)
+
+ If frame Is Nothing Then
+ MessageBox.Show(Me, "There is no picture to export yet.", "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+
+ Try
+ Directory.CreateDirectory(_project.OutputFramesFolder)
+ Catch ex As Exception
+ If disposeFrame Then frame.Dispose()
+ MessageBox.Show(Me, "The output folder could not be created:" & vbCrLf & _project.OutputFramesFolder & vbCrLf & vbCrLf & ex.Message,
+ "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Return
+ End Try
+
+ Dim kind As String = If(isField, "field", "intensity")
+ Dim gain As Double = If(isField, FieldOverlayGain(), IntensityOverlayGain())
+ Dim toSave As Bitmap = frame
+ Dim disposeToSave As Boolean = False
+ If gain > 0.0 AndAlso _glowEdgesImage IsNot Nothing Then
+ toSave = ComposeGlowOverlay(frame, gain)
+ disposeToSave = True
+ End If
+
+ Dim suffix As String = NextNumericSuffix(_project.OutputFramesFolder).ToString("D4", CultureInfo.InvariantCulture)
+ Dim fileName As String = _project.Name & "_" & kind & "_frame" & _lastStepsDone.ToString(CultureInfo.InvariantCulture) & "_" & suffix & ".png"
+ Dim fullPath As String = Path.Combine(_project.OutputFramesFolder, fileName)
+
+ Try
+ toSave.Save(fullPath, System.Drawing.Imaging.ImageFormat.Png)
+ ToolStripStatusLabel1.Text = "Frame exported: " & fileName
+ Catch ex As Exception
+ MessageBox.Show(Me, "The frame could not be saved:" & vbCrLf & vbCrLf & ex.Message, "Export frame", MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ Finally
+ If disposeToSave Then toSave.Dispose()
+ If disposeFrame Then frame.Dispose()
+ End Try
+ End Sub
+
+ ''' <summary>Next available 4-digit numeric filename suffix for a file saved into folder: the highest existing
+ ''' file in folder whose name (before the extension) ends in exactly 4 digits, plus 1 - starts at 1 when there
+ ''' is no such file yet. Used for exported frames (ExportFrame) and videos (RunSimulation) instead of the
+ ''' previous date/time stamp, which was found to make file names too long. Formats with "D4" (e.g. "0001"),
+ ''' growing past 4 digits rather than wrapping once the count passes 9999.</summary>
+ Private Function NextNumericSuffix(folder As String) As Integer
+ Dim best As Integer = 0
+ If Directory.Exists(folder) Then
+ For Each f As String In Directory.GetFiles(folder)
+ Dim nameOnly As String = Path.GetFileNameWithoutExtension(f)
+ If nameOnly.Length >= 4 Then
+ Dim tail As String = nameOnly.Substring(nameOnly.Length - 4)
+ Dim n As Integer
+ If Integer.TryParse(tail, NumberStyles.None, CultureInfo.InvariantCulture, n) Then
+ If n > best Then best = n
+ End If
+ End If
+ Next
+ End If
+ Return best + 1
+ End Function
+
+ ''' <summary>
+ ''' Opens the project's video output folder in Windows Explorer - which already shows video thumbnails and lets
+ ''' the files be renamed or deleted there, so there is no need to build a picker of our own for that. Opened in
+ ''' "Details" view (see OpenFolderInExplorer) - more useful than thumbnails for a folder of video files.
+ ''' </summary>
+ Private Sub OpenVideoFolder()
+ Dim folder As String = If(_project Is Nothing, "", _project.OutputVideoFolder)
+ If folder.Length = 0 Then
+ MessageBox.Show(Me, "There is no project open yet.", "Open video folder", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ Try
+ ' so the folder can be opened even before any video has been exported
+ OpenFolderInExplorer(folder, FVM_DETAILS)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The video folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open video folder",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ''' <summary>Opens the project's output frames folder (btnOpenImageFolder on the Preview tab) in Windows
+ ''' Explorer, the same way OpenVideoFolder does for the video folder - but in "Large icons" view (see
+ ''' OpenFolderInExplorer), which shows thumbnails of the exported images.</summary>
+ Private Sub OpenFramesFolder()
+ Dim folder As String = If(_project Is Nothing, "", _project.OutputFramesFolder)
+ If folder.Length = 0 Then
+ MessageBox.Show(Me, "There is no project open yet.", "Open image folder", MessageBoxButtons.OK, MessageBoxIcon.Information)
+ Return
+ End If
+ Try
+ ' so the folder can be opened even before any frame has been exported
+ OpenFolderInExplorer(folder, FVM_ICON)
+ Catch ex As Exception
+ MessageBox.Show(Me, "The image folder could not be opened:" & vbCrLf & vbCrLf & ex.Message, "Open image folder",
+ MessageBoxButtons.OK, MessageBoxIcon.Warning)
+ End Try
+ End Sub
+
+ ' Windows Explorer's own view-mode numbers (the classic Shell "FOLDERVIEWMODE" enum), used below.
+ Private Const FVM_ICON As Integer = 1 ' "Large icons"
+ Private Const FVM_DETAILS As Integer = 4 ' "Details"
+
+ ''' <summary>
+ ''' Opens a folder in Windows Explorer and tries to make that window use the given view mode (one of the
+ ''' FVM_ constants above). Explorer has no command-line switch for this, so the folder is opened as before
+ ''' (explorer.exe on the path) and then, best-effort, the "Shell.Application" COM automation object is used
+ ''' to find the newly opened window for that exact folder and set its Document.CurrentViewMode. This uses late
+ ''' binding via reflection rather than a direct COM reference, since Option Strict is on here and adding a COM
+ ''' reference to the project for this alone is more trouble than it is worth.
+ '''
+ ''' This is not fully reliable: if a window for the folder is already open, Explorer reuses it instead of
+ ''' opening a new one (so its view stays whatever it already was), and Explorer separately remembers, per
+ ''' folder, whatever view the user leaves it in afterwards - so this only really matters the first time (or
+ ''' after Explorer has forgotten it). Either way the folder itself always opens; only the requested view can
+ ''' silently fail to apply, which is why every failure here is swallowed rather than shown to the user.
+ ''' </summary>
+ Private Sub OpenFolderInExplorer(folder As String, viewMode As Integer)
+ Directory.CreateDirectory(folder)
+ Dim info As New ProcessStartInfo("explorer.exe", """" & folder & """")
+ info.UseShellExecute = True
+ Process.Start(info)
+
+ Try
+ SetExplorerWindowViewMode(folder, viewMode)
+ Catch
+ ' best effort only - the folder is already open regardless of whether this succeeds
+ End Try
+ End Sub
+
+ Private Sub SetExplorerWindowViewMode(folder As String, viewMode As Integer)
+ Dim targetPath As String = Path.GetFullPath(folder).TrimEnd(Path.DirectorySeparatorChar)
+ Dim shellType As Type = Type.GetTypeFromProgID("Shell.Application")
+ If shellType Is Nothing Then Return
+ Dim shell As Object = Activator.CreateInstance(shellType)
+
+ Try
+ Const memberFlags As Reflection.BindingFlags = Reflection.BindingFlags.InvokeMethod Or Reflection.BindingFlags.GetProperty
+
+ ' give the freshly launched Explorer window a moment to appear
+ For attempt As Integer = 1 To 8
+ Dim windows As Object = shellType.InvokeMember("Windows", memberFlags, Nothing, shell, Nothing)
+ Dim windowsType As Type = windows.GetType()
+ Dim count As Integer = CInt(windowsType.InvokeMember("Count", memberFlags, Nothing, windows, Nothing))
+
+ For i As Integer = 0 To count - 1
+ Dim win As Object = windowsType.InvokeMember("Item", memberFlags, Nothing, windows, New Object() {i})
+ If win Is Nothing Then Continue For
+ Dim winType As Type = win.GetType()
+
+ Dim locationUrl As String = TryCast(winType.InvokeMember("LocationURL", memberFlags, Nothing, win, Nothing), String)
+ If String.IsNullOrEmpty(locationUrl) Then Continue For
+
+ Dim winPath As String
+ Try
+ winPath = New Uri(locationUrl).LocalPath.TrimEnd(Path.DirectorySeparatorChar)
+ Catch
+ Continue For
+ End Try
+
+ If String.Equals(winPath, targetPath, StringComparison.OrdinalIgnoreCase) Then
+ Dim doc As Object = winType.InvokeMember("Document", memberFlags, Nothing, win, Nothing)
+ If doc IsNot Nothing Then
+ doc.GetType().InvokeMember("CurrentViewMode", Reflection.BindingFlags.SetProperty, Nothing, doc, New Object() {viewMode})
+ End If
+ Return
+ End If
+ Next
+
+ Threading.Thread.Sleep(120)
+ Next
+ Finally
+ Runtime.InteropServices.Marshal.ReleaseComObject(shell)
+ End Try
+ End Sub
+
+ ''' <summary>Removes the pictures from the Preview tab and frees them (including the raw frame kept in
+ ''' box.Tag by SetPreviewFrame, when it is a different bitmap from what box.Image itself was showing).</summary>
+ Private Sub ClearPreviews()
+ For Each box As PictureBox In New PictureBox() {_picField, _picIntensity}
+ If box Is Nothing Then Continue For
+ Dim oldImage As Image = box.Image
+ Dim oldRaw As Bitmap = TryCast(box.Tag, Bitmap)
+ box.Image = Nothing
+ box.Tag = Nothing
+ If oldImage IsNot Nothing AndAlso Not Object.ReferenceEquals(oldImage, oldRaw) Then oldImage.Dispose()
+ If oldRaw IsNot Nothing Then oldRaw.Dispose()
+ Next
+
+ ' a new run is starting - the cached last-frame snapshots are from the previous run, so drop them
+ If _lastFullFieldFrame IsNot Nothing Then _lastFullFieldFrame.Dispose()
+ _lastFullFieldFrame = Nothing
+ If _lastFullIntensityFrame IsNot Nothing Then _lastFullIntensityFrame.Dispose()
+ _lastFullIntensityFrame = Nothing
+
+ UpdateCopyButtons()
+ End Sub
+
+ ' grpProbe1_Enter/grpProbe2_Enter and Label21/Label22 Click are unused Designer-generated stubs (harmless, left
+ ' empty). The Pick button, the Sources combo boxes and Button1 (the Probes tab's "Import scene image", still
+ ' under its Designer default name) are wired in Form1.Source.vb/Form1.Probes.vb instead, where the rest of
+ ' those tabs lives.
+ Private Sub grpProbe1_Enter(sender As Object, e As EventArgs) Handles grpProbe1.Enter, grpProbe2.Enter
+ End Sub
+
+ Private Sub Label21_Click(sender As Object, e As EventArgs) Handles Label21.Click, Label22.Click
+ End Sub
+
+ Private Sub lblVideoQuality_Click(sender As Object, e As EventArgs) Handles lblVideoQuality.Click
+
+ End Sub
+
+ Private Sub btnSaveConfiguration2_Click(sender As Object, e As EventArgs) Handles btnSaveConfiguration2.Click
+ SaveProject()
+ End Sub
+End Class
diff --git a/2D_wave_sim_V01/HelpForm.Designer.vb b/2D_wave_sim_V01/HelpForm.Designer.vb
new file mode 100644
index 0000000..dad42e1
--- /dev/null
+++ b/2D_wave_sim_V01/HelpForm.Designer.vb
@@ -0,0 +1,89 @@
+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
+Partial Class HelpForm
+ Inherits System.Windows.Forms.Form
+
+ 'Form overrides dispose to clean up the component list.
+ <System.Diagnostics.DebuggerNonUserCode()> _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+ <System.Diagnostics.DebuggerStepThrough()> _
+ Private Sub InitializeComponent()
+ Me.rtbHelp = New System.Windows.Forms.RichTextBox()
+ Me.pnlButtons = New System.Windows.Forms.FlowLayoutPanel()
+ Me.btnClose = New System.Windows.Forms.Button()
+ Me.pnlButtons.SuspendLayout()
+ Me.SuspendLayout()
+ '
+ 'rtbHelp
+ '
+ Me.rtbHelp.BackColor = System.Drawing.SystemColors.Window
+ Me.rtbHelp.BorderStyle = System.Windows.Forms.BorderStyle.None
+ Me.rtbHelp.Dock = System.Windows.Forms.DockStyle.Fill
+ Me.rtbHelp.Font = New System.Drawing.Font("Arial", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.rtbHelp.Location = New System.Drawing.Point(0, 0)
+ Me.rtbHelp.Margin = New System.Windows.Forms.Padding(12)
+ Me.rtbHelp.Name = "rtbHelp"
+ Me.rtbHelp.ReadOnly = True
+ Me.rtbHelp.Size = New System.Drawing.Size(1039, 843)
+ Me.rtbHelp.TabIndex = 0
+ Me.rtbHelp.Text = ""
+ '
+ 'pnlButtons
+ '
+ Me.pnlButtons.Controls.Add(Me.btnClose)
+ Me.pnlButtons.Dock = System.Windows.Forms.DockStyle.Bottom
+ Me.pnlButtons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft
+ Me.pnlButtons.Location = New System.Drawing.Point(0, 843)
+ Me.pnlButtons.Name = "pnlButtons"
+ Me.pnlButtons.Padding = New System.Windows.Forms.Padding(8)
+ Me.pnlButtons.Size = New System.Drawing.Size(1039, 46)
+ Me.pnlButtons.TabIndex = 1
+ '
+ 'btnClose
+ '
+ Me.btnClose.DialogResult = System.Windows.Forms.DialogResult.OK
+ Me.btnClose.Location = New System.Drawing.Point(930, 11)
+ Me.btnClose.Name = "btnClose"
+ Me.btnClose.Size = New System.Drawing.Size(90, 30)
+ Me.btnClose.TabIndex = 0
+ Me.btnClose.Text = "Close"
+ Me.btnClose.UseVisualStyleBackColor = True
+ '
+ 'HelpForm
+ '
+ Me.AcceptButton = Me.btnClose
+ Me.CancelButton = Me.btnClose
+ Me.ClientSize = New System.Drawing.Size(1039, 889)
+ Me.Controls.Add(Me.rtbHelp)
+ Me.Controls.Add(Me.pnlButtons)
+ Me.MinimizeBox = False
+ Me.MinimumSize = New System.Drawing.Size(560, 400)
+ Me.Name = "HelpForm"
+ Me.ShowIcon = False
+ Me.ShowInTaskbar = False
+ Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
+ Me.Text = "Help - Wave Maker 2D"
+ Me.pnlButtons.ResumeLayout(False)
+ Me.ResumeLayout(False)
+
+ End Sub
+
+ Friend WithEvents rtbHelp As System.Windows.Forms.RichTextBox
+ Friend WithEvents pnlButtons As System.Windows.Forms.FlowLayoutPanel
+ Friend WithEvents btnClose As System.Windows.Forms.Button
+
+End Class
diff --git a/2D_wave_sim_V01/HelpForm.resx b/2D_wave_sim_V01/HelpForm.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/2D_wave_sim_V01/HelpForm.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
diff --git a/2D_wave_sim_V01/HelpForm.vb b/2D_wave_sim_V01/HelpForm.vb
new file mode 100644
index 0000000..e9daee7
--- /dev/null
+++ b/2D_wave_sim_V01/HelpForm.vb
@@ -0,0 +1,194 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Drawing
+Imports System.Windows.Forms
+
+''' <summary>
+''' The Info > Help window: a structured description of what each tab of tabMainFunctions does, which controls
+''' on it matter most, and what those controls influence elsewhere in the program - plus a dedicated section on
+''' the propagation speed c, since its correct value depends on both the Laplacian order and the source
+''' frequency and is easy to get wrong. Designer-editable - the layout (rtbHelp, the Close button) lives in
+''' HelpForm.Designer.vb; this file only fills rtbHelp's text, in FillHelpText below. Opened from Form1's
+''' HelpToolStripMenuItem_Click.
+''' </summary>
+Public Class HelpForm
+
+ Public Sub New()
+ InitializeComponent()
+ FillHelpText(rtbHelp)
+ rtbHelp.SelectionStart = 0
+ rtbHelp.SelectionLength = 0
+ End Sub
+
+ ''' <summary>Writes the actual help text into rtb, one section per tab/topic, using AppendHeading/AppendBody/
+ ''' AppendBullet for simple formatting (bold headings, indented bullets).</summary>
+ Private Sub FillHelpText(rtb As RichTextBox)
+ AppendHeading(rtb, "Wave Dude 2D - Help")
+
+ AppendHeading(rtb, "Disclaimer")
+ AppendBody(rtb,
+ "The current software comes with no warranty or support and is used at your own risk. " &
+ "It is free software, released under the GNU General Public License, version 3 or later: you may use, modify and redistribute it under the terms of that license (see the LICENSE file that comes with the source code). " &
+ "Bugs or suggestions for future improvements can be send to the email address in the 'Info > About' screen")
+
+ AppendHeading(rtb, "Getting started: the project root")
+ AppendBody(rtb,
+ "Every project, its settings, scene, sources, probes and exported files, lives in its own " &
+ "subfolder under one chosen 'project root' folder. Set it with File > Choose project root, or the " &
+ "'Browse root' button on the Settings tab; the current root is shown above the tabs.")
+ AppendBody(rtb,
+ "The 'Projects in current root' list (Settings tab) shows every project found there: New project, " &
+ "Load, Rename, Delete and Save as all act on the selected one. File > New / Open / Save and " &
+ "'Save changes to project' act on whichever project is currently open. Nothing is written to disk " &
+ "until you save your project." &
+ "Projects can be shared between users by sharing the project folder and copy it to their root folder ")
+ AppendBody(rtb, "Load, Rename, Delete and Save as all act on the selected one. File > New / Open / Save and " &
+ "'Save changes to project' act on whichever project is currently open. Nothing is written to disk " &
+ "until you save.")
+
+
+
+ AppendHeading(rtb, "Settings tab")
+ AppendBody(rtb, "The main control panel: engine and rendering settings, the medium/scene, and starting a run.")
+ AppendBullet(rtb, "Use GPU (generally faster)", "switches the simulation engine between CPU and GPU (OpenCL). Faster for larger grids or step counts, but needs a working OpenCL GPU; the CPU engine is the safe fallback.")
+ AppendBullet(rtb, "Use 4th order Laplacian + sub-sampling", "switches the numerical scheme used to step the wave equation each frame. It runs somewhat slower but strongly reduces numerical dispersion (see 'Propagation speed c' below) - and changes what c should be set to.")
+ AppendBullet(rtb, "Simulation steps / Visualize every", "how many steps a run performs, and how often (in steps) the live preview and probes are refreshed while it runs. A larger 'visualize every' makes a run finish faster at the cost of a choppier preview.")
+ AppendBullet(rtb, "Intensity decay factor", "how quickly the accumulated Intensity view forgets past field energy, i.e. how 'persistent' the intensity build-up looks.")
+ AppendBullet(rtb, "Field/Intensity color scheme, scale and offset", "which color table renders each view (see the Colors tab), and how the raw field/intensity values are stretched (scale) and shifted (offset) into that table's brightness range before coloring. The same scale controls also appear, linked, on the Preview tab.")
+ AppendBullet(rtb, "Preview video of / Export video of (Field/Intensity)", "which of the two views is shown live while running, and which is written to a video file when the run finishes - independent choices.")
+ AppendBullet(rtb, "Video quality (%)", "the compression quality used when writing exported video files.")
+ AppendBullet(rtb, "Refractive index / Damping edge (Scene properties)", "the refractive index shapes the medium the wave travels through (a higher index locally slows the wave - it is what actually sets the per-pixel propagation speed the simulation uses, not c; see below). Damping edge adds an absorbing border so waves leave the grid instead of reflecting off its edges.")
+ AppendBullet(rtb, "User defined (X/Y) scene vs. Scene image", "whether the medium's layout comes from a simple, hand-set shape or from an imported image (its brightness mapped to refractive index).")
+ AppendBullet(rtb, "Use object sources / Use image sources, Edit source list", "whether wave sources are the ones built on the Sources tab, or amplitude taken from an image; 'Edit source list' jumps to the Sources tab.")
+ AppendBody(rtb, "Found at the bottom of everly screen: Quick navigate (jump to Preview/Probes/Sources/Settings), Simulation control (Start " &
+ "Simulation / Pause-Resume), and Share with source/probe (send the current scene, field or " &
+ "intensity picture into the Sources or Probes tools as a background image).")
+
+ AppendHeading(rtb, "About Scene Images")
+ AppendBody(rtb, "Currently, scene images can only be created externally in a program like for example Photoshop. Save the images in a lossless format like .png . To add objects to a scene that the waves can interact with, you can use the red and green channels in the image color palette.")
+ AppendBullet(rtb, "Red channel (Refractive index)", "can effectively use values ranging from 100 to 255, which represent refractive index values ranging from 1.00 to 2.55. Values lower than 100 will be set to 100 as a minimum. The red channel can be used to refract or reflect waves and create for example lenses.")
+ AppendBullet(rtb, "Blue channel (Damping)", "reserved for damping - use values between 0 and 255, where zero means no damping and 255 heavy damping. It can be used to create regions that absorb waves like for example borders.")
+ AppendBullet(rtb, "Green channel (Sources)", "reserved for creating wave sources, where the values 1-255 represent the frequency of the waves emitted by a pixel. If you use in-scene sources, do not use anti-aliasing to create them since this can cause the pixels next to a source to also contain a (lower) value in the green channel. When you want to use in-image sources, you must have 'use image sources' checked in the setup tab.")
+
+ AppendHeading(rtb, "Sources tab")
+ AppendBody(rtb, "Defines every object-type wave source placed in the scene; what Is set here directly drives what the simulation emits. When using ")
+ AppendBullet(rtb, "Main type: Single vs. composite", "a single source is one emitter; a composite source is a whole array of them, laid out with a chosen spacing and array size - useful for e.g. simulating an extended or phased source.")
+ AppendBullet(rtb, "Mode: Continuous vs. Pulsed, Frequency, Amplitude, Phase", "a continuous source oscillates forever at the set frequency; a pulsed one also uses the pulse shape/width to taper on and off. Frequency (via the estimated wavelength label) is one of the two things that determine the right value for c - see below.")
+ AppendBullet(rtb, "Composite array: Spacing, Array size, Randomize (Phase/Position/Frequency/Off state)", "how densely and how far the individual emitters in a composite source are spread, and how much each one's properties should vary at random rather than being identical.")
+ AppendBullet(rtb, "Place current source / Pick / Copy / Delete / Save source data", "positions a source in the scene, duplicates or removes it, and can save its data separately; 'Detach after' stops further edits in this panel from affecting an already-placed source.")
+
+ AppendHeading(rtb, "Probes tab")
+ AppendBody(rtb, "Two independent probes (Probe 1, Probe 2), each measuring the field or intensity over the course of a run and graphing it.")
+ AppendBullet(rtb, "Place on: Field / Intensity, Measurement / Probe type", "which picture the probe samples, and what it reports from it (e.g. a value at a point, or an integrated quantity over a box).")
+ AppendBullet(rtb, "Position A / Position B, Box size, Pick", "where the probe samples - a single point, or a box defined by two corners - set either numerically or by picking on the preview.")
+ AppendBullet(rtb, "Full scale vs. Running scale, Auto scale X / Y", "whether the probe's graph shows the whole run at once or only a recent 'running' window, and whether its axes rescale automatically as new data comes in.")
+ AppendBullet(rtb, "Start recording at step #", "delays when the probe starts collecting data, useful for skipping an initial transient before the wave pattern settles.")
+
+ AppendHeading(rtb, "Preview tab")
+ AppendBody(rtb, "Shows the live Field and Intensity pictures while a simulation runs, and is where finished pictures/video are exported.")
+ AppendBullet(rtb, "Field/intensity scale factor", "the same brightness scale as on the Settings tab - the two are linked, so changing one updates the other.")
+ AppendBullet(rtb, "Display overlay, overlay brightness", "blends a 'glowing edges' outline (derived from the scene image) on top of either preview, purely as a visual aid to see the scene layout under the field/intensity. This overlay is also baked into an exported frame or video when it is switched on, not just shown live.")
+ AppendBullet(rtb, "Export video of (Field/Intensity), Export frame as image", "start a video export for the checked view(s) once a run starts, or immediately save the current picture as a PNG. Exported file names end in a plain running number (e.g. _0001) - one higher than the highest such number already in that output folder - rather than a date/time stamp.")
+ AppendBullet(rtb, "Open image/video folder, View video in media player", "quick access to what has already been exported for this project.")
+
+ AppendHeading(rtb, "Manage output tab")
+ AppendBody(rtb,
+ "An overview of everything a project has produced: scenes, exported images and exported videos, " &
+ "each with its creation date. From here files can be renamed, deleted, previewed, opened in their " &
+ "folder, viewed in the media player, copied to the clipboard, or shared back into the Sources/" &
+ "Probes tabs as a background image; external scene files can also be loaded in.")
+
+ AppendHeading(rtb, "Colors tab")
+ AppendBody(rtb, "Manages the color schemes used to render the Field and Intensity pictures everywhere else in the program.")
+ AppendBullet(rtb, "Scheme list", "every scheme found in the scheme folder, sortable by clicking the Scheme or Type column header; Type marks whether a scheme is meant for the Field or the Intensity view (the Settings/Preview tabs' color-scheme pickers use this).")
+ AppendBullet(rtb, "Color Scheme Editor: Color 1..9, color picker", "builds a 9-stop scheme by picking a color for each stop; Save, Save As, Rename and Delete act on the scheme currently being edited.")
+ AppendBullet(rtb, "Scheme folder, Choose...", "where schemes are read from and saved to; changing it reloads the list.")
+
+ AppendHeading(rtb, "Propagation speed (c): the Laplacian order and source frequency")
+ AppendBody(rtb,
+ "c (File > Set c-value, in pixels per simulation step) is only a display/estimate value: it is used " &
+ "solely to compute the estimated wavelength shown next to a source's frequency on the Sources tab " &
+ "(lambda = c / frequency). The wave speed the simulation actually uses at each point comes from the " &
+ "scene's refractive index instead, and can vary from point to point - c does not change how the run " &
+ "itself behaves, only what that wavelength readout says.")
+ AppendBody(rtb,
+ "Getting that readout right, however, depends on both the Laplacian order and the source's " &
+ "frequency, because of numerical dispersion - the standard (3rd order) Laplacian makes longer " &
+ "wavelengths propagate faster through the grid than shorter ones, purely as a numerical artifact of " &
+ "the scheme, not a real physical effect.")
+ AppendBullet(rtb, "4th order Laplacian + sub-sampling (on)", "greatly reduces this dispersion. With it on, set c to 1.00 - the estimate then stays accurate across frequencies.")
+ AppendBullet(rtb, "Standard 3rd order Laplacian (4th order off)", "dispersion is significant, so the correct c depends strongly on frequency: lower frequencies need a higher c, higher frequencies need a lower c. For example, at a source frequency where the true wavelength is 15 pixels, c must be set to about 0.56 (not 1.00) for the readout to show that; leaving c at 1.00 there would read out roughly 9 pixels instead.")
+ AppendBody(rtb,
+ "In short: when 4th order is off, re-check (or reduce) c whenever the source frequency changes " &
+ "noticeably. The '(Info)' label next to the 4th order checkbox on the Settings tab repeats this " &
+ "explanation in the program itself.")
+
+ AppendHeading(rtb, "Menu")
+ AppendBody(rtb,
+ "File: New, Open, Choose project root, Set c-value, Save, Exit." & vbCrLf &
+ "Info: this Help page, and About.")
+
+ AppendBody(rtb,
+ "Enjoy! Jeroen " & vbCrLf)
+ End Sub
+
+ Private Sub AppendHeading(rtb As RichTextBox, text As String)
+ rtb.SelectionStart = rtb.TextLength
+ rtb.SelectionLength = 0
+ rtb.SelectionFont = New Font(rtb.Font, FontStyle.Bold)
+ rtb.SelectionColor = Color.FromArgb(20, 20, 20)
+ rtb.AppendText(vbCrLf & text & vbCrLf)
+ End Sub
+
+ Private Sub AppendBody(rtb As RichTextBox, text As String)
+ rtb.SelectionStart = rtb.TextLength
+ rtb.SelectionLength = 0
+ rtb.SelectionFont = New Font(rtb.Font, FontStyle.Regular)
+ rtb.SelectionColor = Color.Black
+ rtb.AppendText(text & vbCrLf)
+ End Sub
+
+ ''' <summary>A single indented "- Label: explanation" line, label in bold, explanation regular - used for the
+ ''' per-control breakdowns within a tab's section.</summary>
+ Private Sub AppendBullet(rtb As RichTextBox, label As String, explanation As String)
+ rtb.SelectionStart = rtb.TextLength
+ rtb.SelectionLength = 0
+ rtb.SelectionFont = New Font(rtb.Font, FontStyle.Regular)
+ rtb.SelectionColor = Color.Black
+ rtb.AppendText(" - ")
+
+ rtb.SelectionStart = rtb.TextLength
+ rtb.SelectionLength = 0
+ rtb.SelectionFont = New Font(rtb.Font, FontStyle.Bold)
+ rtb.AppendText(label & ": ")
+
+ rtb.SelectionStart = rtb.TextLength
+ rtb.SelectionLength = 0
+ rtb.SelectionFont = New Font(rtb.Font, FontStyle.Regular)
+ rtb.AppendText(explanation & vbCrLf)
+ End Sub
+
+ Private Sub HelpForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+
+ End Sub
+End Class
diff --git a/2D_wave_sim_V01/My Project/Application.Designer.vb b/2D_wave_sim_V01/My Project/Application.Designer.vb
new file mode 100644
index 0000000..1b89485
--- /dev/null
+++ b/2D_wave_sim_V01/My Project/Application.Designer.vb
@@ -0,0 +1,38 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
+ ' or if you encounter build errors in this file, go to the Project Designer
+ ' (go to Project Properties or double-click the My Project node in
+ ' Solution Explorer), and make changes on the Application tab.
+ '
+ Partial Friend Class MyApplication
+
+ <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
+ Public Sub New()
+ MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
+ Me.IsSingleInstance = false
+ Me.EnableVisualStyles = true
+ Me.SaveMySettingsOnExit = true
+ Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
+ End Sub
+
+ <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
+ Protected Overrides Sub OnCreateMainForm()
+ Me.MainForm = Global._2D_wave_sim_V01.Form1
+ End Sub
+ End Class
+End Namespace
diff --git a/2D_wave_sim_V01/My Project/Application.myapp b/2D_wave_sim_V01/My Project/Application.myapp
new file mode 100644
index 0000000..1243847
--- /dev/null
+++ b/2D_wave_sim_V01/My Project/Application.myapp
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <MySubMain>true</MySubMain>
+ <MainForm>Form1</MainForm>
+ <SingleInstance>false</SingleInstance>
+ <ShutdownMode>0</ShutdownMode>
+ <EnableVisualStyles>true</EnableVisualStyles>
+ <AuthenticationMode>0</AuthenticationMode>
+ <ApplicationType>0</ApplicationType>
+ <SaveMySettingsOnExit>true</SaveMySettingsOnExit>
+</MyApplicationData>
diff --git a/2D_wave_sim_V01/My Project/AssemblyInfo.vb b/2D_wave_sim_V01/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..c733073
--- /dev/null
+++ b/2D_wave_sim_V01/My Project/AssemblyInfo.vb
@@ -0,0 +1,54 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' General Information about an assembly is controlled through the following
+' set of attributes. Change these attribute values to modify the information
+' associated with an assembly.
+
+' Review the values of the assembly attributes
+
+<Assembly: AssemblyTitle("Wave_Dude_2D")>
+<Assembly: AssemblyDescription("")>
+<Assembly: AssemblyCompany("")>
+<Assembly: AssemblyProduct("Wave_Dude_2D")>
+<Assembly: AssemblyCopyright("Copyright © 2026 JJM Vleggaar (Huygens Optics)")>
+<Assembly: AssemblyTrademark("")>
+
+<Assembly: ComVisible(False)>
+
+'The following GUID is for the ID of the typelib if this project is exposed to COM
+<Assembly: Guid("51c8e121-f5ae-493a-bd03-487bca68a6fc")>
+
+' Version information for an assembly consists of the following four values:
+'
+' Major Version
+' Minor Version
+' Build Number
+' Revision
+'
+' You can specify all the values or you can default the Build and Revision Numbers
+' by using the '*' as shown below:
+' <Assembly: AssemblyVersion("1.0.*")>
+
+<Assembly: AssemblyVersion("1.0.0.0")>
+<Assembly: AssemblyFileVersion("1.0.0.0")>
diff --git a/2D_wave_sim_V01/My Project/Resources.Designer.vb b/2D_wave_sim_V01/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..b6d7e1d
--- /dev/null
+++ b/2D_wave_sim_V01/My Project/Resources.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''<summary>
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''</summary>
+ <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0"), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''<summary>
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("_2D_wave_sim_V01.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''<summary>
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''</summary>
+ <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+
+ '''<summary>
+ ''' Looks up a localized resource of type System.Drawing.Bitmap.
+ '''</summary>
+ Friend ReadOnly Property QR_code() As System.Drawing.Bitmap
+ Get
+ Dim obj As Object = ResourceManager.GetObject("QR-code", resourceCulture)
+ Return CType(obj,System.Drawing.Bitmap)
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/2D_wave_sim_V01/My Project/Resources.resx b/2D_wave_sim_V01/My Project/Resources.resx
new file mode 100644
index 0000000..cc37485
--- /dev/null
+++ b/2D_wave_sim_V01/My Project/Resources.resx
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <data name="QR-code" type="System.Resources.ResXFileRef, System.Windows.Forms">
+ <value>..\Resources\QR-code.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/2D_wave_sim_V01/My Project/Settings.Designer.vb b/2D_wave_sim_V01/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..a3812d0
--- /dev/null
+++ b/2D_wave_sim_V01/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+' <auto-generated>
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+' </auto-generated>
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
+ Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
+ Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
+ Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
+ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
+ Friend Module MySettingsProperty
+
+ <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
+ Friend ReadOnly Property Settings() As Global._2D_wave_sim_V01.My.MySettings
+ Get
+ Return Global._2D_wave_sim_V01.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/2D_wave_sim_V01/My Project/Settings.settings b/2D_wave_sim_V01/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/2D_wave_sim_V01/My Project/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
diff --git a/2D_wave_sim_V01/Projects/AppSettings.vb b/2D_wave_sim_V01/Projects/AppSettings.vb
new file mode 100644
index 0000000..a02ea66
--- /dev/null
+++ b/2D_wave_sim_V01/Projects/AppSettings.vb
@@ -0,0 +1,91 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.IO
+Imports System.Text
+Imports System.Web.Script.Serialization
+
+''' <summary>
+''' Small per-user settings of the program itself (not of a project): the root folder and the project
+''' that were used last. Stored in settings.json in the user's application data folder.
+''' Reading and writing never throw; a problem simply means the defaults are used.
+''' </summary>
+Public NotInheritable Class AppSettings
+
+ Private Const KeyRootFolder As String = "last_root_folder"
+ Private Const KeyProjectName As String = "last_project_name"
+ Private Const KeyProjectRoot As String = "project_root"
+
+ Public Property LastRootFolder As String = ""
+ Public Property LastProjectName As String = ""
+
+ ''' <summary>The root folder browsed on the Configuration tab (lstAllProjects, File > Choose project root) -
+ ''' distinct from LastRootFolder/LastProjectName, which remember the project that was actually open last, not
+ ''' necessarily the folder being browsed for other projects to switch to.</summary>
+ Public Property ProjectRoot As String = ""
+
+ Private Shared Function SettingsFilePath() As String
+ Return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "2D_wave_sim_V01", "settings.json")
+ End Function
+
+ Public Shared Function Load() As AppSettings
+ Dim settings As New AppSettings()
+ Try
+ Dim filePath As String = SettingsFilePath()
+ If File.Exists(filePath) Then
+ Dim serializer As New JavaScriptSerializer()
+ Dim root As Dictionary(Of String, Object) = TryCast(serializer.DeserializeObject(File.ReadAllText(filePath, Encoding.UTF8)), Dictionary(Of String, Object))
+ If root IsNot Nothing Then
+ settings.LastRootFolder = ReadText(root, KeyRootFolder)
+ settings.LastProjectName = ReadText(root, KeyProjectName)
+ settings.ProjectRoot = ReadText(root, KeyProjectRoot)
+ End If
+ End If
+ Catch ex As Exception
+ ' use the defaults
+ End Try
+ Return settings
+ End Function
+
+ Public Sub Save()
+ Try
+ Dim filePath As String = SettingsFilePath()
+ Directory.CreateDirectory(Path.GetDirectoryName(filePath))
+ Dim values As New Dictionary(Of String, String)()
+ values(KeyRootFolder) = LastRootFolder
+ values(KeyProjectName) = LastProjectName
+ values(KeyProjectRoot) = ProjectRoot
+ Dim serializer As New JavaScriptSerializer()
+ File.WriteAllText(filePath, serializer.Serialize(values), New UTF8Encoding(False))
+ Catch ex As Exception
+ ' the settings are a convenience only
+ End Try
+ End Sub
+
+ Private Shared Function ReadText(root As Dictionary(Of String, Object), key As String) As String
+ Dim v As Object = Nothing
+ If root.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v)
+ Return ""
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Projects/Project.vb b/2D_wave_sim_V01/Projects/Project.vb
new file mode 100644
index 0000000..38af606
--- /dev/null
+++ b/2D_wave_sim_V01/Projects/Project.vb
@@ -0,0 +1,110 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.IO
+
+''' <summary>
+''' An open project: a folder (the folder name is the project name) that contains configuration.json
+''' and the standard subfolders. Projects are created and opened with ProjectStore.
+''' </summary>
+Public NotInheritable Class Project
+
+ Private ReadOnly _folderPath As String
+ Private ReadOnly _config As ProjectConfig
+
+ Friend Sub New(folderPath As String, config As ProjectConfig)
+ _folderPath = folderPath
+ _config = config
+ ' the folder name is the one and only project name
+ _config.ProjectName = Name
+ End Sub
+
+ ''' <summary>The name of the project, which is the name of its folder.</summary>
+ Public ReadOnly Property Name As String
+ Get
+ Return Path.GetFileName(_folderPath)
+ End Get
+ End Property
+
+ ''' <summary>Full path of the main folder of the project.</summary>
+ Public ReadOnly Property FolderPath As String
+ Get
+ Return _folderPath
+ End Get
+ End Property
+
+ ''' <summary>The folder that contains the project folder (the root folder).</summary>
+ Public ReadOnly Property RootFolder As String
+ Get
+ Dim parent As String = Path.GetDirectoryName(_folderPath)
+ If parent Is Nothing Then Return ""
+ Return parent
+ End Get
+ End Property
+
+ ''' <summary>The configuration of the project. Changes are written to disk by Save.</summary>
+ Public ReadOnly Property Config As ProjectConfig
+ Get
+ Return _config
+ End Get
+ End Property
+
+ ''' <summary>Full path of configuration.json.</summary>
+ Public ReadOnly Property ConfigFilePath As String
+ Get
+ Return Path.Combine(_folderPath, ProjectConfig.FileName)
+ End Get
+ End Property
+
+ ''' <summary>Where the user can keep any third-party files used by the project (e.g. the original Photoshop
+ ''' file of a scene image) - not read or written by the simulator itself.</summary>
+ Public ReadOnly Property AssetsFolder As String
+ Get
+ Return Path.Combine(_folderPath, ProjectStore.AssetsFolderName)
+ End Get
+ End Property
+
+ Public ReadOnly Property OutputFramesFolder As String
+ Get
+ Return Path.Combine(_folderPath, ProjectStore.OutputFramesFolderName)
+ End Get
+ End Property
+
+ Public ReadOnly Property OutputVideoFolder As String
+ Get
+ Return Path.Combine(_folderPath, ProjectStore.OutputVideoFolderName)
+ End Get
+ End Property
+
+ Public ReadOnly Property SceneImageFolder As String
+ Get
+ Return Path.Combine(_folderPath, ProjectStore.SceneImageFolderName)
+ End Get
+ End Property
+
+ ''' <summary>Writes the configuration to configuration.json.</summary>
+ Public Sub Save()
+ _config.ProjectName = Name
+ _config.Save(ConfigFilePath)
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Projects/ProjectConfig.vb b/2D_wave_sim_V01/Projects/ProjectConfig.vb
new file mode 100644
index 0000000..a084b07
--- /dev/null
+++ b/2D_wave_sim_V01/Projects/ProjectConfig.vb
@@ -0,0 +1,342 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections
+Imports System.Collections.Generic
+Imports System.Globalization
+Imports System.IO
+Imports System.Text
+Imports System.Web.Script.Serialization
+
+''' <summary>
+''' The configuration of one project, stored as configuration.json in the main folder of the project.
+'''
+''' The file is a JSON object. The keys below are always present. Every tab that gets functionality later
+''' stores its own settings as a section (a nested JSON object), for example:
+''' Dim section = project.Config.GetSection("probes")
+''' section("count") = 3
+''' project.Save()
+''' Keys that this version of the program does not know are kept and written back unchanged, so a file
+''' written by a newer version is not damaged by an older one (it is refused when its format_version is newer).
+''' </summary>
+Public NotInheritable Class ProjectConfig
+
+ ''' <summary>Name of the configuration file inside a project folder.</summary>
+ Public Const FileName As String = "configuration.json"
+
+ ''' <summary>Name of the empty placeholder file that projects had before configuration.json existed.</summary>
+ Public Const LegacyFileName As String = "Configuration.txt"
+
+ ''' <summary>Version of the file layout. Increase it when a change makes old files incompatible.</summary>
+ Public Const CurrentFormatVersion As Integer = 1
+
+ Private Const KeyFormatVersion As String = "format_version"
+ Private Const KeyProjectName As String = "project_name"
+ Private Const KeyCreated As String = "created"
+ Private Const KeyModified As String = "modified"
+ Private Const KeyDescription As String = "description"
+
+ ' insertion ordered in practice, so the file keeps a stable, readable order
+ Private ReadOnly _values As Dictionary(Of String, Object)
+
+ ''' <summary>A new configuration with the standard keys only.</summary>
+ Public Sub New(projectName As String)
+ Dim stamp As String = Timestamp(DateTime.UtcNow)
+ _values = New Dictionary(Of String, Object)()
+ _values(KeyFormatVersion) = CurrentFormatVersion
+ _values(KeyProjectName) = projectName
+ _values(KeyCreated) = stamp
+ _values(KeyModified) = stamp
+ End Sub
+
+ Private Sub New(values As Dictionary(Of String, Object))
+ _values = values
+ If Not _values.ContainsKey(KeyFormatVersion) Then _values(KeyFormatVersion) = CurrentFormatVersion
+ End Sub
+
+ ' ---------------------------------------------------------------- standard values
+
+ Public ReadOnly Property FormatVersion As Integer
+ Get
+ Return GetInteger(KeyFormatVersion, CurrentFormatVersion)
+ End Get
+ End Property
+
+ ''' <summary>Name of the project. It is always the name of the project folder.</summary>
+ Public Property ProjectName As String
+ Get
+ Return GetString(KeyProjectName, "")
+ End Get
+ Set(value As String)
+ _values(KeyProjectName) = value
+ End Set
+ End Property
+
+ ''' <summary>When the project was created (UTC, ISO 8601 text).</summary>
+ Public ReadOnly Property Created As String
+ Get
+ Return GetString(KeyCreated, "")
+ End Get
+ End Property
+
+ ''' <summary>When the file was last saved (UTC, ISO 8601 text).</summary>
+ Public ReadOnly Property Modified As String
+ Get
+ Return GetString(KeyModified, "")
+ End Get
+ End Property
+
+ ''' <summary>A free-form description of the project (Form1's btnDescription/frmDescription), empty when none was set.</summary>
+ Public Property Description As String
+ Get
+ Return GetString(KeyDescription, "")
+ End Get
+ Set(value As String)
+ _values(KeyDescription) = value
+ End Set
+ End Property
+
+ ' ---------------------------------------------------------------- general access (for the tabs)
+
+ Public Function ContainsKey(key As String) As Boolean
+ Return _values.ContainsKey(key)
+ End Function
+
+ Public Function GetString(key As String, fallback As String) As String
+ Dim v As Object = Nothing
+ If _values.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Return Convert.ToString(v, CultureInfo.InvariantCulture)
+ End If
+ Return fallback
+ End Function
+
+ Public Function GetInteger(key As String, fallback As Integer) As Integer
+ Dim v As Object = Nothing
+ If _values.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Return Convert.ToInt32(v, CultureInfo.InvariantCulture)
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ Return fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+ ''' <summary>
+ ''' Sets a value. Allowed values: String, Boolean, numbers, Nothing, a Dictionary(Of String, Object)
+ ''' or a list or array of these.
+ ''' </summary>
+ Public Sub SetValue(key As String, value As Object)
+ _values(key) = value
+ End Sub
+
+ ''' <summary>
+ ''' The nested object with the given name; it is created (empty) when it does not exist yet.
+ ''' Changes made to the returned dictionary are part of the configuration and are written by Save.
+ ''' </summary>
+ Public Function GetSection(name As String) As Dictionary(Of String, Object)
+ Dim v As Object = Nothing
+ If _values.TryGetValue(name, v) Then
+ Dim existing As Dictionary(Of String, Object) = TryCast(v, Dictionary(Of String, Object))
+ If existing IsNot Nothing Then Return existing
+ End If
+ Dim section As New Dictionary(Of String, Object)()
+ _values(name) = section
+ Return section
+ End Function
+
+ ' ---------------------------------------------------------------- file
+
+ ''' <summary>Reads a configuration file. Throws when it cannot be read, is not valid or is from a newer version.</summary>
+ Public Shared Function Load(filePath As String) As ProjectConfig
+ Dim text As String = File.ReadAllText(filePath, Encoding.UTF8)
+
+ Dim serializer As New JavaScriptSerializer()
+ serializer.MaxJsonLength = Integer.MaxValue
+
+ Dim root As Dictionary(Of String, Object) = Nothing
+ Try
+ root = TryCast(serializer.DeserializeObject(text), Dictionary(Of String, Object))
+ Catch ex As Exception When TypeOf ex Is ArgumentException OrElse TypeOf ex Is InvalidOperationException
+ Throw New InvalidDataException("The file " & Path.GetFileName(filePath) & " is not valid JSON: " & ex.Message, ex)
+ End Try
+ If root Is Nothing Then
+ Throw New InvalidDataException("The file " & Path.GetFileName(filePath) & " is not a project configuration (a JSON object was expected).")
+ End If
+
+ Dim config As New ProjectConfig(root)
+ If config.FormatVersion > CurrentFormatVersion Then
+ Throw New InvalidDataException("The file " & Path.GetFileName(filePath) & " was made by a newer version of the program (format " &
+ config.FormatVersion.ToString(CultureInfo.InvariantCulture) & ").")
+ End If
+ Return config
+ End Function
+
+ ''' <summary>Writes the configuration to a file (overwriting an existing file) and updates the modified time.</summary>
+ Public Sub Save(filePath As String)
+ _values(KeyFormatVersion) = CurrentFormatVersion
+ _values(KeyModified) = Timestamp(DateTime.UtcNow)
+
+ Dim sb As New StringBuilder()
+ WriteObject(sb, _values, 0)
+ sb.AppendLine()
+
+ Dim folderPath As String = Path.GetDirectoryName(filePath)
+ If Not String.IsNullOrEmpty(folderPath) Then Directory.CreateDirectory(folderPath)
+
+ ' write to a temporary file first so a failed save never leaves a half-written configuration behind
+ Dim tmp As String = filePath & ".tmp"
+ File.WriteAllText(tmp, sb.ToString(), New UTF8Encoding(False))
+ If File.Exists(filePath) Then File.Delete(filePath)
+ File.Move(tmp, filePath)
+ End Sub
+
+ ' ---------------------------------------------------------------- JSON writing
+
+ Private Shared Function Timestamp(value As DateTime) As String
+ Return value.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'", CultureInfo.InvariantCulture)
+ End Function
+
+ Private Shared Sub WriteValue(sb As StringBuilder, value As Object, level As Integer)
+ If value Is Nothing Then
+ sb.Append("null")
+ Return
+ End If
+
+ Select Case Type.GetTypeCode(value.GetType())
+ Case TypeCode.Boolean
+ sb.Append(If(Convert.ToBoolean(value, CultureInfo.InvariantCulture), "true", "false"))
+ Case TypeCode.Byte, TypeCode.SByte, TypeCode.Int16, TypeCode.UInt16, TypeCode.Int32,
+ TypeCode.UInt32, TypeCode.Int64, TypeCode.UInt64, TypeCode.Decimal
+ sb.Append(Convert.ToString(value, CultureInfo.InvariantCulture))
+ Case TypeCode.Single, TypeCode.Double
+ Dim d As Double = Convert.ToDouble(value, CultureInfo.InvariantCulture)
+ If Double.IsNaN(d) OrElse Double.IsInfinity(d) Then
+ sb.Append("null")
+ Else
+ sb.Append(d.ToString("R", CultureInfo.InvariantCulture))
+ End If
+ Case TypeCode.DateTime
+ sb.Append(Quote(Timestamp(Convert.ToDateTime(value, CultureInfo.InvariantCulture).ToUniversalTime())))
+ Case TypeCode.String, TypeCode.Char
+ sb.Append(Quote(Convert.ToString(value, CultureInfo.InvariantCulture)))
+ Case TypeCode.Object
+ Dim dict As IDictionary = TryCast(value, IDictionary)
+ Dim list As IEnumerable = TryCast(value, IEnumerable)
+ If dict IsNot Nothing Then
+ WriteObject(sb, dict, level)
+ ElseIf list IsNot Nothing Then
+ WriteArray(sb, list, level)
+ Else
+ sb.Append(Quote(Convert.ToString(value, CultureInfo.InvariantCulture)))
+ End If
+ Case Else
+ sb.Append("null")
+ End Select
+ End Sub
+
+ Private Shared Sub WriteObject(sb As StringBuilder, dict As IDictionary, level As Integer)
+ If dict.Count = 0 Then
+ sb.Append("{}")
+ Return
+ End If
+
+ sb.AppendLine("{")
+ Dim index As Integer = 0
+ For Each entry As DictionaryEntry In dict
+ index += 1
+ sb.Append(Indent(level + 1))
+ sb.Append(Quote(Convert.ToString(entry.Key, CultureInfo.InvariantCulture)))
+ sb.Append(": ")
+ WriteValue(sb, entry.Value, level + 1)
+ If index < dict.Count Then sb.Append(",")
+ sb.AppendLine()
+ Next
+ sb.Append(Indent(level))
+ sb.Append("}")
+ End Sub
+
+ Private Shared Sub WriteArray(sb As StringBuilder, list As IEnumerable, level As Integer)
+ Dim items As New List(Of Object)()
+ Dim allScalar As Boolean = True
+ For Each item As Object In list
+ items.Add(item)
+ If item IsNot Nothing AndAlso (TypeOf item Is IDictionary OrElse (TypeOf item Is IEnumerable AndAlso Not TypeOf item Is String)) Then
+ allScalar = False
+ End If
+ Next
+
+ If items.Count = 0 Then
+ sb.Append("[]")
+ ElseIf allScalar Then
+ sb.Append("[")
+ For i As Integer = 0 To items.Count - 1
+ If i > 0 Then sb.Append(", ")
+ WriteValue(sb, items(i), level + 1)
+ Next
+ sb.Append("]")
+ Else
+ sb.AppendLine("[")
+ For i As Integer = 0 To items.Count - 1
+ sb.Append(Indent(level + 1))
+ WriteValue(sb, items(i), level + 1)
+ If i < items.Count - 1 Then sb.Append(",")
+ sb.AppendLine()
+ Next
+ sb.Append(Indent(level))
+ sb.Append("]")
+ End If
+ End Sub
+
+ Private Shared Function Indent(level As Integer) As String
+ Return New String(" "c, level * 2)
+ End Function
+
+ Private Shared Function Quote(text As String) As String
+ If text Is Nothing Then Return """"""
+ Dim sb As New StringBuilder()
+ sb.Append(""""c)
+ For Each ch As Char In text
+ Select Case ch
+ Case """"c
+ sb.Append("\""")
+ Case "\"c
+ sb.Append("\\")
+ Case ChrW(10)
+ sb.Append("\n")
+ Case ChrW(13)
+ sb.Append("\r")
+ Case ChrW(9)
+ sb.Append("\t")
+ Case Else
+ If AscW(ch) < 32 Then
+ sb.Append("\u").Append(AscW(ch).ToString("x4", CultureInfo.InvariantCulture))
+ Else
+ sb.Append(ch)
+ End If
+ End Select
+ Next
+ sb.Append(""""c)
+ Return sb.ToString()
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Projects/ProjectStore.vb b/2D_wave_sim_V01/Projects/ProjectStore.vb
new file mode 100644
index 0000000..4a19b38
--- /dev/null
+++ b/2D_wave_sim_V01/Projects/ProjectStore.vb
@@ -0,0 +1,232 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.IO
+Imports System.Linq
+
+''' <summary>
+''' Creates and opens projects. A project is a folder inside the root folder; the folder name is the
+''' project name. The main folder of a project contains configuration.json and these subfolders:
+''' assets, output_frames, output_video, scene_images
+''' (the configuration is entirely in configuration.json; assets is instead where the user can keep any
+''' third-party files used by the project, such as the original Photoshop file of a scene image.)
+''' </summary>
+Public NotInheritable Class ProjectStore
+
+ Public Const AssetsFolderName As String = "assets"
+ Public Const OutputFramesFolderName As String = "output_frames"
+ Public Const OutputVideoFolderName As String = "output_video"
+ Public Const SceneImageFolderName As String = "scene_images"
+
+ Private Const MaxNameLength As Integer = 100
+
+ Private Shared ReadOnly SubFolderNames As String() = {
+ AssetsFolderName, OutputFramesFolderName, OutputVideoFolderName, SceneImageFolderName}
+
+ ' names that Windows does not allow for a file or folder
+ Private Shared ReadOnly ReservedNames As String() = {
+ "CON", "PRN", "AUX", "NUL",
+ "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
+ "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"}
+
+ Private Sub New()
+ End Sub
+
+ ''' <summary>
+ ''' Checks a project name. Returns an empty string when the name can be used as a folder name,
+ ''' otherwise a message that says what is wrong. The name is never changed silently.
+ ''' </summary>
+ Public Shared Function ValidateName(projectName As String) As String
+ If String.IsNullOrWhiteSpace(projectName) Then Return "Enter a project name."
+ If projectName <> projectName.Trim() Then Return "The project name must not start or end with a space."
+ If projectName.EndsWith(".", StringComparison.Ordinal) Then Return "The project name must not end with a dot."
+ If projectName.Length > MaxNameLength Then
+ Return "The project name is too long (at most " & MaxNameLength.ToString() & " characters)."
+ End If
+
+ Dim invalid As Char() = Path.GetInvalidFileNameChars()
+ For Each ch As Char In projectName
+ If Array.IndexOf(invalid, ch) >= 0 Then
+ If AscW(ch) < 32 Then Return "The project name contains a control character."
+ Return "The project name contains the character '" & ch & "', which is not allowed in a folder name."
+ End If
+ Next
+
+ Dim baseName As String = projectName.Split("."c)(0).ToUpperInvariant()
+ If Array.IndexOf(ReservedNames, baseName) >= 0 Then
+ Return "'" & projectName & "' is a reserved name in Windows and cannot be used as a folder name."
+ End If
+ Return ""
+ End Function
+
+ ''' <summary>The full path of the folder of a project with the given name in the root folder.</summary>
+ Public Shared Function FolderPathFor(rootFolder As String, projectName As String) As String
+ Return Path.Combine(NormalizeFolder(rootFolder), projectName)
+ End Function
+
+ ''' <summary>True when the folder is a project folder (it has configuration.json or the old empty Configuration.txt).</summary>
+ Public Shared Function IsProjectFolder(folderPath As String) As Boolean
+ If String.IsNullOrWhiteSpace(folderPath) OrElse Not Directory.Exists(folderPath) Then Return False
+ Return File.Exists(Path.Combine(folderPath, ProjectConfig.FileName)) OrElse
+ File.Exists(Path.Combine(folderPath, ProjectConfig.LegacyFileName))
+ End Function
+
+ ''' <summary>
+ ''' Opens an existing project folder. Throws (with a readable message) when the folder is not a project
+ ''' or its configuration cannot be read. A project that still has the old empty Configuration.txt is
+ ''' upgraded: configuration.json is written and the empty placeholder is removed.
+ ''' </summary>
+ Public Shared Function Open(folderPath As String) As Project
+ Dim folder As String = NormalizeFolder(folderPath)
+ If Not Directory.Exists(folder) Then
+ Throw New DirectoryNotFoundException("The folder '" & folder & "' does not exist.")
+ End If
+
+ Dim jsonPath As String = Path.Combine(folder, ProjectConfig.FileName)
+ Dim legacyPath As String = Path.Combine(folder, ProjectConfig.LegacyFileName)
+ Dim opened As Project
+
+ If File.Exists(jsonPath) Then
+ opened = New Project(folder, ProjectConfig.Load(jsonPath))
+ ElseIf File.Exists(legacyPath) Then
+ If File.ReadAllText(legacyPath).Trim().Length > 0 Then
+ Throw New InvalidDataException("The file " & ProjectConfig.LegacyFileName &
+ " is not empty and has no known format, so it was not replaced.")
+ End If
+ opened = New Project(folder, New ProjectConfig(Path.GetFileName(folder)))
+ opened.Save()
+ File.Delete(legacyPath)
+ Else
+ Throw New InvalidDataException("The folder '" & Path.GetFileName(folder) & "' is not a project folder: it contains no " &
+ ProjectConfig.FileName & ".")
+ End If
+
+ EnsureSubFolders(folder)
+ Return opened
+ End Function
+
+ ''' <summary>
+ ''' Creates a new project: the project folder (and the root folder when needed), the standard subfolders
+ ''' and configuration.json. Throws (with a readable message) when the name is not valid, the project already
+ ''' exists or the folder already exists and is not empty.
+ ''' </summary>
+ Public Shared Function Create(rootFolder As String, projectName As String) As Project
+ Dim problem As String = ValidateName(projectName)
+ If problem.Length > 0 Then Throw New ArgumentException(problem, "projectName")
+ If String.IsNullOrWhiteSpace(rootFolder) Then Throw New ArgumentException("Enter a root folder.", "rootFolder")
+
+ Dim folder As String = FolderPathFor(rootFolder, projectName)
+ If IsProjectFolder(folder) Then
+ Throw New IOException("A project named '" & projectName & "' already exists in this root folder. Use 'Open existing' to open it.")
+ End If
+ If Directory.Exists(folder) AndAlso Directory.EnumerateFileSystemEntries(folder).Any() Then
+ Throw New IOException("The folder '" & folder & "' already exists and is not empty, so it cannot be used for a new project.")
+ End If
+
+ Directory.CreateDirectory(folder)
+ EnsureSubFolders(folder)
+
+ Dim created As New Project(folder, New ProjectConfig(projectName))
+ created.Save()
+ Return created
+ End Function
+
+ ''' <summary>The names of every project folder directly inside the root folder, sorted alphabetically
+ ''' (case-insensitive). A subfolder that is not a project folder (IsProjectFolder) is left out. Returns an
+ ''' empty list when the root folder does not exist, or cannot be listed (removed drive, no permission, ...).</summary>
+ Public Shared Function ListProjects(rootFolder As String) As List(Of String)
+ Dim names As New List(Of String)()
+ If String.IsNullOrWhiteSpace(rootFolder) OrElse Not Directory.Exists(rootFolder) Then Return names
+
+ Try
+ For Each folder As String In Directory.GetDirectories(rootFolder)
+ If IsProjectFolder(folder) Then names.Add(Path.GetFileName(folder))
+ Next
+ Catch ex As Exception When TypeOf ex Is IOException OrElse TypeOf ex Is UnauthorizedAccessException
+ Return New List(Of String)()
+ End Try
+ names.Sort(Function(a, b) String.Compare(a, b, StringComparison.OrdinalIgnoreCase))
+ Return names
+ End Function
+
+ ''' <summary>
+ ''' Permanently deletes a project folder and everything in it. Throws (with a readable message) when the
+ ''' folder is not a project folder, so a wrong or unrelated folder can never be removed by mistake.
+ ''' </summary>
+ Public Shared Sub Delete(folderPath As String)
+ Dim folder As String = NormalizeFolder(folderPath)
+ If Not IsProjectFolder(folder) Then
+ Throw New InvalidDataException("The folder '" & Path.GetFileName(folder) & "' is not a project folder, so it was not deleted.")
+ End If
+ Directory.Delete(folder, True)
+ End Sub
+
+ ''' <summary>
+ ''' Renames a project by moving its folder to a new name in the same root folder. Throws (with a readable
+ ''' message) when the new name is not valid or a project (or any other file/folder) with that name already
+ ''' exists there. Returns the new folder path.
+ ''' </summary>
+ Public Shared Function Rename(folderPath As String, newProjectName As String) As String
+ Dim folder As String = NormalizeFolder(folderPath)
+ If Not IsProjectFolder(folder) Then
+ Throw New InvalidDataException("The folder '" & Path.GetFileName(folder) & "' is not a project folder, so it was not renamed.")
+ End If
+
+ Dim problem As String = ValidateName(newProjectName)
+ If problem.Length > 0 Then Throw New ArgumentException(problem, "newProjectName")
+
+ Dim rootFolder As String = Path.GetDirectoryName(folder)
+ Dim newFolder As String = FolderPathFor(rootFolder, newProjectName)
+ If String.Equals(folder, newFolder, StringComparison.OrdinalIgnoreCase) Then Return folder ' only a case change, or unchanged
+
+ If Directory.Exists(newFolder) OrElse File.Exists(newFolder) Then
+ Throw New IOException("'" & newProjectName & "' already exists in this root folder. Choose a different name.")
+ End If
+
+ Directory.Move(folder, newFolder)
+ Return newFolder
+ End Function
+
+ ' ---------------------------------------------------------------- helpers
+
+ Private Shared Sub EnsureSubFolders(folder As String)
+ Try
+ For Each subName As String In SubFolderNames
+ Directory.CreateDirectory(Path.Combine(folder, subName))
+ Next
+ Catch ex As Exception When TypeOf ex Is IOException OrElse TypeOf ex Is UnauthorizedAccessException
+ ' not fatal: a folder that cannot be created is reported when it is needed
+ End Try
+ End Sub
+
+ ''' <summary>Full path without a trailing separator (except for a drive root such as C:\).</summary>
+ Friend Shared Function NormalizeFolder(folderPath As String) As String
+ Dim full As String = Path.GetFullPath(folderPath.Trim())
+ Dim pathRoot As String = Path.GetPathRoot(full)
+ If full.Length > pathRoot.Length Then
+ full = full.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
+ End If
+ Return full
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Projects/SceneSettings.vb b/2D_wave_sim_V01/Projects/SceneSettings.vb
new file mode 100644
index 0000000..cf9d10a
--- /dev/null
+++ b/2D_wave_sim_V01/Projects/SceneSettings.vb
@@ -0,0 +1,191 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Globalization
+Imports System.IO
+
+''' <summary>
+''' The scene properties of a project (Configuration tab). They are stored in the section "scene" of
+''' configuration.json:
+''' mode "image" (canvas size = size of the scene image) or "user_defined"
+''' image_file the scene image, relative to the project folder when it lies inside it (forward slashes)
+''' user_width, user_height canvas size in pixels for the user defined scene
+''' damping_edge_enabled, damping_edge_size_px
+''' use_sources (the sources in the scene image), image_source_scale (their amplitude factor),
+''' use_object_sources
+''' The size of a scene image is not stored: it is read from the image itself. There is no scene-level "use probes"
+''' switch: each probe has its own "On" checkbox (ProbeSettings.Active) instead.
+''' </summary>
+Public NotInheritable Class SceneSettings
+
+ Public Const SectionName As String = "scene"
+
+ Public Const ModeImage As String = "image"
+ Public Const ModeUserDefined As String = "user_defined"
+
+ ' the defaults are those of the Python example (1920 x 1080 canvas, 64 px damping edge)
+ Public Const DefaultWidth As Integer = 1920
+ Public Const DefaultHeight As Integer = 1080
+ Public Const DefaultDampingEdgeSize As Integer = 64
+
+ Public Const MinCanvasSize As Integer = 8
+ Public Const MaxCanvasSize As Integer = 16384
+ Public Const MaxDampingEdgeSize As Integer = 8192
+
+ Public Const DefaultImageSourceScale As Double = 1.0
+ Public Const MaxImageSourceScale As Double = 1000.0
+
+ ''' <summary>The refractive index of a user defined (image-less) scene's background, 1.0 to 2.55 (a red channel value of 100 to 255, as in a scene image).</summary>
+ Public Const DefaultBackgroundRefractiveIndex As Double = 1.0
+ Public Const MinBackgroundRefractiveIndex As Double = 1.0
+ Public Const MaxBackgroundRefractiveIndex As Double = 2.55
+
+ ''' <summary>True: the canvas is the scene image. False: the canvas has the user defined size.</summary>
+ Public Property UseImage As Boolean = False
+
+ ''' <summary>The scene image as stored: relative to the project folder when inside it, otherwise a full path. Empty when none.</summary>
+ Public Property ImageFile As String = ""
+
+ Public Property UserWidth As Integer = DefaultWidth
+ Public Property UserHeight As Integer = DefaultHeight
+
+ ''' <summary>No software-chosen default of its own, the same as SimulationSettings.Steps/TimeDecayFactor - a
+ ''' new project starts at whatever chkDampingEdge's own Designer Checked value is (see StartNewProject,
+ ''' Form1.vb). The False below (used by FromConfig) is only the fallback for an existing project saved before
+ ''' this setting existed.</summary>
+ Public Property DampingEdgeEnabled As Boolean
+ Public Property DampingEdgeSize As Integer = DefaultDampingEdgeSize
+
+ ''' <summary>Use the sources in the green channel of the scene image.</summary>
+ Public Property UseSources As Boolean = False
+
+ ''' <summary>Amplitude factor of the image sources (source_amplitude of StaticImageScene in the Python code).</summary>
+ Public Property ImageSourceScale As Double = DefaultImageSourceScale
+
+ ''' <summary>Use the source objects of the source list (not implemented yet; only the setting is kept). No
+ ''' software-chosen default of its own, the same as DampingEdgeEnabled above - a new project starts at
+ ''' whatever chkUseObjectSources' own Designer Checked value is (see StartNewProject, Form1.vb).</summary>
+ Public Property UseObjectSources As Boolean
+
+ ''' <summary>The background refractive index of a user defined scene (a scene image has its own value per pixel, from its red channel).</summary>
+ Public Property BackgroundRefractiveIndex As Double = DefaultBackgroundRefractiveIndex
+
+ ' ---------------------------------------------------------------- configuration file
+
+ ''' <summary>Reads the scene settings from a project configuration; missing or invalid values get their defaults.</summary>
+ Public Shared Function FromConfig(config As ProjectConfig) As SceneSettings
+ Dim scene As New SceneSettings()
+ If Not config.ContainsKey(SectionName) Then Return scene
+
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ scene.UseImage = (ReadText(section, "mode", ModeUserDefined) = ModeImage)
+ scene.ImageFile = ReadText(section, "image_file", "")
+ scene.UserWidth = ReadInt(section, "user_width", DefaultWidth, MinCanvasSize, MaxCanvasSize)
+ scene.UserHeight = ReadInt(section, "user_height", DefaultHeight, MinCanvasSize, MaxCanvasSize)
+ scene.DampingEdgeEnabled = ReadBool(section, "damping_edge_enabled", False)
+ scene.DampingEdgeSize = ReadInt(section, "damping_edge_size_px", DefaultDampingEdgeSize, 1, MaxDampingEdgeSize)
+ scene.UseSources = ReadBool(section, "use_sources", False)
+ scene.ImageSourceScale = ReadDouble(section, "image_source_scale", DefaultImageSourceScale, 0.0, MaxImageSourceScale)
+ scene.UseObjectSources = ReadBool(section, "use_object_sources", False)
+ scene.BackgroundRefractiveIndex = ReadDouble(section, "background_refractive_index", DefaultBackgroundRefractiveIndex,
+ MinBackgroundRefractiveIndex, MaxBackgroundRefractiveIndex)
+ Return scene
+ End Function
+
+ ''' <summary>Puts the scene settings into a project configuration (call Project.Save to write the file).</summary>
+ Public Sub ToConfig(config As ProjectConfig)
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ section("mode") = If(UseImage, ModeImage, ModeUserDefined)
+ section("image_file") = ImageFile
+ section("user_width") = UserWidth
+ section("user_height") = UserHeight
+ section("damping_edge_enabled") = DampingEdgeEnabled
+ section("damping_edge_size_px") = DampingEdgeSize
+ section("use_sources") = UseSources
+ section("image_source_scale") = ImageSourceScale
+ section("use_object_sources") = UseObjectSources
+ section("background_refractive_index") = BackgroundRefractiveIndex
+ End Sub
+
+ ' ---------------------------------------------------------------- image paths
+
+ ''' <summary>The path to store for an image: relative to the project folder when the image is inside it.</summary>
+ Public Shared Function ToStoredPath(projectFolder As String, fullPath As String) As String
+ If String.IsNullOrEmpty(projectFolder) Then Return fullPath
+ Dim prefix As String = projectFolder.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) & Path.DirectorySeparatorChar
+ If fullPath.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) Then
+ Return fullPath.Substring(prefix.Length).Replace(Path.DirectorySeparatorChar, "/"c)
+ End If
+ Return fullPath
+ End Function
+
+ ''' <summary>The full path of a stored image path.</summary>
+ Public Shared Function ToFullPath(projectFolder As String, storedPath As String) As String
+ If String.IsNullOrEmpty(storedPath) Then Return ""
+ If Path.IsPathRooted(storedPath) Then Return storedPath
+ Return Path.Combine(projectFolder, storedPath.Replace("/"c, Path.DirectorySeparatorChar))
+ End Function
+
+ ' ---------------------------------------------------------------- helpers
+
+ Private Shared Function ReadText(section As Dictionary(Of String, Object), key As String, fallback As String) As String
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadBool(section As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadDouble(section As Dictionary(Of String, Object), key As String, fallback As Double,
+ minValue As Double, maxValue As Double) As Double
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim x As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)
+ If x >= minValue AndAlso x <= maxValue Then Return x
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+ Private Shared Function ReadInt(section As Dictionary(Of String, Object), key As String, fallback As Integer,
+ minValue As Integer, maxValue As Integer) As Integer
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)
+ If n >= minValue AndAlso n <= maxValue Then Return n
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Projects/inages/QR-code.png b/2D_wave_sim_V01/Projects/inages/QR-code.png
new file mode 100644
index 0000000..2e99b63
Binary files /dev/null and b/2D_wave_sim_V01/Projects/inages/QR-code.png differ
diff --git a/2D_wave_sim_V01/Resources/QR-code.png b/2D_wave_sim_V01/Resources/QR-code.png
new file mode 100644
index 0000000..2e99b63
Binary files /dev/null and b/2D_wave_sim_V01/Resources/QR-code.png differ
diff --git a/2D_wave_sim_V01/Simulation/AviMjpegWriter.vb b/2D_wave_sim_V01/Simulation/AviMjpegWriter.vb
new file mode 100644
index 0000000..0963e71
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/AviMjpegWriter.vb
@@ -0,0 +1,199 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.IO
+Imports System.Text
+
+''' <summary>
+''' Writes a video as an AVI file with Motion JPEG frames. Every frame is given as an ordinary JPEG image.
+''' No codec or external program is needed. VLC and most video editors play the file; a program like
+''' ffmpeg can convert it to MP4.
+'''
+''' File layout (all numbers little endian):
+''' RIFF 'AVI ' [ LIST 'hdrl' [ 'avih' (56) LIST 'strl' [ 'strh' (56) 'strf' (40) ] ]
+''' LIST 'movi' [ '00dc' frame ... ] 'idx1' index ]
+''' The sizes and the frame count are written when the file is closed.
+''' </summary>
+Friend NotInheritable Class AviMjpegWriter
+ Implements IDisposable
+
+ ' AVI files are limited to 4 GB (unsigned 32 bit sizes); stop before that
+ Private Const MaxFileSize As Long = 3900000000L
+
+ ' positions of the numbers that are filled in at the end
+ Private Const PosRiffSize As Long = 4
+ Private Const PosTotalFrames As Long = 48
+ Private Const PosBufferSize As Long = 60
+ Private Const PosStreamLength As Long = 140
+ Private Const PosStreamBufferSize As Long = 144
+ Private Const PosMoviSize As Long = 216
+ Private Const PosMoviTag As Long = 220
+
+ Private _stream As FileStream
+ Private _writer As BinaryWriter
+ Private ReadOnly _offsets As New List(Of Integer)()
+ Private ReadOnly _sizes As New List(Of Integer)()
+ Private _largestFrame As Integer
+ Private _closed As Boolean
+
+ Public Sub New(filePath As String, width As Integer, height As Integer, framesPerSecond As Integer)
+ _stream = New FileStream(filePath, FileMode.Create, FileAccess.Write, FileShare.Read)
+ _writer = New BinaryWriter(_stream)
+
+ Dim ascii As Encoding = Encoding.ASCII
+
+ _writer.Write(ascii.GetBytes("RIFF"))
+ _writer.Write(0UI) ' file size - 8, filled in at the end
+ _writer.Write(ascii.GetBytes("AVI "))
+
+ _writer.Write(ascii.GetBytes("LIST"))
+ _writer.Write(192UI) ' 'hdrl' + avih chunk (64) + strl list chunk (124)
+ _writer.Write(ascii.GetBytes("hdrl"))
+
+ ' main header
+ _writer.Write(ascii.GetBytes("avih"))
+ _writer.Write(56UI)
+ _writer.Write(CUInt(1000000 \ framesPerSecond)) ' microseconds per frame
+ _writer.Write(0UI) ' maximum bytes per second
+ _writer.Write(0UI) ' padding granularity
+ _writer.Write(&H10UI) ' flags: has index
+ _writer.Write(0UI) ' total frames, filled in at the end
+ _writer.Write(0UI) ' initial frames
+ _writer.Write(1UI) ' streams
+ _writer.Write(0UI) ' suggested buffer size, filled in at the end
+ _writer.Write(CUInt(width))
+ _writer.Write(CUInt(height))
+ For i As Integer = 0 To 3
+ _writer.Write(0UI) ' reserved
+ Next
+
+ ' the video stream
+ _writer.Write(ascii.GetBytes("LIST"))
+ _writer.Write(116UI) ' 'strl' + strh chunk (64) + strf chunk (48)
+ _writer.Write(ascii.GetBytes("strl"))
+
+ _writer.Write(ascii.GetBytes("strh"))
+ _writer.Write(56UI)
+ _writer.Write(ascii.GetBytes("vids"))
+ _writer.Write(ascii.GetBytes("MJPG"))
+ _writer.Write(0UI) ' flags
+ _writer.Write(0US) ' priority
+ _writer.Write(0US) ' language
+ _writer.Write(0UI) ' initial frames
+ _writer.Write(1UI) ' scale
+ _writer.Write(CUInt(framesPerSecond)) ' rate: frames per second = rate / scale
+ _writer.Write(0UI) ' start
+ _writer.Write(0UI) ' length in frames, filled in at the end
+ _writer.Write(0UI) ' suggested buffer size, filled in at the end
+ _writer.Write(&HFFFFFFFFUI) ' quality: default
+ _writer.Write(0UI) ' sample size
+ _writer.Write(0US) ' frame rectangle: left, top, right, bottom
+ _writer.Write(0US)
+ _writer.Write(CUShort(width))
+ _writer.Write(CUShort(height))
+
+ _writer.Write(ascii.GetBytes("strf")) ' BITMAPINFOHEADER
+ _writer.Write(40UI)
+ _writer.Write(40UI) ' structure size
+ _writer.Write(width)
+ _writer.Write(height)
+ _writer.Write(1US) ' planes
+ _writer.Write(24US) ' bits per pixel
+ _writer.Write(ascii.GetBytes("MJPG"))
+ _writer.Write(CUInt(CLng(width) * height * 3L And &HFFFFFFFFL))
+ _writer.Write(0) ' pixels per meter
+ _writer.Write(0)
+ _writer.Write(0UI) ' colors used
+ _writer.Write(0UI) ' important colors
+
+ _writer.Write(ascii.GetBytes("LIST"))
+ _writer.Write(0UI) ' size of the movie list, filled in at the end
+ _writer.Write(ascii.GetBytes("movi"))
+ End Sub
+
+ ''' <summary>The number of frames written so far.</summary>
+ Public ReadOnly Property FrameCount As Integer
+ Get
+ Return _offsets.Count
+ End Get
+ End Property
+
+ ''' <summary>Adds one frame: the first length bytes of data are a complete JPEG image.</summary>
+ Public Sub AddFrame(data As Byte(), length As Integer)
+ If _closed Then Throw New InvalidOperationException("The video file is already closed.")
+
+ ' room for this frame and the index (16 bytes per frame)
+ If _stream.Position + length + 16L * (_offsets.Count + 2) + 64L > MaxFileSize Then
+ Throw New IOException("The video file would become larger than 4 GB, which the AVI format does not allow.")
+ End If
+
+ _offsets.Add(CInt(_stream.Position - PosMoviTag))
+ _sizes.Add(length)
+ _writer.Write(Encoding.ASCII.GetBytes("00dc"))
+ _writer.Write(CUInt(length))
+ _writer.Write(data, 0, length)
+ If (length And 1) = 1 Then _writer.Write(CByte(0)) ' chunks are padded to an even size
+ If length > _largestFrame Then _largestFrame = length
+ End Sub
+
+ ''' <summary>Writes the index and the sizes and closes the file.</summary>
+ Public Sub Close()
+ If _closed Then Return
+ _closed = True
+
+ Try
+ Dim moviEnd As Long = _stream.Position
+
+ _writer.Write(Encoding.ASCII.GetBytes("idx1"))
+ _writer.Write(CUInt(16 * _offsets.Count))
+ For i As Integer = 0 To _offsets.Count - 1
+ _writer.Write(Encoding.ASCII.GetBytes("00dc"))
+ _writer.Write(&H10UI) ' key frame
+ _writer.Write(CUInt(_offsets(i)))
+ _writer.Write(CUInt(_sizes(i)))
+ Next
+ Dim fileEnd As Long = _stream.Position
+
+ Patch(PosRiffSize, CUInt(fileEnd - 8L))
+ Patch(PosTotalFrames, CUInt(_offsets.Count))
+ Patch(PosBufferSize, CUInt(_largestFrame))
+ Patch(PosStreamLength, CUInt(_offsets.Count))
+ Patch(PosStreamBufferSize, CUInt(_largestFrame))
+ Patch(PosMoviSize, CUInt(moviEnd - PosMoviSize))
+ _writer.Flush()
+ Finally
+ _writer.Close()
+ _stream.Dispose()
+ End Try
+ End Sub
+
+ Private Sub Patch(position As Long, value As UInteger)
+ _stream.Seek(position, SeekOrigin.Begin)
+ _writer.Write(value)
+ End Sub
+
+ Public Sub Dispose() Implements IDisposable.Dispose
+ Close()
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/FrameRenderer.vb b/2D_wave_sim_V01/Simulation/FrameRenderer.vb
new file mode 100644
index 0000000..af6f210
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/FrameRenderer.vb
@@ -0,0 +1,197 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+'
+' Portions of this file are based on WaveSimulator2D by 0x23
+' <https://github.com/0x23/WaveSimulator2D>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Drawing
+Imports System.Drawing.Imaging
+Imports System.Runtime.InteropServices
+Imports System.Threading.Tasks
+
+''' <summary>
+''' Turns the field or the intensity of a wave engine (CPU or GPU) into pixels, like WaveVisualizer.render_field and
+''' render_intensity: the value is converted to a table index (see ColorLut) and the index to a color.
+''' Without a color table (Nothing) the index itself is used as gray level.
+''' The picture can be smaller than the simulation (a preview): every picture pixel then takes the nearest
+''' simulation pixel.
+''' </summary>
+Friend NotInheritable Class FrameRenderer
+
+ Private Sub New()
+ End Sub
+
+ ''' <summary>Renders the field into pixels (packed ARGB, row by row, dw x dh).</summary>
+ Public Shared Sub RenderField(sim As IWaveEngine, lut As Integer(), brightness As Single, pixels As Integer(), dw As Integer, dh As Integer)
+ Dim u As Single() = sim.FieldData
+ Dim stride As Integer = sim.Stride
+ Dim sw As Integer = sim.Width
+ Dim sh As Integer = sim.Height
+
+ Parallel.For(0, dh,
+ Sub(y As Integer)
+ Dim srcRow As Integer = (CInt(CLng(y) * sh \ dh) + 1) * stride + 1
+ Dim dst As Integer = y * dw
+ For x As Integer = 0 To dw - 1
+ Dim v As Single = u(srcRow + CInt(CLng(x) * sw \ dw))
+ pixels(dst + x) = Colorize(ColorLut.FieldIndex(v, brightness), lut)
+ Next
+ End Sub)
+ End Sub
+
+ ''' <summary>Renders the intensity (exponent 0.5, as in the Python code) into pixels (packed ARGB, dw x dh).</summary>
+ Public Shared Sub RenderIntensity(sim As IWaveEngine, lut As Integer(), brightness As Single, pixels As Integer(), dw As Integer, dh As Integer)
+ Dim inten As Single() = sim.IntensityData
+ Dim stride As Integer = sim.Stride
+ Dim sw As Integer = sim.Width
+ Dim sh As Integer = sim.Height
+
+ Parallel.For(0, dh,
+ Sub(y As Integer)
+ Dim srcRow As Integer = (CInt(CLng(y) * sh \ dh) + 1) * stride + 1
+ Dim dst As Integer = y * dw
+ For x As Integer = 0 To dw - 1
+ Dim v As Single = inten(srcRow + CInt(CLng(x) * sw \ dw))
+ Dim index As Integer = 0
+ If v > 0.0F Then
+ Dim s As Double = Math.Sqrt(v) * brightness
+ If s > 1.0 Then s = 1.0
+ index = CInt(Math.Truncate(s * 254.0))
+ End If
+ pixels(dst + x) = Colorize(index, lut)
+ Next
+ End Sub)
+ End Sub
+
+ Private Shared Function Colorize(index As Integer, lut As Integer()) As Integer
+ If lut IsNot Nothing Then Return lut(index)
+ Return &HFF000000 Or (index << 16) Or (index << 8) Or index
+ End Function
+
+ ''' <summary>Reads bmp into a flat array of R,G,B byte triplets, row by row, resampled to exactly w x h (bmp is
+ ''' expected to already be that size in the one place this is used - SimulationJob.GlowOverlay in
+ ''' SimulationRunner - so this is just a format normalization, not a real resize). Used to additively blend
+ ''' Form1's "glowing edges" preview overlay into exported video frames - see AddOverlay.</summary>
+ Public Shared Function ToRgbBytes(bmp As Bitmap, w As Integer, h As Integer) As Byte()
+ Dim result(w * h * 3 - 1) As Byte
+ Using normalized As New Bitmap(w, h, PixelFormat.Format24bppRgb)
+ Using g As Graphics = Graphics.FromImage(normalized)
+ g.Clear(Color.Black)
+ g.DrawImageUnscaled(bmp, 0, 0)
+ End Using
+ Dim rect As New Rectangle(0, 0, w, h)
+ Dim data As BitmapData = normalized.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb)
+ Try
+ Dim stride As Integer = data.Stride
+ Dim raw(stride * h - 1) As Byte
+ Marshal.Copy(data.Scan0, raw, 0, raw.Length)
+ For y As Integer = 0 To h - 1
+ Dim rowSrc As Integer = y * stride
+ Dim rowDst As Integer = y * w * 3
+ For x As Integer = 0 To w - 1
+ Dim s As Integer = rowSrc + x * 3
+ Dim d As Integer = rowDst + x * 3
+ result(d) = raw(s)
+ result(d + 1) = raw(s + 1)
+ result(d + 2) = raw(s + 2)
+ Next
+ Next
+ Finally
+ normalized.UnlockBits(data)
+ End Try
+ End Using
+ Return result
+ End Function
+
+ ''' <summary>
+ ''' overlayRgb (ToRgbBytes) with gain already multiplied into every byte and clamped to 255, so that
+ ''' AddOverlay's per-frame, per-pixel work is a plain add instead of repeating a floating-point multiply and
+ ''' a CInt conversion on the same bytes for every single exported frame - gain is fixed for the whole run
+ ''' (frozen at Start Simulation, like everything else in SimulationJob), so there is no reason to redo this
+ ''' more than once. Returns Nothing (AddOverlay then does nothing) when gain is 0 or below or there is no
+ ''' overlay to scale.
+ ''' </summary>
+ Public Shared Function ScaleOverlayRgb(overlayRgb As Byte(), gain As Double) As Byte()
+ If overlayRgb Is Nothing OrElse gain <= 0.0 Then Return Nothing
+
+ Dim scaled(overlayRgb.Length - 1) As Byte
+ For i As Integer = 0 To overlayRgb.Length - 1
+ scaled(i) = CByte(Math.Min(255.0, overlayRgb(i) * gain))
+ Next
+ Return scaled
+ End Function
+
+ ''' <summary>
+ ''' Additively blends a gain-prescaled overlay (ScaleOverlayRgb - B,G,R triplets, same w x h as pixels) into
+ ''' pixels (packed 0xAARRGGBB, as RenderField/RenderIntensity/Colorize produce), clamped to 255 per channel:
+ ''' never darkens, never touches the alpha byte, and a black overlay pixel (no edge there) leaves pixels
+ ''' untouched. Does nothing when there is no (prescaled) overlay. Parallelized by row like RenderField/
+ ''' RenderIntensity, since this runs once per exported video frame at full simulation resolution and was the
+ ''' actual cost of the glow-edges overlay on a video export - the live preview (Form1's own
+ ''' ComposeGlowOverlay, same multiply-then-add idea, kept separate since it runs on the UI thread against a
+ ''' Bitmap) is comparatively small and only runs a few times a second, so it was never the bottleneck.
+ ''' </summary>
+ Public Shared Sub AddOverlay(pixels As Integer(), scaledOverlayRgb As Byte(), w As Integer, h As Integer)
+ If scaledOverlayRgb Is Nothing Then Return
+
+ Parallel.For(0, h,
+ Sub(y As Integer)
+ Dim rowPix As Integer = y * w
+ Dim rowRgb As Integer = y * w * 3
+ For x As Integer = 0 To w - 1
+ Dim o As Integer = rowRgb + x * 3
+ Dim ob As Integer = scaledOverlayRgb(o)
+ Dim og As Integer = scaledOverlayRgb(o + 1)
+ Dim orr As Integer = scaledOverlayRgb(o + 2)
+ If ob = 0 AndAlso og = 0 AndAlso orr = 0 Then Continue For
+
+ Dim i As Integer = rowPix + x
+ Dim argb As Integer = pixels(i)
+ Dim a As Integer = argb And &HFF000000
+ Dim r As Integer = (argb >> 16) And &HFF
+ Dim gr As Integer = (argb >> 8) And &HFF
+ Dim b As Integer = argb And &HFF
+
+ r = Math.Min(255, r + orr)
+ gr = Math.Min(255, gr + og)
+ b = Math.Min(255, b + ob)
+
+ pixels(i) = a Or (r << 16) Or (gr << 8) Or b
+ Next
+ End Sub)
+ End Sub
+
+ ''' <summary>Makes a bitmap from packed ARGB pixels. The caller disposes the bitmap.</summary>
+ Public Shared Function ToBitmap(pixels As Integer(), w As Integer, h As Integer) As Bitmap
+ Dim bmp As New Bitmap(w, h, PixelFormat.Format32bppArgb)
+ Dim data As BitmapData = bmp.LockBits(New Rectangle(0, 0, w, h), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb)
+ Try
+ For y As Integer = 0 To h - 1
+ Marshal.Copy(pixels, y * w, IntPtr.Add(data.Scan0, y * data.Stride), w)
+ Next
+ Finally
+ bmp.UnlockBits(data)
+ End Try
+ Return bmp
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/FrameSink.vb b/2D_wave_sim_V01/Simulation/FrameSink.vb
new file mode 100644
index 0000000..46e0137
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/FrameSink.vb
@@ -0,0 +1,98 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Drawing
+Imports System.Drawing.Imaging
+Imports System.IO
+
+''' <summary>A video file that receives rendered frames (packed ARGB pixels, row by row).</summary>
+Friend Interface IFrameSink
+ Inherits IDisposable
+
+ ''' <summary>Adds one frame of the size the sink was opened with.</summary>
+ Sub AddPixels(pixels As Integer())
+
+ ''' <summary>Finishes the file so that it can be played.</summary>
+ Sub Close()
+
+ ''' <summary>The full path of the file.</summary>
+ ReadOnly Property FilePath As String
+End Interface
+
+''' <summary>
+''' Video as an AVI file with Motion JPEG frames (see AviMjpegWriter). Needs no codec on this computer,
+''' but Windows' own players do not play it; VLC does.
+''' </summary>
+Friend NotInheritable Class AviFrameSink
+ Implements IFrameSink
+
+ Private Shared ReadOnly JpegCodec As ImageCodecInfo = FindJpegCodec()
+
+ Private ReadOnly _jpegQuality As Long
+ Private ReadOnly _path As String
+ Private ReadOnly _writer As AviMjpegWriter
+ Private ReadOnly _width As Integer
+ Private ReadOnly _height As Integer
+ Private ReadOnly _buffer As New MemoryStream()
+
+ Public Sub New(filePath As String, width As Integer, height As Integer, framesPerSecond As Integer, quality As Integer)
+ _jpegQuality = Math.Max(1, Math.Min(100, quality))
+ _path = filePath
+ _width = width
+ _height = height
+ _writer = New AviMjpegWriter(filePath, width, height, framesPerSecond)
+ End Sub
+
+ Public ReadOnly Property FilePath As String Implements IFrameSink.FilePath
+ Get
+ Return _path
+ End Get
+ End Property
+
+ Public Sub AddPixels(pixels As Integer()) Implements IFrameSink.AddPixels
+ Using bmp As Bitmap = FrameRenderer.ToBitmap(pixels, _width, _height)
+ _buffer.SetLength(0)
+ Using parameters As New EncoderParameters(1)
+ parameters.Param(0) = New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, _jpegQuality)
+ bmp.Save(_buffer, JpegCodec, parameters)
+ End Using
+ _writer.AddFrame(_buffer.GetBuffer(), CInt(_buffer.Length))
+ End Using
+ End Sub
+
+ Public Sub Close() Implements IFrameSink.Close
+ _writer.Close()
+ End Sub
+
+ Public Sub Dispose() Implements IDisposable.Dispose
+ _writer.Close()
+ _buffer.Dispose()
+ End Sub
+
+ Private Shared Function FindJpegCodec() As ImageCodecInfo
+ For Each codec As ImageCodecInfo In ImageCodecInfo.GetImageEncoders()
+ If codec.FormatID = ImageFormat.Jpeg.Guid Then Return codec
+ Next
+ Throw New InvalidOperationException("The JPEG encoder is not available on this computer.")
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/GpuWaveSimulator.vb b/2D_wave_sim_V01/Simulation/GpuWaveSimulator.vb
new file mode 100644
index 0000000..6ff9d21
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/GpuWaveSimulator.vb
@@ -0,0 +1,1152 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+'
+' Portions of this file are based on WaveSimulator2D by 0x23
+' <https://github.com/0x23/WaveSimulator2D>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Text
+
+''' <summary>
+''' The 2D wave equation on the graphics card (through OpenCL), the same algorithm as WaveSimulator:
+''' new u = u + (u - previous u) * d + laplacian * c^2 (3x3 kernel 0.066 / 0.184 / -1)
+''' sources: u = u * 0.9 + sin(frequency * t) * amplitude * 0.1
+''' intensity: two cascaded one-pole filters, I1 = I1 * alpha + u^2 * (1 - alpha), I2 = I2 * alpha + I1 * (1 - alpha),
+''' blended (IntensityBlend) into what is shown/exported: Iout = (I1 * (1 - blend) + I2 * blend) * scale. alpha
+''' is derived once per simulation - see WaveSimulator's class summary (why two stages and the blend, not the
+''' single, fixed-0.98 filter shown above) and SimulationSettings.TimeDecayFactor's comment (why alpha); scale is
+''' SimulationSettings.IntensityScale (why it exists)
+''' The field, the previous field, c^2, d and the intensity stay in the memory of the graphics card; only when a
+''' frame is drawn (PrepareFrame) the field and/or intensity are copied back. The arrays have the same layout as
+''' those of the CPU engine (a border of one cell), so the same renderer draws both.
+'''
+''' Optionally (use4thOrderLaplacian), the wave_step kernel instead computes the Laplacian with a 4th order
+''' accurate, 5-point "cross" stencil wherever there is room for it, the same as WaveSimulator.UpdateField on the
+''' CPU (see that class's summary for why). Which form to use is baked into the generated kernel source as a
+''' compile-time #define, not a runtime branch, so there is no extra cost when it is off.
+'''
+''' The 4th order stencil needs the same time sub-stepping as the CPU engine to stay stable, for the same reason
+''' (see WaveSimulator's class summary): AdvanceOneStep launches the wave_step kernel _subSteps times instead of
+''' once when _subSteps > 1, with c2 scaled by a c2Scale kernel argument (1.0F / _subSteps^2) and the d buffer
+''' pre-scaled (on the host, once, at Build time) to its 1 / _subSteps-th root, so _subSteps kernel launches move
+''' the field by exactly the same physical time and damping as one ordinary launch. The intensity buffer is only
+''' updated (via the kernel's "track" argument) on the last of the _subSteps launches, so its own exponential
+''' averaging still runs once per AdvanceOneStep call, matching the CPU engine and its own earlier calibration.
+''' _subSteps is 1 (c2Scale exactly 1.0F, an exact no-op multiply, and the d buffer unchanged) whenever the 3x3
+''' kernel is used or this scene's highest c^2 does not need sub-stepping - see ComputeSubSteps.
+''' </summary>
+Friend NotInheritable Class GpuWaveSimulator
+ Implements IWaveEngine
+
+ Private ReadOnly _description As String
+ Private ReadOnly _width As Integer
+ Private ReadOnly _height As Integer
+ Private ReadOnly _stride As Integer
+ Private ReadOnly _cells As Integer
+ Private ReadOnly _track As Boolean
+ Private ReadOnly _sourceCount As Integer
+ Private ReadOnly _amplitude As Single
+ Private ReadOnly _use4thOrderLaplacian As Boolean
+ ' see the class summary; 1 (no sub-stepping) unless Use4thOrderLaplacian needs otherwise for this scene's c^2.
+ ' Set once, in Build (called from New) - not itself ReadOnly because VB.NET only allows a ReadOnly field to be
+ ' assigned directly inside the declaring class's constructor, not in a method (Build) that constructor calls.
+ Private _subSteps As Integer
+ ' 1.0F / _subSteps^2, or exactly 1.0F when _subSteps = 1 (a bit-for-bit no-op multiply in the kernel); see _subSteps
+ Private _c2Mult As Single
+ ' the intensity's exponential-average decay factor for this simulation (replaces the old fixed 0.98f in the
+ ' kernel), set once in Build - see WaveSimulator._intensityAlpha (CPU engine) for the identical computation
+ Private _intensityAlpha As Single
+ ' SimulationSettings.IntensityScale - see that property's comment and WaveSimulator._intensityScale (CPU engine)
+ Private _intensityScale As Single
+
+ Private _context As IntPtr
+ Private _queue As IntPtr
+ Private _program As IntPtr
+
+ ' Two field buffers that take turns as "current field" and "previous field"; there is a kernel for each turn
+ Private ReadOnly _field(1) As IntPtr
+ Private ReadOnly _stepKernel(1) As IntPtr
+ Private ReadOnly _sourceKernel(1) As IntPtr
+ Private _current As Integer
+
+ Private _c2Buffer As IntPtr
+ Private _dBuffer As IntPtr
+ ' the second cascaded filter stage's recursive state - see the class summary and WaveSimulator._intensity (CPU
+ ' engine); used only inside wave_step, never read back - what is read back/probed is _intensityOutBuffer
+ Private _intensityBuffer As IntPtr
+ ' the first of the two cascaded exponential-filter stages that make up the intensity - see the class summary
+ ' and WaveSimulator._intensityStage1 (CPU engine); used only inside wave_step, never read back
+ Private _intensityStage1Buffer As IntPtr
+ ' the blend of _intensityStage1Buffer and _intensityBuffer (IntensityBlend) that is actually read back/probed -
+ ' see the class summary and WaveSimulator._intensityOut (CPU engine)
+ Private _intensityOutBuffer As IntPtr
+ Private _indexBuffer As IntPtr
+ Private _levelBuffer As IntPtr
+ Private _frequencyBuffer As IntPtr
+
+ ' object sources (Sources tab): the flat list of generated point-source elements that are within the canvas,
+ ' one entry per element; the frequency table above (_frequencyBuffer, indexed by Level) is shared with the
+ ' image sources since both use the same level-to-frequency scale
+ Private ReadOnly _objSourceCount As Integer
+ Private ReadOnly _objSourceKernel(1) As IntPtr
+ Private _objIndexBuffer As IntPtr
+ Private _objLevelBuffer As IntPtr
+ Private _objAmplitudeBuffer As IntPtr
+ Private _objPhaseBuffer As IntPtr
+ Private _objModeBuffer As IntPtr
+ Private _objPulseShapeBuffer As IntPtr
+ Private _objOnWidthBuffer As IntPtr
+ ' the off-width currently in effect for each element, in cycles; read-write on the GPU (see apply_object_sources)
+ ' since an element with RandomizeOffWidthAmount > 0 redraws it there each time it completes a cycle
+ Private _objOffWidthBuffer As IntPtr
+ ' "detach source": the step at which each element stops driving the field (releasing its hold on it), or -1 to never
+ Private _objDetachStepBuffer As IntPtr
+ ' runtime state for off-width re-randomization (see SourceElement.RandomizeOffWidthAmount): the un-randomized
+ ' anchor each redraw is centered on, the per-element +/- spread (0 = never redraw), the cycle-clock value at
+ ' which each element's current off+on cycle started, and a per-element xorshift32 PRNG seed (kernel-side
+ ' reinterpreted as uint - only the entropy bits matter, not signedness)
+ Private _objOffWidthBaseBuffer As IntPtr
+ Private _objRandomizeOffWidthAmountBuffer As IntPtr
+ Private _objCycleAnchorBuffer As IntPtr
+ Private _objRngStateBuffer As IntPtr
+ Private ReadOnly _objGrid1D(0) As IntPtr
+
+ Private ReadOnly _grid2D(1) As IntPtr
+ Private ReadOnly _grid1D(0) As IntPtr
+
+ Private _hostField As Single()
+ Private _hostIntensity As Single()
+
+ Private _time As Double
+ Private _sinceFinish As Integer
+ Private _released As Boolean
+
+ ' the probes: a second small program measures them on the card.
+ ' Point probes: one value per step; the values wait in a history buffer until the next TakeProbeSamples
+ ' (or until the buffer is full).
+ Private Const ProbeRows As Integer = 2048
+ Private _deviceId As IntPtr
+ Private _probeSampler As ProbeSampler
+ Private _probeProgram As IntPtr
+ Private ReadOnly _probeKernel(1) As IntPtr
+ Private _pixelBuffer As IntPtr
+ Private _infoBuffer As IntPtr
+ Private _historyBuffer As IntPtr
+ Private _probeRow As Integer
+ Private ReadOnly _probeGrid(0) As IntPtr
+ Private ReadOnly _probeValues As New List(Of List(Of Single))()
+
+ ' Line probes: the pixels of all lines in one list; the totals (integrated intensity) are kept on the card,
+ ' the profiles are gathered into a small buffer and copied back when they are asked for
+ Private ReadOnly _gatherKernel(1) As IntPtr
+ Private _accumulateKernel As IntPtr
+ Private _profilePixelBuffer As IntPtr
+ Private _profileModeBuffer As IntPtr
+ ' "start recording at step #" for the integrated line probes: one entry per pixel (same layout as _profilePixelBuffer/
+ ' _profileModeBuffer), so profile_accumulate can skip a pixel's contribution before its probe's start step
+ Private _profileStartFlagBuffer As IntPtr
+ Private _profileStartStepBuffer As IntPtr
+ Private _profileTotalBuffer As IntPtr
+ Private _profileOutBuffer As IntPtr
+ Private _profileCount As Integer
+ Private _profileIntegrates As Boolean
+ Private _profileStart As Integer()
+ Private ReadOnly _profileGrid(0) As IntPtr
+
+ ''' <summary>
+ ''' Tries the GPUs one after the other, the best first. Returns Nothing when none works; <paramref name="problems"/>
+ ''' then tells why (or, when a later GPU did work, why the earlier ones did not).
+ ''' Throws DllNotFoundException when there is no OpenCL driver.
+ ''' </summary>
+ ''' <param name="use4thOrderLaplacian">See the class summary.</param>
+ ''' <param name="timeDecayFactor">SimulationSettings.TimeDecayFactor - see that property's comment.</param>
+ ''' <param name="intensityScale">SimulationSettings.IntensityScale - see that property's comment.</param>
+ ''' <param name="objectSources">The generated elements of the object sources (Sources tab), or Nothing/empty for none.</param>
+ Public Shared Function TryCreate(scene As SceneData, sourceFrequencyScale As Double, sourceAmplitude As Double,
+ trackIntensity As Boolean, use4thOrderLaplacian As Boolean, timeDecayFactor As Double,
+ intensityScale As Double,
+ ByRef problems As String,
+ Optional objectSources As List(Of SourceElement) = Nothing) As GpuWaveSimulator
+ problems = ""
+ Dim devices As List(Of GpuDeviceInfo) = GpuDeviceInfo.FindAll()
+ If devices.Count = 0 Then
+ problems = "no GPU found through OpenCL" & If(IntPtr.Size = 4, " (this is a 32-bit process; run the 64-bit build)", "")
+ Return Nothing
+ End If
+
+ Dim messages As New StringBuilder()
+ For Each dev As GpuDeviceInfo In devices
+ Try
+ Return New GpuWaveSimulator(dev, scene, sourceFrequencyScale, sourceAmplitude, trackIntensity, use4thOrderLaplacian, timeDecayFactor, intensityScale, objectSources)
+ Catch ex As Exception
+ If messages.Length > 0 Then messages.Append("; ")
+ messages.Append(dev.Name).Append(": ").Append(ex.Message)
+ End Try
+ Next
+ problems = messages.ToString()
+ Return Nothing
+ End Function
+
+ Private Sub New(device As GpuDeviceInfo, scene As SceneData, sourceFrequencyScale As Double,
+ sourceAmplitude As Double, trackIntensity As Boolean, use4thOrderLaplacian As Boolean,
+ timeDecayFactor As Double, intensityScale As Double,
+ Optional objectSources As List(Of SourceElement) = Nothing)
+ _description = "GPU: " & device.Name & " (OpenCL)"
+ _width = scene.Width
+ _height = scene.Height
+ _stride = _width + 2
+ _cells = _stride * (_height + 2)
+ _track = trackIntensity
+ _sourceCount = scene.SourceCount
+ _amplitude = CSng(sourceAmplitude)
+ _use4thOrderLaplacian = use4thOrderLaplacian
+
+ If device.MaxAllocation > 0 AndAlso CLng(_cells) * 4L > device.MaxAllocation Then
+ Throw New InvalidOperationException("the scene is too large for this GPU")
+ End If
+
+ ' object sources: keep only the elements whose position is inside the canvas (a randomized composite
+ ' element can fall outside), same filtering as the CPU engine (WaveSimulator)
+ Dim keptObjSources As New List(Of SourceElement)()
+ If objectSources IsNot Nothing Then
+ For Each el As SourceElement In objectSources
+ If el.PosX >= 0 AndAlso el.PosX < _width AndAlso el.PosY >= 0 AndAlso el.PosY < _height Then
+ keptObjSources.Add(el)
+ End If
+ Next
+ End If
+ _objSourceCount = keptObjSources.Count
+
+ Try
+ Build(device, scene, sourceFrequencyScale, timeDecayFactor, intensityScale, keptObjSources)
+ Catch ex As Exception
+ ReleaseAll()
+ Throw
+ End Try
+ End Sub
+
+ Private Sub Build(device As GpuDeviceInfo, scene As SceneData, sourceFrequencyScale As Double, timeDecayFactor As Double,
+ intensityScale As Double, objectSources As List(Of SourceElement))
+ Dim code As Integer = 0
+ _deviceId = device.DeviceId
+ Dim props() As IntPtr = {New IntPtr(OpenClApi.ContextPlatformProperty), device.PlatformId, IntPtr.Zero}
+ Dim devs() As IntPtr = {device.DeviceId}
+
+ _context = OpenClApi.clCreateContext(props, 1UI, devs, IntPtr.Zero, IntPtr.Zero, code)
+ OpenClApi.Check(code, "clCreateContext")
+ _queue = OpenClApi.clCreateCommandQueue(_context, device.DeviceId, 0UL, code)
+ OpenClApi.Check(code, "clCreateCommandQueue")
+
+ Dim sources() As String = {KernelSource(_use4thOrderLaplacian)}
+ _program = OpenClApi.clCreateProgramWithSource(_context, 1UI, sources, Nothing, code)
+ OpenClApi.Check(code, "clCreateProgramWithSource")
+ code = OpenClApi.clBuildProgram(_program, 1UI, devs, "", IntPtr.Zero, IntPtr.Zero)
+ If code <> 0 Then
+ Dim log As String = OpenClApi.BuildLog(_program, device.DeviceId)
+ Throw New InvalidOperationException("the program for the GPU could not be built (" & OpenClApi.ErrorName(code) & ")" &
+ If(log.Length > 0, ": " & log, ""))
+ End If
+
+ ' the scene, with a border of one cell like the CPU engine
+ Dim c2 As Single() = New Single(_cells - 1) {}
+ Dim d As Single() = New Single(_cells - 1) {}
+ For y As Integer = 0 To _height - 1
+ Array.Copy(scene.C2, y * _width, c2, (y + 1) * _stride + 1, _width)
+ Array.Copy(scene.D, y * _width, d, (y + 1) * _stride + 1, _width)
+ Next
+
+ ' see the class summary: sub-stepping keeps the 4th order stencil stable without changing the physical
+ ' wave speed or damping - _subSteps stays 1 (no sub-stepping) unless the 4th order stencil is in use and
+ ' this scene's highest c^2 actually needs it. The d buffer uploaded below is pre-scaled to match (its
+ ' 1 / _subSteps-th root, or unchanged when _subSteps = 1), same as WaveSimulator's _dEffective on the CPU.
+ Dim maxC2 As Single = 0.0F
+ If _use4thOrderLaplacian Then
+ For i As Integer = 0 To c2.Length - 1
+ If c2(i) > maxC2 Then maxC2 = c2(i)
+ Next
+ End If
+ _subSteps = If(_use4thOrderLaplacian, ComputeSubSteps(maxC2), 1)
+
+ Dim dUpload As Single() = d
+ If _subSteps > 1 Then
+ Dim dEff As Single() = New Single(d.Length - 1) {}
+ Dim invN As Double = 1.0 / _subSteps
+ For i As Integer = 0 To d.Length - 1
+ dEff(i) = CSng(Math.Pow(CDbl(d(i)), invN))
+ Next
+ dUpload = dEff
+ _c2Mult = 1.0F / CSng(_subSteps * _subSteps)
+ Else
+ _c2Mult = 1.0F
+ End If
+
+ _c2Buffer = CreateFloatBuffer(c2)
+ _dBuffer = CreateFloatBuffer(dUpload)
+
+ Dim zeros As Single() = New Single(_cells - 1) {}
+ _field(0) = CreateFloatBuffer(zeros)
+ _field(1) = CreateFloatBuffer(zeros)
+ If _track Then
+ _intensityBuffer = CreateFloatBuffer(zeros)
+ _intensityStage1Buffer = CreateFloatBuffer(zeros)
+ _intensityOutBuffer = CreateFloatBuffer(zeros)
+ Else
+ _intensityBuffer = CreateFloatBuffer(New Single(0) {})
+ _intensityStage1Buffer = CreateFloatBuffer(New Single(0) {})
+ _intensityOutBuffer = CreateFloatBuffer(New Single(0) {})
+ End If
+
+ ' the level-to-frequency table (level 0-255 -> frequency), shared by the image sources and the object sources
+ If _sourceCount > 0 OrElse _objSourceCount > 0 Then
+ Dim frequency(255) As Single
+ For l As Integer = 0 To 255
+ frequency(l) = CSng(l / 255.0 * 0.5 * sourceFrequencyScale)
+ Next
+ _frequencyBuffer = CreateFloatBuffer(frequency)
+ End If
+
+ ' the intensity's averaging time constant scales inversely with the frequency of the slowest active source
+ ' (image or object; a level of 0 means "no source" and is excluded) - see WaveSimulator's identical
+ ' computation (CPU engine) and TimeDecayFactor's comment (SimulationSettings.vb) for why
+ Dim minActiveLevel As Integer = 0
+ For i As Integer = 0 To _sourceCount - 1
+ Dim lv As Integer = CInt(scene.SourceLevel(i))
+ If lv > 0 AndAlso (minActiveLevel = 0 OrElse lv < minActiveLevel) Then minActiveLevel = lv
+ Next
+ For Each el As SourceElement In objectSources
+ If el.Level > 0 AndAlso (minActiveLevel = 0 OrElse el.Level < minActiveLevel) Then minActiveLevel = el.Level
+ Next
+ Const NominalDecayLevel As Integer = 100 ' see WaveSimulator.NominalDecayLevel (CPU engine)
+ If minActiveLevel = 0 Then minActiveLevel = NominalDecayLevel
+ Dim tauSteps As Double = Math.Max(1.0, timeDecayFactor * NominalDecayLevel / minActiveLevel)
+ _intensityAlpha = CSng(Math.Exp(-1.0 / tauSteps))
+ _intensityScale = CSng(intensityScale)
+
+ ' the image sources (from the green channel of the scene image)
+ If _sourceCount > 0 Then
+ Dim index(_sourceCount - 1) As Integer
+ Dim level(_sourceCount - 1) As Integer
+ For i As Integer = 0 To _sourceCount - 1
+ index(i) = (scene.SourceY(i) + 1) * _stride + scene.SourceX(i) + 1
+ level(i) = CInt(scene.SourceLevel(i))
+ Next
+ _indexBuffer = CreateIntBuffer(index)
+ _levelBuffer = CreateIntBuffer(level)
+ End If
+
+ ' the object sources (Sources tab)
+ If _objSourceCount > 0 Then
+ Dim objIndex(_objSourceCount - 1) As Integer
+ Dim objLevel(_objSourceCount - 1) As Integer
+ Dim objAmplitude(_objSourceCount - 1) As Single
+ Dim objPhase(_objSourceCount - 1) As Single
+ Dim objMode(_objSourceCount - 1) As Integer
+ Dim objPulseShape(_objSourceCount - 1) As Integer
+ Dim objOnWidth(_objSourceCount - 1) As Integer
+ Dim objOffWidth(_objSourceCount - 1) As Integer
+ Dim objDetachStep(_objSourceCount - 1) As Integer
+ Dim objOffWidthBase(_objSourceCount - 1) As Integer
+ Dim objRandomizeOffWidthAmount(_objSourceCount - 1) As Integer
+ Dim objCycleAnchor(_objSourceCount - 1) As Single
+ Dim objRngState(_objSourceCount - 1) As Integer
+ ' a local, host-side RNG just to seed each element's on-GPU xorshift32 generator - xorshift needs a
+ ' nonzero starting state, so 0 is never allowed
+ Dim seedRng As New Random()
+ For i As Integer = 0 To _objSourceCount - 1
+ Dim el As SourceElement = objectSources(i)
+ objIndex(i) = (el.PosY + 1) * _stride + el.PosX + 1
+ objLevel(i) = el.Level
+ objAmplitude(i) = CSng(el.Amplitude)
+ objPhase(i) = CSng(el.PhaseRad)
+ objMode(i) = If(el.Mode = SourceMode.Pulsed, 1, 0)
+ objPulseShape(i) = If(el.PulseShape = SourcePulseShape.SmoothedSquare, 1, 0)
+ objOnWidth(i) = el.OnWidthCycles
+ objOffWidth(i) = el.OffWidthCycles
+ objDetachStep(i) = el.DetachAfterStep
+ objOffWidthBase(i) = el.OffWidthBase
+ objRandomizeOffWidthAmount(i) = el.RandomizeOffWidthAmount
+ objCycleAnchor(i) = 0.0F
+ Dim seed As Integer = seedRng.Next(Integer.MinValue, Integer.MaxValue)
+ If seed = 0 Then seed = 1
+ objRngState(i) = seed
+ Next
+ _objIndexBuffer = CreateIntBuffer(objIndex)
+ _objLevelBuffer = CreateIntBuffer(objLevel)
+ _objAmplitudeBuffer = CreateFloatBuffer(objAmplitude)
+ _objPhaseBuffer = CreateFloatBuffer(objPhase)
+ _objModeBuffer = CreateIntBuffer(objMode)
+ _objPulseShapeBuffer = CreateIntBuffer(objPulseShape)
+ _objOnWidthBuffer = CreateIntBuffer(objOnWidth)
+ _objOffWidthBuffer = CreateIntBuffer(objOffWidth)
+ _objDetachStepBuffer = CreateIntBuffer(objDetachStep)
+ _objOffWidthBaseBuffer = CreateIntBuffer(objOffWidthBase)
+ _objRandomizeOffWidthAmountBuffer = CreateIntBuffer(objRandomizeOffWidthAmount)
+ _objCycleAnchorBuffer = CreateFloatBuffer(objCycleAnchor)
+ _objRngStateBuffer = CreateIntBuffer(objRngState)
+ End If
+
+ ' the kernels; kernel k reads field buffer k and writes into buffer 1 - k
+ For k As Integer = 0 To 1
+ _stepKernel(k) = CreateKernel("wave_step")
+ SetMem(_stepKernel(k), 0UI, _field(k))
+ SetMem(_stepKernel(k), 1UI, _field(1 - k))
+ SetMem(_stepKernel(k), 2UI, _c2Buffer)
+ SetMem(_stepKernel(k), 3UI, _dBuffer)
+ SetMem(_stepKernel(k), 4UI, _intensityBuffer)
+ SetInt(_stepKernel(k), 5UI, _width)
+ SetInt(_stepKernel(k), 6UI, _height)
+ SetInt(_stepKernel(k), 7UI, _stride)
+ SetInt(_stepKernel(k), 8UI, If(_track, 1, 0))
+ SetFloat(_stepKernel(k), 9UI, _c2Mult)
+ SetFloat(_stepKernel(k), 10UI, _intensityAlpha)
+ SetMem(_stepKernel(k), 11UI, _intensityStage1Buffer)
+ SetMem(_stepKernel(k), 12UI, _intensityOutBuffer)
+ SetFloat(_stepKernel(k), 13UI, _intensityScale)
+
+ If _sourceCount > 0 Then
+ _sourceKernel(k) = CreateKernel("apply_sources")
+ SetMem(_sourceKernel(k), 0UI, _field(k))
+ SetMem(_sourceKernel(k), 1UI, _indexBuffer)
+ SetMem(_sourceKernel(k), 2UI, _levelBuffer)
+ SetMem(_sourceKernel(k), 3UI, _frequencyBuffer)
+ SetFloat(_sourceKernel(k), 5UI, _amplitude)
+ SetInt(_sourceKernel(k), 6UI, _sourceCount)
+ End If
+
+ If _objSourceCount > 0 Then
+ _objSourceKernel(k) = CreateKernel("apply_object_sources")
+ SetMem(_objSourceKernel(k), 0UI, _field(k))
+ SetMem(_objSourceKernel(k), 1UI, _objIndexBuffer)
+ SetMem(_objSourceKernel(k), 2UI, _objLevelBuffer)
+ SetMem(_objSourceKernel(k), 3UI, _objAmplitudeBuffer)
+ SetMem(_objSourceKernel(k), 4UI, _objPhaseBuffer)
+ SetMem(_objSourceKernel(k), 5UI, _objModeBuffer)
+ SetMem(_objSourceKernel(k), 6UI, _objPulseShapeBuffer)
+ SetMem(_objSourceKernel(k), 7UI, _objOnWidthBuffer)
+ SetMem(_objSourceKernel(k), 8UI, _objOffWidthBuffer)
+ SetMem(_objSourceKernel(k), 9UI, _objDetachStepBuffer)
+ SetMem(_objSourceKernel(k), 10UI, _frequencyBuffer)
+ SetInt(_objSourceKernel(k), 12UI, _objSourceCount)
+ ' appended at the end rather than renumbering 0-12, so every SetMem/SetInt call above (and the
+ ' per-call SetFloat for t at index 11 in AdvanceOneStep) keeps its existing, already-correct index
+ SetMem(_objSourceKernel(k), 13UI, _objOffWidthBaseBuffer)
+ SetMem(_objSourceKernel(k), 14UI, _objRandomizeOffWidthAmountBuffer)
+ SetMem(_objSourceKernel(k), 15UI, _objCycleAnchorBuffer)
+ SetMem(_objSourceKernel(k), 16UI, _objRngStateBuffer)
+ End If
+ Next
+
+ _grid2D(0) = New IntPtr(_width)
+ _grid2D(1) = New IntPtr(_height)
+ _grid1D(0) = New IntPtr(Math.Max(1, _sourceCount))
+ _objGrid1D(0) = New IntPtr(Math.Max(1, _objSourceCount))
+
+ _hostField = New Single(_cells - 1) {}
+ If _track Then _hostIntensity = New Single(_cells - 1) {}
+ _current = 0
+ End Sub
+
+ ''' <summary>
+ ''' The number of smaller time steps (see the class summary) that keep c2 * |lambda max| of the 4th order
+ ''' stencil under the same target margin as WaveSimulator.ComputeSubSteps on the CPU (identical formula);
+ ''' 1 when that is already true for the given (highest, in this scene) c^2.
+ ''' </summary>
+ Private Shared Function ComputeSubSteps(maxC2 As Single) As Integer
+ ' the 4th order stencil's largest |eigenvalue| (32/3) and the same stability safety margin (2.0) as
+ ' WaveSimulator.FourthOrderLambdaMax / SubStepTargetLimit on the CPU - see that class's comments
+ Const LambdaMax4th As Single = 32.0F / 3.0F
+ Const TargetLimit As Single = 2.0F
+ If maxC2 <= 0.0F Then Return 1
+ Dim n As Double = Math.Ceiling(Math.Sqrt(CDbl(maxC2) * CDbl(LambdaMax4th) / CDbl(TargetLimit)))
+ Return Math.Max(1, CInt(n))
+ End Function
+
+ ''' <summary>
+ ''' The OpenCL C code of the two kernels. use4thOrderLaplacian selects, at compile time (a #define, not a
+ ''' runtime branch), which form of the Laplacian wave_step uses - see the class summary and
+ ''' WaveSimulator.UpdateField, whose CPU-side stencils and boundary logic this mirrors exactly. wave_step's
+ ''' c2Scale argument is the sub-stepping scale (see the class summary), and its intensityAlpha argument is the
+ ''' intensity's exponential-average decay factor (_intensityAlpha) - both are runtime kernel arguments rather
+ ''' than a #define, so they need no text formatting/locale handling here.
+ ''' </summary>
+ Private Shared Function KernelSource(use4thOrderLaplacian As Boolean) As String
+ Dim s As New StringBuilder()
+ s.AppendLine("#define USE_4TH_ORDER " & If(use4thOrderLaplacian, "1", "0"))
+ s.AppendLine()
+ s.AppendLine("__kernel void wave_step(__global const float* u, __global float* up, __global const float* c2,")
+ s.AppendLine(" __global const float* d, __global float* inten,")
+ s.AppendLine(" const int w, const int h, const int stride, const int track, const float c2Scale,")
+ s.AppendLine(" const float intensityAlpha, __global float* inten1, __global float* intenOut,")
+ s.AppendLine(" const float intensityScale)")
+ s.AppendLine("{")
+ s.AppendLine(" int x = get_global_id(0);")
+ s.AppendLine(" int y = get_global_id(1);")
+ s.AppendLine(" if (x >= w || y >= h) return;")
+ s.AppendLine(" int i = (y + 1) * stride + x + 1;")
+ s.AppendLine(" float uc = u[i];")
+ s.AppendLine(" float lap;")
+ s.AppendLine("#if USE_4TH_ORDER")
+ ' the 4th order 5-point "cross" stencil (reaches 2 cells away along x and along y), only where the domain
+ ' has that much room - the outermost ring (x = 0, x = w - 1, y = 0, y = h - 1) falls back to the 3x3
+ ' kernel below, the same boundary rule as WaveSimulator.UpdateField on the CPU
+ s.AppendLine(" if (x >= 1 && x <= w - 2 && y >= 1 && y <= h - 2) {")
+ s.AppendLine(" lap = (-1.0f / 12.0f) * (u[i - 2] + u[i + 2] + u[i - 2 * stride] + u[i + 2 * stride])")
+ s.AppendLine(" + (4.0f / 3.0f) * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride])")
+ s.AppendLine(" - 5.0f * uc;")
+ s.AppendLine(" } else {")
+ s.AppendLine(" lap = 0.066f * (u[i - stride - 1] + u[i - stride + 1] + u[i + stride - 1] + u[i + stride + 1])")
+ s.AppendLine(" + 0.184f * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride]) - uc;")
+ s.AppendLine(" }")
+ s.AppendLine("#else")
+ s.AppendLine(" lap = 0.066f * (u[i - stride - 1] + u[i - stride + 1] + u[i + stride - 1] + u[i + stride + 1])")
+ s.AppendLine(" + 0.184f * (u[i - 1] + u[i + 1] + u[i - stride] + u[i + stride]) - uc;")
+ s.AppendLine("#endif")
+ s.AppendLine(" float nv = uc + (uc - up[i]) * d[i] + lap * c2[i] * c2Scale;")
+ s.AppendLine(" up[i] = nv;")
+ ' two cascaded one-pole stages, blended (0.5f - see WaveSimulator.IntensityBlend, CPU engine) into what is
+ ' read back/probed (intenOut) instead of using the full 2-stage cascade outright - see the class summary
+ s.AppendLine(" if (track != 0) {")
+ s.AppendLine(" float s1 = inten1[i] * intensityAlpha + nv * nv * (1.0f - intensityAlpha);")
+ s.AppendLine(" inten1[i] = s1;")
+ s.AppendLine(" float s2 = inten[i] * intensityAlpha + s1 * (1.0f - intensityAlpha);")
+ s.AppendLine(" inten[i] = s2;")
+ s.AppendLine(" intenOut[i] = (s1 * 0.5f + s2 * 0.5f) * intensityScale;")
+ s.AppendLine(" }")
+ s.AppendLine("}")
+ s.AppendLine()
+ s.AppendLine("__kernel void apply_sources(__global float* u, __global const int* idx, __global const int* level,")
+ s.AppendLine(" __global const float* freq, const float t, const float amp, const int n)")
+ s.AppendLine("{")
+ s.AppendLine(" int k = get_global_id(0);")
+ s.AppendLine(" if (k >= n) return;")
+ s.AppendLine(" int p = idx[k];")
+ s.AppendLine(" u[p] = u[p] * 0.9f + sin(freq[level[k]] * t) * amp * 0.1f;")
+ s.AppendLine("}")
+ s.AppendLine()
+ ' xorshift32: OpenCL has no built-in RNG, so object sources that re-randomize their off-width (see
+ ' SourceElement.RandomizeOffWidthAmount) carry their own per-element state (rngState, seeded host-side,
+ ' nonzero) through this. Matches WaveSimulator's use of SourceSettings.RandomInt only in spirit (a uniform
+ ' draw in [-amount, amount]), not bit-for-bit - the two engines are not expected to reproduce each other.
+ s.AppendLine("inline uint xorshift32(uint x)")
+ s.AppendLine("{")
+ s.AppendLine(" x ^= x << 13;")
+ s.AppendLine(" x ^= x >> 17;")
+ s.AppendLine(" x ^= x << 5;")
+ s.AppendLine(" return x;")
+ s.AppendLine("}")
+ s.AppendLine()
+ ' object sources (Sources tab): same math as WaveSimulator.ApplySources/ComputePulsePosition/PulseEnvelope
+ ' on the CPU, one element per work item; mode 0 = continuous (envelope always 1), 1 = pulsed (Gaussian or
+ ' smoothed-square envelope, "off" preceding "on" within each onWidth/offWidth cycle of the element's own
+ ' frequency). offWidth is read-write: for an element with offWidthRandomizeAmount[k] > 0 this kernel redraws
+ ' it (uniformly within +/- offWidthRandomizeAmount of offWidthBase) every time that element completes a full
+ ' off+on cycle, advancing its own cycleAnchor[k] to mark where the new cycle started - so, unlike the other
+ ' object-source buffers, offWidth/cycleAnchor/rngState are genuinely mutated by the GPU across steps.
+ s.AppendLine("__kernel void apply_object_sources(__global float* u, __global const int* idx, __global const int* level,")
+ s.AppendLine(" __global const float* amp, __global const float* phase, __global const int* mode,")
+ s.AppendLine(" __global const int* pulseShape, __global const int* onWidth, __global int* offWidth,")
+ s.AppendLine(" __global const int* detachStep,")
+ s.AppendLine(" __global const float* freq, const float t, const int n,")
+ s.AppendLine(" __global const int* offWidthBase, __global const int* offWidthRandomizeAmount,")
+ s.AppendLine(" __global float* cycleAnchor, __global int* rngState)")
+ s.AppendLine("{")
+ s.AppendLine(" int k = get_global_id(0);")
+ s.AppendLine(" if (k >= n) return;")
+ ' "detach source": once the run reaches the element's detach step, its drive is faded out linearly over the
+ ' next DetachRampSteps steps (rather than cut instantly), then it stops driving the field entirely (not even
+ ' writing towards 0) so it releases its hold and stops diffracting waves through that point - matching
+ ' WaveSimulator.ApplySources exactly (SourceElement.DetachRampSteps is the single shared constant).
+ s.AppendLine(" float detachFade = 1.0f;")
+ s.AppendLine(" if (detachStep[k] >= 0) {")
+ s.AppendLine(" float stepsSinceDetach = t - (float)detachStep[k];")
+ s.AppendLine(" if (stepsSinceDetach >= " & SourceElement.DetachRampSteps.ToString() & ".0f) return;")
+ s.AppendLine(" if (stepsSinceDetach > 0.0f) detachFade = 1.0f - stepsSinceDetach / " & SourceElement.DetachRampSteps.ToString() & ".0f;")
+ s.AppendLine(" }")
+ s.AppendLine(" float f = freq[level[k]];")
+ s.AppendLine(" float envelope = 1.0f;")
+ s.AppendLine(" if (mode[k] != 0) {")
+ s.AppendLine(" int ow = offWidth[k];")
+ s.AppendLine(" int period = onWidth[k] + ow;")
+ s.AppendLine(" if (period > 0) {")
+ s.AppendLine(" float cycleClock = f * t / (2.0f * M_PI_F);")
+ s.AppendLine(" float pos;")
+ s.AppendLine(" int isFirstCycle;")
+ s.AppendLine(" if (offWidthRandomizeAmount[k] <= 0) {")
+ ' shifted so t = 0 lands at pos = ow (the start of the "on" span), not pos = 0 (the start of an "off" span) -
+ ' a single/non-randomized source starting silent for its off-width was never the intent (see
+ ' WaveSimulator.ComputePulsePosition, kept in exact agreement with this kernel)
+ s.AppendLine(" float adjustedClock = cycleClock + (float)ow;")
+ s.AppendLine(" isFirstCycle = (floor(adjustedClock / (float)period) == 0.0f) ? 1 : 0;")
+ s.AppendLine(" pos = adjustedClock - period * floor(adjustedClock / (float)period);")
+ s.AppendLine(" } else {")
+ s.AppendLine(" pos = cycleClock - cycleAnchor[k];")
+ s.AppendLine(" int guard = 0;")
+ s.AppendLine(" while (pos >= (float)period && guard < 1000) {")
+ s.AppendLine(" cycleAnchor[k] += (float)period;")
+ s.AppendLine(" pos -= (float)period;")
+ s.AppendLine(" uint state = xorshift32((uint)rngState[k]);")
+ s.AppendLine(" rngState[k] = (int)state;")
+ s.AppendLine(" int amt = offWidthRandomizeAmount[k];")
+ s.AppendLine(" int span = 2 * amt + 1;")
+ s.AppendLine(" int r = (int)(state % (uint)span) - amt;")
+ s.AppendLine(" ow = offWidthBase[k] + r;")
+ s.AppendLine(" if (ow < 1) ow = 1;")
+ s.AppendLine(" offWidth[k] = ow;")
+ s.AppendLine(" period = onWidth[k] + ow;")
+ s.AppendLine(" guard++;")
+ s.AppendLine(" }")
+ s.AppendLine(" if (pos < 0.0f) pos = 0.0f;")
+ ' the anchor only ever advances (above) once a cycle has actually completed, so it still reading its initial
+ ' 0 means no cycle has completed yet - we are still in the element's very first (off-first) cycle
+ s.AppendLine(" isFirstCycle = (cycleAnchor[k] == 0.0f) ? 1 : 0;")
+ s.AppendLine(" }")
+ s.AppendLine(" if (pulseShape[k] == 0) {")
+ s.AppendLine(" if (pos < (float)ow) {")
+ s.AppendLine(" envelope = 0.0f;")
+ s.AppendLine(" } else {")
+ s.AppendLine(" float onPos = pos - (float)ow;")
+ s.AppendLine(" float center = onWidth[k] / 2.0f;")
+ s.AppendLine(" float sigma = max(onWidth[k] / 6.0f, 1.0e-6f);")
+ s.AppendLine(" float dd = (onPos - center) / sigma;")
+ s.AppendLine(" envelope = exp(-0.5f * dd * dd);")
+ s.AppendLine(" }")
+ s.AppendLine(" } else {")
+ s.AppendLine(" // a flat-topped pulse (envelope 1 while on, 0 while off) with a short, FIXED-width")
+ s.AppendLine(" // (in cycles) smoothed edge at the rise and the fall - fixed, so a long off span")
+ s.AppendLine(" // sits at (very close to) 0 for nearly all of it instead of lingering. The math is")
+ s.AppendLine(" // exactly the on-first formula, fed a coordinate shifted so the on span starts at 0.")
+ s.AppendLine(" float shifted = pos - (float)ow;")
+ ' wrapping shifted forward by a full period makes it continue the falling tail of the on-span that JUST
+ ' ended - correct from the second off-span onward, where that on-span really happened. The very first
+ ' off-span (isFirstCycle) has no real preceding on-emission to continue from, so wrapping there would
+ ' fabricate one: pos = 0 would land exactly on that phantom falling edge and start the run at envelope ~0.5
+ ' instead of ~0, emitting a spurious one-cycle "blip" before the source actually goes quiet. Left un-wrapped
+ ' (deeply negative) instead, dRise/dFall below correctly place it far from both edges, keeping the envelope
+ ' at (very close to) 0 until the real rising edge - matching WaveSimulator.PulseEnvelope exactly.
+ s.AppendLine(" if (shifted < 0.0f && !isFirstCycle) shifted += (float)period;")
+ s.AppendLine(" float edgeWidth = 0.35f;")
+ s.AppendLine(" float dFall = shifted - (float)onWidth[k];")
+ s.AppendLine(" float dRise = shifted;")
+ s.AppendLine(" if (dRise > (float)period / 2.0f) dRise -= (float)period;")
+ s.AppendLine(" float rising = 0.5f + atan(dRise / edgeWidth) / M_PI_F;")
+ s.AppendLine(" float falling = 0.5f - atan(dFall / edgeWidth) / M_PI_F;")
+ s.AppendLine(" envelope = rising * falling;")
+ s.AppendLine(" }")
+ s.AppendLine(" }")
+ s.AppendLine(" }")
+ s.AppendLine(" float v = sin(phase[k] + f * t) * amp[k] * envelope * detachFade;")
+ s.AppendLine(" int p = idx[k];")
+ s.AppendLine(" u[p] = u[p] * 0.9f + v * 0.1f;")
+ s.AppendLine("}")
+ Return s.ToString()
+ End Function
+
+ ' ---- small OpenCL helpers
+
+ Private Function CreateFloatBuffer(data As Single()) As IntPtr
+ Dim bytes As New IntPtr(CLng(data.Length) * 4L)
+ Dim code As Integer = 0
+ Dim buffer As IntPtr = OpenClApi.clCreateBuffer(_context, OpenClApi.MemReadWrite, bytes, IntPtr.Zero, code)
+ OpenClApi.Check(code, "clCreateBuffer")
+ OpenClApi.Check(OpenClApi.clEnqueueWriteBufferFloat(_queue, buffer, 1UI, IntPtr.Zero, bytes, data, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueWriteBuffer")
+ Return buffer
+ End Function
+
+ Private Function CreateIntBuffer(data As Integer()) As IntPtr
+ Dim bytes As New IntPtr(CLng(data.Length) * 4L)
+ Dim code As Integer = 0
+ Dim buffer As IntPtr = OpenClApi.clCreateBuffer(_context, OpenClApi.MemReadWrite, bytes, IntPtr.Zero, code)
+ OpenClApi.Check(code, "clCreateBuffer")
+ OpenClApi.Check(OpenClApi.clEnqueueWriteBufferInt(_queue, buffer, 1UI, IntPtr.Zero, bytes, data, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueWriteBuffer")
+ Return buffer
+ End Function
+
+ Private Function CreateKernel(name As String) As IntPtr
+ Return CreateKernelFrom(_program, name)
+ End Function
+
+ Private Function CreateKernelFrom(program As IntPtr, name As String) As IntPtr
+ Dim code As Integer = 0
+ Dim kernel As IntPtr = OpenClApi.clCreateKernel(program, name, code)
+ OpenClApi.Check(code, "clCreateKernel " & name)
+ Return kernel
+ End Function
+
+ Private Shared Sub SetMem(kernel As IntPtr, index As UInteger, value As IntPtr)
+ OpenClApi.Check(OpenClApi.clSetKernelArgMem(kernel, index, New IntPtr(IntPtr.Size), value), "clSetKernelArg")
+ End Sub
+
+ Private Shared Sub SetInt(kernel As IntPtr, index As UInteger, value As Integer)
+ OpenClApi.Check(OpenClApi.clSetKernelArgInt(kernel, index, New IntPtr(4), value), "clSetKernelArg")
+ End Sub
+
+ Private Shared Sub SetFloat(kernel As IntPtr, index As UInteger, value As Single)
+ OpenClApi.Check(OpenClApi.clSetKernelArgFloat(kernel, index, New IntPtr(4), value), "clSetKernelArg")
+ End Sub
+
+ ' ---- IWaveEngine
+
+ Public ReadOnly Property Description As String Implements IWaveEngine.Description
+ Get
+ Return _description
+ End Get
+ End Property
+
+ Public ReadOnly Property Width As Integer Implements IWaveEngine.Width
+ Get
+ Return _width
+ End Get
+ End Property
+
+ Public ReadOnly Property Height As Integer Implements IWaveEngine.Height
+ Get
+ Return _height
+ End Get
+ End Property
+
+ Public ReadOnly Property Stride As Integer Implements IWaveEngine.Stride
+ Get
+ Return _stride
+ End Get
+ End Property
+
+ Public ReadOnly Property FieldData As Single() Implements IWaveEngine.FieldData
+ Get
+ Return _hostField
+ End Get
+ End Property
+
+ Public ReadOnly Property IntensityData As Single() Implements IWaveEngine.IntensityData
+ Get
+ Return _hostIntensity
+ End Get
+ End Property
+
+ Public Sub AdvanceOneStep() Implements IWaveEngine.AdvanceOneStep
+ Dim k As Integer = _current
+
+ If _sourceCount > 0 Then
+ SetFloat(_sourceKernel(k), 4UI, CSng(_time))
+ OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _sourceKernel(k), 1UI, Nothing, _grid1D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (sources)")
+ End If
+ If _objSourceCount > 0 Then
+ SetFloat(_objSourceKernel(k), 11UI, CSng(_time))
+ OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _objSourceKernel(k), 1UI, Nothing, _objGrid1D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (object sources)")
+ End If
+
+ If _subSteps <= 1 Then
+ ' unchanged single-launch path: the "track" argument was bound once, at Build time, to If(_track, 1, 0)
+ OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _stepKernel(k), 2UI, Nothing, _grid2D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (step)")
+ k = 1 - k
+ Else
+ ' _subSteps smaller launches (see the class summary); only the last one updates the intensity buffer,
+ ' so its own exponential averaging still runs once per AdvanceOneStep call, not _subSteps times
+ For subStep As Integer = 1 To _subSteps
+ Dim trackNow As Integer = If(subStep = _subSteps AndAlso _track, 1, 0)
+ SetInt(_stepKernel(k), 8UI, trackNow)
+ OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _stepKernel(k), 2UI, Nothing, _grid2D, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (step)")
+ k = 1 - k
+ Next
+ End If
+
+ ' the buffer that received the new values is now the current field
+ _current = k
+ _time += 1.0
+
+ ' now and then wait for the card, so that the commands do not pile up and errors show up in time
+ _sinceFinish += 1
+ If _sinceFinish >= 16 Then
+ _sinceFinish = 0
+ OpenClApi.Check(OpenClApi.clFinish(_queue), "clFinish")
+ End If
+ End Sub
+
+ Public Sub PrepareFrame(needField As Boolean, needIntensity As Boolean) Implements IWaveEngine.PrepareFrame
+ Dim bytes As New IntPtr(CLng(_cells) * 4L)
+ If needField Then
+ OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _field(_current), 1UI, IntPtr.Zero, bytes, _hostField, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer")
+ End If
+ If needIntensity AndAlso _track Then
+ OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _intensityOutBuffer, 1UI, IntPtr.Zero, bytes, _hostIntensity, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer")
+ End If
+ _sinceFinish = 0
+ End Sub
+
+ ' ---- probes
+
+ Private Shared Function ProbeKernelSource() As String
+ Dim s As New StringBuilder()
+ ' point probes: the value of the pixel of every probe, into row "row" of the history
+ s.AppendLine("__kernel void probe_sample(__global const float* u, __global const float* inten, __global const int* pix,")
+ s.AppendLine(" __global const int* info, __global float* hist, const int row, const int n)")
+ s.AppendLine("{")
+ s.AppendLine(" int p = get_global_id(0);")
+ s.AppendLine(" if (p >= n) return;")
+ s.AppendLine(" int start = info[p * 4];")
+ s.AppendLine(" int count = info[p * 4 + 1];")
+ s.AppendLine(" int useI = info[p * 4 + 2];")
+ s.AppendLine(" int mean = info[p * 4 + 3];")
+ s.AppendLine(" float s = 0.0f;")
+ s.AppendLine(" if (useI != 0) {")
+ s.AppendLine(" for (int k = 0; k < count; k++) s += inten[pix[start + k]];")
+ s.AppendLine(" } else {")
+ s.AppendLine(" for (int k = 0; k < count; k++) s += u[pix[start + k]];")
+ s.AppendLine(" }")
+ s.AppendLine(" if (mean != 0 && count > 0) s = s / (float)count;")
+ s.AppendLine(" hist[row * n + p] = s;")
+ s.AppendLine("}")
+ s.AppendLine()
+ ' line probes: mode 0 = field, 1 = intensity, 2 = intensity totals over the steps; pStartFlag/pStartStep are the
+ ' probe's "start recording at step #" (0/1 and the step): before that step the total is left at zero, so
+ ' intensity that arrived earlier is purged rather than baked into the total once recording starts
+ s.AppendLine("__kernel void profile_accumulate(__global const float* inten, __global const int* ppix,")
+ s.AppendLine(" __global const int* pmode, __global const int* pStartFlag, __global const int* pStartStep,")
+ s.AppendLine(" __global float* total, const int step, const int n)")
+ s.AppendLine("{")
+ s.AppendLine(" int k = get_global_id(0);")
+ s.AppendLine(" if (k >= n) return;")
+ s.AppendLine(" if (pmode[k] != 2) return;")
+ s.AppendLine(" if (pStartFlag[k] != 0 && step < pStartStep[k]) return;")
+ s.AppendLine(" total[k] += inten[ppix[k]];")
+ s.AppendLine("}")
+ s.AppendLine()
+ s.AppendLine("__kernel void profile_gather(__global const float* u, __global const float* inten, __global const int* ppix,")
+ s.AppendLine(" __global const int* pmode, __global const float* total, __global float* outv, const int n)")
+ s.AppendLine("{")
+ s.AppendLine(" int k = get_global_id(0);")
+ s.AppendLine(" if (k >= n) return;")
+ s.AppendLine(" int m = pmode[k];")
+ s.AppendLine(" float v;")
+ s.AppendLine(" if (m == 2) v = total[k];")
+ s.AppendLine(" else if (m == 1) v = inten[ppix[k]];")
+ s.AppendLine(" else v = u[ppix[k]];")
+ s.AppendLine(" outv[k] = v;")
+ s.AppendLine("}")
+ Return s.ToString()
+ End Function
+
+ Public Sub SetProbes(sampler As ProbeSampler) Implements IWaveEngine.SetProbes
+ If sampler Is Nothing OrElse sampler.Count = 0 Then Return
+
+ Try
+ If sampler.NeedsIntensity AndAlso Not _track Then
+ Throw New InvalidOperationException("the intensity is not tracked")
+ End If
+
+ Dim code As Integer = 0
+ Dim devs() As IntPtr = {_deviceId}
+
+ Dim sources() As String = {ProbeKernelSource()}
+ _probeProgram = OpenClApi.clCreateProgramWithSource(_context, 1UI, sources, Nothing, code)
+ OpenClApi.Check(code, "clCreateProgramWithSource (probes)")
+ code = OpenClApi.clBuildProgram(_probeProgram, 1UI, devs, "", IntPtr.Zero, IntPtr.Zero)
+ If code <> 0 Then
+ Dim log As String = OpenClApi.BuildLog(_probeProgram, _deviceId)
+ Throw New InvalidOperationException("the probe program for the GPU could not be built (" & OpenClApi.ErrorName(code) & ")" &
+ If(log.Length > 0, ": " & log, ""))
+ End If
+
+ If sampler.HasSeries Then SetUpSeriesProbes(sampler)
+ If sampler.HasProfiles Then SetUpProfileProbes(sampler)
+ _probeSampler = sampler
+ Catch ex As Exception
+ Throw New InvalidOperationException("the probes could not be set up on the GPU: " & ex.Message, ex)
+ End Try
+ End Sub
+
+ Private Sub SetUpSeriesProbes(sampler As ProbeSampler)
+ Dim n As Integer = sampler.Count
+ Dim code As Integer = 0
+
+ ' the pixels of the point probes in one list; info = start, count, uses intensity, average (not sum) per probe
+ Dim total As Integer = 0
+ For p As Integer = 0 To n - 1
+ If Not sampler.IsProfile(p) Then total += sampler.Pixels(p).Length
+ Next
+ Dim pix(Math.Max(total, 1) - 1) As Integer
+ Dim info(n * 4 - 1) As Integer
+ Dim position As Integer = 0
+ For p As Integer = 0 To n - 1
+ If sampler.IsProfile(p) Then Continue For
+ Dim px As Integer() = sampler.Pixels(p)
+ Array.Copy(px, 0, pix, position, px.Length)
+ info(p * 4) = position
+ info(p * 4 + 1) = px.Length
+ info(p * 4 + 2) = If(sampler.UseIntensity(p), 1, 0)
+ info(p * 4 + 3) = 1
+ position += px.Length
+ Next
+ _pixelBuffer = CreateIntBuffer(pix)
+ _infoBuffer = CreateIntBuffer(info)
+
+ Dim historyBytes As New IntPtr(CLng(ProbeRows) * n * 4L)
+ _historyBuffer = OpenClApi.clCreateBuffer(_context, OpenClApi.MemReadWrite, historyBytes, IntPtr.Zero, code)
+ OpenClApi.Check(code, "clCreateBuffer (probes)")
+
+ For k As Integer = 0 To 1
+ _probeKernel(k) = CreateKernelFrom(_probeProgram, "probe_sample")
+ SetMem(_probeKernel(k), 0UI, _field(k))
+ SetMem(_probeKernel(k), 1UI, _intensityOutBuffer)
+ SetMem(_probeKernel(k), 2UI, _pixelBuffer)
+ SetMem(_probeKernel(k), 3UI, _infoBuffer)
+ SetMem(_probeKernel(k), 4UI, _historyBuffer)
+ SetInt(_probeKernel(k), 5UI, 0)
+ SetInt(_probeKernel(k), 6UI, n)
+ Next
+
+ _probeGrid(0) = New IntPtr(n)
+ _probeValues.Clear()
+ For i As Integer = 0 To n - 1
+ _probeValues.Add(New List(Of Single)())
+ Next
+ _probeRow = 0
+ End Sub
+
+ Private Sub SetUpProfileProbes(sampler As ProbeSampler)
+ Dim n As Integer = sampler.Count
+
+ Dim total As Integer = 0
+ For p As Integer = 0 To n - 1
+ If sampler.IsProfile(p) Then total += sampler.Pixels(p).Length
+ Next
+ Dim pix(total - 1) As Integer
+ Dim mode(total - 1) As Integer
+ Dim startFlag(total - 1) As Integer
+ Dim startStep(total - 1) As Integer
+ _profileStart = New Integer(n - 1) {}
+ _profileIntegrates = False
+
+ Dim position As Integer = 0
+ For p As Integer = 0 To n - 1
+ _profileStart(p) = position
+ If Not sampler.IsProfile(p) Then Continue For
+
+ Dim px As Integer() = sampler.Pixels(p)
+ Dim m As Integer = If(sampler.Integrate(p), 2, If(sampler.UseIntensity(p), 1, 0))
+ If m = 2 Then _profileIntegrates = True
+ Dim useStart As Integer = If(sampler.UseStartAfterStep(p), 1, 0)
+ Dim afterStep As Integer = sampler.StartAfterStep(p)
+ For k As Integer = 0 To px.Length - 1
+ pix(position + k) = px(k)
+ mode(position + k) = m
+ startFlag(position + k) = useStart
+ startStep(position + k) = afterStep
+ Next
+ position += px.Length
+ Next
+ _profileCount = total
+
+ _profilePixelBuffer = CreateIntBuffer(pix)
+ _profileModeBuffer = CreateIntBuffer(mode)
+ _profileTotalBuffer = CreateFloatBuffer(New Single(total - 1) {})
+ _profileOutBuffer = CreateFloatBuffer(New Single(total - 1) {})
+
+ For k As Integer = 0 To 1
+ _gatherKernel(k) = CreateKernelFrom(_probeProgram, "profile_gather")
+ SetMem(_gatherKernel(k), 0UI, _field(k))
+ SetMem(_gatherKernel(k), 1UI, _intensityOutBuffer)
+ SetMem(_gatherKernel(k), 2UI, _profilePixelBuffer)
+ SetMem(_gatherKernel(k), 3UI, _profileModeBuffer)
+ SetMem(_gatherKernel(k), 4UI, _profileTotalBuffer)
+ SetMem(_gatherKernel(k), 5UI, _profileOutBuffer)
+ SetInt(_gatherKernel(k), 6UI, total)
+ Next
+
+ If _profileIntegrates Then
+ _profileStartFlagBuffer = CreateIntBuffer(startFlag)
+ _profileStartStepBuffer = CreateIntBuffer(startStep)
+ _accumulateKernel = CreateKernelFrom(_probeProgram, "profile_accumulate")
+ SetMem(_accumulateKernel, 0UI, _intensityOutBuffer)
+ SetMem(_accumulateKernel, 1UI, _profilePixelBuffer)
+ SetMem(_accumulateKernel, 2UI, _profileModeBuffer)
+ SetMem(_accumulateKernel, 3UI, _profileStartFlagBuffer)
+ SetMem(_accumulateKernel, 4UI, _profileStartStepBuffer)
+ SetMem(_accumulateKernel, 5UI, _profileTotalBuffer)
+ SetInt(_accumulateKernel, 7UI, total)
+ End If
+
+ _profileGrid(0) = New IntPtr(total)
+ End Sub
+
+ Public Sub SampleProbes() Implements IWaveEngine.SampleProbes
+ If _probeSampler Is Nothing Then Return
+
+ Dim k As Integer = _current
+ If _probeSampler.HasSeries Then
+ If _probeRow >= ProbeRows Then ReadProbeHistory()
+ SetInt(_probeKernel(k), 5UI, _probeRow)
+ OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _probeKernel(k), 1UI, Nothing, _probeGrid, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (probes)")
+ _probeRow += 1
+ End If
+
+ ' the intensity totals of the lines that are integrated: add the intensity of this step (unless it is before
+ ' that probe's "start recording at step #", in which case the kernel leaves the total at zero)
+ If _profileIntegrates Then
+ SetInt(_accumulateKernel, 6UI, CInt(_time))
+ OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _accumulateKernel, 1UI, Nothing, _profileGrid, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (totals)")
+ End If
+ End Sub
+
+ ''' <summary>Copies the measured values from the graphics memory into the lists.</summary>
+ Private Sub ReadProbeHistory()
+ If _probeSampler Is Nothing OrElse _probeRow = 0 Then Return
+
+ Dim n As Integer = _probeSampler.Count
+ Dim values(_probeRow * n - 1) As Single
+ OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _historyBuffer, 1UI, IntPtr.Zero, New IntPtr(CLng(values.Length) * 4L), values, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer (probes)")
+ For r As Integer = 0 To _probeRow - 1
+ For p As Integer = 0 To n - 1
+ If Not _probeSampler.IsProfile(p) Then _probeValues(p).Add(values(r * n + p))
+ Next
+ Next
+ _probeRow = 0
+ _sinceFinish = 0
+ End Sub
+
+ Public Function TakeProbeSamples() As Single()() Implements IWaveEngine.TakeProbeSamples
+ If _probeSampler Is Nothing Then Return New Single()() {}
+
+ Dim n As Integer = _probeSampler.Count
+ Dim result As Single()() = New Single(n - 1)() {}
+ If _probeSampler.HasSeries Then ReadProbeHistory()
+ For p As Integer = 0 To n - 1
+ If _probeSampler.IsProfile(p) Then
+ result(p) = New Single(-1) {}
+ Else
+ result(p) = _probeValues(p).ToArray()
+ _probeValues(p).Clear()
+ End If
+ Next
+ Return result
+ End Function
+
+ Public Function ReadProbeProfiles() As Single()() Implements IWaveEngine.ReadProbeProfiles
+ If _probeSampler Is Nothing Then Return New Single()() {}
+
+ Dim n As Integer = _probeSampler.Count
+ Dim result As Single()() = New Single(n - 1)() {}
+ If Not _probeSampler.HasProfiles Then Return result
+
+ Dim k As Integer = _current
+ OpenClApi.Check(OpenClApi.clEnqueueNDRangeKernel(_queue, _gatherKernel(k), 1UI, Nothing, _profileGrid, Nothing, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueNDRangeKernel (profiles)")
+
+ Dim values As Single() = New Single(_profileCount - 1) {}
+ OpenClApi.Check(OpenClApi.clEnqueueReadBufferFloat(_queue, _profileOutBuffer, 1UI, IntPtr.Zero, New IntPtr(CLng(_profileCount) * 4L), values, 0UI, IntPtr.Zero, IntPtr.Zero), "clEnqueueReadBuffer (profiles)")
+ _sinceFinish = 0
+
+ For p As Integer = 0 To n - 1
+ If Not _probeSampler.IsProfile(p) Then Continue For
+ Dim length As Integer = _probeSampler.Pixels(p).Length
+ Dim profile As Single() = New Single(length - 1) {}
+ Array.Copy(values, _profileStart(p), profile, 0, length)
+ result(p) = profile
+ Next
+ Return result
+ End Function
+
+ Public Sub Dispose() Implements IDisposable.Dispose
+ ReleaseAll()
+ End Sub
+
+ Private Sub ReleaseAll()
+ If _released Then Return
+ _released = True
+
+ Try
+ If _queue <> IntPtr.Zero Then OpenClApi.clFinish(_queue)
+ Catch ex As Exception
+ ' the driver is gone or in trouble; release what can be released
+ End Try
+
+ For k As Integer = 0 To 1
+ ReleaseKernel(_stepKernel(k))
+ ReleaseKernel(_sourceKernel(k))
+ ReleaseKernel(_objSourceKernel(k))
+ ReleaseKernel(_probeKernel(k))
+ ReleaseKernel(_gatherKernel(k))
+ ReleaseMem(_field(k))
+ Next
+ ReleaseKernel(_accumulateKernel)
+ ReleaseMem(_pixelBuffer)
+ ReleaseMem(_infoBuffer)
+ ReleaseMem(_historyBuffer)
+ ReleaseMem(_profilePixelBuffer)
+ ReleaseMem(_profileModeBuffer)
+ ReleaseMem(_profileStartFlagBuffer)
+ ReleaseMem(_profileStartStepBuffer)
+ ReleaseMem(_profileTotalBuffer)
+ ReleaseMem(_profileOutBuffer)
+ ReleaseMem(_c2Buffer)
+ ReleaseMem(_dBuffer)
+ ReleaseMem(_intensityBuffer)
+ ReleaseMem(_intensityStage1Buffer)
+ ReleaseMem(_intensityOutBuffer)
+ ReleaseMem(_indexBuffer)
+ ReleaseMem(_levelBuffer)
+ ReleaseMem(_frequencyBuffer)
+ ReleaseMem(_objIndexBuffer)
+ ReleaseMem(_objLevelBuffer)
+ ReleaseMem(_objAmplitudeBuffer)
+ ReleaseMem(_objPhaseBuffer)
+ ReleaseMem(_objModeBuffer)
+ ReleaseMem(_objPulseShapeBuffer)
+ ReleaseMem(_objOnWidthBuffer)
+ ReleaseMem(_objOffWidthBuffer)
+ ReleaseMem(_objDetachStepBuffer)
+ ReleaseMem(_objOffWidthBaseBuffer)
+ ReleaseMem(_objRandomizeOffWidthAmountBuffer)
+ ReleaseMem(_objCycleAnchorBuffer)
+ ReleaseMem(_objRngStateBuffer)
+
+ Try
+ If _probeProgram <> IntPtr.Zero Then OpenClApi.clReleaseProgram(_probeProgram)
+ If _program <> IntPtr.Zero Then OpenClApi.clReleaseProgram(_program)
+ If _queue <> IntPtr.Zero Then OpenClApi.clReleaseCommandQueue(_queue)
+ If _context <> IntPtr.Zero Then OpenClApi.clReleaseContext(_context)
+ Catch ex As Exception
+ ' nothing more can be done
+ End Try
+ _probeProgram = IntPtr.Zero
+ _program = IntPtr.Zero
+ _queue = IntPtr.Zero
+ _context = IntPtr.Zero
+ End Sub
+
+ Private Shared Sub ReleaseMem(ByRef handle As IntPtr)
+ Try
+ If handle <> IntPtr.Zero Then OpenClApi.clReleaseMemObject(handle)
+ Catch ex As Exception
+ ' nothing more can be done
+ End Try
+ handle = IntPtr.Zero
+ End Sub
+
+ Private Shared Sub ReleaseKernel(ByRef handle As IntPtr)
+ Try
+ If handle <> IntPtr.Zero Then OpenClApi.clReleaseKernel(handle)
+ Catch ex As Exception
+ ' nothing more can be done
+ End Try
+ handle = IntPtr.Zero
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/IWaveEngine.vb b/2D_wave_sim_V01/Simulation/IWaveEngine.vb
new file mode 100644
index 0000000..01d2145
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/IWaveEngine.vb
@@ -0,0 +1,121 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+
+''' <summary>
+''' A wave simulation engine: the CPU version (WaveSimulator) or the GPU version (GpuWaveSimulator).
+''' Both keep the field and the intensity in arrays with a border of one cell, pixel (x, y) is at
+''' (y + 1) * Stride + x + 1, and both are advanced one time step at a time.
+''' </summary>
+Friend Interface IWaveEngine
+ Inherits IDisposable
+
+ ''' <summary>Where the simulation runs, for example "CPU (8 threads)" or "GPU: NVIDIA GeForce MX130 (OpenCL)".</summary>
+ ReadOnly Property Description As String
+
+ ReadOnly Property Width As Integer
+ ReadOnly Property Height As Integer
+
+ ''' <summary>Distance between two rows in FieldData and IntensityData.</summary>
+ ReadOnly Property Stride As Integer
+
+ ''' <summary>The field of the last completed step, valid after PrepareFrame(True, ...). Do not change.</summary>
+ ReadOnly Property FieldData As Single()
+
+ ''' <summary>The averaged intensity, valid after PrepareFrame(..., True); Nothing when it is not tracked. Do not change.</summary>
+ ReadOnly Property IntensityData As Single()
+
+ ''' <summary>One time step: apply the sources, update the field, update the intensity.</summary>
+ Sub AdvanceOneStep()
+
+ ''' <summary>
+ ''' Makes FieldData and/or IntensityData available for drawing. Does nothing on the CPU; on the GPU the data is
+ ''' copied from the graphics memory, so only ask for what is going to be drawn.
+ ''' </summary>
+ Sub PrepareFrame(needField As Boolean, needIntensity As Boolean)
+
+ ''' <summary>Tells the engine which values to measure for the probes (Nothing or no probes: nothing is measured).</summary>
+ Sub SetProbes(sampler As ProbeSampler)
+
+ ''' <summary>
+ ''' Measures the probes in the state after the last AdvanceOneStep: one value per step for every point probe, and
+ ''' the running totals of the line probes that integrate the intensity.
+ ''' </summary>
+ Sub SampleProbes()
+
+ ''' <summary>The values measured for the point probes since the last call, per probe (an empty array for a line probe or when there is none).</summary>
+ Function TakeProbeSamples() As Single()()
+
+ ''' <summary>
+ ''' The values along the line of every line probe in the current state (Nothing for a point probe): the field, the
+ ''' intensity, or the intensity totals of the steps so far. On the GPU this waits for the card, so do not call it every step.
+ ''' </summary>
+ Function ReadProbeProfiles() As Single()()
+
+End Interface
+
+''' <summary>Makes the engine that a run asks for, with the CPU as the fall back.</summary>
+Friend NotInheritable Class WaveEngineFactory
+
+ Private Sub New()
+ End Sub
+
+ ''' <summary>
+ ''' Makes the GPU engine when the settings ask for it and that works, otherwise the CPU engine.
+ ''' <paramref name="note"/> is empty, or tells why the GPU was not used (or that the first choice failed).
+ ''' Object sources (the Sources tab) run on either engine, the same as the image sources.
+ ''' </summary>
+ Public Shared Function Create(scene As SceneData, settings As SimulationSettings, sourceAmplitude As Double,
+ trackIntensity As Boolean, ByRef note As String,
+ Optional objectSources As List(Of SourceElement) = Nothing) As IWaveEngine
+ note = ""
+
+ If settings.UseGpu Then
+ Dim problems As String = ""
+ Dim gpu As GpuWaveSimulator = Nothing
+ Try
+ gpu = GpuWaveSimulator.TryCreate(scene, settings.SourceFrequencyScale, sourceAmplitude, trackIntensity,
+ settings.Use4thOrderLaplacian, settings.TimeDecayFactor, settings.IntensityScale,
+ problems, objectSources)
+ Catch ex As DllNotFoundException
+ problems = "no OpenCL driver (OpenCL.dll) found; install the driver of the graphics card"
+ Catch ex As BadImageFormatException
+ problems = "the OpenCL driver does not match this 32/64-bit program"
+ Catch ex As EntryPointNotFoundException
+ problems = "the OpenCL driver is incomplete"
+ Catch ex As Exception
+ problems = ex.Message
+ End Try
+
+ If gpu IsNot Nothing Then
+ If problems.Length > 0 Then note = "the first choice failed - " & problems
+ Return gpu
+ End If
+ note = "GPU not used: " & problems
+ End If
+
+ Return New WaveSimulator(scene, settings.SourceFrequencyScale, sourceAmplitude, trackIntensity,
+ settings.Use4thOrderLaplacian, settings.TimeDecayFactor, settings.IntensityScale, objectSources)
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/MfVideoWriter.vb b/2D_wave_sim_V01/Simulation/MfVideoWriter.vb
new file mode 100644
index 0000000..9cefb11
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/MfVideoWriter.vb
@@ -0,0 +1,359 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Runtime.InteropServices
+
+' ---------------------------------------------------------------------------------------------------------------
+' The few Media Foundation interfaces that MfVideoWriter needs. Only the order of the methods matters (it is the
+' order of the entries in the COM method table); the methods that are not used are placeholders. Every interface
+' repeats the methods of IMFAttributes because .NET does not inherit them in COM interfaces.
+' ---------------------------------------------------------------------------------------------------------------
+
+<ComImport(), Guid("2CD2D921-C447-44A7-A13C-4ADABFC247E3"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
+Friend Interface IMFAttributesNative
+ <PreserveSig> Function GetItem() As Integer
+ <PreserveSig> Function GetItemType() As Integer
+ <PreserveSig> Function CompareItem() As Integer
+ <PreserveSig> Function Compare() As Integer
+ <PreserveSig> Function GetUINT32() As Integer
+ <PreserveSig> Function GetUINT64() As Integer
+ <PreserveSig> Function GetDouble() As Integer
+ <PreserveSig> Function GetGUID() As Integer
+ <PreserveSig> Function GetStringLength() As Integer
+ <PreserveSig> Function GetString() As Integer
+ <PreserveSig> Function GetAllocatedString() As Integer
+ <PreserveSig> Function GetBlobSize() As Integer
+ <PreserveSig> Function GetBlob() As Integer
+ <PreserveSig> Function GetAllocatedBlob() As Integer
+ <PreserveSig> Function GetUnknown() As Integer
+ <PreserveSig> Function SetItem() As Integer
+ <PreserveSig> Function DeleteItem() As Integer
+ <PreserveSig> Function DeleteAllItems() As Integer
+ <PreserveSig> Function SetUINT32(<MarshalAs(UnmanagedType.LPStruct)> guidKey As Guid, value As Integer) As Integer
+ <PreserveSig> Function SetUINT64(<MarshalAs(UnmanagedType.LPStruct)> guidKey As Guid, value As ULong) As Integer
+ <PreserveSig> Function SetDouble() As Integer
+ <PreserveSig> Function SetGUID(<MarshalAs(UnmanagedType.LPStruct)> guidKey As Guid, <MarshalAs(UnmanagedType.LPStruct)> value As Guid) As Integer
+ <PreserveSig> Function SetString() As Integer
+ <PreserveSig> Function SetBlob() As Integer
+ <PreserveSig> Function SetUnknown() As Integer
+ <PreserveSig> Function LockStore() As Integer
+ <PreserveSig> Function UnlockStore() As Integer
+ <PreserveSig> Function GetCount() As Integer
+ <PreserveSig> Function GetItemByIndex() As Integer
+ <PreserveSig> Function CopyAllItems() As Integer
+End Interface
+
+<ComImport(), Guid("C40A00F2-B93A-4D80-AE8C-5A1C634F58E4"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
+Friend Interface IMFSampleNative
+ <PreserveSig> Function A01() As Integer
+ <PreserveSig> Function A02() As Integer
+ <PreserveSig> Function A03() As Integer
+ <PreserveSig> Function A04() As Integer
+ <PreserveSig> Function A05() As Integer
+ <PreserveSig> Function A06() As Integer
+ <PreserveSig> Function A07() As Integer
+ <PreserveSig> Function A08() As Integer
+ <PreserveSig> Function A09() As Integer
+ <PreserveSig> Function A10() As Integer
+ <PreserveSig> Function A11() As Integer
+ <PreserveSig> Function A12() As Integer
+ <PreserveSig> Function A13() As Integer
+ <PreserveSig> Function A14() As Integer
+ <PreserveSig> Function A15() As Integer
+ <PreserveSig> Function A16() As Integer
+ <PreserveSig> Function A17() As Integer
+ <PreserveSig> Function A18() As Integer
+ <PreserveSig> Function A19() As Integer
+ <PreserveSig> Function A20() As Integer
+ <PreserveSig> Function A21() As Integer
+ <PreserveSig> Function A22() As Integer
+ <PreserveSig> Function A23() As Integer
+ <PreserveSig> Function A24() As Integer
+ <PreserveSig> Function A25() As Integer
+ <PreserveSig> Function A26() As Integer
+ <PreserveSig> Function A27() As Integer
+ <PreserveSig> Function A28() As Integer
+ <PreserveSig> Function A29() As Integer
+ <PreserveSig> Function A30() As Integer
+ <PreserveSig> Function GetSampleFlags() As Integer
+ <PreserveSig> Function SetSampleFlags() As Integer
+ <PreserveSig> Function GetSampleTime() As Integer
+ <PreserveSig> Function SetSampleTime(sampleTime As Long) As Integer
+ <PreserveSig> Function GetSampleDuration() As Integer
+ <PreserveSig> Function SetSampleDuration(duration As Long) As Integer
+ <PreserveSig> Function GetBufferCount() As Integer
+ <PreserveSig> Function GetBufferByIndex() As Integer
+ <PreserveSig> Function ConvertToContiguousBuffer() As Integer
+ <PreserveSig> Function AddBuffer(buffer As IntPtr) As Integer
+ <PreserveSig> Function RemoveBufferByIndex() As Integer
+ <PreserveSig> Function RemoveAllBuffers() As Integer
+ <PreserveSig> Function GetTotalLength() As Integer
+ <PreserveSig> Function CopyToBuffer() As Integer
+End Interface
+
+<ComImport(), Guid("045FA593-8799-42B8-BC8D-8968C6453507"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
+Friend Interface IMFMediaBufferNative
+ <PreserveSig> Function Lock(ByRef data As IntPtr, ByRef maxLength As Integer, ByRef currentLength As Integer) As Integer
+ <PreserveSig> Function Unlock() As Integer
+ <PreserveSig> Function GetCurrentLength() As Integer
+ <PreserveSig> Function SetCurrentLength(length As Integer) As Integer
+ <PreserveSig> Function GetMaxLength() As Integer
+End Interface
+
+<ComImport(), Guid("3137F1CD-FE5E-4805-A5D8-FB477448CB3D"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
+Friend Interface IMFSinkWriterNative
+ <PreserveSig> Function AddStream(mediaType As IntPtr, ByRef streamIndex As Integer) As Integer
+ <PreserveSig> Function SetInputMediaType(streamIndex As Integer, mediaType As IntPtr, encodingParameters As IntPtr) As Integer
+ <PreserveSig> Function BeginWriting() As Integer
+ <PreserveSig> Function WriteSample(streamIndex As Integer, sample As IntPtr) As Integer
+ <PreserveSig> Function SendStreamTick() As Integer
+ <PreserveSig> Function PlaceMarker() As Integer
+ <PreserveSig> Function NotifyEndOfSegment() As Integer
+ <PreserveSig> Function Flush() As Integer
+ <PreserveSig> Function FinalizeWriting() As Integer
+ <PreserveSig> Function GetServiceForStream() As Integer
+ <PreserveSig> Function GetStatistics() As Integer
+End Interface
+
+''' <summary>
+''' Writes an H.264 video in an MP4 file with the Media Foundation of Windows (the encoder that is built into Windows),
+''' so no codec or other program is needed and every Windows player opens the file.
+''' The constructor throws when Media Foundation or its H.264 encoder is not available or the size is not supported;
+''' the caller can then use another writer.
+''' </summary>
+Friend NotInheritable Class MfVideoWriter
+ Implements IFrameSink
+
+ ' the version of Media Foundation that is asked for (MF_VERSION of the Windows 7 and later SDK)
+ Private Const MfVersion As Integer = &H20070
+
+ Private Shared ReadOnly MajorType As New Guid("48eba18e-f8c9-4687-bf11-0a74c9f96a8f")
+ Private Shared ReadOnly SubType As New Guid("f7e34c9a-42e8-4714-b74b-cb29d72c35e5")
+ Private Shared ReadOnly AvgBitrate As New Guid("20332624-fb0d-4d9e-bd0d-cbf6786c102e")
+ Private Shared ReadOnly InterlaceMode As New Guid("e2724bb8-e676-4806-b4b2-a8d6efb44ccd")
+ Private Shared ReadOnly FrameSize As New Guid("1652c33d-d6b2-4012-b834-72030849a37d")
+ Private Shared ReadOnly FrameRate As New Guid("c459a2e8-3d2c-4e44-b132-fee5156c7bb0")
+ Private Shared ReadOnly PixelAspectRatio As New Guid("c6376a1e-8d0a-4027-be45-6d9a0ad39bb6")
+ Private Shared ReadOnly DefaultStride As New Guid("644b4e48-1e02-4516-b0eb-c01ca9d49ac6")
+ Private Shared ReadOnly VideoType As New Guid("73646976-0000-0010-8000-00AA00389B71")
+ Private Shared ReadOnly H264Format As New Guid("34363248-0000-0010-8000-00AA00389B71")
+ Private Shared ReadOnly Rgb32Format As New Guid("00000016-0000-0010-8000-00AA00389B71")
+
+ <DllImport("mfplat.dll", ExactSpelling:=True)>
+ Private Shared Function MFStartup(version As Integer, flags As Integer) As Integer
+ End Function
+
+ <DllImport("mfplat.dll", ExactSpelling:=True)>
+ Private Shared Function MFShutdown() As Integer
+ End Function
+
+ <DllImport("mfplat.dll", ExactSpelling:=True)>
+ Private Shared Function MFCreateMediaType(ByRef mediaType As IntPtr) As Integer
+ End Function
+
+ <DllImport("mfplat.dll", ExactSpelling:=True)>
+ Private Shared Function MFCreateSample(ByRef sample As IntPtr) As Integer
+ End Function
+
+ <DllImport("mfplat.dll", ExactSpelling:=True)>
+ Private Shared Function MFCreateMemoryBuffer(maxLength As Integer, ByRef buffer As IntPtr) As Integer
+ End Function
+
+ <DllImport("mfreadwrite.dll", ExactSpelling:=True, CharSet:=CharSet.Unicode)>
+ Private Shared Function MFCreateSinkWriterFromURL(url As String, byteStream As IntPtr, attributes As IntPtr, ByRef writer As IntPtr) As Integer
+ End Function
+
+ Private ReadOnly _path As String
+ Private ReadOnly _srcWidth As Integer
+ Private ReadOnly _srcHeight As Integer
+ Private ReadOnly _width As Integer ' the encoded size: H.264 needs even sizes
+ Private ReadOnly _height As Integer
+ Private ReadOnly _fps As Integer
+ Private ReadOnly _cropped As Integer()
+
+ Private _started As Boolean
+ Private _writerPtr As IntPtr
+ Private _writer As IMFSinkWriterNative
+ Private _frames As Integer
+ Private _closed As Boolean
+
+ Public Sub New(filePath As String, width As Integer, height As Integer, framesPerSecond As Integer, quality As Integer)
+ _path = filePath
+ _srcWidth = width
+ _srcHeight = height
+ _width = width And Not 1
+ _height = height And Not 1
+ _fps = framesPerSecond
+ If _width < 16 OrElse _height < 16 Then Throw New NotSupportedException("The canvas is too small for H.264 video.")
+ If CLng(_width) * _height > 4096L * 2304L Then Throw New NotSupportedException("The canvas is too large for the H.264 encoder of Windows.")
+ If _width <> _srcWidth OrElse _height <> _srcHeight Then _cropped = New Integer(_width * _height - 1) {}
+
+ Check(MFStartup(MfVersion, 0))
+ _started = True
+ Try
+ Check(MFCreateSinkWriterFromURL(filePath, IntPtr.Zero, IntPtr.Zero, _writerPtr))
+ _writer = DirectCast(Marshal.GetObjectForIUnknown(_writerPtr), IMFSinkWriterNative)
+
+ ' the quality (1 to 100) sets the bits per pixel of every frame: 0.01 * 50 ^ (quality / 100),
+ ' which is 0.01 at quality 1, 0.15 at 70 and 0.5 at 100 (1920 x 1080 at 60 frames/s: 1 to 62 Mbit/s)
+ Dim q As Integer = Math.Max(1, Math.Min(100, quality))
+ Dim bitsPerPixel As Double = 0.01 * Math.Pow(50.0, q / 100.0)
+ Dim bitrate As Long = CLng(_width * CDbl(_height) * _fps * bitsPerPixel)
+ bitrate = Math.Max(300000L, Math.Min(200000000L, bitrate))
+
+ Dim outputType As IntPtr = MakeType(H264Format, CInt(bitrate), False)
+ Dim streamIndex As Integer = 0
+ Try
+ Check(_writer.AddStream(outputType, streamIndex))
+ Finally
+ Marshal.Release(outputType)
+ End Try
+
+ ' the pictures are given as 32 bit pixels; the sink writer converts them for the encoder
+ Dim inputType As IntPtr = MakeType(Rgb32Format, 0, True)
+ Try
+ Check(_writer.SetInputMediaType(streamIndex, inputType, IntPtr.Zero))
+ Finally
+ Marshal.Release(inputType)
+ End Try
+
+ Check(_writer.BeginWriting())
+ Catch
+ Cleanup()
+ Throw
+ End Try
+ End Sub
+
+ Public ReadOnly Property FilePath As String Implements IFrameSink.FilePath
+ Get
+ Return _path
+ End Get
+ End Property
+
+ ''' <summary>Makes a video media type (an IMFMediaType) and returns its interface pointer. The caller releases it.</summary>
+ Private Function MakeType(format As Guid, bitrate As Integer, topDown As Boolean) As IntPtr
+ Dim ptr As IntPtr = IntPtr.Zero
+ Check(MFCreateMediaType(ptr))
+ Try
+ Dim a As IMFAttributesNative = DirectCast(Marshal.GetObjectForIUnknown(ptr), IMFAttributesNative)
+ Try
+ Check(a.SetGUID(MajorType, VideoType))
+ Check(a.SetGUID(SubType, format))
+ If bitrate > 0 Then Check(a.SetUINT32(AvgBitrate, bitrate))
+ Check(a.SetUINT32(InterlaceMode, 2)) ' progressive
+ Check(a.SetUINT64(FrameSize, (CULng(_width) << 32) Or CULng(_height)))
+ Check(a.SetUINT64(FrameRate, (CULng(_fps) << 32) Or 1UL))
+ Check(a.SetUINT64(PixelAspectRatio, (1UL << 32) Or 1UL))
+ If topDown Then Check(a.SetUINT32(DefaultStride, _width * 4)) ' positive stride: the first row is the top row
+ Finally
+ Marshal.ReleaseComObject(a)
+ End Try
+ Catch
+ Marshal.Release(ptr)
+ Throw
+ End Try
+ Return ptr
+ End Function
+
+ Public Sub AddPixels(pixels As Integer()) Implements IFrameSink.AddPixels
+ If _closed Then Throw New InvalidOperationException("The video file is already closed.")
+
+ Dim source As Integer() = pixels
+ If _cropped IsNot Nothing Then
+ For y As Integer = 0 To _height - 1
+ Array.Copy(pixels, y * _srcWidth, _cropped, y * _width, _width)
+ Next
+ source = _cropped
+ End If
+
+ Dim byteCount As Integer = _width * _height * 4
+ Dim bufferPtr As IntPtr = IntPtr.Zero
+ Dim samplePtr As IntPtr = IntPtr.Zero
+ Dim buffer As IMFMediaBufferNative = Nothing
+ Dim sample As IMFSampleNative = Nothing
+ Try
+ Check(MFCreateMemoryBuffer(byteCount, bufferPtr))
+ buffer = DirectCast(Marshal.GetObjectForIUnknown(bufferPtr), IMFMediaBufferNative)
+
+ Dim data As IntPtr = IntPtr.Zero
+ Dim maxLength As Integer = 0
+ Dim currentLength As Integer = 0
+ Check(buffer.Lock(data, maxLength, currentLength))
+ Try
+ Marshal.Copy(source, 0, data, _width * _height)
+ Finally
+ buffer.Unlock()
+ End Try
+ Check(buffer.SetCurrentLength(byteCount))
+
+ Check(MFCreateSample(samplePtr))
+ sample = DirectCast(Marshal.GetObjectForIUnknown(samplePtr), IMFSampleNative)
+ Check(sample.AddBuffer(bufferPtr))
+
+ ' times are in units of 100 nanoseconds
+ Check(sample.SetSampleTime(CLng(_frames) * 10000000L \ _fps))
+ Check(sample.SetSampleDuration(10000000L \ _fps))
+
+ Check(_writer.WriteSample(0, samplePtr))
+ _frames += 1
+ Finally
+ If sample IsNot Nothing Then Marshal.ReleaseComObject(sample)
+ If samplePtr <> IntPtr.Zero Then Marshal.Release(samplePtr)
+ If buffer IsNot Nothing Then Marshal.ReleaseComObject(buffer)
+ If bufferPtr <> IntPtr.Zero Then Marshal.Release(bufferPtr)
+ End Try
+ End Sub
+
+ Public Sub Close() Implements IFrameSink.Close
+ If _closed Then Return
+ _closed = True
+ Try
+ If _writer IsNot Nothing AndAlso _frames > 0 Then Check(_writer.FinalizeWriting())
+ Finally
+ Cleanup()
+ End Try
+ End Sub
+
+ Private Sub Cleanup()
+ If _writer IsNot Nothing Then
+ Marshal.ReleaseComObject(_writer)
+ _writer = Nothing
+ End If
+ If _writerPtr <> IntPtr.Zero Then
+ Marshal.Release(_writerPtr)
+ _writerPtr = IntPtr.Zero
+ End If
+ If _started Then
+ _started = False
+ MFShutdown()
+ End If
+ End Sub
+
+ Public Sub Dispose() Implements IDisposable.Dispose
+ Close()
+ End Sub
+
+ Private Shared Sub Check(hr As Integer)
+ If hr < 0 Then Marshal.ThrowExceptionForHR(hr)
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/OpenClApi.vb b/2D_wave_sim_V01/Simulation/OpenClApi.vb
new file mode 100644
index 0000000..0f828d2
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/OpenClApi.vb
@@ -0,0 +1,249 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Runtime.InteropServices
+Imports System.Text
+
+''' <summary>
+''' The part of the OpenCL 1.2 C interface that the GPU simulation needs, called directly from OpenCL.dll.
+''' OpenCL.dll is installed with the driver of the graphics card (NVIDIA, Intel and AMD all install it), so no
+''' extra package is needed. Names and parameters follow the C header (cl.h); "size_t" is an IntPtr,
+''' "cl_bitfield" a ULong, "cl_uint" a UInteger and "cl_bool" a UInteger.
+''' </summary>
+Friend Module OpenClApi
+
+ Friend Const DeviceTypeGpu As ULong = 4UL
+ Friend Const MemReadWrite As ULong = 1UL
+ Friend Const ContextPlatformProperty As Integer = &H1084
+
+ Friend Const PlatformNameInfo As UInteger = &H902UI
+ Friend Const DeviceMaxComputeUnits As UInteger = &H1002UI
+ Friend Const DeviceMaxClockFrequency As UInteger = &H100CUI
+ Friend Const DeviceMaxMemAllocSize As UInteger = &H1010UI
+ Friend Const DeviceGlobalMemSize As UInteger = &H101FUI
+ Friend Const DeviceName As UInteger = &H102BUI
+ Friend Const DeviceVendor As UInteger = &H102CUI
+ Friend Const DeviceHostUnifiedMemory As UInteger = &H1035UI
+ Friend Const ProgramBuildLog As UInteger = &H1183UI
+
+ ' ---- platforms and devices
+
+ Friend Declare Ansi Function clGetPlatformIDs Lib "OpenCL.dll" (numEntries As UInteger, platforms As IntPtr(), ByRef numPlatforms As UInteger) As Integer
+
+ Friend Declare Ansi Function clGetDeviceIDs Lib "OpenCL.dll" (platform As IntPtr, deviceType As ULong, numEntries As UInteger, devices As IntPtr(), ByRef numDevices As UInteger) As Integer
+
+ Friend Declare Ansi Function clGetDeviceInfo Lib "OpenCL.dll" (device As IntPtr, paramName As UInteger, paramSize As IntPtr, paramValue As Byte(), ByRef sizeRet As IntPtr) As Integer
+
+ ' ---- context, queue, program, kernels
+
+ Friend Declare Ansi Function clCreateContext Lib "OpenCL.dll" (properties As IntPtr(), numDevices As UInteger, devices As IntPtr(), notify As IntPtr, userData As IntPtr, ByRef errcode As Integer) As IntPtr
+
+ Friend Declare Ansi Function clCreateCommandQueue Lib "OpenCL.dll" (context As IntPtr, device As IntPtr, properties As ULong, ByRef errcode As Integer) As IntPtr
+
+ Friend Declare Ansi Function clCreateProgramWithSource Lib "OpenCL.dll" (context As IntPtr, count As UInteger, <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.LPStr)> strings As String(), lengths As IntPtr(), ByRef errcode As Integer) As IntPtr
+
+ Friend Declare Ansi Function clBuildProgram Lib "OpenCL.dll" (program As IntPtr, numDevices As UInteger, devices As IntPtr(), options As String, notify As IntPtr, userData As IntPtr) As Integer
+
+ Friend Declare Ansi Function clGetProgramBuildInfo Lib "OpenCL.dll" (program As IntPtr, device As IntPtr, paramName As UInteger, paramSize As IntPtr, paramValue As Byte(), ByRef sizeRet As IntPtr) As Integer
+
+ Friend Declare Ansi Function clCreateKernel Lib "OpenCL.dll" (program As IntPtr, kernelName As String, ByRef errcode As Integer) As IntPtr
+
+ Friend Declare Ansi Function clSetKernelArgMem Lib "OpenCL.dll" Alias "clSetKernelArg" (kernel As IntPtr, argIndex As UInteger, argSize As IntPtr, ByRef argValue As IntPtr) As Integer
+
+ Friend Declare Ansi Function clSetKernelArgInt Lib "OpenCL.dll" Alias "clSetKernelArg" (kernel As IntPtr, argIndex As UInteger, argSize As IntPtr, ByRef argValue As Integer) As Integer
+
+ Friend Declare Ansi Function clSetKernelArgFloat Lib "OpenCL.dll" Alias "clSetKernelArg" (kernel As IntPtr, argIndex As UInteger, argSize As IntPtr, ByRef argValue As Single) As Integer
+
+ ' ---- memory and execution
+
+ Friend Declare Ansi Function clCreateBuffer Lib "OpenCL.dll" (context As IntPtr, flags As ULong, size As IntPtr, hostPtr As IntPtr, ByRef errcode As Integer) As IntPtr
+
+ Friend Declare Ansi Function clEnqueueWriteBufferFloat Lib "OpenCL.dll" Alias "clEnqueueWriteBuffer" (queue As IntPtr, buffer As IntPtr, blocking As UInteger, offset As IntPtr, size As IntPtr, data As Single(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer
+
+ Friend Declare Ansi Function clEnqueueWriteBufferInt Lib "OpenCL.dll" Alias "clEnqueueWriteBuffer" (queue As IntPtr, buffer As IntPtr, blocking As UInteger, offset As IntPtr, size As IntPtr, data As Integer(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer
+
+ Friend Declare Ansi Function clEnqueueReadBufferFloat Lib "OpenCL.dll" Alias "clEnqueueReadBuffer" (queue As IntPtr, buffer As IntPtr, blocking As UInteger, offset As IntPtr, size As IntPtr, data As Single(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer
+
+ Friend Declare Ansi Function clEnqueueNDRangeKernel Lib "OpenCL.dll" (queue As IntPtr, kernel As IntPtr, workDim As UInteger, globalOffset As IntPtr(), globalSize As IntPtr(), localSize As IntPtr(), numEvents As UInteger, waitList As IntPtr, evt As IntPtr) As Integer
+
+ Friend Declare Ansi Function clFinish Lib "OpenCL.dll" (queue As IntPtr) As Integer
+
+ ' ---- release
+
+ Friend Declare Ansi Function clReleaseMemObject Lib "OpenCL.dll" (memObj As IntPtr) As Integer
+ Friend Declare Ansi Function clReleaseKernel Lib "OpenCL.dll" (kernel As IntPtr) As Integer
+ Friend Declare Ansi Function clReleaseProgram Lib "OpenCL.dll" (program As IntPtr) As Integer
+ Friend Declare Ansi Function clReleaseCommandQueue Lib "OpenCL.dll" (queue As IntPtr) As Integer
+ Friend Declare Ansi Function clReleaseContext Lib "OpenCL.dll" (context As IntPtr) As Integer
+
+ ' ---- helpers
+
+ ''' <summary>Throws when an OpenCL call returned an error code (0 = CL_SUCCESS).</summary>
+ Friend Sub Check(code As Integer, what As String)
+ If code <> 0 Then Throw New InvalidOperationException(what & " failed: " & ErrorName(code))
+ End Sub
+
+ Friend Function ErrorName(code As Integer) As String
+ Dim name As String
+ Select Case code
+ Case -1 : name = "CL_DEVICE_NOT_FOUND"
+ Case -2 : name = "CL_DEVICE_NOT_AVAILABLE"
+ Case -3 : name = "CL_COMPILER_NOT_AVAILABLE"
+ Case -4 : name = "CL_MEM_OBJECT_ALLOCATION_FAILURE (out of GPU memory)"
+ Case -5 : name = "CL_OUT_OF_RESOURCES"
+ Case -6 : name = "CL_OUT_OF_HOST_MEMORY"
+ Case -11 : name = "CL_BUILD_PROGRAM_FAILURE"
+ Case -30 : name = "CL_INVALID_VALUE"
+ Case -33 : name = "CL_INVALID_DEVICE"
+ Case -34 : name = "CL_INVALID_CONTEXT"
+ Case -36 : name = "CL_INVALID_COMMAND_QUEUE"
+ Case -38 : name = "CL_INVALID_MEM_OBJECT"
+ Case -45 : name = "CL_INVALID_PROGRAM_EXECUTABLE"
+ Case -46 : name = "CL_INVALID_KERNEL_NAME"
+ Case -48 : name = "CL_INVALID_KERNEL"
+ Case -49 : name = "CL_INVALID_ARG_INDEX"
+ Case -50 : name = "CL_INVALID_ARG_VALUE"
+ Case -51 : name = "CL_INVALID_ARG_SIZE"
+ Case -52 : name = "CL_INVALID_KERNEL_ARGS"
+ Case -54 : name = "CL_INVALID_WORK_GROUP_SIZE"
+ Case -55 : name = "CL_INVALID_WORK_ITEM_SIZE"
+ Case -61 : name = "CL_INVALID_BUFFER_SIZE"
+ Case -1001 : name = "no OpenCL platform (CL_PLATFORM_NOT_FOUND_KHR)"
+ Case Else : name = "error"
+ End Select
+ Return name & " (" & code.ToString(System.Globalization.CultureInfo.InvariantCulture) & ")"
+ End Function
+
+ ''' <summary>The bytes of a device info item, or Nothing when the item is not available.</summary>
+ Friend Function DeviceInfoBytes(device As IntPtr, paramName As UInteger) As Byte()
+ Dim needed As IntPtr = IntPtr.Zero
+ If clGetDeviceInfo(device, paramName, IntPtr.Zero, Nothing, needed) <> 0 Then Return Nothing
+ Dim n As Integer = needed.ToInt32()
+ If n <= 0 Then Return Nothing
+ Dim buffer(n - 1) As Byte
+ Dim written As IntPtr = IntPtr.Zero
+ If clGetDeviceInfo(device, paramName, New IntPtr(n), buffer, written) <> 0 Then Return Nothing
+ Return buffer
+ End Function
+
+ Friend Function DeviceString(device As IntPtr, paramName As UInteger) As String
+ Dim buffer As Byte() = DeviceInfoBytes(device, paramName)
+ If buffer Is Nothing Then Return ""
+ Return Encoding.ASCII.GetString(buffer).Trim(ChrW(0), " "c)
+ End Function
+
+ ''' <summary>A number (32 or 64 bits) of a device info item, 0 when it is not available.</summary>
+ Friend Function DeviceNumber(device As IntPtr, paramName As UInteger) As ULong
+ Dim buffer As Byte() = DeviceInfoBytes(device, paramName)
+ If buffer Is Nothing Then Return 0UL
+ If buffer.Length >= 8 Then Return BitConverter.ToUInt64(buffer, 0)
+ If buffer.Length >= 4 Then Return BitConverter.ToUInt32(buffer, 0)
+ Return 0UL
+ End Function
+
+ ''' <summary>The build log of a program (the compiler messages).</summary>
+ Friend Function BuildLog(program As IntPtr, device As IntPtr) As String
+ Try
+ Dim needed As IntPtr = IntPtr.Zero
+ If clGetProgramBuildInfo(program, device, ProgramBuildLog, IntPtr.Zero, Nothing, needed) <> 0 Then Return ""
+ Dim n As Integer = needed.ToInt32()
+ If n <= 0 Then Return ""
+ Dim buffer(n - 1) As Byte
+ Dim written As IntPtr = IntPtr.Zero
+ If clGetProgramBuildInfo(program, device, ProgramBuildLog, New IntPtr(n), buffer, written) <> 0 Then Return ""
+ Return Encoding.ASCII.GetString(buffer).Trim(ChrW(0), " "c, ChrW(13), ChrW(10))
+ Catch ex As Exception
+ Return ""
+ End Try
+ End Function
+
+End Module
+
+''' <summary>A GPU that OpenCL can use.</summary>
+Friend NotInheritable Class GpuDeviceInfo
+
+ Public PlatformId As IntPtr
+ Public DeviceId As IntPtr
+ Public Name As String = ""
+ Public Vendor As String = ""
+
+ ''' <summary>True for a card with its own memory (the NVIDIA GeForce), False for the graphics of the processor (Intel UHD).</summary>
+ Public Discrete As Boolean
+
+ ''' <summary>Compute units times clock (MHz): a rough measure of the speed.</summary>
+ Public Score As Double
+
+ Public GlobalMemory As Long
+ Public MaxAllocation As Long
+
+ ''' <summary>
+ ''' All GPUs that OpenCL knows, the best first: cards with their own memory come before the graphics of the
+ ''' processor. Throws DllNotFoundException when there is no OpenCL driver at all.
+ ''' </summary>
+ Public Shared Function FindAll() As List(Of GpuDeviceInfo)
+ Dim found As New List(Of GpuDeviceInfo)()
+
+ Dim platformCount As UInteger = 0UI
+ If OpenClApi.clGetPlatformIDs(0UI, Nothing, platformCount) <> 0 OrElse platformCount = 0UI Then Return found
+
+ Dim platforms(CInt(platformCount) - 1) As IntPtr
+ Dim returned As UInteger = 0UI
+ If OpenClApi.clGetPlatformIDs(platformCount, platforms, returned) <> 0 Then Return found
+
+ For Each plat As IntPtr In platforms
+ Dim deviceCount As UInteger = 0UI
+ If OpenClApi.clGetDeviceIDs(plat, OpenClApi.DeviceTypeGpu, 0UI, Nothing, deviceCount) <> 0 OrElse deviceCount = 0UI Then Continue For
+
+ Dim ids(CInt(deviceCount) - 1) As IntPtr
+ Dim got As UInteger = 0UI
+ If OpenClApi.clGetDeviceIDs(plat, OpenClApi.DeviceTypeGpu, deviceCount, ids, got) <> 0 Then Continue For
+
+ For Each id As IntPtr In ids
+ found.Add(Describe(plat, id))
+ Next
+ Next
+
+ found.Sort(Function(a As GpuDeviceInfo, b As GpuDeviceInfo) As Integer
+ If a.Discrete <> b.Discrete Then Return If(a.Discrete, -1, 1)
+ Return b.Score.CompareTo(a.Score)
+ End Function)
+ Return found
+ End Function
+
+ Private Shared Function Describe(plat As IntPtr, id As IntPtr) As GpuDeviceInfo
+ Dim g As New GpuDeviceInfo()
+ g.PlatformId = plat
+ g.DeviceId = id
+ g.Name = OpenClApi.DeviceString(id, OpenClApi.DeviceName)
+ g.Vendor = OpenClApi.DeviceString(id, OpenClApi.DeviceVendor)
+ g.Discrete = (OpenClApi.DeviceNumber(id, OpenClApi.DeviceHostUnifiedMemory) = 0UL)
+ Dim units As Double = CDbl(OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxComputeUnits))
+ Dim clock As Double = CDbl(OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxClockFrequency))
+ g.Score = units * Math.Max(1.0, clock)
+ g.GlobalMemory = CLng(OpenClApi.DeviceNumber(id, OpenClApi.DeviceGlobalMemSize) And &H7FFFFFFFFFFFFFFFUL)
+ g.MaxAllocation = CLng(OpenClApi.DeviceNumber(id, OpenClApi.DeviceMaxMemAllocSize) And &H7FFFFFFFFFFFFFFFUL)
+ If g.Name.Length = 0 Then g.Name = "GPU"
+ Return g
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/ProbeGraphPainter.vb b/2D_wave_sim_V01/Simulation/ProbeGraphPainter.vb
new file mode 100644
index 0000000..3128be2
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/ProbeGraphPainter.vb
@@ -0,0 +1,713 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Drawing
+Imports System.Drawing.Drawing2D
+Imports System.Drawing.Imaging
+Imports System.Drawing.Text
+Imports System.Globalization
+Imports System.Runtime.InteropServices
+
+''' <summary>
+''' Draws the probe graphs (a little box with axes and the measured curve) and the probe markers. Used for the live
+''' pictures on the screen (with a Graphics of the picture box) and for the exported videos (through ProbeOverlay).
+''' Point probe value (Y) against the simulation step (X)
+''' Line probe value (Y) against the position on the line A-B in pixels (X), at the current step
+''' </summary>
+Friend NotInheritable Class ProbeGraphPainter
+
+ Private Sub New()
+ End Sub
+
+ ''' <summary>The nominal size of the box in scene pixels.</summary>
+ Public Shared Function NominalBoxSize(boxSize As ProbeBoxSize) As Size
+ Select Case boxSize
+ Case ProbeBoxSize.Tiny
+ Return New Size(200, 100)
+ Case ProbeBoxSize.Small
+ Return New Size(300, 150)
+ Case ProbeBoxSize.Large
+ Return New Size(500, 250)
+ Case ProbeBoxSize.ExtraLarge
+ Return New Size(700, 350)
+ Case Else
+ Return New Size(400, 200)
+ End Select
+ End Function
+
+ ''' <summary>
+ ''' The graph box in scene pixels of a canvas of w x h: the nominal size (smaller when the canvas is small: at most
+ ''' half as wide as the canvas) with its top left corner where the probe says, moved when necessary so that the box stays on the canvas.
+ ''' </summary>
+ Public Shared Function BoxInCanvas(probe As ProbeSettings, w As Integer, h As Integer) As Rectangle
+ Dim nominal As Size = NominalBoxSize(probe.BoxSize)
+ Dim factor As Double = 1.0
+ If nominal.Width > w / 2.0 Then factor = Math.Min(factor, (w / 2.0) / nominal.Width)
+ If nominal.Height > h Then factor = Math.Min(factor, h / CDbl(nominal.Height))
+
+ Dim boxW As Integer = Math.Max(1, CInt(nominal.Width * factor))
+ Dim boxH As Integer = Math.Max(1, CInt(nominal.Height * factor))
+ Dim x As Integer = Math.Max(0, Math.Min(w - boxW, probe.BoxX))
+ Dim y As Integer = Math.Max(0, Math.Min(h - boxH, probe.BoxY))
+ Return New Rectangle(x, y, boxW, boxH)
+ End Function
+
+ ' ---------------------------------------------------------------- the axes
+
+ ''' <summary>
+ ''' The ranges of the graph.
+ ''' Point probe: X is the simulation step. With a running graph the last RunningWindow steps are shown; with a full
+ ''' graph the whole run (0 to the last step so far when X is scaled automatically, otherwise 0 to the total number of steps).
+ ''' Line probe: X is the position on the line, from 0 to the length of the line.
+ ''' With automatic Y the range follows the values that are shown.
+ ''' </summary>
+ Public Shared Sub ComputeRanges(probe As ProbeSettings, trace As ProbeTrace, totalSteps As Integer,
+ ByRef xMin As Double, ByRef xMax As Double, ByRef yMin As Double, ByRef yMax As Double)
+ If probe.Kind = ProbeKind.Line Then
+ ProfileRanges(probe, trace, xMin, xMax, yMin, yMax)
+ Else
+ Dim series As ProbeSeries = Nothing
+ If trace IsNot Nothing Then series = trace.Series
+ Dim startStep As Double = If(probe.UseStartAfterStep, Math.Max(0, probe.StartAfterStep), 0.0)
+ SeriesRanges(probe, series, totalSteps, startStep, xMin, xMax, yMin, yMax)
+ End If
+ End Sub
+
+ ''' <summary>
+ ''' The ranges for a point probe. When "start after step" is used, the values from before that step are trimmed off:
+ ''' xMin never goes below it, so the visible range starts there (with more room for the data that follows, especially
+ ''' with the full scale, which would otherwise show mostly empty space before the data starts).
+ ''' </summary>
+ Private Shared Sub SeriesRanges(probe As ProbeSettings, series As ProbeSeries, totalSteps As Integer, startStep As Double,
+ ByRef xMin As Double, ByRef xMax As Double, ByRef yMin As Double, ByRef yMax As Double)
+ Dim count As Integer = If(series Is Nothing, 0, series.Count)
+ Dim current As Double = count
+
+ If probe.ScaleMode = ProbeScaleMode.Full Then
+ xMin = startStep
+ xMax = If(probe.AutoScaleX, Math.Max(current, startStep + 1.0), Math.Max(CDbl(totalSteps), startStep + 1.0))
+ Else
+ Dim window As Double = Math.Max(10, probe.RunningWindow)
+ If probe.AutoScaleX Then
+ xMax = Math.Max(current, startStep + 1.0)
+ xMin = Math.Max(startStep, xMax - window)
+ Else
+ xMax = Math.Max(current, startStep + window)
+ xMin = Math.Max(startStep, xMax - window)
+ End If
+ End If
+ If xMax <= xMin Then xMax = xMin + 1.0
+
+ yMin = probe.YMin
+ yMax = probe.YMax
+ If Not (yMax > yMin) Then
+ yMin = -1.0
+ yMax = 1.0
+ End If
+
+ If probe.AutoScaleY AndAlso count > 0 Then
+ Dim i0 As Integer = Math.Max(0, CInt(Math.Floor(xMin)) - 1)
+ Dim i1 As Integer = Math.Min(count - 1, CInt(Math.Ceiling(xMax)))
+ Dim lo As Double = Double.MaxValue
+ Dim hi As Double = Double.MinValue
+ Dim values As Single() = series.Values
+ For i As Integer = i0 To i1
+ Dim v As Single = values(i)
+ If Not (Single.IsNaN(v) OrElse Single.IsInfinity(v)) Then
+ If v < lo Then lo = v
+ If v > hi Then hi = v
+ End If
+ Next
+ If lo <= hi Then FitRange(lo, hi, False, yMin, yMax)
+ End If
+ End Sub
+
+ Private Shared Sub ProfileRanges(probe As ProbeSettings, trace As ProbeTrace,
+ ByRef xMin As Double, ByRef xMax As Double, ByRef yMin As Double, ByRef yMax As Double)
+ Dim length As Double = 0.0
+ Dim profile As Single() = Nothing
+ If trace IsNot Nothing Then
+ length = trace.ProfileLength
+ profile = trace.Profile
+ End If
+
+ xMin = 0.0
+ xMax = If(length > 0.0, length, 1.0)
+
+ yMin = probe.YMin
+ yMax = probe.YMax
+ If Not (yMax > yMin) Then
+ yMin = -1.0
+ yMax = 1.0
+ End If
+
+ If probe.AutoScaleY AndAlso profile IsNot Nothing Then
+ Dim lo As Double = Double.MaxValue
+ Dim hi As Double = Double.MinValue
+ For i As Integer = 0 To profile.Length - 1
+ Dim v As Single = profile(i)
+ If Not (Single.IsNaN(v) OrElse Single.IsInfinity(v)) Then
+ If v < lo Then lo = v
+ If v > hi Then hi = v
+ End If
+ Next
+ ' an intensity starts at zero
+ If lo <= hi Then FitRange(lo, hi, probe.Measurement <> ProbeMeasurement.Amplitude AndAlso lo >= 0.0, yMin, yMax)
+ End If
+ End Sub
+
+ ''' <summary>A value range with some room around the values (from zero when zeroBased).</summary>
+ Private Shared Sub FitRange(lo As Double, hi As Double, zeroBased As Boolean, ByRef yMin As Double, ByRef yMax As Double)
+ Dim span As Double = hi - lo
+ Dim biggest As Double = Math.Max(Math.Abs(hi), Math.Abs(lo))
+ Dim pad As Double = span * 0.08
+ If span < biggest * 0.000000001 OrElse span < 1.0E-30 Then
+ pad = Math.Max(biggest * 0.1, 0.000001)
+ End If
+ yMin = If(zeroBased, 0.0, lo - pad)
+ yMax = hi + pad
+ End Sub
+
+ Private Shared Function NiceTicks(lo As Double, hi As Double, target As Integer) As List(Of Double)
+ Dim ticks As New List(Of Double)()
+ Dim span As Double = hi - lo
+ If Not (span > 0.0) OrElse Double.IsInfinity(span) Then Return ticks
+
+ Dim raw As Double = span / Math.Max(1, target)
+ Dim magnitude As Double = Math.Pow(10.0, Math.Floor(Math.Log10(raw)))
+ Dim normalized As Double = raw / magnitude
+ Dim tickStep As Double
+ If normalized < 1.5 Then
+ tickStep = 1.0
+ ElseIf normalized < 3.0 Then
+ tickStep = 2.0
+ ElseIf normalized < 7.0 Then
+ tickStep = 5.0
+ Else
+ tickStep = 10.0
+ End If
+ tickStep *= magnitude
+
+ Dim v As Double = Math.Ceiling(lo / tickStep) * tickStep
+ Dim guard As Integer = 0
+ While v <= hi + tickStep * 0.000000001 AndAlso guard < 40
+ ticks.Add(If(Math.Abs(v) < tickStep * 0.000000001, 0.0, v))
+ v += tickStep
+ guard += 1
+ End While
+ Return ticks
+ End Function
+
+ Private Shared Function FormatTick(v As Double) As String
+ If v = 0.0 Then Return "0"
+ Return v.ToString("G3", CultureInfo.InvariantCulture)
+ End Function
+
+ ''' <summary>A position on the step axis or on the line: a whole number, or with one decimal for a short line.</summary>
+ Private Shared Function FormatPosition(v As Double, span As Double) As String
+ If span >= 10.0 Then Return Math.Round(v).ToString("0", CultureInfo.InvariantCulture)
+ Return v.ToString("0.#", CultureInfo.InvariantCulture)
+ End Function
+
+ ' ---------------------------------------------------------------- the graph
+
+ ''' <summary>Draws the graph box (background, axes, curve, title and a value) in the given rectangle.</summary>
+ Public Shared Sub DrawGraph(g As Graphics, bounds As Rectangle, title As String, probe As ProbeSettings,
+ trace As ProbeTrace, totalSteps As Integer)
+ If bounds.Width < 40 OrElse bounds.Height < 30 Then Return
+
+ Dim state As GraphicsState = g.Save()
+ Try
+ g.SmoothingMode = SmoothingMode.AntiAlias
+ g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit
+
+ Using background As New SolidBrush(Color.FromArgb(235, 14, 16, 22))
+ g.FillRectangle(background, bounds)
+ End Using
+ Using border As New Pen(Color.FromArgb(170, 200, 200, 210), 1.0F)
+ g.DrawRectangle(border, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1)
+ End Using
+
+ Dim fontPx As Single = Math.Max(9.0F, bounds.Height / 14.0F)
+ Using font As New Font("Segoe UI", fontPx, FontStyle.Regular, GraphicsUnit.Pixel)
+ Dim labelWidth As Integer = CInt(Math.Ceiling(fontPx * 4.4F))
+ Dim topMargin As Integer = CInt(fontPx * 2.3F)
+ Dim bottomMargin As Integer = CInt(fontPx * 1.9F)
+ Dim plot As New Rectangle(bounds.X + labelWidth + 6, bounds.Y + topMargin,
+ bounds.Width - labelWidth - 6 - 10, bounds.Height - topMargin - bottomMargin)
+ If plot.Width < 20 OrElse plot.Height < 15 Then Return
+
+ ' a line probe (a profile of the current instant) has nothing meaningful to show before the start step is
+ ' reached, so it stays blank until then; a point probe (a series) is trimmed instead, see SeriesRanges
+ Dim isLine As Boolean = (probe.Kind = ProbeKind.Line)
+ Dim started As Boolean = Not probe.UseStartAfterStep OrElse trace Is Nothing OrElse trace.StepsSampled >= probe.StartAfterStep
+ Dim shownTrace As ProbeTrace = If(started, trace, Nothing)
+
+ ' a point probe's own range/autoscale must see the real trace (it is trimmed by "start after step" inside
+ ' ComputeRanges/SeriesRanges, not hidden); only a line probe uses shownTrace, to stay blank until it starts
+ Dim xMin, xMax, yMin, yMax As Double
+ ComputeRanges(probe, If(isLine, shownTrace, trace), totalSteps, xMin, xMax, yMin, yMax)
+
+ DrawAxes(g, font, fontPx, bounds, plot, xMin, xMax, yMin, yMax)
+ Dim lineWidth As Single = Math.Max(1.2F, bounds.Height / 110.0F)
+ If isLine Then
+ If shownTrace IsNot Nothing Then DrawProfile(g, plot, shownTrace.Profile, yMin, yMax, lineWidth)
+ Else
+ ' a point probe is trimmed (xMin), not hidden: its curve is drawn up to the current value even before
+ ' the start step is reached (the range is then just very small)
+ If trace IsNot Nothing Then DrawCurve(g, plot, trace.Series, xMin, xMax, yMin, yMax, lineWidth)
+ End If
+ DrawTitle(g, font, bounds, title, ValueText(isLine, If(isLine, shownTrace, trace)), fontPx)
+ End Using
+ Finally
+ g.Restore(state)
+ End Try
+ End Sub
+
+ ''' <summary>The value at the top right of the box: the last value of a point probe, the highest value on the line of a line probe.</summary>
+ Private Shared Function ValueText(isLine As Boolean, trace As ProbeTrace) As String
+ If trace Is Nothing Then Return ""
+
+ If isLine Then
+ Dim profile As Single() = trace.Profile
+ If profile Is Nothing OrElse profile.Length = 0 Then Return ""
+ Dim hi As Single = Single.MinValue
+ For i As Integer = 0 To profile.Length - 1
+ Dim v As Single = profile(i)
+ If Not (Single.IsNaN(v) OrElse Single.IsInfinity(v)) AndAlso v > hi Then hi = v
+ Next
+ If hi = Single.MinValue Then Return ""
+ Return "max " & FormatTick(hi)
+ End If
+
+ If trace.Series.Count = 0 Then Return ""
+ Dim last As Single = trace.Series.LastValue
+ If Single.IsNaN(last) OrElse Single.IsInfinity(last) Then Return ""
+ Return "= " & FormatTick(last)
+ End Function
+
+ Private Shared Sub DrawAxes(g As Graphics, font As Font, fontPx As Single, bounds As Rectangle, plot As Rectangle,
+ xMin As Double, xMax As Double, yMin As Double, yMax As Double)
+ Using gridPen As New Pen(Color.FromArgb(46, 255, 255, 255), 1.0F)
+ Using zeroPen As New Pen(Color.FromArgb(120, 255, 255, 255), 1.0F)
+ Using textBrush As New SolidBrush(Color.FromArgb(225, 225, 225, 230))
+ Using rightAligned As New StringFormat()
+ Using centered As New StringFormat()
+ rightAligned.Alignment = StringAlignment.Far
+ rightAligned.LineAlignment = StringAlignment.Center
+ rightAligned.FormatFlags = StringFormatFlags.NoWrap
+ centered.Alignment = StringAlignment.Center
+ centered.FormatFlags = StringFormatFlags.NoWrap
+
+ ' value axis
+ For Each v As Double In NiceTicks(yMin, yMax, 4)
+ Dim y As Single = ToPixelY(v, plot, yMin, yMax)
+ g.DrawLine(If(v = 0.0, zeroPen, gridPen), plot.Left, y, plot.Right, y)
+ g.DrawString(FormatTick(v), font, textBrush,
+ New RectangleF(bounds.X + 1, y - fontPx * 0.7F, plot.Left - bounds.X - 4, fontPx * 1.4F), rightAligned)
+ Next
+
+ ' step axis (point probe) or position on the line (line probe)
+ For Each v As Double In NiceTicks(xMin, xMax, 5)
+ Dim x As Single = CSng(plot.Left + (v - xMin) / (xMax - xMin) * plot.Width)
+ g.DrawLine(gridPen, x, plot.Top, x, plot.Bottom)
+ g.DrawString(FormatPosition(v, xMax - xMin), font, textBrush,
+ New RectangleF(x - fontPx * 2.5F, plot.Bottom + 2, fontPx * 5.0F, fontPx * 1.4F), centered)
+ Next
+ End Using
+ End Using
+ End Using
+ End Using
+
+ Using framePen As New Pen(Color.FromArgb(130, 200, 200, 210), 1.0F)
+ g.DrawRectangle(framePen, plot.X, plot.Y, plot.Width, plot.Height)
+ End Using
+ End Using
+ End Sub
+
+ Private Shared Function ToPixelY(v As Double, plot As Rectangle, yMin As Double, yMax As Double) As Single
+ Dim y As Double = plot.Bottom - (v - yMin) / (yMax - yMin) * plot.Height
+ If y < -30000.0 Then y = -30000.0
+ If y > 30000.0 Then y = 30000.0
+ Return CSng(y)
+ End Function
+
+ ''' <summary>The curve of a point probe: the value of every step.</summary>
+ Private Shared Sub DrawCurve(g As Graphics, plot As Rectangle, series As ProbeSeries,
+ xMin As Double, xMax As Double, yMin As Double, yMax As Double, lineWidth As Single)
+ If series Is Nothing OrElse series.Count < 1 Then Return
+
+ Dim values As Single() = series.Values
+ Dim count As Integer = series.Count
+ Dim i0 As Integer = Math.Max(0, CInt(Math.Floor(xMin)) - 1)
+ Dim i1 As Integer = Math.Min(count - 1, CInt(Math.Ceiling(xMax)))
+ If i1 < i0 Then Return
+
+ Dim points As New List(Of PointF)()
+ Dim visible As Integer = i1 - i0 + 1
+ Dim xScale As Double = plot.Width / (xMax - xMin)
+
+ If visible <= plot.Width * 2 Then
+ ' every value gets its own point (value i belongs to step i + 1)
+ For i As Integer = i0 To i1
+ Dim v As Single = values(i)
+ If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For
+ points.Add(New PointF(CSng(plot.Left + (i + 1 - xMin) * xScale), ToPixelY(v, plot, yMin, yMax)))
+ Next
+ Else
+ ' more values than pixels: draw the lowest and the highest value of every pixel column
+ For column As Integer = 0 To plot.Width - 1
+ Dim a As Integer = i0 + CInt(CLng(column) * visible \ plot.Width)
+ Dim b As Integer = i0 + CInt(CLng(column + 1) * visible \ plot.Width) - 1
+ If b < a Then b = a
+ Dim lo As Single = Single.MaxValue
+ Dim hi As Single = Single.MinValue
+ For i As Integer = a To Math.Min(b, i1)
+ Dim v As Single = values(i)
+ If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For
+ If v < lo Then lo = v
+ If v > hi Then hi = v
+ Next
+ If lo <= hi Then
+ Dim x As Single = plot.Left + column + 0.5F
+ points.Add(New PointF(x, ToPixelY(lo, plot, yMin, yMax)))
+ points.Add(New PointF(x, ToPixelY(hi, plot, yMin, yMax)))
+ End If
+ Next
+ End If
+
+ StrokePoints(g, plot, points, lineWidth)
+ End Sub
+
+ ''' <summary>The curve of a line probe: the value at every pixel of the line, from A (left) to B (right).</summary>
+ Private Shared Sub DrawProfile(g As Graphics, plot As Rectangle, profile As Single(), yMin As Double, yMax As Double, lineWidth As Single)
+ If profile Is Nothing OrElse profile.Length < 1 Then Return
+
+ Dim n As Integer = profile.Length
+ Dim points As New List(Of PointF)()
+
+ If n <= plot.Width * 2 Then
+ For k As Integer = 0 To n - 1
+ Dim v As Single = profile(k)
+ If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For
+ Dim fraction As Double = If(n > 1, k / (n - 1.0), 0.0)
+ points.Add(New PointF(CSng(plot.Left + fraction * plot.Width), ToPixelY(v, plot, yMin, yMax)))
+ Next
+ Else
+ ' more pixels on the line than on the screen: the lowest and the highest value of every pixel column
+ For column As Integer = 0 To plot.Width - 1
+ Dim a As Integer = CInt(CLng(column) * n \ plot.Width)
+ Dim b As Integer = CInt(CLng(column + 1) * n \ plot.Width) - 1
+ If b < a Then b = a
+ Dim lo As Single = Single.MaxValue
+ Dim hi As Single = Single.MinValue
+ For k As Integer = a To Math.Min(b, n - 1)
+ Dim v As Single = profile(k)
+ If Single.IsNaN(v) OrElse Single.IsInfinity(v) Then Continue For
+ If v < lo Then lo = v
+ If v > hi Then hi = v
+ Next
+ If lo <= hi Then
+ Dim x As Single = plot.Left + column + 0.5F
+ points.Add(New PointF(x, ToPixelY(lo, plot, yMin, yMax)))
+ points.Add(New PointF(x, ToPixelY(hi, plot, yMin, yMax)))
+ End If
+ Next
+ End If
+
+ StrokePoints(g, plot, points, lineWidth)
+ End Sub
+
+ Private Shared Sub StrokePoints(g As Graphics, plot As Rectangle, points As List(Of PointF), lineWidth As Single)
+ If points.Count < 2 Then
+ If points.Count = 1 Then
+ Using dot As New SolidBrush(Color.FromArgb(255, 255, 208, 64))
+ g.FillEllipse(dot, points(0).X - 2.0F, points(0).Y - 2.0F, 4.0F, 4.0F)
+ End Using
+ End If
+ Return
+ End If
+
+ Dim clip As Region = g.Clip
+ Try
+ g.SetClip(plot)
+ Using pen As New Pen(Color.FromArgb(255, 255, 208, 64), lineWidth)
+ pen.LineJoin = LineJoin.Round
+ g.DrawLines(pen, points.ToArray())
+ End Using
+ Finally
+ g.Clip = clip
+ clip.Dispose()
+ End Try
+ End Sub
+
+ Private Shared Sub DrawTitle(g As Graphics, font As Font, bounds As Rectangle, title As String,
+ valueText As String, fontPx As Single)
+ Using textBrush As New SolidBrush(Color.FromArgb(240, 240, 240, 245))
+ Using valueBrush As New SolidBrush(Color.FromArgb(255, 255, 208, 64))
+ Using farFormat As New StringFormat()
+ Using nearFormat As New StringFormat()
+ farFormat.Alignment = StringAlignment.Far
+ farFormat.FormatFlags = StringFormatFlags.NoWrap
+ nearFormat.Alignment = StringAlignment.Near
+ nearFormat.Trimming = StringTrimming.EllipsisCharacter
+ nearFormat.FormatFlags = StringFormatFlags.NoWrap
+
+ Dim valueWidth As Single = 0.0F
+ If valueText.Length > 0 Then
+ valueWidth = g.MeasureString(valueText, font).Width
+ g.DrawString(valueText, font, valueBrush,
+ New RectangleF(bounds.Right - valueWidth - 8, bounds.Y + 3, valueWidth + 4, fontPx * 1.4F), farFormat)
+ End If
+ g.DrawString(title, font, textBrush,
+ New RectangleF(bounds.X + 6, bounds.Y + 3, Math.Max(10.0F, bounds.Width - valueWidth - 16), fontPx * 1.4F), nearFormat)
+ End Using
+ End Using
+ End Using
+ End Using
+ End Sub
+
+ ' ---------------------------------------------------------------- the markers
+
+ ''' <summary>
+ ''' Draws the probe position(s): a cross at A (and B) with the number of the probe, and the line between them.
+ ''' A simulation pixel (x, y) is drawn at (originX + (x + 0.5) * scaleX, originY + (y + 0.5) * scaleY).
+ ''' </summary>
+ Public Shared Sub DrawMarkers(g As Graphics, probe As ProbeSettings, index As Integer, originX As Single, originY As Single,
+ scaleX As Single, scaleY As Single)
+ Dim ax As Single = originX + (probe.PosAX + 0.5F) * scaleX
+ Dim ay As Single = originY + (probe.PosAY + 0.5F) * scaleY
+ Dim bx As Single = originX + (probe.PosBX + 0.5F) * scaleX
+ Dim by2 As Single = originY + (probe.PosBY + 0.5F) * scaleY
+ Dim isLine As Boolean = (probe.Kind = ProbeKind.Line)
+ Dim number As String = (index + 1).ToString(CultureInfo.InvariantCulture)
+
+ Dim state As GraphicsState = g.Save()
+ Try
+ g.SmoothingMode = SmoothingMode.AntiAlias
+ g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit
+ Using dark As New Pen(Color.FromArgb(210, 0, 0, 0), 3.5F)
+ Using light As New Pen(Color.White, 1.5F)
+ If isLine Then
+ g.DrawLine(dark, ax, ay, bx, by2)
+ g.DrawLine(light, ax, ay, bx, by2)
+ End If
+ DrawCross(g, dark, light, ax, ay)
+ If isLine Then DrawCross(g, dark, light, bx, by2)
+ End Using
+ End Using
+
+ Using font As New Font("Segoe UI", 13.0F, FontStyle.Bold, GraphicsUnit.Pixel)
+ Using shadow As New SolidBrush(Color.FromArgb(220, 0, 0, 0))
+ Using textBrush As New SolidBrush(Color.White)
+ ' a line probe has two ends, so each is labelled with the probe number and which end it is
+ If isLine Then
+ DrawNumber(g, font, shadow, textBrush, number & "A", ax, ay)
+ DrawNumber(g, font, shadow, textBrush, number & "B", bx, by2)
+ Else
+ DrawNumber(g, font, shadow, textBrush, number, ax, ay)
+ End If
+ End Using
+ End Using
+ End Using
+ Finally
+ g.Restore(state)
+ End Try
+ End Sub
+
+ Private Shared Sub DrawCross(g As Graphics, dark As Pen, light As Pen, x As Single, y As Single)
+ Const arm As Single = 7.0F
+ g.DrawLine(dark, x - arm, y, x + arm, y)
+ g.DrawLine(dark, x, y - arm, x, y + arm)
+ g.DrawLine(light, x - arm, y, x + arm, y)
+ g.DrawLine(light, x, y - arm, x, y + arm)
+ End Sub
+
+ Private Shared Sub DrawNumber(g As Graphics, font As Font, shadow As Brush, textBrush As Brush, text As String, x As Single, y As Single)
+ g.DrawString(text, font, shadow, x + 9.0F, y - 18.0F)
+ g.DrawString(text, font, textBrush, x + 8.0F, y - 19.0F)
+ End Sub
+
+End Class
+
+''' <summary>Draws the probes into the pixels of an exported video frame.</summary>
+Friend NotInheritable Class ProbeOverlay
+
+ Private Sub New()
+ End Sub
+
+ ''' <summary>
+ ''' Draws the markers and the graph boxes of the probes that belong on this kind of picture into a frame
+ ''' (packed ARGB pixels, w x h). The frame is the whole scene, so the box is where the probe says (in scene pixels).
+ ''' </summary>
+ Public Shared Sub Burn(pixels As Integer(), w As Integer, h As Integer, probes As IList(Of ProbeSettings),
+ traces As ProbeTrace(), placeOn As ProbePlaceOn, totalSteps As Integer)
+ For index As Integer = 0 To probes.Count - 1
+ Dim probe As ProbeSettings = probes(index)
+ If probe.PlaceOn <> placeOn OrElse Not probe.Active Then Continue For
+
+ DrawMarkerPixels(pixels, w, h, probe, index)
+
+ Dim rect As Rectangle = ProbeGraphPainter.BoxInCanvas(probe, w, h)
+ If rect.Width < 60 OrElse rect.Height < 30 Then Continue For
+
+ Using bmp As New Bitmap(rect.Width, rect.Height, PixelFormat.Format32bppPArgb)
+ Using g As Graphics = Graphics.FromImage(bmp)
+ g.Clear(Color.Transparent)
+ ProbeGraphPainter.DrawGraph(g, New Rectangle(0, 0, rect.Width, rect.Height), probe.Title(index), probe, traces(index), totalSteps)
+ End Using
+ Blend(pixels, w, h, bmp, rect)
+ End Using
+ Next
+ End Sub
+
+ ''' <summary>Puts a picture with premultiplied alpha over a rectangle of the frame.</summary>
+ Private Shared Sub Blend(pixels As Integer(), w As Integer, h As Integer, bmp As Bitmap, rect As Rectangle)
+ Dim data As BitmapData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppPArgb)
+ Try
+ Dim row(bmp.Width - 1) As Integer
+ For y As Integer = 0 To bmp.Height - 1
+ Dim fy As Integer = rect.Y + y
+ If fy < 0 OrElse fy >= h Then Continue For
+
+ Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, bmp.Width)
+ For x As Integer = 0 To bmp.Width - 1
+ Dim fx As Integer = rect.X + x
+ If fx < 0 OrElse fx >= w Then Continue For
+
+ Dim src As Integer = row(x)
+ Dim a As Integer = (src >> 24) And &HFF
+ If a = 0 Then Continue For
+
+ Dim idx As Integer = fy * w + fx
+ If a = 255 Then
+ pixels(idx) = src Or &HFF000000
+ Else
+ Dim dst As Integer = pixels(idx)
+ Dim inv As Integer = 255 - a
+ Dim r As Integer = Math.Min(255, ((src >> 16) And &HFF) + (((dst >> 16) And &HFF) * inv + 127) \ 255)
+ Dim gr As Integer = Math.Min(255, ((src >> 8) And &HFF) + (((dst >> 8) And &HFF) * inv + 127) \ 255)
+ Dim b As Integer = Math.Min(255, (src And &HFF) + ((dst And &HFF) * inv + 127) \ 255)
+ pixels(idx) = &HFF000000 Or (r << 16) Or (gr << 8) Or b
+ End If
+ Next
+ Next
+ Finally
+ bmp.UnlockBits(data)
+ End Try
+ End Sub
+
+ ' ---- markers, drawn pixel by pixel
+
+ Private Shared Sub DrawMarkerPixels(pixels As Integer(), w As Integer, h As Integer, probe As ProbeSettings, index As Integer)
+ Dim arm As Integer = Math.Max(6, h \ 120)
+ Dim isLine As Boolean = (probe.Kind = ProbeKind.Line)
+
+ ' black underneath, white on top
+ For pass As Integer = 0 To 1
+ Dim color As Integer = If(pass = 0, &HFF000000, &HFFFFFFFF)
+ Dim radius As Integer = If(pass = 0, 2, 1)
+
+ If isLine Then DrawThickLine(pixels, w, h, probe.PosAX, probe.PosAY, probe.PosBX, probe.PosBY, color, radius)
+ DrawCrossPixels(pixels, w, h, probe.PosAX, probe.PosAY, arm, color, radius)
+ If isLine Then DrawCrossPixels(pixels, w, h, probe.PosBX, probe.PosBY, arm, color, radius)
+ Next
+
+ ' the number of the probe next to the cross; a line probe's two ends are labelled with which end they are
+ Dim number As String = (index + 1).ToString(CultureInfo.InvariantCulture)
+ Dim fontPx As Single = Math.Max(12.0F, h / 60.0F)
+ If isLine Then
+ BurnLabel(pixels, w, h, number & "A", probe.PosAX + arm + 2, probe.PosAY - arm - CInt(fontPx * 1.4F), fontPx)
+ BurnLabel(pixels, w, h, number & "B", probe.PosBX + arm + 2, probe.PosBY - arm - CInt(fontPx * 1.4F), fontPx)
+ Else
+ BurnLabel(pixels, w, h, number, probe.PosAX + arm + 2, probe.PosAY - arm - CInt(fontPx * 1.4F), fontPx)
+ End If
+ End Sub
+
+ Private Shared Sub BurnLabel(pixels As Integer(), w As Integer, h As Integer, text As String, x As Integer, y As Integer, fontPx As Single)
+ Using font As New Font("Segoe UI", fontPx, FontStyle.Bold, GraphicsUnit.Pixel)
+ Dim labelWidth As Integer
+ Dim labelHeight As Integer
+ Using measure As New Bitmap(1, 1)
+ Using g As Graphics = Graphics.FromImage(measure)
+ Dim m As SizeF = g.MeasureString(text, font)
+ labelWidth = CInt(Math.Ceiling(m.Width)) + 4
+ labelHeight = CInt(Math.Ceiling(m.Height)) + 4
+ End Using
+ End Using
+
+ Using bmp As New Bitmap(labelWidth, labelHeight, PixelFormat.Format32bppPArgb)
+ Using g As Graphics = Graphics.FromImage(bmp)
+ g.Clear(Color.Transparent)
+ g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit
+ Using shadow As New SolidBrush(Color.FromArgb(220, 0, 0, 0))
+ Using white As New SolidBrush(Color.White)
+ g.DrawString(text, font, shadow, 3.0F, 3.0F)
+ g.DrawString(text, font, white, 2.0F, 2.0F)
+ End Using
+ End Using
+ End Using
+ Blend(pixels, w, h, bmp, New Rectangle(x, y, labelWidth, labelHeight))
+ End Using
+ End Using
+ End Sub
+
+ Private Shared Sub DrawCrossPixels(pixels As Integer(), w As Integer, h As Integer, x As Integer, y As Integer,
+ arm As Integer, color As Integer, radius As Integer)
+ DrawThickLine(pixels, w, h, x - arm, y, x + arm, y, color, radius)
+ DrawThickLine(pixels, w, h, x, y - arm, x, y + arm, color, radius)
+ End Sub
+
+ Private Shared Sub DrawThickLine(pixels As Integer(), w As Integer, h As Integer, x0 As Integer, y0 As Integer,
+ x1 As Integer, y1 As Integer, color As Integer, radius As Integer)
+ Dim dx As Integer = Math.Abs(x1 - x0)
+ Dim dy As Integer = -Math.Abs(y1 - y0)
+ Dim sx As Integer = If(x0 < x1, 1, -1)
+ Dim sy As Integer = If(y0 < y1, 1, -1)
+ Dim diff As Integer = dx + dy
+ Dim guard As Integer = 0
+
+ Do
+ For oy As Integer = -radius To radius
+ For ox As Integer = -radius To radius
+ Dim px As Integer = x0 + ox
+ Dim py As Integer = y0 + oy
+ If px >= 0 AndAlso px < w AndAlso py >= 0 AndAlso py < h Then pixels(py * w + px) = color
+ Next
+ Next
+
+ If (x0 = x1 AndAlso y0 = y1) OrElse guard > 100000 Then Exit Do
+ guard += 1
+ Dim e2 As Integer = 2 * diff
+ If e2 >= dy Then
+ diff += dy
+ x0 += sx
+ End If
+ If e2 <= dx Then
+ diff += dx
+ y0 += sy
+ End If
+ Loop
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/ProbeSampling.vb b/2D_wave_sim_V01/Simulation/ProbeSampling.vb
new file mode 100644
index 0000000..81390e4
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/ProbeSampling.vb
@@ -0,0 +1,352 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+
+''' <summary>The measured values of one point probe, one value per simulation step (value i belongs to step i + 1).</summary>
+Friend NotInheritable Class ProbeSeries
+
+ Private _values As Single() = New Single(1023) {}
+ Private _count As Integer
+
+ ''' <summary>The number of values.</summary>
+ Public ReadOnly Property Count As Integer
+ Get
+ Return _count
+ End Get
+ End Property
+
+ ''' <summary>The values; only the first Count entries are valid. Do not change.</summary>
+ Public ReadOnly Property Values As Single()
+ Get
+ Return _values
+ End Get
+ End Property
+
+ ''' <summary>The last value, or NaN when there is none yet.</summary>
+ Public ReadOnly Property LastValue As Single
+ Get
+ If _count = 0 Then Return Single.NaN
+ Return _values(_count - 1)
+ End Get
+ End Property
+
+ Public Sub Add(items As Single())
+ If items Is Nothing OrElse items.Length = 0 Then Return
+ Dim needed As Integer = _count + items.Length
+ If needed > _values.Length Then
+ Dim bigger As Single() = New Single(Math.Max(needed, _values.Length * 2) - 1) {}
+ Array.Copy(_values, bigger, _count)
+ _values = bigger
+ End If
+ Array.Copy(items, 0, _values, _count, items.Length)
+ _count = needed
+ End Sub
+
+ Public Sub Clear()
+ _count = 0
+ End Sub
+
+End Class
+
+''' <summary>
+''' What the graph of one probe shows: for a point probe the series of values (one per step), for a line probe the
+''' profile, the values along the line at the last update. The profile array is replaced, never changed, so it can be
+''' passed from the simulation thread to the user interface.
+''' </summary>
+Friend NotInheritable Class ProbeTrace
+
+ Private _profile As Single()
+ Private _profileLength As Double
+
+ Public ReadOnly Series As New ProbeSeries()
+
+ ''' <summary>The simulation step of the last update (the last SampleProbes/collect that reached this trace). Used to hold
+ ''' back the graph until "start after step" is reached.</summary>
+ Public Property StepsSampled As Integer
+
+ ''' <summary>The values along the line from A to B (one per pixel), or Nothing when there is none yet.</summary>
+ Public ReadOnly Property Profile As Single()
+ Get
+ Return _profile
+ End Get
+ End Property
+
+ ''' <summary>The length of the line in pixels (the profile is drawn from 0 to this length).</summary>
+ Public ReadOnly Property ProfileLength As Double
+ Get
+ Return _profileLength
+ End Get
+ End Property
+
+ Public Sub SetProfile(values As Single(), length As Double)
+ _profile = values
+ _profileLength = length
+ End Sub
+
+End Class
+
+''' <summary>New measurements for the user interface: per probe the new values of a point probe and the last profile of a line probe.</summary>
+Friend NotInheritable Class ProbeUpdate
+
+ ''' <summary>The new values of the point probes (empty for a line probe).</summary>
+ Public ReadOnly Samples As Single()()
+
+ ''' <summary>The last profile of the line probes; Nothing for a point probe or when the profile did not change.</summary>
+ Public ReadOnly Profiles As Single()()
+
+ ''' <summary>The length in pixels of the line of every probe (0 for a point).</summary>
+ Public ReadOnly Lengths As Double()
+
+ ''' <summary>The simulation step this update was measured at.</summary>
+ Public ReadOnly StepsDone As Integer
+
+ Public Sub New(samples As Single()(), profiles As Single()(), lengths As Double(), stepsDone As Integer)
+ Me.Samples = samples
+ Me.Profiles = profiles
+ Me.Lengths = lengths
+ Me.StepsDone = stepsDone
+ End Sub
+
+End Class
+
+''' <summary>
+''' What a simulation engine has to measure for the probes. For every probe the pixels (as indices into the padded
+''' field arrays, see IWaveEngine) and what is read there: the field or the intensity.
+''' Point probe one pixel; the engine measures its value at every step (a series).
+''' Point, integrated the same, but the values are added up over time (done by ProbeCollector).
+''' Line probe the pixels on the line A-B; the engine gives the values along the line when asked (a profile).
+''' Line, integrated the engine adds the intensity of every pixel of the line up over the steps.
+''' </summary>
+Friend NotInheritable Class ProbeSampler
+
+ Public ReadOnly Count As Integer
+ Public ReadOnly Pixels As Integer()()
+ Public ReadOnly IsProfile As Boolean()
+ Public ReadOnly UseIntensity As Boolean()
+ Public ReadOnly Cumulative As Boolean()
+ Public ReadOnly Integrate As Boolean()
+ Public ReadOnly Lengths As Double()
+ Public ReadOnly NeedsIntensity As Boolean
+ Public ReadOnly HasSeries As Boolean
+ Public ReadOnly HasProfiles As Boolean
+
+ ''' <summary>Per probe: whether "start recording at step #" is on, and that step. Used to purge (never accumulate)
+ ''' the running total of an integrated (cumulative) probe from before that step, so the total shown once recording
+ ''' starts is not inflated by intensity that arrived before it - see ProbeCollector.Collect, WaveSimulator.SampleProbes
+ ''' and GpuWaveSimulator's profile_accumulate kernel.</summary>
+ Public ReadOnly UseStartAfterStep As Boolean()
+ Public ReadOnly StartAfterStep As Integer()
+
+ Private Sub New(pixels As Integer()(), isProfile As Boolean(), useIntensity As Boolean(), cumulative As Boolean(),
+ integrate As Boolean(), lengths As Double(), useStartAfterStep As Boolean(), startAfterStep As Integer())
+ Count = pixels.Length
+ Me.Pixels = pixels
+ Me.IsProfile = isProfile
+ Me.UseIntensity = useIntensity
+ Me.Cumulative = cumulative
+ Me.Integrate = integrate
+ Me.Lengths = lengths
+ Me.UseStartAfterStep = useStartAfterStep
+ Me.StartAfterStep = startAfterStep
+ For i As Integer = 0 To Count - 1
+ If useIntensity(i) Then NeedsIntensity = True
+ If isProfile(i) Then
+ HasProfiles = True
+ Else
+ HasSeries = True
+ End If
+ Next
+ End Sub
+
+ ''' <summary>Builds the sampler for a canvas of w x h pixels. Positions outside the canvas are moved onto it.</summary>
+ Public Shared Function Build(probes As IList(Of ProbeSettings), w As Integer, h As Integer) As ProbeSampler
+ Dim n As Integer = probes.Count
+ Dim pixels As Integer()() = New Integer(n - 1)() {}
+ Dim isProfile(n - 1) As Boolean
+ Dim useIntensity(n - 1) As Boolean
+ Dim cumulative(n - 1) As Boolean
+ Dim integrate(n - 1) As Boolean
+ Dim lengths(n - 1) As Double
+ Dim useStartAfterStep(n - 1) As Boolean
+ Dim startAfterStep(n - 1) As Integer
+ Dim stride As Integer = w + 2
+
+ For i As Integer = 0 To n - 1
+ Dim p As ProbeSettings = probes(i)
+ Dim ax As Integer = Clamp(p.PosAX, w - 1)
+ Dim ay As Integer = Clamp(p.PosAY, h - 1)
+ Dim integrated As Boolean = (p.Measurement = ProbeMeasurement.IntegratedIntensity)
+
+ If p.Kind = ProbeKind.Line Then
+ Dim endX As Integer = Clamp(p.PosBX, w - 1)
+ Dim endY As Integer = Clamp(p.PosBY, h - 1)
+ pixels(i) = LinePixels(ax, ay, endX, endY, stride)
+ isProfile(i) = True
+ integrate(i) = integrated
+ Dim dx As Double = endX - ax
+ Dim dy As Double = endY - ay
+ lengths(i) = Math.Sqrt(dx * dx + dy * dy)
+ Else
+ pixels(i) = New Integer() {(ay + 1) * stride + ax + 1}
+ cumulative(i) = integrated
+ End If
+
+ useIntensity(i) = (p.Measurement <> ProbeMeasurement.Amplitude)
+ useStartAfterStep(i) = p.UseStartAfterStep
+ startAfterStep(i) = p.StartAfterStep
+ Next
+
+ Return New ProbeSampler(pixels, isProfile, useIntensity, cumulative, integrate, lengths, useStartAfterStep, startAfterStep)
+ End Function
+
+ Private Shared Function Clamp(value As Integer, maxValue As Integer) As Integer
+ If value < 0 Then Return 0
+ If value > maxValue Then Return maxValue
+ Return value
+ End Function
+
+ ''' <summary>The pixels on the line from (x0, y0) to (x1, y1), as indices into the padded arrays.</summary>
+ Private Shared Function LinePixels(x0 As Integer, y0 As Integer, x1 As Integer, y1 As Integer, stride As Integer) As Integer()
+ Dim result As New List(Of Integer)()
+ Dim dx As Integer = Math.Abs(x1 - x0)
+ Dim dy As Integer = -Math.Abs(y1 - y0)
+ Dim sx As Integer = If(x0 < x1, 1, -1)
+ Dim sy As Integer = If(y0 < y1, 1, -1)
+ Dim diff As Integer = dx + dy
+
+ Do
+ result.Add((y0 + 1) * stride + x0 + 1)
+ If x0 = x1 AndAlso y0 = y1 Then Exit Do
+ Dim e2 As Integer = 2 * diff
+ If e2 >= dy Then
+ diff += dy
+ x0 += sx
+ End If
+ If e2 <= dx Then
+ diff += dx
+ y0 += sy
+ End If
+ Loop
+ Return result.ToArray()
+ End Function
+
+ ''' <summary>The value of a point probe in the given data (the field or the intensity array of an engine).</summary>
+ Public Function Compute(probeIndex As Integer, data As Single()) As Single
+ If data Is Nothing Then Return 0.0F
+ Return data(Pixels(probeIndex)(0))
+ End Function
+
+End Class
+
+''' <summary>
+''' Collects the measurements of an engine: the series of the point probes and the profiles of the line probes
+''' (for the graphs in the exported videos), and the new values for the user interface.
+''' </summary>
+Friend NotInheritable Class ProbeCollector
+
+ Public ReadOnly Traces As ProbeTrace()
+
+ Private ReadOnly _sampler As ProbeSampler
+ Private ReadOnly _totals As Double()
+ Private ReadOnly _pending As New List(Of List(Of Single))()
+ Private ReadOnly _fresh As Boolean()
+ Private _lastStepsDone As Integer
+
+ Public Sub New(sampler As ProbeSampler)
+ _sampler = sampler
+ Traces = New ProbeTrace(sampler.Count - 1) {}
+ _totals = New Double(sampler.Count - 1) {}
+ _fresh = New Boolean(sampler.Count - 1) {}
+ For i As Integer = 0 To sampler.Count - 1
+ Traces(i) = New ProbeTrace()
+ _pending.Add(New List(Of Single)())
+ Next
+ End Sub
+
+ ''' <summary>Takes the values that the engine measured for the point probes since the last call.</summary>
+ Public Sub Collect(engine As IWaveEngine, stepsDone As Integer)
+ If Not _sampler.HasSeries Then Return
+
+ Dim raw As Single()() = engine.TakeProbeSamples()
+ ' the number of steps already processed before this batch, so the absolute step of values(k) can be worked
+ ' out below (one value per step, in order) - needed to purge a cumulative total from before "start after step"
+ Dim batchStartStep As Integer = _lastStepsDone
+ For p As Integer = 0 To _sampler.Count - 1
+ If _sampler.IsProfile(p) OrElse p >= raw.Length Then Continue For
+ Dim values As Single() = raw(p)
+ If values Is Nothing OrElse values.Length = 0 Then Continue For
+
+ If _sampler.Cumulative(p) Then
+ Dim useStart As Boolean = _sampler.UseStartAfterStep(p)
+ Dim startStep As Integer = _sampler.StartAfterStep(p)
+ For k As Integer = 0 To values.Length - 1
+ If useStart AndAlso (batchStartStep + k + 1) < startStep Then
+ ' before recording starts: keep the running total at zero, purging any intensity that
+ ' arrived earlier, so the total does not jump the moment recording starts
+ _totals(p) = 0.0
+ values(k) = 0.0F
+ Else
+ _totals(p) += values(k)
+ values(k) = CSng(_totals(p))
+ End If
+ Next
+ End If
+
+ Traces(p).Series.Add(values)
+ Traces(p).StepsSampled = stepsDone
+ _pending(p).AddRange(values)
+ Next
+ _lastStepsDone = stepsDone
+ End Sub
+
+ ''' <summary>Takes the profiles of the line probes in the current state of the engine.</summary>
+ Public Sub CollectProfiles(engine As IWaveEngine, stepsDone As Integer)
+ If Not _sampler.HasProfiles Then Return
+
+ Dim raw As Single()() = engine.ReadProbeProfiles()
+ For p As Integer = 0 To _sampler.Count - 1
+ If Not _sampler.IsProfile(p) OrElse p >= raw.Length OrElse raw(p) Is Nothing Then Continue For
+ Traces(p).SetProfile(raw(p), _sampler.Lengths(p))
+ Traces(p).StepsSampled = stepsDone
+ _fresh(p) = True
+ Next
+ _lastStepsDone = stepsDone
+ End Sub
+
+ ''' <summary>What is new since the last call (for the user interface).</summary>
+ Public Function TakeForUi() As ProbeUpdate
+ Dim n As Integer = _sampler.Count
+ Dim samples As Single()() = New Single(n - 1)() {}
+ Dim profiles As Single()() = New Single(n - 1)() {}
+ For p As Integer = 0 To n - 1
+ samples(p) = _pending(p).ToArray()
+ _pending(p).Clear()
+ If _fresh(p) Then
+ profiles(p) = Traces(p).Profile
+ _fresh(p) = False
+ End If
+ Next
+ Return New ProbeUpdate(samples, profiles, _sampler.Lengths, _lastStepsDone)
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/ProbeSettings.vb b/2D_wave_sim_V01/Simulation/ProbeSettings.vb
new file mode 100644
index 0000000..b8eafb2
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/ProbeSettings.vb
@@ -0,0 +1,327 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections
+Imports System.Collections.Generic
+Imports System.Globalization
+
+''' <summary>The simulation picture the probe and its graph box are drawn on.</summary>
+Public Enum ProbePlaceOn
+ Field = 0
+ Intensity = 1
+End Enum
+
+''' <summary>What a probe measures.</summary>
+Public Enum ProbeMeasurement
+ ''' <summary>The field value (only on the field picture).</summary>
+ Amplitude = 0
+ ''' <summary>The averaged intensity (only on the intensity picture).</summary>
+ Intensity = 1
+ ''' <summary>The intensity summed over time (the total that has passed the point, or each point of the line, so far).</summary>
+ IntegratedIntensity = 2
+End Enum
+
+Public Enum ProbeKind
+ ''' <summary>One pixel, position A. The graph shows the value against the simulation step.</summary>
+ Point = 0
+ ''' <summary>The pixels on the line from A to B. The graph shows the value against the position on the line, at the current step.</summary>
+ Line = 1
+End Enum
+
+Public Enum ProbeBoxSize
+ Tiny = 0
+ Small = 1
+ Medium = 2
+ Large = 3
+ ExtraLarge = 4
+End Enum
+
+Public Enum ProbeScaleMode
+ ''' <summary>The graph shows the last steps and scrolls along.</summary>
+ Running = 0
+ ''' <summary>The graph shows the whole run.</summary>
+ Full = 1
+End Enum
+
+''' <summary>
+''' One probe: it measures the field or the intensity during the simulation and shows the result in a little graph box
+''' in the field or intensity picture. A point probe (A) shows its value against the simulation step; a line probe
+''' (A-B) shows the values along the line, against the position on the line, at the current step.
+''' The probes are stored in the section "probes" of configuration.json as a list "items".
+''' </summary>
+Public NotInheritable Class ProbeSettings
+
+ Public Const SectionName As String = "probes"
+ Public Const DefaultRunningWindow As Integer = 500
+ Public Const MaxRunningWindow As Integer = 1000000
+
+ Public Property PlaceOn As ProbePlaceOn = ProbePlaceOn.Field
+ Public Property Measurement As ProbeMeasurement = ProbeMeasurement.Amplitude
+ Public Property Kind As ProbeKind = ProbeKind.Point
+
+ ''' <summary>Position A and position B in simulation pixels (0, 0 = top left).</summary>
+ Public Property PosAX As Integer = 100
+ Public Property PosAY As Integer = 100
+ Public Property PosBX As Integer = 300
+ Public Property PosBY As Integer = 100
+
+ Public Property BoxSize As ProbeBoxSize = ProbeBoxSize.Medium
+
+ ''' <summary>The top left corner of the graph box in simulation pixels (picked in the picture).</summary>
+ Public Property BoxX As Integer = 450
+ Public Property BoxY As Integer = 20
+
+ ''' <summary>When False, the probe is switched off: not sampled or shown in a simulation, but its settings are
+ ''' kept ("On" checkbox). Off by default (this property's own default, used for both probes of a new project -
+ ''' see NewProbeList, Form1.Probes.vb). A probe loaded from a project saved before "active" was written for it
+ ''' still comes back On (FromDictionary's own separate, hardcoded fallback below), so that project keeps its
+ ''' exact previous behavior instead of silently picking up the new-project default.</summary>
+ Public Property Active As Boolean = False
+
+ Public Property ScaleMode As ProbeScaleMode = ProbeScaleMode.Running
+ Public Property AutoScaleX As Boolean = True
+ Public Property AutoScaleY As Boolean = True
+
+ ''' <summary>The value axis when it is not scaled automatically.</summary>
+ Public Property YMin As Double = -1.0
+ Public Property YMax As Double = 1.0
+
+ ''' <summary>The number of steps that a running graph shows.</summary>
+ Public Property RunningWindow As Integer = DefaultRunningWindow
+
+ ''' <summary>When True, the graph shows no data from before step StartAfterStep (0 = from the start).</summary>
+ Public Property UseStartAfterStep As Boolean = False
+ Public Property StartAfterStep As Integer = 0
+
+ Public Function Clone() As ProbeSettings
+ Return DirectCast(MemberwiseClone(), ProbeSettings)
+ End Function
+
+ ''' <summary>Takes over the settings that only change how the graph looks (not what is measured), so that they can be changed during a run.</summary>
+ Public Sub CopyDisplayFrom(other As ProbeSettings)
+ Active = other.Active
+ BoxSize = other.BoxSize
+ BoxX = other.BoxX
+ BoxY = other.BoxY
+ ScaleMode = other.ScaleMode
+ AutoScaleX = other.AutoScaleX
+ AutoScaleY = other.AutoScaleY
+ YMin = other.YMin
+ YMax = other.YMax
+ RunningWindow = other.RunningWindow
+ UseStartAfterStep = other.UseStartAfterStep
+ StartAfterStep = other.StartAfterStep
+ End Sub
+
+ ''' <summary>Makes the measurement fit the picture: amplitude on the field, intensity or integrated intensity on the intensity.</summary>
+ Public Sub Normalize()
+ If PlaceOn = ProbePlaceOn.Field Then
+ Measurement = ProbeMeasurement.Amplitude
+ ElseIf Measurement = ProbeMeasurement.Amplitude Then
+ Measurement = ProbeMeasurement.Intensity
+ End If
+ If Not (YMax > YMin) Then
+ YMin = -1.0
+ YMax = 1.0
+ End If
+ If RunningWindow < 10 Then RunningWindow = 10
+ If RunningWindow > MaxRunningWindow Then RunningWindow = MaxRunningWindow
+ If StartAfterStep < 0 Then StartAfterStep = 0
+ End Sub
+
+ Public Function MeasurementText() As String
+ Select Case Measurement
+ Case ProbeMeasurement.Amplitude
+ Return "Amplitude"
+ Case ProbeMeasurement.IntegratedIntensity
+ Return "Integrated intensity"
+ Case Else
+ Return "Intensity"
+ End Select
+ End Function
+
+ ''' <summary>The title of the graph, for example "Probe 1 - Amplitude". The number is also drawn at the probe in the picture.</summary>
+ Public Function Title(index As Integer) As String
+ Return "Probe " & (index + 1).ToString(CultureInfo.InvariantCulture) & " - " & MeasurementText()
+ End Function
+
+ ' ---------------------------------------------------------------- configuration file
+
+ ''' <summary>The probes of a project configuration. There is always at least one (a default probe when there is none).</summary>
+ Public Shared Function ListFromConfig(config As ProjectConfig) As List(Of ProbeSettings)
+ Dim result As New List(Of ProbeSettings)()
+
+ If config.ContainsKey(SectionName) Then
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ Dim items As Object = Nothing
+ If section.TryGetValue("items", items) Then
+ Dim list As IEnumerable = TryCast(items, IEnumerable)
+ If list IsNot Nothing AndAlso Not TypeOf items Is String Then
+ For Each item As Object In list
+ Dim d As Dictionary(Of String, Object) = TryCast(item, Dictionary(Of String, Object))
+ If d IsNot Nothing Then result.Add(FromDictionary(d))
+ Next
+ End If
+ End If
+ End If
+
+ If result.Count = 0 Then result.Add(New ProbeSettings())
+ Return result
+ End Function
+
+ Public Shared Sub ListToConfig(probes As List(Of ProbeSettings), config As ProjectConfig)
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ Dim items As New List(Of Object)()
+ For Each p As ProbeSettings In probes
+ items.Add(p.ToDictionary())
+ Next
+ section("count") = items.Count
+ section("items") = items
+ End Sub
+
+ Private Function ToDictionary() As Dictionary(Of String, Object)
+ Dim d As New Dictionary(Of String, Object)()
+ d("active") = Active
+ d("place_on") = If(PlaceOn = ProbePlaceOn.Field, "field", "intensity")
+ Select Case Measurement
+ Case ProbeMeasurement.Amplitude
+ d("measurement") = "amplitude"
+ Case ProbeMeasurement.IntegratedIntensity
+ d("measurement") = "integrated_intensity"
+ Case Else
+ d("measurement") = "intensity"
+ End Select
+ d("probe_type") = If(Kind = ProbeKind.Line, "line", "point")
+ d("ax") = PosAX
+ d("ay") = PosAY
+ d("bx") = PosBX
+ d("by") = PosBY
+ Select Case BoxSize
+ Case ProbeBoxSize.Tiny
+ d("box_size") = "tiny"
+ Case ProbeBoxSize.Small
+ d("box_size") = "small"
+ Case ProbeBoxSize.Large
+ d("box_size") = "large"
+ Case ProbeBoxSize.ExtraLarge
+ d("box_size") = "extra_large"
+ Case Else
+ d("box_size") = "medium"
+ End Select
+ d("box_x") = BoxX
+ d("box_y") = BoxY
+ d("scale_mode") = If(ScaleMode = ProbeScaleMode.Full, "full", "running")
+ d("auto_scale_x") = AutoScaleX
+ d("auto_scale_y") = AutoScaleY
+ d("y_min") = YMin
+ d("y_max") = YMax
+ d("running_window") = RunningWindow
+ d("use_start_after_step") = UseStartAfterStep
+ d("start_after_step") = StartAfterStep
+ Return d
+ End Function
+
+ Private Shared Function FromDictionary(d As Dictionary(Of String, Object)) As ProbeSettings
+ Dim p As New ProbeSettings()
+
+ p.Active = ReadBool(d, "active", True)
+ p.PlaceOn = If(ReadText(d, "place_on", "field") = "intensity", ProbePlaceOn.Intensity, ProbePlaceOn.Field)
+ Select Case ReadText(d, "measurement", "amplitude")
+ Case "intensity"
+ p.Measurement = ProbeMeasurement.Intensity
+ Case "integrated_intensity"
+ p.Measurement = ProbeMeasurement.IntegratedIntensity
+ Case Else
+ p.Measurement = ProbeMeasurement.Amplitude
+ End Select
+ p.Kind = If(ReadText(d, "probe_type", "point") = "line", ProbeKind.Line, ProbeKind.Point)
+ p.PosAX = ReadInt(d, "ax", 100, 0, 100000)
+ p.PosAY = ReadInt(d, "ay", 100, 0, 100000)
+ p.PosBX = ReadInt(d, "bx", 300, 0, 100000)
+ p.PosBY = ReadInt(d, "by", 100, 0, 100000)
+ Select Case ReadText(d, "box_size", "medium")
+ Case "tiny"
+ p.BoxSize = ProbeBoxSize.Tiny
+ Case "small"
+ p.BoxSize = ProbeBoxSize.Small
+ Case "large"
+ p.BoxSize = ProbeBoxSize.Large
+ Case "extra_large"
+ p.BoxSize = ProbeBoxSize.ExtraLarge
+ Case Else
+ p.BoxSize = ProbeBoxSize.Medium
+ End Select
+ p.BoxX = ReadInt(d, "box_x", 450, 0, 100000)
+ p.BoxY = ReadInt(d, "box_y", 20, 0, 100000)
+ p.ScaleMode = If(ReadText(d, "scale_mode", "running") = "full", ProbeScaleMode.Full, ProbeScaleMode.Running)
+ p.AutoScaleX = ReadBool(d, "auto_scale_x", True)
+ p.AutoScaleY = ReadBool(d, "auto_scale_y", True)
+ p.YMin = ReadDouble(d, "y_min", -1.0, -1.0E+30, 1.0E+30)
+ p.YMax = ReadDouble(d, "y_max", 1.0, -1.0E+30, 1.0E+30)
+ p.RunningWindow = ReadInt(d, "running_window", DefaultRunningWindow, 10, MaxRunningWindow)
+ p.UseStartAfterStep = ReadBool(d, "use_start_after_step", False)
+ p.StartAfterStep = ReadInt(d, "start_after_step", 0, 0, 1000000000)
+ p.Normalize()
+ Return p
+ End Function
+
+ Private Shared Function ReadText(d As Dictionary(Of String, Object), key As String, fallback As String) As String
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadBool(d As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadInt(d As Dictionary(Of String, Object), key As String, fallback As Integer,
+ minValue As Integer, maxValue As Integer) As Integer
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)
+ If n >= minValue AndAlso n <= maxValue Then Return n
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+ Private Shared Function ReadDouble(d As Dictionary(Of String, Object), key As String, fallback As Double,
+ minValue As Double, maxValue As Double) As Double
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim x As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)
+ If x >= minValue AndAlso x <= maxValue Then Return x
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/SceneData.vb b/2D_wave_sim_V01/Simulation/SceneData.vb
new file mode 100644
index 0000000..836602d
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/SceneData.vb
@@ -0,0 +1,178 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+'
+' Portions of this file are based on WaveSimulator2D by 0x23
+' <https://github.com/0x23/WaveSimulator2D>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Drawing
+Imports System.Drawing.Imaging
+Imports System.Runtime.InteropServices
+
+''' <summary>
+''' The per-pixel description of a scene that the wave simulation needs, all row by row (index = y * Width + x):
+''' C2 the squared wave speed (1 / refractive index) ^ 2 (the time step is 1)
+''' D the damping factor of the velocity, 1 = no damping, 0 = the wave is stopped
+''' sources: pixel positions and the value of the green channel, which sets the frequency
+'''
+''' The rules are those of the Python classes StaticImageScene, StaticRefractiveIndex and StaticDampening:
+''' red channel refractive index times 100 (values are limited to 0.9 to 10)
+''' green channel every pixel above 0 is a sinusoidal source; the value sets its frequency
+''' blue channel damping: the damping factor is 1 - blue / 255
+''' damping edge a border of the given thickness, damping factor sqrt(i / thickness) at i pixels from the edge
+''' </summary>
+Friend NotInheritable Class SceneData
+
+ Public ReadOnly Width As Integer
+ Public ReadOnly Height As Integer
+ Public ReadOnly C2 As Single()
+ Public ReadOnly D As Single()
+ Public ReadOnly SourceX As Integer()
+ Public ReadOnly SourceY As Integer()
+ Public ReadOnly SourceLevel As Byte()
+
+ Private Sub New(w As Integer, h As Integer, c2 As Single(), d As Single(),
+ srcX As Integer(), srcY As Integer(), srcLevel As Byte())
+ Width = w
+ Height = h
+ Me.C2 = c2
+ Me.D = d
+ SourceX = srcX
+ SourceY = srcY
+ SourceLevel = srcLevel
+ End Sub
+
+ Public ReadOnly Property SourceCount As Integer
+ Get
+ Return SourceX.Length
+ End Get
+ End Property
+
+ ''' <summary>A scene from an image (red = refractive index, green = sources, blue = damping).</summary>
+ Public Shared Function FromImage(image As Bitmap, useSources As Boolean, dampingEdge As Integer) As SceneData
+ Dim w As Integer = image.Width
+ Dim h As Integer = image.Height
+ Dim c2(w * h - 1) As Single
+ Dim d(w * h - 1) As Single
+ Dim sx As New List(Of Integer)()
+ Dim sy As New List(Of Integer)()
+ Dim sl As New List(Of Byte)()
+
+ Dim data As BitmapData = image.LockBits(New Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)
+ Try
+ Dim row(w * 4 - 1) As Byte
+ For y As Integer = 0 To h - 1
+ Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, w * 4)
+ For x As Integer = 0 To w - 1
+ Dim o As Integer = x * 4
+ ' Format32bppArgb is stored as B, G, R, A
+ Dim blue As Integer = row(o)
+ Dim green As Integer = row(o + 1)
+ Dim red As Integer = row(o + 2)
+
+ Dim n As Double = red / 100.0
+ If n < 0.9 Then n = 0.9
+ If n > 10.0 Then n = 10.0
+ Dim c As Double = 1.0 / n
+
+ Dim idx As Integer = y * w + x
+ c2(idx) = CSng(c * c)
+ d(idx) = CSng(1.0 - blue / 255.0)
+
+ If useSources AndAlso green > 0 Then
+ sx.Add(x)
+ sy.Add(y)
+ sl.Add(CByte(green))
+ End If
+ Next
+ Next
+ Finally
+ image.UnlockBits(data)
+ End Try
+
+ ApplyBorder(d, w, h, dampingEdge)
+ Return New SceneData(w, h, c2, d, sx.ToArray(), sy.ToArray(), sl.ToArray())
+ End Function
+
+ ''' <summary>
+ ''' An empty, user defined scene (no sources), optionally with a damping edge. The background gets the given
+ ''' refractive index (1.0 by default, the same rule as a scene image's red channel: index = red / 100).
+ ''' </summary>
+ Public Shared Function Empty(w As Integer, h As Integer, dampingEdge As Integer, Optional refractiveIndex As Double = 1.0) As SceneData
+ Dim n As Double = refractiveIndex
+ If n < 0.9 Then n = 0.9
+ If n > 10.0 Then n = 10.0
+ Dim c As Single = CSng(1.0 / n)
+
+ Dim c2(w * h - 1) As Single
+ Dim d(w * h - 1) As Single
+ For i As Integer = 0 To c2.Length - 1
+ c2(i) = c * c
+ d(i) = 1.0F
+ Next
+ ApplyBorder(d, w, h, dampingEdge)
+ Return New SceneData(w, h, c2, d, New Integer() {}, New Integer() {}, New Byte() {})
+ End Function
+
+ ''' <summary>The number of source pixels (green channel above 0) in a scene image.</summary>
+ Public Shared Function CountSources(image As Bitmap) As Integer
+ Dim w As Integer = image.Width
+ Dim h As Integer = image.Height
+ Dim count As Integer = 0
+
+ Dim data As BitmapData = image.LockBits(New Rectangle(0, 0, w, h), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb)
+ Try
+ Dim row(w * 4 - 1) As Byte
+ For y As Integer = 0 To h - 1
+ Marshal.Copy(IntPtr.Add(data.Scan0, y * data.Stride), row, 0, w * 4)
+ For x As Integer = 0 To w - 1
+ If row(x * 4 + 1) > 0 Then count += 1
+ Next
+ Next
+ Finally
+ image.UnlockBits(data)
+ End Try
+ Return count
+ End Function
+
+ ''' <summary>
+ ''' Damping edge, as in StaticDampening: the ring i pixels from the edge gets the factor sqrt(i / thickness),
+ ''' so the outermost ring stops the wave completely and the factor rises to 1 inside.
+ ''' </summary>
+ Friend Shared Sub ApplyBorder(d As Single(), w As Integer, h As Integer, thickness As Integer)
+ Dim t As Integer = Math.Min(thickness, Math.Min(w, h) \ 2)
+ If t <= 0 Then Return
+
+ For i As Integer = 0 To t - 1
+ Dim v As Single = CSng(Math.Sqrt(i / CDbl(t)))
+ For x As Integer = i To w - 1 - i
+ d(i * w + x) = v
+ d((h - 1 - i) * w + x) = v
+ Next
+ For y As Integer = i To h - 1 - i
+ d(y * w + i) = v
+ d(y * w + (w - 1 - i)) = v
+ Next
+ Next
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/SimulationRunner.vb b/2D_wave_sim_V01/Simulation/SimulationRunner.vb
new file mode 100644
index 0000000..c898c23
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/SimulationRunner.vb
@@ -0,0 +1,502 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Diagnostics
+Imports System.Drawing
+Imports System.Drawing.Imaging
+Imports System.IO
+Imports System.Threading
+
+''' <summary>Everything a simulation run needs. Filled in by the form; the runner owns the job (and the image in it) afterwards.</summary>
+Friend NotInheritable Class SimulationJob
+
+ ''' <summary>The scene image (red = refractive index, green = sources, blue = damping). Nothing for an empty, user defined scene.</summary>
+ Public Image As Bitmap
+
+ ''' <summary>The canvas size of an empty scene (ignored when there is an image).</summary>
+ Public Width As Integer
+ Public Height As Integer
+
+ ''' <summary>The background refractive index of an empty scene (ignored when there is an image).</summary>
+ Public BackgroundRefractiveIndex As Double = 1.0
+
+ Public UseSources As Boolean
+
+ ''' <summary>Amplitude factor of the sources in the scene image.</summary>
+ Public SourceAmplitude As Double = 1.0
+
+ Public DampingEdge As Integer
+
+ ''' <summary>A private copy of the simulation settings.</summary>
+ Public Settings As SimulationSettings
+
+ ''' <summary>Color tables (255 packed ARGB values), or Nothing for gray levels.</summary>
+ Public FieldLut As Integer()
+ Public IntensityLut As Integer()
+
+ ''' <summary>Video files to write, normally .mp4; empty = no video of that kind. When H.264 is not available the extension becomes .avi.</summary>
+ Public FieldVideoPath As String = ""
+ Public IntensityVideoPath As String = ""
+
+ ''' <summary>The probes to measure (copies), or Nothing for none.</summary>
+ Public Probes As List(Of ProbeSettings)
+
+ ''' <summary>The generated elements of the object sources to run (Sources tab), or Nothing/empty for none.</summary>
+ Public ObjectSources As List(Of SourceElement)
+
+ ''' <summary>The size (pixels) of the preview area; previews are made to fit it.</summary>
+ Public PreviewWidth As Integer
+ Public PreviewHeight As Integer
+
+ ''' <summary>The Viewer tab's "glowing edges" overlay (Form1's _glowEdgesImage), exactly the size of the
+ ''' simulation canvas - Nothing when there is none (no scene image), or when both gains below are 0 (the
+ ''' overlay is switched off for both Field and Intensity). Frozen at the start of the run, the same as
+ ''' Settings - the runner owns and disposes it. See FrameRenderer.AddOverlay.</summary>
+ Public GlowOverlay As Bitmap
+
+ ''' <summary>How strongly to blend GlowOverlay into the Field/Intensity video, frozen at the start of the run
+ ''' from Form1's numBrightnessFieldOverlay/numBrightnessIntensityOverlay and chkDiplayOverlayInField/
+ ''' chkDiplayOverlayInIntensity (0 when unchecked - see Form1.FieldOverlayGain/IntensityOverlayGain). Only
+ ''' affects the exported videos - the live preview keeps blending its own copy of the overlay in on the UI
+ ''' thread (Form1.ShowPreview/ComposeGlowOverlay), which can track the checkbox/brightness box live; a
+ ''' running export cannot, so it uses whatever these were at the moment Start Simulation was pressed.</summary>
+ Public FieldOverlayGain As Double
+ Public IntensityOverlayGain As Double
+
+End Class
+
+Friend Enum SimulationStatus
+ Completed
+ Cancelled
+ Failed
+End Enum
+
+Friend NotInheritable Class SimulationResult
+ Public Status As SimulationStatus
+ Public Message As String = ""
+ Public StepsDone As Integer
+ Public Elapsed As TimeSpan
+ Public Files As New List(Of String)()
+
+ ''' <summary>The video files that were written (empty when there is none of that kind).</summary>
+ Public FieldFile As String = ""
+ Public IntensityFile As String = ""
+
+ ''' <summary>Where the simulation ran ("CPU (8 threads)", "GPU: NVIDIA GeForce MX130 (OpenCL)"), and why the GPU was not used when it was asked for.</summary>
+ Public Engine As String = ""
+ Public EngineNote As String = ""
+
+ ''' <summary>A full simulation-resolution snapshot of the field/intensity, rendered right before the engine
+ ''' was closed down - so a still export (the Preview tab's "Export current Field/Intensity frame" buttons) has
+ ''' something to save even once the run has fully stopped and the live engine no longer exists. Nothing when
+ ''' the run failed before an engine was created, or when intensity was not tracked for this run (LastIntensityFrame
+ ''' only). The receiver owns the bitmap(s).</summary>
+ Public LastFieldFrame As Bitmap
+ Public LastIntensityFrame As Bitmap
+End Class
+
+''' <summary>
+''' Runs a simulation on a background thread, as the loop in main_curr.py: for every step update the scene
+''' (sources), update the field and the intensity; every N steps render a frame for the previews and the videos.
+''' The events are raised on the background thread; the form must pass them on to the user interface thread.
+''' </summary>
+Friend NotInheritable Class SimulationRunner
+
+ ''' <summary>Steps done so far and the total, raised about ten times a second.</summary>
+ Public Event ProgressChanged(stepsDone As Integer, totalSteps As Integer)
+
+ ''' <summary>The engine that runs the simulation (CPU or GPU) was chosen. The note is empty, or tells why the GPU is not used.</summary>
+ Public Event EngineReady(description As String, note As String)
+
+ ''' <summary>New probe measurements: the new values of the point probes and the last profile of the line probes. The receiver owns the arrays.</summary>
+ Public Event ProbesUpdated(update As ProbeUpdate)
+
+ ''' <summary>A preview picture is ready. The receiver owns the bitmap and must call PreviewShown when it is done with it.</summary>
+ Public Event PreviewReady(isField As Boolean, frame As Bitmap)
+
+ ''' <summary>The run is over (completed, stopped or failed). This is the last event.</summary>
+ Public Event Finished(result As SimulationResult)
+
+ Private Const JpegQuality As Long = 90L
+
+ ''' <summary>Minimum time (ms) between previews - see its use in Run() for why this exists: it keeps a GPU
+ ''' engine's readback rate steady and independent of how fast the UI thread happens to be at displaying the
+ ''' previous one (e.g. with/without the "display overlay" checkboxes), rather than implicitly riding on
+ ''' _previewPending alone. ~30 fps is already faster than a picture box is usefully watchable at.</summary>
+ Private Const PreviewIntervalMs As Long = 33L
+
+ Private ReadOnly _job As SimulationJob
+ Private _thread As Thread
+ Private _cancel As Integer
+ Private _previewPending As Integer
+
+ ' open = running, closed = paused
+ Private ReadOnly _gate As New ManualResetEventSlim(True)
+
+ ' the live engine, set once at the start of Run() and cleared just before it is disposed at the end; read from
+ ' the UI thread (RenderCurrentFrame) only while paused, when the background thread is parked at _gate.Wait()
+ ' and is not touching it
+ Private _sim As IWaveEngine
+
+ ' the probe collector for this run (Nothing when there are no probes), set alongside _sim so RenderCurrentFrame
+ ' can also burn the probe markers/graphs onto a still export - the video export loop in Run() already does
+ ' this (ProbeOverlay.Burn) but RenderCurrentFrame did not, which left probe data out of exported still frames
+ Private _collector As ProbeCollector
+
+ Public Sub New(job As SimulationJob)
+ _job = job
+ End Sub
+
+ Public Sub Start()
+ _thread = New Thread(AddressOf Run)
+ _thread.IsBackground = True
+ _thread.Name = "Wave simulation"
+ _thread.Start()
+ End Sub
+
+ ''' <summary>Asks the run to stop after the current step. The videos are closed properly.</summary>
+ Public Sub Cancel()
+ Interlocked.Exchange(_cancel, 1)
+ _gate.Set() ' a paused run must wake up to stop
+ End Sub
+
+ ''' <summary>Holds the run before the next step. The videos stay open.</summary>
+ Public Sub PauseRun()
+ _gate.Reset()
+ End Sub
+
+ ''' <summary>Continues a paused run.</summary>
+ Public Sub ResumeRun()
+ _gate.Set()
+ End Sub
+
+ ''' <summary>Tells the runner that a preview picture was shown (or thrown away). When all pictures that were
+ ''' announced are shown, the next preview is made.</summary>
+ Public Sub PreviewShown()
+ Interlocked.Decrement(_previewPending)
+ End Sub
+
+ ''' <summary>Waits until the thread has ended. Returns False when the time ran out.</summary>
+ Public Function WaitForExit(milliseconds As Integer) As Boolean
+ Dim t As Thread = _thread
+ If t Is Nothing Then Return True
+ Return t.Join(milliseconds)
+ End Function
+
+ ''' <summary>
+ ''' Renders the field or the intensity at full simulation resolution, on demand (for a still-image export) -
+ ''' only while the run is paused, since only then is the background thread guaranteed not to be touching the
+ ''' engine's arrays. Returns Nothing when the run is not paused, when the engine is gone (not yet created, or
+ ''' the run has finished), or when the intensity is asked for but was not tracked for this run.
+ ''' </summary>
+ Public Function RenderCurrentFrame(isField As Boolean, lut As Integer(), brightness As Single) As Bitmap
+ If _gate.IsSet Then Return Nothing ' running (not paused) - unsafe to read
+ Dim sim As IWaveEngine = _sim
+ If sim Is Nothing Then Return Nothing
+ If Not isField AndAlso sim.IntensityData Is Nothing Then Return Nothing
+
+ Dim w As Integer = sim.Width
+ Dim h As Integer = sim.Height
+ sim.PrepareFrame(isField, Not isField)
+ Dim pixels As Integer() = New Integer(w * h - 1) {}
+ If isField Then
+ FrameRenderer.RenderField(sim, lut, brightness, pixels, w, h)
+ If _collector IsNot Nothing Then ProbeOverlay.Burn(pixels, w, h, _job.Probes, _collector.Traces, ProbePlaceOn.Field, _job.Settings.Steps)
+ Else
+ FrameRenderer.RenderIntensity(sim, lut, brightness, pixels, w, h)
+ If _collector IsNot Nothing Then ProbeOverlay.Burn(pixels, w, h, _job.Probes, _collector.Traces, ProbePlaceOn.Intensity, _job.Settings.Steps)
+ End If
+ Return FrameRenderer.ToBitmap(pixels, w, h)
+ End Function
+
+ Private Sub Run()
+ Dim result As New SimulationResult()
+ Dim clock As Stopwatch = Stopwatch.StartNew()
+ Dim fieldWriter As IFrameSink = Nothing
+ Dim intensityWriter As IFrameSink = Nothing
+ Dim sim As IWaveEngine = Nothing
+ ' declared here (not inside Try, unlike most locals below) because Finally also needs them, for the
+ ' last-frame probe overlay - a Dim inside Try is a compile error in Finally (BC30451): unlike most VB
+ ' locals, Try/Catch/Finally each have their own block scope
+ Dim collector As ProbeCollector = Nothing
+ Dim total As Integer = 0
+
+ Try
+ Dim settings As SimulationSettings = _job.Settings
+ Dim exportField As Boolean = _job.FieldVideoPath.Length > 0
+ Dim exportIntensity As Boolean = _job.IntensityVideoPath.Length > 0
+ Dim needIntensity As Boolean = exportIntensity OrElse settings.PreviewIntensity
+
+ ' the scene and the simulator
+ Dim scene As SceneData
+ If _job.Image IsNot Nothing Then
+ scene = SceneData.FromImage(_job.Image, _job.UseSources, _job.DampingEdge)
+ _job.Image.Dispose()
+ _job.Image = Nothing
+ Else
+ scene = SceneData.Empty(_job.Width, _job.Height, _job.DampingEdge, _job.BackgroundRefractiveIndex)
+ End If
+ Dim w As Integer = scene.Width
+ Dim h As Integer = scene.Height
+
+ ' the probes
+ Dim sampler As ProbeSampler = Nothing
+ If _job.Probes IsNot Nothing AndAlso _job.Probes.Count > 0 Then
+ sampler = ProbeSampler.Build(_job.Probes, w, h)
+ collector = New ProbeCollector(sampler)
+ If sampler.NeedsIntensity Then needIntensity = True
+ End If
+ Dim engineNote As String = ""
+ sim = WaveEngineFactory.Create(scene, settings, _job.SourceAmplitude, needIntensity, engineNote, _job.ObjectSources)
+ _sim = sim
+ _collector = collector
+ scene = Nothing
+ result.Engine = sim.Description
+ result.EngineNote = engineNote
+ RaiseEvent EngineReady(sim.Description, engineNote)
+ If sampler IsNot Nothing Then sim.SetProbes(sampler)
+
+ ' videos
+ If exportField Then
+ fieldWriter = OpenSink(_job.FieldVideoPath, w, h, settings.VideoFps, settings.VideoQuality, result)
+ result.Files.Add(fieldWriter.FilePath)
+ result.FieldFile = fieldWriter.FilePath
+ End If
+ If exportIntensity Then
+ intensityWriter = OpenSink(_job.IntensityVideoPath, w, h, settings.VideoFps, settings.VideoQuality, result)
+ result.Files.Add(intensityWriter.FilePath)
+ result.IntensityFile = intensityWriter.FilePath
+ End If
+
+ Dim fullPixels As Integer() = Nothing
+ If exportField OrElse exportIntensity Then fullPixels = New Integer(w * h - 1) {}
+
+ ' the "glowing edges" overlay for the videos (FrameRenderer.AddOverlay) - converted to a plain RGB
+ ' byte array and gain-prescaled (FrameRenderer.ScaleOverlayRgb) once, up front, rather than redoing
+ ' either on every single exported frame; this was the actual cost of the overlay on a video export
+ Dim fieldOverlayScaled As Byte() = Nothing
+ Dim intensityOverlayScaled As Byte() = Nothing
+ If _job.GlowOverlay IsNot Nothing AndAlso (exportField OrElse exportIntensity) Then
+ Dim overlayRgb As Byte() = FrameRenderer.ToRgbBytes(_job.GlowOverlay, w, h)
+ If exportField Then fieldOverlayScaled = FrameRenderer.ScaleOverlayRgb(overlayRgb, _job.FieldOverlayGain)
+ If exportIntensity Then intensityOverlayScaled = FrameRenderer.ScaleOverlayRgb(overlayRgb, _job.IntensityOverlayGain)
+ End If
+ If _job.GlowOverlay IsNot Nothing Then
+ _job.GlowOverlay.Dispose()
+ _job.GlowOverlay = Nothing
+ End If
+
+ ' previews are made small enough to fit the preview area
+ Dim previewW As Integer = w
+ Dim previewH As Integer = h
+ Dim scale As Double = Math.Min(_job.PreviewWidth / CDbl(w), _job.PreviewHeight / CDbl(h))
+ If scale < 1.0 Then
+ previewW = Math.Max(1, CInt(Math.Floor(w * scale)))
+ previewH = Math.Max(1, CInt(Math.Floor(h * scale)))
+ End If
+ Dim previewPixels As Integer() = Nothing
+ If settings.PreviewField OrElse settings.PreviewIntensity Then previewPixels = New Integer(previewW * previewH - 1) {}
+
+ Dim fieldBrightness As Single = CSng(settings.FieldBrightness)
+ Dim intensityBrightness As Single = CSng(settings.IntensityBrightness)
+ Dim every As Integer = Math.Max(1, settings.VisualizeEvery)
+ total = settings.Steps
+
+ Dim lastProgress As Long = 0
+ Dim lastProbePost As Long = 0
+ Dim lastPreview As Long = 0
+
+ result.Status = SimulationStatus.Completed
+ For i As Integer = 0 To total - 1
+ If Not _gate.IsSet Then
+ ' paused: the time of the pause does not count
+ clock.Stop()
+ RaiseEvent ProgressChanged(result.StepsDone, total)
+ _gate.Wait()
+ clock.Start()
+ End If
+
+ If Thread.VolatileRead(_cancel) <> 0 Then
+ result.Status = SimulationStatus.Cancelled
+ Exit For
+ End If
+
+ sim.AdvanceOneStep()
+ If sampler IsNot Nothing Then sim.SampleProbes()
+ result.StepsDone = i + 1
+
+ If (i Mod every) = 0 Then
+ ' the probe values up to this step (the graphs in the videos need them)
+ If collector IsNot Nothing Then
+ collector.Collect(sim, result.StepsDone)
+ If exportField OrElse exportIntensity Then collector.CollectProfiles(sim, result.StepsDone)
+ End If
+
+ ' previews are only made when the pictures of the last preview have all been shown, and not
+ ' more often than roughly PreviewIntervalMs. The second condition is the fix for a real bug:
+ ' without it, this was gated purely by _previewPending (whether the UI thread has finished
+ ' showing the last one, via ShowPreview/PreviewShown) - and on a GPU engine, PrepareFrame
+ ' below is where the actual cost is (a full-resolution GPU->host readback, not just the small
+ ' preview picture), so the GPU run's speed ended up riding on how fast the UI happened to be.
+ ' With the "display overlay" checkboxes off, SetPreviewFrame is cheap and _previewPending
+ ' clears almost immediately, so a readback fired on nearly every eligible step; with them on,
+ ' ComposeGlowOverlay's per-pixel blend made the UI side slow enough to skip most of those
+ ' readbacks "by accident", which is why turning the overlay on made the run go faster rather
+ ' than slower. Pacing previews by elapsed time keeps the readback rate steady and no longer
+ ' dependent on a checkbox that was never meant to affect simulation throughput. Exporting a
+ ' video already forces a readback every eligible step regardless (see exportField/
+ ' exportIntensity below), which is why the slowdown was never visible with video export on.
+ Dim previewDue As Boolean = clock.ElapsedMilliseconds - lastPreview >= PreviewIntervalMs
+ Dim doPreview As Boolean = previewPixels IsNot Nothing AndAlso previewDue AndAlso Thread.VolatileRead(_previewPending) <= 0
+ If doPreview Then lastPreview = clock.ElapsedMilliseconds
+
+ ' a GPU engine copies only the data that is going to be drawn
+ sim.PrepareFrame(exportField OrElse (doPreview AndAlso settings.PreviewField),
+ exportIntensity OrElse (doPreview AndAlso settings.PreviewIntensity))
+
+ If exportField Then
+ FrameRenderer.RenderField(sim, _job.FieldLut, fieldBrightness, fullPixels, w, h)
+ FrameRenderer.AddOverlay(fullPixels, fieldOverlayScaled, w, h)
+ If collector IsNot Nothing Then ProbeOverlay.Burn(fullPixels, w, h, _job.Probes, collector.Traces, ProbePlaceOn.Field, total)
+ fieldWriter.AddPixels(fullPixels)
+ End If
+ If exportIntensity Then
+ FrameRenderer.RenderIntensity(sim, _job.IntensityLut, intensityBrightness, fullPixels, w, h)
+ FrameRenderer.AddOverlay(fullPixels, intensityOverlayScaled, w, h)
+ If collector IsNot Nothing Then ProbeOverlay.Burn(fullPixels, w, h, _job.Probes, collector.Traces, ProbePlaceOn.Intensity, total)
+ intensityWriter.AddPixels(fullPixels)
+ End If
+
+ If doPreview Then
+ Dim announced As Integer = If(settings.PreviewField, 1, 0) + If(settings.PreviewIntensity, 1, 0)
+ Interlocked.Exchange(_previewPending, announced)
+ If settings.PreviewField Then
+ FrameRenderer.RenderField(sim, _job.FieldLut, fieldBrightness, previewPixels, previewW, previewH)
+ RaiseEvent PreviewReady(True, FrameRenderer.ToBitmap(previewPixels, previewW, previewH))
+ End If
+ If settings.PreviewIntensity Then
+ FrameRenderer.RenderIntensity(sim, _job.IntensityLut, intensityBrightness, previewPixels, previewW, previewH)
+ RaiseEvent PreviewReady(False, FrameRenderer.ToBitmap(previewPixels, previewW, previewH))
+ End If
+ End If
+ End If
+
+ ' the probe values go to the user interface about 20 times a second
+ If collector IsNot Nothing AndAlso clock.ElapsedMilliseconds - lastProbePost >= 50 Then
+ lastProbePost = clock.ElapsedMilliseconds
+ collector.Collect(sim, result.StepsDone)
+ collector.CollectProfiles(sim, result.StepsDone)
+ RaiseEvent ProbesUpdated(collector.TakeForUi())
+ End If
+
+ If clock.ElapsedMilliseconds - lastProgress >= 100 Then
+ lastProgress = clock.ElapsedMilliseconds
+ RaiseEvent ProgressChanged(i + 1, total)
+ End If
+ Next
+
+ ' the last probe values
+ If collector IsNot Nothing Then
+ collector.Collect(sim, result.StepsDone)
+ collector.CollectProfiles(sim, result.StepsDone)
+ RaiseEvent ProbesUpdated(collector.TakeForUi())
+ End If
+
+ Catch ex As OutOfMemoryException
+ result.Status = SimulationStatus.Failed
+ result.Message = "There is not enough memory for a simulation of this size. Use a smaller canvas."
+ Catch ex As Exception
+ result.Status = SimulationStatus.Failed
+ result.Message = ex.Message
+ Finally
+ ' close the videos, also after a stop or an error, so that the files can be played
+ Try
+ If fieldWriter IsNot Nothing Then fieldWriter.Close()
+ Catch ex As Exception
+ ' nothing more can be done
+ End Try
+ Try
+ If intensityWriter IsNot Nothing Then intensityWriter.Close()
+ Catch ex As Exception
+ ' nothing more can be done
+ End Try
+ If sim IsNot Nothing Then
+ ' one last full-resolution snapshot, so a still export still has something to save once the run
+ ' has fully stopped and the engine itself is gone (see SimulationResult.LastFieldFrame/LastIntensityFrame)
+ Try
+ Dim lastPixels As Integer() = New Integer(sim.Width * sim.Height - 1) {}
+ Dim needInten As Boolean = sim.IntensityData IsNot Nothing
+ sim.PrepareFrame(True, needInten)
+ FrameRenderer.RenderField(sim, _job.FieldLut, CSng(_job.Settings.FieldBrightness), lastPixels, sim.Width, sim.Height)
+ If collector IsNot Nothing Then ProbeOverlay.Burn(lastPixels, sim.Width, sim.Height, _job.Probes, collector.Traces, ProbePlaceOn.Field, total)
+ result.LastFieldFrame = FrameRenderer.ToBitmap(lastPixels, sim.Width, sim.Height)
+ If needInten Then
+ FrameRenderer.RenderIntensity(sim, _job.IntensityLut, CSng(_job.Settings.IntensityBrightness), lastPixels, sim.Width, sim.Height)
+ If collector IsNot Nothing Then ProbeOverlay.Burn(lastPixels, sim.Width, sim.Height, _job.Probes, collector.Traces, ProbePlaceOn.Intensity, total)
+ result.LastIntensityFrame = FrameRenderer.ToBitmap(lastPixels, sim.Width, sim.Height)
+ End If
+ Catch ex As Exception
+ ' no still frame this time - not fatal, the export buttons just won't have anything to save
+ End Try
+ Try
+ sim.Dispose()
+ Catch ex As Exception
+ ' nothing more can be done
+ End Try
+ _sim = Nothing
+ _collector = Nothing
+ End If
+ If _job.Image IsNot Nothing Then _job.Image.Dispose()
+ End Try
+
+ clock.Stop()
+ result.Elapsed = clock.Elapsed
+ RaiseEvent ProgressChanged(result.StepsDone, _job.Settings.Steps)
+ RaiseEvent Finished(result)
+ End Sub
+
+ ''' <summary>
+ ''' Opens a video file. An .mp4 file is written as H.264 with the encoder of Windows; when that is not possible
+ ''' (no Media Foundation, size not supported) an .avi file with Motion JPEG frames is written instead.
+ ''' </summary>
+ Private Shared Function OpenSink(filePath As String, w As Integer, h As Integer, fps As Integer, quality As Integer, result As SimulationResult) As IFrameSink
+ If String.Equals(Path.GetExtension(filePath), ".mp4", StringComparison.OrdinalIgnoreCase) Then
+ Try
+ Return New MfVideoWriter(filePath, w, h, fps, quality)
+ Catch ex As Exception
+ If File.Exists(filePath) Then
+ Try
+ File.Delete(filePath)
+ Catch ex2 As Exception
+ ' an empty leftover file does no harm
+ End Try
+ End If
+ result.Message = "MP4 (H.264) video could not be made on this computer (" & ex.Message.Trim() &
+ "). The videos were written as Motion JPEG .avi files instead; play them with VLC."
+ filePath = Path.ChangeExtension(filePath, ".avi")
+ End Try
+ End If
+ Return New AviFrameSink(filePath, w, h, fps, quality)
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/SimulationSettings.vb b/2D_wave_sim_V01/Simulation/SimulationSettings.vb
new file mode 100644
index 0000000..345184f
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/SimulationSettings.vb
@@ -0,0 +1,256 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Globalization
+
+''' <summary>
+''' The simulation settings of a project (Configuration tab). They are stored in the section "simulation" of
+''' configuration.json:
+''' steps, visualize_every number of time steps, and a frame is shown or exported every N steps
+''' export_field, export_intensity write a video of the field / of the intensity
+''' preview_field, preview_intensity show the field / the intensity in the Preview tab while simulating
+''' field_color_scheme, intensity_color_scheme names of the color schemes to use (empty: gray levels)
+''' and a few values that have no control on the screen yet but can be edited in the file:
+''' field_brightness, intensity_brightness, field_black_level, intensity_black_level,
+''' source_frequency_scale, video_fps
+''' video_quality 1 to 100, quality of the exported videos (higher = larger files)
+''' use_gpu simulate on the graphics card (OpenCL) instead of the processor
+''' wave_speed_c "Set c-value" (File menu); see the WaveSpeedC property below
+''' time_decay_factor "Intensity decay factor" (Configuration tab); see TimeDecayFactor below
+''' intensity_scale "Intensity scale" (Configuration tab); see IntensityScale below
+''' The defaults are those of the Python example (main_curr.py).
+''' </summary>
+Public NotInheritable Class SimulationSettings
+
+ Public Const SectionName As String = "simulation"
+
+ ' DefaultSteps is only the fallback for an existing project saved before "steps" existed (FromConfig below) -
+ ' Steps itself has no software-chosen default of its own any more, the same as TimeDecayFactor: a new project
+ ' starts at whatever numSimulationSteps' own Designer value is (see StartNewProject's "New SimulationSettings()").
+ Public Const DefaultSteps As Integer = 2500
+ Public Const MaxSteps As Integer = 10000000
+ Public Const MaxVisualizeEvery As Integer = 1000
+ Public Const MaxVideoFps As Integer = 240
+ Public Const DefaultVideoQuality As Integer = 70
+
+ Public Property Steps As Integer
+ Public Property VisualizeEvery As Integer = 2
+
+ Public Property ExportField As Boolean = False
+ Public Property ExportIntensity As Boolean = False
+ Public Property PreviewField As Boolean = True
+ Public Property PreviewIntensity As Boolean = True
+
+ ''' <summary>The scheme names a new project starts with (FillSchemeCombo, Form1.vb) - selected only when a
+ ''' scheme with that exact name (case-insensitive) and matching SchemeType exists; otherwise the combo just
+ ''' shows nothing selected, same as for any other scheme name that is not found.</summary>
+ Public Property FieldColorScheme As String = "Default_Field"
+ Public Property IntensityColorScheme As String = "Default_intensity"
+
+ ''' <summary>Brightness scale of the field view (render_field(7) in the Python example; 30.0 here is high
+ ''' enough to see a single source in the simulation, which is what numFieldScaling's own Designer default
+ ''' now also shows for a new source).</summary>
+ Public Property FieldBrightness As Double = 30.0
+
+ ''' <summary>Brightness scale of the intensity view (render_intensity(7) in the Python example; see FieldBrightness).</summary>
+ Public Property IntensityBrightness As Double = 30.0
+
+ Public Property FieldBlackLevel As Double = -0.05
+ Public Property IntensityBlackLevel As Double = 0.0
+
+ ''' <summary>Multiplies the frequency of the sources that come from the green channel of the scene image.</summary>
+ Public Property SourceFrequencyScale As Double = 2.0
+
+ Public Property VideoFps As Integer = 60
+
+ ''' <summary>Quality of the exported videos, 1 (small files) to 100 (best picture, large files).</summary>
+ Public Property VideoQuality As Integer = DefaultVideoQuality
+
+ ''' <summary>Run the simulation on the graphics card. Falls back to the processor when that is not possible.</summary>
+ Public Property UseGpu As Boolean = False
+
+ ''' <summary>
+ ''' Use a 4th order accurate discrete Laplacian (a 5-point "cross" in each of x and y, reaching 2 cells away)
+ ''' instead of the standard 3x3 kernel, everywhere it is safe to (see WaveSimulator.UpdateField/
+ ''' GpuWaveSimulator.KernelSource - the outermost ring of the domain still falls back to the 3x3 kernel, since
+ ''' it does not have 2 cells of margin). This reduces numerical dispersion (short wavelengths, under-resolved by
+ ''' the grid, are otherwise slowed down relative to long ones - see the "Set c-value" comment on WaveSpeedC,
+ ''' above, whose default is itself a symptom of this) at the cost of roughly twice the memory reads per step.
+ ''' On by default for a new project (this property's own default, used by StartNewProject's
+ ''' "New SimulationSettings()"). An existing project saved before this property existed still loads as Off
+ ''' (FromConfig's own separate, hardcoded fallback below), so it keeps its exact previous behavior instead of
+ ''' silently picking up the new project default.
+ ''' </summary>
+ Public Property Use4thOrderLaplacian As Boolean = True
+
+ ''' <summary>
+ ''' The propagation speed of waves through the medium, in simulation pixels per step (lambda = c / frequency).
+ ''' Set from the "Set c-value" entry on the File menu. This is only used to estimate and display a source's
+ ''' wavelength (lblLambdaIs on the Sources tab) - it does not affect the simulation itself, which derives the
+ ''' real, per-pixel wave speed from the scene's refractive index (the red channel of the scene image; see
+ ''' SceneData.C2) instead, and can vary from pixel to pixel while this single value cannot.
+ ''' A new project starts at 1.0, the solver's own default speed for a uniform medium (this property's own
+ ''' default, used by StartNewProject's "New SimulationSettings()"). An existing project saved before this
+ ''' field existed still loads at 0.563 instead (FromConfig's own separate, hardcoded fallback below) - that
+ ''' value was found experimentally to be the correct one at around a source frequency of 100, and is kept only
+ ''' so such a project's displayed wavelength estimate does not change out from under it. Like every other
+ ''' property here, this belongs to one project's SimulationSettings and is saved/loaded with it (wave_speed_c,
+ ''' below) - it is not a global/universal setting, so different projects can each keep their own value.
+ ''' </summary>
+ Public Property WaveSpeedC As Double = 1.0
+
+ ''' <summary>
+ ''' "Intensity decay factor" (Configuration tab, numTimeDecayFactor): the intensity shown/exported is not the
+ ''' raw Sqr(field), it is an exponential running average of it (see WaveSimulator.UpdateField /
+ ''' GpuWaveSimulator.KernelSource), because a source oscillates every step and the raw squared amplitude would
+ ''' flicker at twice the source frequency instead of showing a steady intensity. The averaging needs a time
+ ''' constant of at least a few periods of the slowest active source, or that flicker "prints through"; a fixed
+ ''' time constant long enough for a low frequency source is unnecessarily long for a high frequency one and
+ ''' shows as a visible trail behind anything that moves. Both engines now scale the time constant inversely
+ ''' with the frequency of the slowest active source (image or object) instead of using one fixed value, and
+ ''' this property is the number of steps that time constant works out to at a nominal medium source (green
+ ''' level 100). Raising it lengthens the trail on every source (helps a low frequency source avoid
+ ''' print-through); lowering it shortens the trail (helps a high frequency source look crisp) at the cost of
+ ''' print-through if a low frequency source is also present in the same scene. This class does not itself pick
+ ''' a number for a new project - that would just be a second, competing default fighting the one already set on
+ ''' numTimeDecayFactor (Configuration tab) in the Designer - so StartNewProject (Form1.vb) instead reads the
+ ''' control's own value right after creating a new SimulationSettings, and that is the only place a new
+ ''' project's starting value is decided; changing it means changing numTimeDecayFactor's Value in the Designer.
+ ''' </summary>
+ Public Property TimeDecayFactor As Double
+
+ ''' <summary>
+ ''' A plain multiplier on the tracked intensity itself (not just how it is displayed): both engines apply it to
+ ''' every intensity value they compute, so it changes the actual numbers in the preview, the exported videos,
+ ''' the probe data and any exported files - unlike FieldBrightness/IntensityBrightness above, which only scale
+ ''' how an image is drawn from the numbers, leaving the numbers themselves alone. It exists because, with the
+ ''' filtering TimeDecayFactor controls (see its comment), the raw intensity ends up landing around 1e-5 for
+ ''' typical scenes - an inconvenient scale for an axis or a data file - and the right multiplier to bring that
+ ''' into a convenient range depends on the source amplitudes and pulse shapes actually used, which this class
+ ''' has no way to predict. The default of 1.0 leaves the raw numbers exactly as computed; numIntensityScale
+ ''' (Configuration tab) lets the value be tuned by eye once the actual scale in use is visible.
+ ''' </summary>
+ Public Property IntensityScale As Double = 1.0
+
+ ''' <summary>A copy that a running simulation can keep while the user goes on editing.</summary>
+ Public Function Clone() As SimulationSettings
+ Return DirectCast(MemberwiseClone(), SimulationSettings)
+ End Function
+
+ ' ---------------------------------------------------------------- configuration file
+
+ Public Shared Function FromConfig(config As ProjectConfig) As SimulationSettings
+ Dim s As New SimulationSettings()
+ If Not config.ContainsKey(SectionName) Then Return s
+
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ s.Steps = ReadInt(section, "steps", DefaultSteps, 1, MaxSteps)
+ s.VisualizeEvery = ReadInt(section, "visualize_every", 2, 1, MaxVisualizeEvery)
+ s.ExportField = ReadBool(section, "export_field", False)
+ s.ExportIntensity = ReadBool(section, "export_intensity", False)
+ s.PreviewField = ReadBool(section, "preview_field", True)
+ s.PreviewIntensity = ReadBool(section, "preview_intensity", True)
+ s.FieldColorScheme = ReadText(section, "field_color_scheme", "Default_Field")
+ s.IntensityColorScheme = ReadText(section, "intensity_color_scheme", "Default_intensity")
+ s.FieldBrightness = ReadDouble(section, "field_brightness", 30.0, 0.0001, 100000.0)
+ s.IntensityBrightness = ReadDouble(section, "intensity_brightness", 30.0, 0.0001, 100000.0)
+ s.FieldBlackLevel = ReadDouble(section, "field_black_level", -0.05, -10.0, 1.0)
+ s.IntensityBlackLevel = ReadDouble(section, "intensity_black_level", 0.0, -10.0, 1.0)
+ s.SourceFrequencyScale = ReadDouble(section, "source_frequency_scale", 2.0, 0.0, 1000.0)
+ s.VideoFps = ReadInt(section, "video_fps", 60, 1, MaxVideoFps)
+ s.VideoQuality = ReadInt(section, "video_quality", DefaultVideoQuality, 1, 100)
+ s.UseGpu = ReadBool(section, "use_gpu", False)
+ s.Use4thOrderLaplacian = ReadBool(section, "use_4th_order_laplacian", False)
+ s.WaveSpeedC = ReadDouble(section, "wave_speed_c", 0.563, 0.000001, 1000000.0)
+ s.TimeDecayFactor = ReadDouble(section, "time_decay_factor", 10.0, 1.0, 100.0)
+ s.IntensityScale = ReadDouble(section, "intensity_scale", 1.0, 0.0000001, 1000000.0)
+ Return s
+ End Function
+
+ Public Sub ToConfig(config As ProjectConfig)
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ section("steps") = Steps
+ section("visualize_every") = VisualizeEvery
+ section("export_field") = ExportField
+ section("export_intensity") = ExportIntensity
+ section("preview_field") = PreviewField
+ section("preview_intensity") = PreviewIntensity
+ section("field_color_scheme") = FieldColorScheme
+ section("intensity_color_scheme") = IntensityColorScheme
+ section("field_brightness") = FieldBrightness
+ section("intensity_brightness") = IntensityBrightness
+ section("field_black_level") = FieldBlackLevel
+ section("intensity_black_level") = IntensityBlackLevel
+ section("source_frequency_scale") = SourceFrequencyScale
+ section("video_fps") = VideoFps
+ section("video_quality") = VideoQuality
+ section("use_gpu") = UseGpu
+ section("use_4th_order_laplacian") = Use4thOrderLaplacian
+ section("wave_speed_c") = WaveSpeedC
+ section("time_decay_factor") = TimeDecayFactor
+ section("intensity_scale") = IntensityScale
+ End Sub
+
+ ' ---------------------------------------------------------------- helpers
+
+ Private Shared Function ReadText(section As Dictionary(Of String, Object), key As String, fallback As String) As String
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadBool(section As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadInt(section As Dictionary(Of String, Object), key As String, fallback As Integer,
+ minValue As Integer, maxValue As Integer) As Integer
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)
+ If n >= minValue AndAlso n <= maxValue Then Return n
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+ Private Shared Function ReadDouble(section As Dictionary(Of String, Object), key As String, fallback As Double,
+ minValue As Double, maxValue As Double) As Double
+ Dim v As Object = Nothing
+ If section.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim d As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)
+ If d >= minValue AndAlso d <= maxValue Then Return d
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/SourceSettings.vb b/2D_wave_sim_V01/Simulation/SourceSettings.vb
new file mode 100644
index 0000000..eb8689c
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/SourceSettings.vb
@@ -0,0 +1,474 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections
+Imports System.Collections.Generic
+Imports System.Globalization
+
+''' <summary>Whether a source is one point (or line, in a future version) or an X-Y array of points.</summary>
+Public Enum SourceMainType
+ ''' <summary>One point source. Named Simple (not Single) because Single is a reserved VB keyword (the floating-point type).</summary>
+ Simple = 0
+ Composite = 1
+End Enum
+
+''' <summary>Whether a source (or an element of a composite source) is always on, or switches on and off in cycles of its own frequency.</summary>
+Public Enum SourceMode
+ Continuous = 0
+ Pulsed = 1
+End Enum
+
+''' <summary>The shape of the amplitude envelope of a pulsed source while it is "on".</summary>
+Public Enum SourcePulseShape
+ Gaussian = 0
+ SmoothedSquare = 1
+End Enum
+
+''' <summary>How the elements of a composite source get their frequency/phase/off-width/position: all the same as the
+''' single source, or randomized around it.</summary>
+Public Enum SourceCompositeMode
+ InheritFromSingle = 0
+ InheritAndRandomize = 1
+End Enum
+
+''' <summary>
+''' One concrete point source, as it is actually run by the simulation: the result of "Generate composite source" for
+''' every element of the array (or the only element of a simple source). Generating rolls the randomization once, so
+''' a run is reproducible: the engine never re-randomizes.
+''' </summary>
+Public NotInheritable Class SourceElement
+ Public Property PosX As Integer
+ Public Property PosY As Integer
+
+ ''' <summary>The frequency, expressed the same way as an image source's green level (1-255): frequency = level / 255 * 0.5 * SourceFrequencyScale.</summary>
+ Public Property Level As Integer = 100
+
+ ''' <summary>0 (silent) to 1 (full scale).</summary>
+ Public Property Amplitude As Double = 0.5
+
+ Public Property PhaseRad As Double = 0.0
+
+ Public Property Mode As SourceMode = SourceMode.Continuous
+ Public Property PulseShape As SourcePulseShape = SourcePulseShape.Gaussian
+
+ ''' <summary>The number of cycles (of the source's own frequency) that it is off, then on, then off again, ...</summary>
+ Public Property OnWidthCycles As Integer = 10
+ Public Property OffWidthCycles As Integer = 10
+
+ ''' <summary>The un-randomized off-width (the composite source's own OffStateCycles at generate time), used as
+ ''' the anchor every time OffWidthCycles is re-randomized at runtime. Equal to OffWidthCycles unless
+ ''' RandomizeOffWidthAmount > 0.</summary>
+ Public Property OffWidthBase As Integer = 10
+
+ ''' <summary>When greater than 0, the engine redraws OffWidthCycles (uniformly within +/- this amount of
+ ''' OffWidthBase) every time this element completes a full off+on cycle, so sources don't stay in lockstep or
+ ''' permanently favor one extreme. 0 means the off-width set at generate time is never changed again.</summary>
+ Public Property RandomizeOffWidthAmount As Integer = 0
+
+ ''' <summary>The simulation step at which this element stops driving the field (releasing its hold on it, so it
+ ''' no longer diffracts waves passing through its position), or -1 to never detach. Copied from the parent
+ ''' SourceSettings' DetachSource/DetachAfterSteps at generate time.</summary>
+ Public Property DetachAfterStep As Integer = -1
+
+ ''' <summary>
+ ''' The number of simulation steps over which a detaching element's drive is faded out (linearly, down to 0),
+ ''' rather than cut instantly at DetachAfterStep - an abrupt cutoff otherwise leaves a small kink in the forcing
+ ''' at that point, which can ring. Shared by both engines (WaveSimulator.ApplySources and the
+ ''' apply_object_sources GPU kernel in GpuWaveSimulator), so the two stay in exact agreement.
+ ''' </summary>
+ Public Const DetachRampSteps As Integer = 30
+
+ Public Function Clone() As SourceElement
+ Return DirectCast(MemberwiseClone(), SourceElement)
+ End Function
+End Class
+
+''' <summary>
+''' One source of the project: either a single point source, or a composite source (an X-Y array of point sources
+''' built from the same base parameters, optionally randomized). "Generate composite source" resolves the current
+''' parameters (and, for a composite source, a fresh random draw) into a fixed list of SourceElement, which is what
+''' the simulation actually runs; "Save source" keeps both the authoring parameters (so the source can be reopened
+''' and edited or regenerated) and that generated list (so a saved project runs exactly what was generated, even
+''' before it is regenerated again). The sources are stored in the section "object_sources" of configuration.json.
+''' </summary>
+Public NotInheritable Class SourceSettings
+
+ Public Const SectionName As String = "object_sources"
+
+ Public Property Name As String = "Source 1"
+ Public Property MainType As SourceMainType = SourceMainType.Simple
+
+ ''' <summary>The position of a simple source, or the center of a composite source's array, in simulation pixels.
+ ''' PosX/PosY only hold a meaningful value once HasPosition is True (picked in the picture, or typed) - until
+ ''' then they are just the unset default, and the Sources tab must not draw a marker for it.</summary>
+ Public Property PosX As Integer = 100
+ Public Property PosY As Integer = 100
+
+ ''' <summary>Whether PosX/PosY have actually been assigned (by picking a position in the picture, or by typing
+ ''' one) rather than still holding the default. Sources loaded from a project saved before this flag existed
+ ''' default to True (see FromDictionary), since they were positioned under the old rules.</summary>
+ Public Property HasPosition As Boolean = False
+
+ ''' <summary>Whether the source interacts with the simulation at all. Off by default is never true - a new
+ ''' source starts on. Switching it off keeps every parameter (it can still be edited, and switched back on)
+ ''' but the source takes no part in a run: SourcesForRun leaves it out entirely, so it neither drives the
+ ''' field nor gets in the way of waves passing through its position.</summary>
+ Public Property SourceOn As Boolean = True
+
+ ''' <summary>When True, the source stops driving the field after DetachAfterSteps simulation steps (it runs
+ ''' normally up to that point). A source that keeps driving the field also holds it at a fixed value there,
+ ''' which diffracts waves that later pass through that point; detaching releases that hold once the source
+ ''' has done its job, so the field becomes free of it again for the rest of the run.</summary>
+ Public Property DetachSource As Boolean = False
+
+ ''' <summary>The simulation step (0-based) at which the source detaches, when DetachSource is True.</summary>
+ Public Property DetachAfterSteps As Integer = 1000
+
+ ' ---- single source (base) properties
+
+ ''' <summary>1-255, the same scale as an image source's green level.</summary>
+ Public Property Frequency As Integer = 100
+
+ ''' <summary>0-100 (%) of the source amplitude; 100 matches numAmplitude's own Designer default for a new source.</summary>
+ Public Property Amplitude As Integer = 100
+
+ ''' <summary>-180 to 180 degrees.</summary>
+ Public Property PhaseDeg As Integer = 0
+
+ Public Property Mode As SourceMode = SourceMode.Continuous
+ Public Property PulseShape As SourcePulseShape = SourcePulseShape.Gaussian
+ Public Property PulseWidthCycles As Integer = 10
+ Public Property OffStateCycles As Integer = 10
+
+ ' ---- composite source properties
+
+ Public Property ArraySizeX As Integer = 1
+ Public Property ArraySizeY As Integer = 1
+ Public Property SpacingX As Integer = 10
+ Public Property SpacingY As Integer = 10
+ Public Property CompositeMode As SourceCompositeMode = SourceCompositeMode.InheritFromSingle
+
+ Public Property RandomizeFrequency As Boolean = False
+ Public Property RandomizeFrequencyAmount As Integer = 0
+ Public Property RandomizePhase As Boolean = False
+ Public Property RandomizePhaseAmount As Integer = 0
+ Public Property RandomizeOffWidth As Boolean = False
+ Public Property RandomizeOffWidthAmount As Integer = 0
+ Public Property RandomizePosition As Boolean = False
+ Public Property RandomizePositionAmount As Integer = 0
+
+ ''' <summary>The concrete elements produced by the last "Generate composite source" (one element for a simple source). Empty until generated.</summary>
+ Public Property Elements As New List(Of SourceElement)()
+
+ Public Function Clone() As SourceSettings
+ Dim c As SourceSettings = DirectCast(MemberwiseClone(), SourceSettings)
+ c.Elements = New List(Of SourceElement)()
+ For Each e As SourceElement In Elements
+ c.Elements.Add(e.Clone())
+ Next
+ Return c
+ End Function
+
+ Public Sub Normalize()
+ If Frequency < 1 Then Frequency = 1
+ If Frequency > 255 Then Frequency = 255
+ If Amplitude < 0 Then Amplitude = 0
+ If Amplitude > 100 Then Amplitude = 100
+ If PhaseDeg < -180 Then PhaseDeg = -180
+ If PhaseDeg > 180 Then PhaseDeg = 180
+ If PulseWidthCycles < 1 Then PulseWidthCycles = 1
+ If OffStateCycles < 1 Then OffStateCycles = 1
+ If ArraySizeX < 1 Then ArraySizeX = 1
+ If ArraySizeY < 1 Then ArraySizeY = 1
+ If DetachAfterSteps < 0 Then DetachAfterSteps = 0
+ End Sub
+
+ ''' <summary>Rebuilds Elements from the current parameters: one element for a simple source, or an ArraySizeX x
+ ''' ArraySizeY grid centered on (PosX, PosY) for a composite source, randomized once per element when
+ ''' CompositeMode is InheritAndRandomize and the matching "Randomize" check box is on.</summary>
+ Public Sub GenerateElements(rng As Random)
+ Normalize()
+ Dim result As New List(Of SourceElement)()
+
+ If MainType = SourceMainType.Simple Then
+ result.Add(MakeBaseElement(PosX, PosY))
+ Else
+ Dim cols As Integer = ArraySizeX
+ Dim rows As Integer = ArraySizeY
+ Dim randomize As Boolean = (CompositeMode = SourceCompositeMode.InheritAndRandomize)
+
+ For row As Integer = 0 To rows - 1
+ For col As Integer = 0 To cols - 1
+ ' the array is centered on (PosX, PosY), not anchored at a corner
+ Dim ex As Integer = PosX + CInt(Math.Round((col - (cols - 1) / 2.0) * SpacingX))
+ Dim ey As Integer = PosY + CInt(Math.Round((row - (rows - 1) / 2.0) * SpacingY))
+
+ If randomize AndAlso RandomizePosition AndAlso RandomizePositionAmount > 0 Then
+ ex += RandomInt(rng, RandomizePositionAmount)
+ ey += RandomInt(rng, RandomizePositionAmount)
+ End If
+
+ Dim el As SourceElement = MakeBaseElement(ex, ey)
+
+ If randomize AndAlso RandomizeFrequency AndAlso RandomizeFrequencyAmount > 0 Then
+ el.Level = Clamp(Frequency + RandomInt(rng, RandomizeFrequencyAmount), 1, 255)
+ End If
+ If randomize AndAlso RandomizePhase AndAlso RandomizePhaseAmount > 0 Then
+ Dim deg As Integer = Clamp(PhaseDeg + RandomInt(rng, RandomizePhaseAmount), -180, 180)
+ el.PhaseRad = deg * Math.PI / 180.0
+ End If
+ If randomize AndAlso RandomizeOffWidth AndAlso RandomizeOffWidthAmount > 0 Then
+ el.OffWidthCycles = Math.Max(1, OffStateCycles + RandomInt(rng, RandomizeOffWidthAmount))
+ el.RandomizeOffWidthAmount = RandomizeOffWidthAmount
+ End If
+
+ result.Add(el)
+ Next
+ Next
+ End If
+
+ Elements = result
+ End Sub
+
+ Private Function MakeBaseElement(x As Integer, y As Integer) As SourceElement
+ Dim el As New SourceElement()
+ el.PosX = x
+ el.PosY = y
+ el.Level = Frequency
+ el.Amplitude = Amplitude / 100.0
+ el.PhaseRad = PhaseDeg * Math.PI / 180.0
+ el.Mode = Mode
+ el.PulseShape = PulseShape
+ el.OnWidthCycles = PulseWidthCycles
+ el.OffWidthCycles = OffStateCycles
+ el.OffWidthBase = OffStateCycles
+ el.RandomizeOffWidthAmount = 0
+ el.DetachAfterStep = If(DetachSource, DetachAfterSteps, -1)
+ Return el
+ End Function
+
+ ''' <summary>A uniform random integer in [-amount, amount].</summary>
+ Friend Shared Function RandomInt(rng As Random, amount As Integer) As Integer
+ If amount <= 0 Then Return 0
+ Return rng.Next(-amount, amount + 1)
+ End Function
+
+ Private Shared Function Clamp(value As Integer, minValue As Integer, maxValue As Integer) As Integer
+ Return Math.Max(minValue, Math.Min(maxValue, value))
+ End Function
+
+ ' ---------------------------------------------------------------- configuration file
+
+ Public Shared Function ListFromConfig(config As ProjectConfig) As List(Of SourceSettings)
+ Dim result As New List(Of SourceSettings)()
+
+ If config.ContainsKey(SectionName) Then
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ Dim items As Object = Nothing
+ If section.TryGetValue("items", items) Then
+ Dim list As IEnumerable = TryCast(items, IEnumerable)
+ If list IsNot Nothing AndAlso Not TypeOf items Is String Then
+ For Each item As Object In list
+ Dim d As Dictionary(Of String, Object) = TryCast(item, Dictionary(Of String, Object))
+ If d IsNot Nothing Then result.Add(FromDictionary(d))
+ Next
+ End If
+ End If
+ End If
+
+ Return result
+ End Function
+
+ Public Shared Sub ListToConfig(sources As List(Of SourceSettings), config As ProjectConfig)
+ Dim section As Dictionary(Of String, Object) = config.GetSection(SectionName)
+ Dim items As New List(Of Object)()
+ For Each s As SourceSettings In sources
+ items.Add(s.ToDictionary())
+ Next
+ section("count") = items.Count
+ section("items") = items
+ End Sub
+
+ Private Function ToDictionary() As Dictionary(Of String, Object)
+ Dim d As New Dictionary(Of String, Object)()
+ d("name") = Name
+ d("main_type") = If(MainType = SourceMainType.Composite, "composite", "single")
+ d("x") = PosX
+ d("y") = PosY
+ d("has_position") = HasPosition
+ d("source_on") = SourceOn
+ d("detach_source") = DetachSource
+ d("detach_after_steps") = DetachAfterSteps
+ d("frequency") = Frequency
+ d("amplitude") = Amplitude
+ d("phase_deg") = PhaseDeg
+ d("mode") = If(Mode = SourceMode.Pulsed, "pulsed", "continuous")
+ d("pulse_shape") = If(PulseShape = SourcePulseShape.SmoothedSquare, "smoothed_square", "gaussian")
+ d("pulse_width_cycles") = PulseWidthCycles
+ d("off_state_cycles") = OffStateCycles
+ d("array_size_x") = ArraySizeX
+ d("array_size_y") = ArraySizeY
+ d("spacing_x") = SpacingX
+ d("spacing_y") = SpacingY
+ d("composite_mode") = If(CompositeMode = SourceCompositeMode.InheritAndRandomize, "randomize", "inherit")
+ d("randomize_frequency") = RandomizeFrequency
+ d("randomize_frequency_amount") = RandomizeFrequencyAmount
+ d("randomize_phase") = RandomizePhase
+ d("randomize_phase_amount") = RandomizePhaseAmount
+ d("randomize_off_width") = RandomizeOffWidth
+ d("randomize_off_width_amount") = RandomizeOffWidthAmount
+ d("randomize_position") = RandomizePosition
+ d("randomize_position_amount") = RandomizePositionAmount
+
+ Dim elementList As New List(Of Object)()
+ For Each el As SourceElement In Elements
+ Dim ed As New Dictionary(Of String, Object)()
+ ed("x") = el.PosX
+ ed("y") = el.PosY
+ ed("level") = el.Level
+ ed("amplitude") = el.Amplitude
+ ed("phase_rad") = el.PhaseRad
+ ed("mode") = If(el.Mode = SourceMode.Pulsed, "pulsed", "continuous")
+ ed("pulse_shape") = If(el.PulseShape = SourcePulseShape.SmoothedSquare, "smoothed_square", "gaussian")
+ ed("on_width_cycles") = el.OnWidthCycles
+ ed("off_width_cycles") = el.OffWidthCycles
+ ed("off_width_base") = el.OffWidthBase
+ ed("randomize_off_width_amount") = el.RandomizeOffWidthAmount
+ ed("detach_after_step") = el.DetachAfterStep
+ elementList.Add(ed)
+ Next
+ d("elements") = elementList
+
+ Return d
+ End Function
+
+ Private Shared Function FromDictionary(d As Dictionary(Of String, Object)) As SourceSettings
+ Dim s As New SourceSettings()
+
+ s.Name = ReadText(d, "name", s.Name)
+ s.MainType = If(ReadText(d, "main_type", "single") = "composite", SourceMainType.Composite, SourceMainType.Simple)
+ s.PosX = ReadInt(d, "x", s.PosX, -1000000, 1000000)
+ s.PosY = ReadInt(d, "y", s.PosY, -1000000, 1000000)
+ ' a project saved before HasPosition existed has no "has_position" entry - default to True, since its
+ ' sources were positioned under the old rules (there was no "unset" state back then)
+ s.HasPosition = ReadBool(d, "has_position", True)
+ ' a project saved before SourceOn/DetachSource existed has no entries for them either - default to the
+ ' same behavior it always had: on, and never detaching
+ s.SourceOn = ReadBool(d, "source_on", True)
+ s.DetachSource = ReadBool(d, "detach_source", False)
+ s.DetachAfterSteps = ReadInt(d, "detach_after_steps", s.DetachAfterSteps, 0, 1000000000)
+ s.Frequency = ReadInt(d, "frequency", s.Frequency, 1, 255)
+ s.Amplitude = ReadInt(d, "amplitude", s.Amplitude, 0, 100)
+ s.PhaseDeg = ReadInt(d, "phase_deg", s.PhaseDeg, -180, 180)
+ s.Mode = If(ReadText(d, "mode", "continuous") = "pulsed", SourceMode.Pulsed, SourceMode.Continuous)
+ s.PulseShape = If(ReadText(d, "pulse_shape", "gaussian") = "smoothed_square", SourcePulseShape.SmoothedSquare, SourcePulseShape.Gaussian)
+ s.PulseWidthCycles = ReadInt(d, "pulse_width_cycles", s.PulseWidthCycles, 1, 1000000)
+ s.OffStateCycles = ReadInt(d, "off_state_cycles", s.OffStateCycles, 1, 1000000)
+ s.ArraySizeX = ReadInt(d, "array_size_x", s.ArraySizeX, 1, 100000)
+ s.ArraySizeY = ReadInt(d, "array_size_y", s.ArraySizeY, 1, 100000)
+ s.SpacingX = ReadInt(d, "spacing_x", s.SpacingX, -1000000, 1000000)
+ s.SpacingY = ReadInt(d, "spacing_y", s.SpacingY, -1000000, 1000000)
+ s.CompositeMode = If(ReadText(d, "composite_mode", "inherit") = "randomize", SourceCompositeMode.InheritAndRandomize, SourceCompositeMode.InheritFromSingle)
+ s.RandomizeFrequency = ReadBool(d, "randomize_frequency", False)
+ s.RandomizeFrequencyAmount = ReadInt(d, "randomize_frequency_amount", 0, 0, 1000000)
+ s.RandomizePhase = ReadBool(d, "randomize_phase", False)
+ s.RandomizePhaseAmount = ReadInt(d, "randomize_phase_amount", 0, 0, 1000000)
+ s.RandomizeOffWidth = ReadBool(d, "randomize_off_width", False)
+ s.RandomizeOffWidthAmount = ReadInt(d, "randomize_off_width_amount", 0, 0, 1000000)
+ s.RandomizePosition = ReadBool(d, "randomize_position", False)
+ s.RandomizePositionAmount = ReadInt(d, "randomize_position_amount", 0, 0, 1000000)
+
+ Dim elements As New List(Of SourceElement)()
+ Dim elementsObj As Object = Nothing
+ If d.TryGetValue("elements", elementsObj) Then
+ Dim list As IEnumerable = TryCast(elementsObj, IEnumerable)
+ If list IsNot Nothing AndAlso Not TypeOf elementsObj Is String Then
+ For Each item As Object In list
+ Dim ed As Dictionary(Of String, Object) = TryCast(item, Dictionary(Of String, Object))
+ If ed Is Nothing Then Continue For
+ Dim el As New SourceElement()
+ el.PosX = ReadInt(ed, "x", 0, -1000000, 1000000)
+ el.PosY = ReadInt(ed, "y", 0, -1000000, 1000000)
+ el.Level = ReadInt(ed, "level", 100, 1, 255)
+ el.Amplitude = ReadDouble(ed, "amplitude", 0.5, 0.0, 1.0)
+ el.PhaseRad = ReadDouble(ed, "phase_rad", 0.0, -1000.0, 1000.0)
+ el.Mode = If(ReadText(ed, "mode", "continuous") = "pulsed", SourceMode.Pulsed, SourceMode.Continuous)
+ el.PulseShape = If(ReadText(ed, "pulse_shape", "gaussian") = "smoothed_square", SourcePulseShape.SmoothedSquare, SourcePulseShape.Gaussian)
+ el.OnWidthCycles = ReadInt(ed, "on_width_cycles", 10, 1, 1000000)
+ el.OffWidthCycles = ReadInt(ed, "off_width_cycles", 10, 1, 1000000)
+ ' a project saved before off-width re-randomization existed has no "off_width_base" entry -
+ ' default to this element's own off_width_cycles (already read above), which is exactly its
+ ' anchor under the old, always-static behavior
+ el.OffWidthBase = ReadInt(ed, "off_width_base", el.OffWidthCycles, 1, 1000000)
+ el.RandomizeOffWidthAmount = ReadInt(ed, "randomize_off_width_amount", 0, 0, 1000000)
+ el.DetachAfterStep = ReadInt(ed, "detach_after_step", -1, -1, 1000000000)
+ elements.Add(el)
+ Next
+ End If
+ End If
+ s.Elements = elements
+
+ s.Normalize()
+ Return s
+ End Function
+
+ Private Shared Function ReadText(d As Dictionary(Of String, Object), key As String, fallback As String) As String
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then Return Convert.ToString(v, CultureInfo.InvariantCulture)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadBool(d As Dictionary(Of String, Object), key As String, fallback As Boolean) As Boolean
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso TypeOf v Is Boolean Then Return Convert.ToBoolean(v)
+ Return fallback
+ End Function
+
+ Private Shared Function ReadInt(d As Dictionary(Of String, Object), key As String, fallback As Integer,
+ minValue As Integer, maxValue As Integer) As Integer
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim n As Integer = Convert.ToInt32(v, CultureInfo.InvariantCulture)
+ If n >= minValue AndAlso n <= maxValue Then Return n
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+ Private Shared Function ReadDouble(d As Dictionary(Of String, Object), key As String, fallback As Double,
+ minValue As Double, maxValue As Double) As Double
+ Dim v As Object = Nothing
+ If d.TryGetValue(key, v) AndAlso v IsNot Nothing Then
+ Try
+ Dim x As Double = Convert.ToDouble(v, CultureInfo.InvariantCulture)
+ If x >= minValue AndAlso x <= maxValue Then Return x
+ Catch ex As Exception When TypeOf ex Is FormatException OrElse TypeOf ex Is InvalidCastException OrElse TypeOf ex Is OverflowException
+ ' use the fallback
+ End Try
+ End If
+ Return fallback
+ End Function
+
+End Class
diff --git a/2D_wave_sim_V01/Simulation/WaveSimulator.vb b/2D_wave_sim_V01/Simulation/WaveSimulator.vb
new file mode 100644
index 0000000..ca1ee5e
--- /dev/null
+++ b/2D_wave_sim_V01/Simulation/WaveSimulator.vb
@@ -0,0 +1,653 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+'
+' Portions of this file are based on WaveSimulator2D by 0x23
+' <https://github.com/0x23/WaveSimulator2D>.
+
+Option Strict On
+Option Explicit On
+
+Imports System.Collections.Generic
+Imports System.Threading.Tasks
+
+''' <summary>
+''' The 2D wave equation on the CPU, a port of the Python class WaveSimulator2D (which runs on the GPU with CuPy):
+''' laplacian = 3x3 convolution with [[0.066, 0.184, 0.066], [0.184, -1, 0.184], [0.066, 0.184, 0.066]]
+''' new u = u + (u - previous u) * d + laplacian * c^2
+''' with the field outside the domain fixed at 0. The sources are applied before each step as in
+''' update_scene / StaticImageScene.update_field:
+''' u = u * 0.9 + sin(frequency * t) * 0.1
+''' The intensity is no longer a single exponential average of WaveVisualizer.update (I = I * 0.98 + u^2 * 0.02):
+''' a single-pole filter like that only rolls off at 6 dB/octave, so it never fully removes the ripple at the
+''' source's own oscillation frequency, just delays it - lengthening its time constant mostly adds trail without
+''' buying much extra ripple suppression. Instead the same one-pole filter (I = I * alpha + x * (1 - alpha)) is run
+''' twice in a row (_intensityStage1, then _intensity), a critically-damped 2-pole low-pass that rolls off at
+''' 12 dB/octave, so for the same responsiveness it suppresses the ripple far more without needing to know the
+''' local frequency at every pixel. Two full stages turned out to add more delay than wanted at low frequencies
+''' (a short pulse can come and go before the second stage has caught up, understating its peak) for not that
+''' much extra benefit over one, so what is actually shown/exported (_intensityOut) is a blend of the one-stage
+''' and two-stage outputs (IntensityBlend) - roughly the middle ground between the two (about 9, not 6 or 12,
+''' dB/octave), still well ahead of a single stage at rejecting the ripple but reacting closer to as fast.
+''' alpha (_intensityAlpha) is derived once per simulation so the time constant of each stage scales inversely
+''' with the frequency of the slowest active source, times the user's TimeDecayFactor - see that property's
+''' comment (SimulationSettings.vb) for why.
+'''
+''' The arrays have a border of one cell (which always stays 0) so that the step needs no edge tests.
+''' The rows are divided over all processor cores.
+'''
+''' Optionally (Use4thOrderLaplacian), the Laplacian is instead computed with a 4th order accurate, 5-point
+''' "cross" stencil (reaching 2 cells away along x and along y) wherever there is room for it - see UpdateField.
+''' This reduces numerical dispersion (short, under-resolved wavelengths otherwise travel slower than long ones -
+''' see the SimulationSettings.WaveSpeedC comment) at roughly twice the memory reads per step. The outermost ring
+''' of the domain still uses the original 3x3 kernel, since it only has the usual one cell of border to read from,
+''' not the two the wider stencil needs.
+'''
+''' The 4th order stencil's coefficients (-1/12, 4/3, -5) reach much further from zero than the 3x3 kernel's
+''' (0.066, 0.184, -1) - about 7 times further at the highest spatial frequency the grid can represent - so the
+''' same c^2 that is safely stable with the 3x3 kernel can be wildly unstable with the 4th order one (the field
+''' blows up: everywhere saturates except at object edges, which is what an invalid/unstable Laplacian looks like).
+''' To stay stable without changing the physical wave speed, AdvanceOneStep instead takes _subSteps smaller time
+''' steps per call when the 4th order stencil is used: c^2 is scaled by 1 / _subSteps^2 (matching a time step
+''' _subSteps times smaller) and the damping factor d by its _subSteps-th root (so _subSteps applications of it
+''' compound back to the original d), so the net effect after _subSteps steps is exactly the same physical
+''' propagation and damping as one ordinary step - just spread over more, individually stable, time steps.
+''' _subSteps is computed once per scene from its highest c^2 (ComputeSubSteps) and is 1 (no sub-stepping, and a
+''' multiply by the exact literal 1.0F) whenever the 3x3 kernel is used or the scene's c^2 does not need it.
+''' </summary>
+Friend NotInheritable Class WaveSimulator
+ Implements IWaveEngine
+
+ Private Const KernelCorner As Single = 0.066F
+ Private Const KernelEdge As Single = 0.184F
+ Private Const SourceOpacity As Single = 0.9F
+ ' nominal source level (of 255) that TimeDecayFactor's steps count is calibrated against - see the property's
+ ' comment (SimulationSettings.vb) and _intensityAlpha's computation below
+ Private Const NominalDecayLevel As Integer = 100
+ ' how much of the fully cascaded (2-stage, 12 dB/octave) intensity is blended into the shown/exported value
+ ' versus the 1-stage (6 dB/octave) intensity - see the class summary; 0.5 is the middle ground, about 9 dB/octave
+ Private Const IntensityBlend As Single = 0.5F
+
+ ' the 4th order "cross" stencil's coefficients: (-f(-2) + 16f(-1) - 30f(0) + 16f(+1) - f(+2)) / 12 per axis,
+ ' the two axes' center terms combined into one (-60/12 = -5) since both apply to the same center pixel
+ Private Const FourthOrderNear As Single = 4.0F / 3.0F ' 16 / 12
+ Private Const FourthOrderFar As Single = -1.0F / 12.0F
+ Private Const FourthOrderCenter As Single = -5.0F ' -60 / 12
+
+ ' the 4th order stencil's largest |eigenvalue| (at the grid's highest spatial frequency, kx = ky = pi):
+ ' 2 * (-1/12 * cos(2k) + 4/3 * cos(k) - 5/2)|k=pi per axis, summed over x and y = -32/3
+ Private Const FourthOrderLambdaMax As Single = 32.0F / 3.0F
+ ' how far below the hard stability limit (c^2 * |lambda max| <= 4) sub-stepping aims to stay - chosen to give
+ ' roughly the same safety margin the 3x3 kernel already has in practice (its own c^2 * |lambda max| is about
+ ' 1.8 at the highest c^2 the app allows, i.e. about 2.2 times under the limit of 4)
+ Private Const SubStepTargetLimit As Single = 2.0F
+
+ Private ReadOnly _width As Integer
+ Private ReadOnly _height As Integer
+ Private ReadOnly _stride As Integer
+ Private ReadOnly _use4thOrderLaplacian As Boolean
+ ' see the class summary; 1 (no sub-stepping) unless Use4thOrderLaplacian needs otherwise for this scene's c^2
+ Private ReadOnly _subSteps As Integer
+ ' the d array used by UpdateField: the original _d itself when _subSteps = 1 (same reference, so multiplying by
+ ' it is bit-for-bit identical to before), otherwise a separate array of _d raised to the power 1 / _subSteps
+ Private ReadOnly _dEffective As Single()
+ ' 1.0F / _subSteps^2 (or exactly 1.0F when _subSteps = 1, a bit-for-bit no-op multiply)
+ Private ReadOnly _c2Mult As Single
+ ' the intensity's exponential-average decay factor for this simulation (replaces the old fixed 0.98F) - see
+ ' TimeDecayFactor's comment (SimulationSettings.vb) and its computation at the end of the constructor
+ Private ReadOnly _intensityAlpha As Single
+ ' SimulationSettings.IntensityScale - see that property's comment
+ Private ReadOnly _intensityScale As Single
+
+ Private _u As Single()
+ Private _uPrev As Single()
+ Private ReadOnly _c2 As Single()
+ Private ReadOnly _d As Single()
+ ' the 2-stage cascade's internal recursive state (12 dB/octave) - no longer what is shown/exported, see
+ ' _intensityOut below and the class summary
+ Private ReadOnly _intensity As Single()
+ ' the first of the two cascaded exponential-filter stages that make up the intensity (see the class summary);
+ ' Nothing when the intensity is not tracked, same as _intensity
+ Private ReadOnly _intensityStage1 As Single()
+ ' the blend of _intensityStage1 and _intensity (IntensityBlend) that is actually shown/exported - see the class
+ ' summary; Nothing when the intensity is not tracked, same as _intensity
+ Private ReadOnly _intensityOut As Single()
+
+ Private ReadOnly _sourceIndex As Integer()
+ Private ReadOnly _sourceLevel As Byte()
+ Private ReadOnly _levelFrequency(255) As Double
+ Private ReadOnly _levelUsed(255) As Boolean
+ Private ReadOnly _levelValue(255) As Single
+ Private ReadOnly _sourceAmplitude As Double
+
+ ' object sources (Sources tab): the flat list of generated point-source elements that are within the canvas
+ Private ReadOnly _objSources As SourceElement()
+ Private ReadOnly _objIndex As Integer()
+
+ ' per-object-source runtime state for pulsed sources whose off-width is re-randomized at runtime (see
+ ' SourceElement.RandomizeOffWidthAmount): _objCycleAnchor(i) is the cycle-clock value (in cycles of the
+ ' element's own frequency) at which its current off+on cycle started, and _objCurrentOffWidth(i) is the
+ ' off-width (in cycles) currently in effect for it. Both are parallel arrays to _objSources/_objIndex.
+ ' Elements that never re-randomize (RandomizeOffWidthAmount <= 0, the common case) never touch this state:
+ ' their position within the cycle is still computed as a pure function of _time, exactly as before.
+ Private ReadOnly _objRandom As New Random()
+ Private ReadOnly _objCycleAnchor As Double()
+ Private ReadOnly _objCurrentOffWidth As Integer()
+
+ ''' <summary>Safety cap on how many off+on cycles ComputePulsePosition will advance through in a single call, so a
+ ''' pathological configuration (e.g. an off-width collapsing towards 0) can never turn into an infinite loop.</summary>
+ Private Const CycleAdvanceGuard As Integer = 1000
+
+ Private _time As Double
+
+ ' the probes: the values of the point probes per step, the intensity totals (per pixel of the line) of the integrating line probes
+ Private _sampler As ProbeSampler
+ Private ReadOnly _probeValues As New List(Of List(Of Single))()
+ Private _profileTotals As Double()()
+
+ ''' <param name="scene">The scene (its arrays are copied).</param>
+ ''' <param name="sourceFrequencyScale">Frequency of a source = green value / 255 * 0.5 * this value.</param>
+ ''' <param name="sourceAmplitude">Amplitude of the sources (1 = the value of the Python code).</param>
+ ''' <param name="trackIntensity">True when the intensity is needed (it costs extra time in every step).</param>
+ ''' <param name="use4thOrderLaplacian">See the class summary (Use4thOrderLaplacian).</param>
+ ''' <param name="timeDecayFactor">SimulationSettings.TimeDecayFactor - see that property's comment.</param>
+ ''' <param name="intensityScale">SimulationSettings.IntensityScale - see that property's comment.</param>
+ ''' <param name="objectSources">The generated elements of the object sources (Sources tab), or Nothing/empty for none.</param>
+ Public Sub New(scene As SceneData, sourceFrequencyScale As Double, sourceAmplitude As Double, trackIntensity As Boolean,
+ use4thOrderLaplacian As Boolean, timeDecayFactor As Double, intensityScale As Double,
+ Optional objectSources As List(Of SourceElement) = Nothing)
+ _sourceAmplitude = sourceAmplitude
+ _use4thOrderLaplacian = use4thOrderLaplacian
+ _intensityScale = CSng(intensityScale)
+ _width = scene.Width
+ _height = scene.Height
+ _stride = _width + 2
+ Dim size As Integer = _stride * (_height + 2)
+
+ _u = New Single(size - 1) {}
+ _uPrev = New Single(size - 1) {}
+ _c2 = New Single(size - 1) {}
+ _d = New Single(size - 1) {}
+ If trackIntensity Then
+ _intensity = New Single(size - 1) {}
+ _intensityStage1 = New Single(size - 1) {}
+ _intensityOut = New Single(size - 1) {}
+ End If
+
+ For y As Integer = 0 To _height - 1
+ Array.Copy(scene.C2, y * _width, _c2, (y + 1) * _stride + 1, _width)
+ Array.Copy(scene.D, y * _width, _d, (y + 1) * _stride + 1, _width)
+ Next
+
+ ' see the class summary: sub-stepping keeps the 4th order stencil stable without changing the physical
+ ' wave speed or damping - _subSteps stays 1 (no sub-stepping) unless the 4th order stencil is in use and
+ ' this scene's highest c^2 actually needs it
+ If use4thOrderLaplacian Then
+ Dim maxC2 As Single = 0.0F
+ For i As Integer = 0 To _c2.Length - 1
+ If _c2(i) > maxC2 Then maxC2 = _c2(i)
+ Next
+ _subSteps = ComputeSubSteps(maxC2)
+ Else
+ _subSteps = 1
+ End If
+
+ If _subSteps > 1 Then
+ Dim dEff As Single() = New Single(_d.Length - 1) {}
+ Dim invN As Double = 1.0 / _subSteps
+ For i As Integer = 0 To _d.Length - 1
+ dEff(i) = CSng(Math.Pow(CDbl(_d(i)), invN))
+ Next
+ _dEffective = dEff
+ _c2Mult = 1.0F / CSng(_subSteps * _subSteps)
+ Else
+ _dEffective = _d
+ _c2Mult = 1.0F
+ End If
+
+ Dim n As Integer = scene.SourceCount
+ _sourceIndex = New Integer(n - 1) {}
+ _sourceLevel = New Byte(n - 1) {}
+ For i As Integer = 0 To n - 1
+ _sourceIndex(i) = (scene.SourceY(i) + 1) * _stride + scene.SourceX(i) + 1
+ _sourceLevel(i) = scene.SourceLevel(i)
+ _levelUsed(scene.SourceLevel(i)) = True
+ Next
+ For level As Integer = 0 To 255
+ _levelFrequency(level) = level / 255.0 * 0.5 * sourceFrequencyScale
+ Next
+
+ ' object sources: keep only the elements whose position is inside the canvas (a randomized composite element can fall outside)
+ If objectSources Is Nothing Then
+ _objSources = Array.Empty(Of SourceElement)()
+ _objIndex = Array.Empty(Of Integer)()
+ Else
+ Dim keptEl As New List(Of SourceElement)()
+ Dim keptIdx As New List(Of Integer)()
+ For Each el As SourceElement In objectSources
+ If el.PosX >= 0 AndAlso el.PosX < _width AndAlso el.PosY >= 0 AndAlso el.PosY < _height Then
+ keptEl.Add(el)
+ keptIdx.Add((el.PosY + 1) * _stride + el.PosX + 1)
+ End If
+ Next
+ _objSources = keptEl.ToArray()
+ _objIndex = keptIdx.ToArray()
+ End If
+
+ ' the intensity's averaging time constant scales inversely with the frequency of the slowest active
+ ' source (image or object; a level of 0 means "no source" and is excluded) - see TimeDecayFactor's comment
+ ' (SimulationSettings.vb) for why, and NominalDecayLevel's comment for the calibration this reproduces
+ Dim minActiveLevel As Integer = 0
+ For level As Integer = 1 To 255
+ If _levelUsed(level) Then
+ minActiveLevel = level
+ Exit For
+ End If
+ Next
+ For Each el As SourceElement In _objSources
+ If el.Level > 0 AndAlso (minActiveLevel = 0 OrElse el.Level < minActiveLevel) Then minActiveLevel = el.Level
+ Next
+ If minActiveLevel = 0 Then minActiveLevel = NominalDecayLevel
+ Dim tauSteps As Double = Math.Max(1.0, timeDecayFactor * NominalDecayLevel / minActiveLevel)
+ _intensityAlpha = CSng(Math.Exp(-1.0 / tauSteps))
+
+ _objCycleAnchor = New Double(_objSources.Length - 1) {}
+ _objCurrentOffWidth = New Integer(_objSources.Length - 1) {}
+ For i As Integer = 0 To _objSources.Length - 1
+ ' the very first cycle uses the off-width already rolled once at "Generate composite source" time;
+ ' later cycles (for elements that opt into it) redraw from OffWidthBase - see ComputePulsePosition
+ _objCurrentOffWidth(i) = _objSources(i).OffWidthCycles
+ Next
+ End Sub
+
+ Public ReadOnly Property Width As Integer Implements IWaveEngine.Width
+ Get
+ Return _width
+ End Get
+ End Property
+
+ Public ReadOnly Property Height As Integer Implements IWaveEngine.Height
+ Get
+ Return _height
+ End Get
+ End Property
+
+ ''' <summary>Distance between two rows in FieldData and IntensityData. Pixel (x, y) is at (y + 1) * Stride + x + 1.</summary>
+ Public ReadOnly Property Stride As Integer Implements IWaveEngine.Stride
+ Get
+ Return _stride
+ End Get
+ End Property
+
+ ''' <summary>The field of the last completed step (with a border of one cell). Do not change.</summary>
+ Public ReadOnly Property FieldData As Single() Implements IWaveEngine.FieldData
+ Get
+ Return _u
+ End Get
+ End Property
+
+ ''' <summary>The averaged intensity (with a border of one cell), or Nothing when it is not tracked. Do not change.</summary>
+ Public ReadOnly Property IntensityData As Single() Implements IWaveEngine.IntensityData
+ Get
+ Return _intensityOut
+ End Get
+ End Property
+
+ Public ReadOnly Property Description As String Implements IWaveEngine.Description
+ Get
+ Return "CPU (" & Environment.ProcessorCount.ToString(System.Globalization.CultureInfo.InvariantCulture) & " threads)"
+ End Get
+ End Property
+
+ ''' <summary>Nothing to do: the field and the intensity are always in memory.</summary>
+ Public Sub PrepareFrame(needField As Boolean, needIntensity As Boolean) Implements IWaveEngine.PrepareFrame
+ End Sub
+
+ Public Sub Dispose() Implements IDisposable.Dispose
+ End Sub
+
+ Public Sub SetProbes(sampler As ProbeSampler) Implements IWaveEngine.SetProbes
+ _probeValues.Clear()
+ _profileTotals = Nothing
+ If sampler Is Nothing OrElse sampler.Count = 0 Then
+ _sampler = Nothing
+ Return
+ End If
+ If sampler.NeedsIntensity AndAlso _intensityOut Is Nothing Then
+ Throw New InvalidOperationException("the intensity is not tracked")
+ End If
+
+ _sampler = sampler
+ _profileTotals = New Double(sampler.Count - 1)() {}
+ For i As Integer = 0 To sampler.Count - 1
+ _probeValues.Add(New List(Of Single)())
+ If sampler.Integrate(i) Then _profileTotals(i) = New Double(sampler.Pixels(i).Length - 1) {}
+ Next
+ End Sub
+
+ Public Sub SampleProbes() Implements IWaveEngine.SampleProbes
+ If _sampler Is Nothing Then Return
+ Dim currentStep As Integer = CInt(_time)
+ For p As Integer = 0 To _sampler.Count - 1
+ If Not _sampler.IsProfile(p) Then
+ Dim data As Single() = If(_sampler.UseIntensity(p), _intensityOut, _u)
+ _probeValues(p).Add(_sampler.Compute(p, data))
+ ElseIf _sampler.Integrate(p) Then
+ ' before "start after step" the totals are simply never added to, so they stay at zero: any intensity
+ ' that arrived earlier is purged rather than being baked into the total once recording starts
+ If _sampler.UseStartAfterStep(p) AndAlso currentStep < _sampler.StartAfterStep(p) Then Continue For
+
+ ' the intensity that has passed every point of the line, added up over the steps
+ Dim px As Integer() = _sampler.Pixels(p)
+ Dim totals As Double() = _profileTotals(p)
+ Dim inten As Single() = _intensityOut
+ For k As Integer = 0 To px.Length - 1
+ totals(k) += inten(px(k))
+ Next
+ End If
+ Next
+ End Sub
+
+ Public Function TakeProbeSamples() As Single()() Implements IWaveEngine.TakeProbeSamples
+ If _sampler Is Nothing Then Return New Single()() {}
+ Dim result As Single()() = New Single(_sampler.Count - 1)() {}
+ For p As Integer = 0 To _sampler.Count - 1
+ result(p) = _probeValues(p).ToArray()
+ _probeValues(p).Clear()
+ Next
+ Return result
+ End Function
+
+ Public Function ReadProbeProfiles() As Single()() Implements IWaveEngine.ReadProbeProfiles
+ If _sampler Is Nothing Then Return New Single()() {}
+ Dim result As Single()() = New Single(_sampler.Count - 1)() {}
+ For p As Integer = 0 To _sampler.Count - 1
+ If Not _sampler.IsProfile(p) Then Continue For
+
+ Dim px As Integer() = _sampler.Pixels(p)
+ Dim values As Single() = New Single(px.Length - 1) {}
+ If _sampler.Integrate(p) Then
+ Dim totals As Double() = _profileTotals(p)
+ For k As Integer = 0 To px.Length - 1
+ values(k) = CSng(totals(k))
+ Next
+ Else
+ Dim data As Single() = If(_sampler.UseIntensity(p), _intensityOut, _u)
+ For k As Integer = 0 To px.Length - 1
+ values(k) = data(px(k))
+ Next
+ End If
+ result(p) = values
+ Next
+ Return result
+ End Function
+
+ ''' <summary>The number of steps done so far (the time in steps).</summary>
+ Public ReadOnly Property Time As Double
+ Get
+ Return _time
+ End Get
+ End Property
+
+ ''' <summary>
+ ''' The number of smaller time steps (see the class summary) that keep c2 * |lambda max| of the 4th order
+ ''' stencil under SubStepTargetLimit for the given (highest, in this scene) c^2; 1 when that is already true.
+ ''' </summary>
+ Private Shared Function ComputeSubSteps(maxC2 As Single) As Integer
+ If maxC2 <= 0.0F Then Return 1
+ Dim n As Double = Math.Ceiling(Math.Sqrt(CDbl(maxC2) * CDbl(FourthOrderLambdaMax) / CDbl(SubStepTargetLimit)))
+ Return Math.Max(1, CInt(n))
+ End Function
+
+ ''' <summary>One time step: apply the sources, then update the field (and the intensity) _subSteps times.</summary>
+ Public Sub AdvanceOneStep() Implements IWaveEngine.AdvanceOneStep
+ ApplySources()
+ For subStep As Integer = 1 To _subSteps
+ UpdateField(_dEffective, _c2Mult, subStep = _subSteps)
+ Next
+ _time += 1.0
+ End Sub
+
+ Private Sub ApplySources()
+ Dim u As Single() = _u
+
+ If _sourceIndex.Length > 0 Then
+ ' sin(phase + frequency * t) * amplitude is the same for all sources with the same green value
+ For level As Integer = 1 To 255
+ If _levelUsed(level) Then
+ _levelValue(level) = CSng(Math.Sin(_levelFrequency(level) * _time) * _sourceAmplitude)
+ End If
+ Next
+
+ For i As Integer = 0 To _sourceIndex.Length - 1
+ Dim idx As Integer = _sourceIndex(i)
+ u(idx) = u(idx) * SourceOpacity + _levelValue(_sourceLevel(i)) * (1.0F - SourceOpacity)
+ Next
+ End If
+
+ For i As Integer = 0 To _objSources.Length - 1
+ Dim el As SourceElement = _objSources(i)
+ ' "detach source": once the run reaches the source's detach step, its drive is faded out linearly over
+ ' the next DetachRampSteps steps (rather than cut instantly), then it stops driving the field entirely
+ ' (not even towards 0) so it releases its hold and stops diffracting waves through that point. A hard
+ ' cutoff would otherwise leave a small kink in the forcing right at the detach step, which can ring.
+ Dim detachFade As Single = 1.0F
+ If el.DetachAfterStep >= 0 Then
+ Dim stepsSinceDetach As Double = _time - el.DetachAfterStep
+ If stepsSinceDetach >= SourceElement.DetachRampSteps Then Continue For
+ If stepsSinceDetach > 0.0 Then
+ detachFade = CSng(1.0 - stepsSinceDetach / SourceElement.DetachRampSteps)
+ End If
+ End If
+ Dim freq As Double = _levelFrequency(el.Level)
+ Dim envelope As Double
+ If el.Mode = SourceMode.Continuous Then
+ envelope = 1.0
+ Else
+ Dim offWidth As Integer
+ Dim isFirstCycle As Boolean
+ Dim pos As Double = ComputePulsePosition(i, el, freq, offWidth, isFirstCycle)
+ envelope = PulseEnvelope(el, pos, offWidth, isFirstCycle)
+ End If
+ Dim v As Single = CSng(Math.Sin(el.PhaseRad + freq * _time) * el.Amplitude * envelope) * detachFade
+ Dim idx As Integer = _objIndex(i)
+ u(idx) = u(idx) * SourceOpacity + v * (1.0F - SourceOpacity)
+ Next
+ End Sub
+
+ ''' <summary>
+ ''' Returns the element's position within its current off+on cycle (0 = the very start of the "off" span, up to
+ ''' but not including its current period), and reports the off-width in effect for that cycle via offWidth.
+ ''' For most elements (RandomizeOffWidthAmount &lt;= 0) the off-width never changes, so this is a pure, stateless
+ ''' function of _time - except that the cycle clock is shifted by the off-width, so the run starts already at the
+ ''' beginning of the "on" span (pos = offWidth) instead of at the start of an off span: a single/non-randomized
+ ''' source sitting silent for its off-width at the very start of a run was never the intent, only ever a side
+ ''' effect of the cycle position formula happening to start at 0. An element with RandomizeOffWidthAmount &gt; 0
+ ''' (only ever a composite source with "Randomize off-width" ticked) keeps the original start-in-off-state
+ ''' behavior instead, since there the elements are meant to desynchronize from a common starting point rather
+ ''' than all begin already mid-pulse. For an element that opted into runtime re-randomization, this also owns
+ ''' that element's runtime state: each time _time has advanced far enough to complete the current cycle, it
+ ''' advances the element's cycle anchor and redraws a fresh off-width (uniformly within +/- RandomizeOffWidthAmount
+ ''' of OffWidthBase) before computing the position - so every source keeps its own, independently-drifting rhythm
+ ''' instead of staying locked to whatever it rolled once at generate time.
+ ''' isFirstCycle reports whether pos falls within the element's very first off+on cycle since the run began -
+ ''' see PulseEnvelope for why that matters for the SmoothedSquare pulse shape.
+ ''' </summary>
+ Private Function ComputePulsePosition(i As Integer, el As SourceElement, freq As Double, ByRef offWidth As Integer, ByRef isFirstCycle As Boolean) As Double
+ ' cycles of the source's own frequency elapsed since t = 0 (not folding in the phase, so the on/off timing
+ ' does not shift when only the phase of the wave itself is changed)
+ Dim cycleClock As Double = freq * _time / (2.0 * Math.PI)
+
+ If el.RandomizeOffWidthAmount <= 0 Then
+ offWidth = el.OffWidthCycles
+ Dim period As Integer = el.OnWidthCycles + offWidth
+ If period <= 0 Then
+ isFirstCycle = True
+ Return 0.0
+ End If
+ ' shifted so cycleClock = 0 lands at pos = offWidth (the start of the "on" span), not pos = 0 (the start
+ ' of an "off" span) - see the summary above
+ Dim adjustedClock As Double = cycleClock + offWidth
+ isFirstCycle = (Math.Floor(adjustedClock / period) = 0.0)
+ Return adjustedClock - period * Math.Floor(adjustedClock / period) ' 0 .. period
+ End If
+
+ offWidth = _objCurrentOffWidth(i)
+ Dim dynPeriod As Integer = el.OnWidthCycles + offWidth
+ If dynPeriod <= 0 Then
+ isFirstCycle = True
+ Return 0.0
+ End If
+
+ Dim pos As Double = cycleClock - _objCycleAnchor(i)
+ Dim guard As Integer = 0
+ While pos >= dynPeriod AndAlso guard < CycleAdvanceGuard
+ _objCycleAnchor(i) += dynPeriod
+ pos -= dynPeriod
+ offWidth = Math.Max(1, el.OffWidthBase + SourceSettings.RandomInt(_objRandom, el.RandomizeOffWidthAmount))
+ _objCurrentOffWidth(i) = offWidth
+ dynPeriod = el.OnWidthCycles + offWidth
+ guard += 1
+ End While
+ If pos < 0.0 Then pos = 0.0 ' should not happen (_time only increases), guarded for safety
+ ' the anchor only ever advances (above) once a cycle has actually completed, so it still reading its initial
+ ' 0 means no cycle has completed yet - we are still in the element's very first (off-first) cycle
+ isFirstCycle = (_objCycleAnchor(i) = 0.0)
+ Return pos
+ End Function
+
+ ''' <summary>
+ ''' For a pulsed source, the source is "off" for offWidth cycles of its own frequency, then "on" for
+ ''' OnWidthCycles cycles, repeating (off precedes on so that, at the start of a run, every source is silent for
+ ''' its own off-width before its first pulse, rather than every source firing simultaneously at t = 0). Within
+ ''' the "on" span the amplitude is shaped by PulseShape: Gaussian tapers smoothly to (about) 0 at both ends of the
+ ''' "on" span, and SmoothedSquare rises and falls quickly (an atan-smoothed square wave, avoiding a hard on/off
+ ''' step that would ring the field). pos and offWidth come from ComputePulsePosition, as does isFirstCycle - see
+ ''' the SmoothedSquare branch below for why that one matters.
+ ''' </summary>
+ Private Function PulseEnvelope(el As SourceElement, pos As Double, offWidth As Integer, isFirstCycle As Boolean) As Double
+ Dim onWidth As Integer = el.OnWidthCycles
+ Dim period As Integer = onWidth + offWidth
+ If period <= 0 Then Return 1.0
+
+ If el.PulseShape = SourcePulseShape.Gaussian Then
+ If pos < offWidth Then Return 0.0
+ Dim onPos As Double = pos - offWidth ' 0 .. onWidth, position within the "on" span
+ Dim center As Double = onWidth / 2.0
+ Dim sigma As Double = Math.Max(onWidth / 6.0, 1.0E-6)
+ Dim d As Double = (onPos - center) / sigma
+ Return Math.Exp(-0.5 * d * d)
+ Else
+ ' a flat-topped pulse (envelope 1 while "on", 0 while "off") with a short, FIXED-width (in cycles, not a
+ ' fraction of the on/off span) smoothed edge at the rise and the fall (see the on-first version's comment
+ ' for why a fixed edge width matters for a large off-width). The math below is exactly the original
+ ' on-first formula, just fed a coordinate shifted so the "on" span starts at 0 (folding around the period
+ ' the same way the original did), which keeps the already-verified edge-smoothing behavior unchanged.
+ Dim shifted As Double = pos - offWidth
+ If shifted < 0.0 Then
+ ' wrapping shifted forward by a full period makes it continue the falling tail of the on-span that
+ ' JUST ended - correct from the second off-span onward, where that on-span really happened. A
+ ' source's very first off-span (isFirstCycle) has no real preceding on-emission to continue from, so
+ ' wrapping there would fabricate one: pos = 0 would land exactly on that phantom falling edge and
+ ' start the run at envelope ~0.5 instead of ~0, emitting a spurious one-cycle "blip" before the
+ ' source actually goes quiet. Left un-wrapped (deeply negative) instead, dRise/dFall below correctly
+ ' place it far from both edges, so the envelope is (very close to) 0 until the real rising edge.
+ If Not isFirstCycle Then shifted += period
+ End If
+ Const EdgeWidth As Double = 0.35
+ Dim dFall As Double = shifted - onWidth ' 0 at the falling edge, grows past it
+ Dim dRise As Double = shifted ' 0 at the rising edge
+ If dRise > period / 2.0 Then dRise -= period ' signed distance to the *nearest* rising edge
+
+ Dim rising As Double = 0.5 + Math.Atan(dRise / EdgeWidth) / Math.PI
+ Dim falling As Double = 0.5 - Math.Atan(dFall / EdgeWidth) / Math.PI
+ Return rising * falling
+ End If
+ End Function
+
+ ''' <summary>
+ ''' One time step of size 1 / _subSteps: dArray is _d itself (_subSteps = 1) or its 1 / _subSteps-th root
+ ''' (see the class summary); c2Mult is 1.0F (_subSteps = 1, an exact no-op) or 1.0F / _subSteps^2; the
+ ''' intensity (if tracked) is only updated when updateIntensity is True, so that its own exponential
+ ''' averaging still runs once per AdvanceOneStep call, from the field after all of its sub-steps, matching
+ ''' its calibration (_intensityAlpha) regardless of how many sub-steps that call takes.
+ ''' </summary>
+ Private Sub UpdateField(dArray As Single(), c2Mult As Single, updateIntensity As Boolean)
+ Dim u As Single() = _u
+ Dim uPrev As Single() = _uPrev
+ Dim c2 As Single() = _c2
+ Dim d As Single() = dArray
+ Dim intensity As Single() = _intensity
+ Dim stage1 As Single() = _intensityStage1
+ Dim intensityOut As Single() = _intensityOut
+ Dim track As Boolean = (intensity IsNot Nothing) AndAlso updateIntensity
+ Dim stride As Integer = _stride
+ Dim w As Integer = _width
+ Dim h As Integer = _height
+ Dim use4th As Boolean = _use4thOrderLaplacian
+ Dim mult As Single = c2Mult
+ Dim alpha As Single = _intensityAlpha
+ Dim blend As Single = IntensityBlend
+ Dim scale As Single = _intensityScale
+
+ Dim bands As Integer = Math.Min(h, Environment.ProcessorCount * 4)
+ Parallel.For(0, bands,
+ Sub(band As Integer)
+ Dim y0 As Integer = CInt(CLng(h) * band \ bands)
+ Dim y1 As Integer = CInt(CLng(h) * (band + 1) \ bands) - 1
+ For y As Integer = y0 To y1
+ Dim idx As Integer = (y + 1) * stride + 1
+ ' the 4th order stencil reaches 2 cells away, so it is only safe for domain rows/columns that
+ ' have that much room before the (1 cell wide) border - the outermost ring of the domain (y = 0,
+ ' y = h - 1, and, per column below, x = 0, x = w - 1) falls back to the original 3x3 kernel
+ Dim rowInterior As Boolean = use4th AndAlso y >= 1 AndAlso y <= h - 2
+ For x As Integer = 0 To w - 1
+ Dim uc As Single = u(idx)
+ Dim laplacian As Single
+ If rowInterior AndAlso x >= 1 AndAlso x <= w - 2 Then
+ laplacian = FourthOrderFar * (u(idx - 2) + u(idx + 2) + u(idx - 2 * stride) + u(idx + 2 * stride)) +
+ FourthOrderNear * (u(idx - 1) + u(idx + 1) + u(idx - stride) + u(idx + stride)) +
+ FourthOrderCenter * uc
+ Else
+ laplacian = KernelCorner * (u(idx - stride - 1) + u(idx - stride + 1) + u(idx + stride - 1) + u(idx + stride + 1)) +
+ KernelEdge * (u(idx - 1) + u(idx + 1) + u(idx - stride) + u(idx + stride)) - uc
+ End If
+ ' the new value replaces the previous one (each cell only reads its own previous value)
+ Dim nv As Single = uc + (uc - uPrev(idx)) * d(idx) + laplacian * c2(idx) * mult
+ uPrev(idx) = nv
+ If track Then
+ ' two cascaded one-pole stages (see the class summary), blended with the 1-stage
+ ' result (IntensityBlend) for the shown/exported intensity rather than using the full
+ ' 2-stage cascade outright
+ Dim s1 As Single = stage1(idx) * alpha + nv * nv * (1.0F - alpha)
+ stage1(idx) = s1
+ Dim s2 As Single = intensity(idx) * alpha + s1 * (1.0F - alpha)
+ intensity(idx) = s2
+ intensityOut(idx) = (s1 * (1.0F - blend) + s2 * blend) * scale
+ End If
+ idx += 1
+ Next
+ Next
+ End Sub)
+
+ ' the array that received the new values is now the current field
+ _uPrev = u
+ _u = uPrev
+ End Sub
+
+End Class
diff --git a/2D_wave_sim_V01/frmDescription.Designer.vb b/2D_wave_sim_V01/frmDescription.Designer.vb
new file mode 100644
index 0000000..eb2f525
--- /dev/null
+++ b/2D_wave_sim_V01/frmDescription.Designer.vb
@@ -0,0 +1,78 @@
+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
+Partial Class frmDescription
+ Inherits System.Windows.Forms.Form
+
+ 'Form overrides dispose to clean up the component list.
+ <System.Diagnostics.DebuggerNonUserCode()> _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Required by the Windows Form Designer
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTE: The following procedure is required by the Windows Form Designer
+ 'It can be modified using the Windows Form Designer.
+ 'Do not modify it using the code editor.
+ <System.Diagnostics.DebuggerStepThrough()> _
+ Private Sub InitializeComponent()
+ Me.TextBox1 = New System.Windows.Forms.TextBox()
+ Me.btnSaveDescription = New System.Windows.Forms.Button()
+ Me.btnCancelDescription = New System.Windows.Forms.Button()
+ Me.SuspendLayout()
+ '
+ 'TextBox1
+ '
+ Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
+ Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.TextBox1.Location = New System.Drawing.Point(22, 23)
+ Me.TextBox1.Multiline = True
+ Me.TextBox1.Name = "TextBox1"
+ Me.TextBox1.Size = New System.Drawing.Size(662, 267)
+ Me.TextBox1.TabIndex = 0
+ '
+ 'btnSaveDescription
+ '
+ Me.btnSaveDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnSaveDescription.Location = New System.Drawing.Point(575, 305)
+ Me.btnSaveDescription.Name = "btnSaveDescription"
+ Me.btnSaveDescription.Size = New System.Drawing.Size(109, 32)
+ Me.btnSaveDescription.TabIndex = 1
+ Me.btnSaveDescription.Text = "OK"
+ Me.btnSaveDescription.UseVisualStyleBackColor = True
+ '
+ 'btnCancelDescription
+ '
+ Me.btnCancelDescription.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
+ Me.btnCancelDescription.Location = New System.Drawing.Point(460, 305)
+ Me.btnCancelDescription.Name = "btnCancelDescription"
+ Me.btnCancelDescription.Size = New System.Drawing.Size(109, 32)
+ Me.btnCancelDescription.TabIndex = 1
+ Me.btnCancelDescription.Text = "Cancel"
+ Me.btnCancelDescription.UseVisualStyleBackColor = True
+ '
+ 'frmDescription
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(705, 349)
+ Me.Controls.Add(Me.btnCancelDescription)
+ Me.Controls.Add(Me.btnSaveDescription)
+ Me.Controls.Add(Me.TextBox1)
+ Me.Name = "frmDescription"
+ Me.Text = "Edit project description"
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+
+ Friend WithEvents TextBox1 As TextBox
+ Friend WithEvents btnSaveDescription As Button
+ Friend WithEvents btnCancelDescription As Button
+End Class
diff --git a/2D_wave_sim_V01/frmDescription.resx b/2D_wave_sim_V01/frmDescription.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/2D_wave_sim_V01/frmDescription.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
diff --git a/2D_wave_sim_V01/frmDescription.vb b/2D_wave_sim_V01/frmDescription.vb
new file mode 100644
index 0000000..629e58b
--- /dev/null
+++ b/2D_wave_sim_V01/frmDescription.vb
@@ -0,0 +1,52 @@
+' Wave Dude 2D - interactive 2D wave simulator
+' Copyright (C) 2026 JJM Vleggaar (Huygens Optics)
+' SPDX-License-Identifier: GPL-3.0-or-later
+'
+' This file is part of Wave Dude 2D.
+'
+' Wave Dude 2D 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.
+'
+' Wave Dude 2D is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU General Public License for more details.
+'
+' You should have received a copy of the GNU General Public License
+' along with Wave Dude 2D. If not, see <https://www.gnu.org/licenses/>.
+
+Option Strict On
+Option Explicit On
+
+''' <summary>
+''' Lets the user type or edit a free-form description of the current project. Opened modally from Form1's
+''' btnDescription_Click, which sets DescriptionText before ShowDialog and reads it back (and saves it to
+''' the project) only when the dialog returns DialogResult.OK (btnSaveDescription); btnCancelDescription
+''' discards any typing.
+''' </summary>
+Public Class frmDescription
+
+ ''' <summary>The text being edited. Form1 sets this before showing the dialog and reads it back after
+ ''' a DialogResult.OK.</summary>
+ Public Property DescriptionText As String
+ Get
+ Return TextBox1.Text
+ End Get
+ Set(value As String)
+ TextBox1.Text = value
+ End Set
+ End Property
+
+ Private Sub btnSaveDescription_Click(sender As Object, e As EventArgs) Handles btnSaveDescription.Click
+ Me.DialogResult = DialogResult.OK
+ Me.Close()
+ End Sub
+
+ Private Sub btnCancelDescription_Click(sender As Object, e As EventArgs) Handles btnCancelDescription.Click
+ Me.DialogResult = DialogResult.Cancel
+ Me.Close()
+ End Sub
+
+End Class