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#
A lens row's icon is its own profile; the Mirror box renames the part; the menu entry reads Lens/Mirror
Alexander Graef2e56a0765d24
diff --git a/CLAUDE.md b/CLAUDE.mdindex 3f9866c..91ea100 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -226,7 +226,11 @@ FrameStore: native memory up to the budget, the rest in a temp file (%LOCALAPPDAIcons that Segoe MDL2 Assets has too, for Windows 10; the `IconGlyphText` style, greyscale) or `MenuIcon.Drawing`, thename of an `Icon<Name>` (and `Icon<Name>Fill`) `StreamGeometry` in `Themes/Controls.xaml`; both make an `IconView`,which the tree's rows and toolbar use directly (`PlusBadge` on the add buttons) and which draws in the inherited text- colour, so a disabled row's icon greys with its name through one trigger on the row. Drawings are 16 px, 1 px strokes+ colour, so a disabled row's icon greys with its name through one trigger on the row. A lens row's icon is its own+ profile (2026-10-29, the user's design): nine `IconLens<Left><Right>` drawings, each surface convex, flat or concave by+ its radius's sign, chosen by `LensIconConverter` from R1 and R2 in a template scoped to the row's icon, so it follows an+ edit; the Part menu's `IconLens` is the biconvex one. The Mirror box renames the part, Lens to Mirror and back+ (`LensPart.MirrorName`, run by the box's command and never by the setter, so a loaded or undone name stays). Drawings are 16 px, 1 px strokeson half pixels, ink in rows and columns 0 to 14 (odd, so it centres like text); every tree row, toolbar button andmenu entry is 23 px, the menu bar's headers through their padding. The pictures' handle glyphs stay in`PreviewPane.xaml`, odd-sized (21, 15, 13 px) with the point at the centre pixel (2026-10-26, Jeroen's report: at 20 px thediff --git a/OpticalParts.md b/OpticalParts.mdindex 4cabeac..9bffead 100644--- a/OpticalParts.md+++ b/OpticalParts.md@@ -81,7 +81,9 @@ left surface) and `R2` −300 (R1 > 0 and R2 < 0 bulge outward, 0 is flat), `Refx'₂ = t/2 + s₂(y'), the sag s(y') = R − sign(R)·√(R² − y'²). The diameter and the centre thickness are the bulk: a radiustoo curved for them is raised to the smallest that fits (`FitRadii`), so the lens fills its diameter and the edge isnever negative (a diameter of 2000 with radii of 300 had given a tiny lens). The form shows the edge thickness, and a-"Concave" box flips both radii. A curved mirror is the same shape with `Mirror` on. On the pictures the size grip+"Concave" box flips both radii. A curved mirror is the same shape with `Mirror` on; ticking the box renames the part, Lens to Mirror and back+(`LensPart.MirrorName`, applied by the box's command, 2026-10-29, the user's design), and the tree row's icon is the+part's own profile, each surface convex, flat or concave by its radius's sign. On the pictures the size gripstretches the lens as a rectangle's grip does: across, the diameter with the profile held; along, the whole profilewith its sags and edge, so a thinner lens is the same lens squashed; diagonally, the lens as a whole; the arcs arerefitted as circles through the stretched rim and vertex, and nothing stops the grip (`SetExtents`; 2026-10-26, Jeroen'sdiff --git a/WaveDudeNext.WPF/Commands/PartCommands.cs b/WaveDudeNext.WPF/Commands/PartCommands.csindex 1908ff4..717c26b 100644--- a/WaveDudeNext.WPF/Commands/PartCommands.cs+++ b/WaveDudeNext.WPF/Commands/PartCommands.cs@@ -19,7 +19,7 @@ using System.Windows.Input;namespace WaveDudeNext.WPF.Commands;-/// <summary>Commands of the part editors, bound on the views themselves: the point list of an outline (<c>Views/PartPointsView</c>) and the node list of a fibre's path (<c>Views/FiberPathView</c>, 2026-10-22), nothing else since the chain toggle replaced the Square and Circle buttons (2026-10-20).</summary>+/// <summary>Commands of the part editors, bound on the views themselves: the point list of an outline (<c>Views/PartPointsView</c>), the node list of a fibre's path (<c>Views/FiberPathView</c>, 2026-10-22) and the lens's Mirror box (<c>Views/LensPartView</c>, 2026-10-29).</summary>public static class PartCommands{/// <summary>Appends a point after the last one.</summary>@@ -27,4 +27,11 @@ public static class PartCommands/// <summary>Removes the point given as parameter.</summary>public static readonly RoutedUICommand RemovePoint = new("Remove point", nameof(RemovePoint), typeof(PartCommands));++ /// <summary>+ /// The lens's Mirror box was ticked or unticked by the user (the box's own command, run after its binding has set the+ /// flag): the part's name follows, Lens becoming Mirror and back (<see cref="Model.LensPart.MirrorName"/>, 2026-10-29,+ /// the user's design). The parameter is the <see cref="Model.LensPart"/>.+ /// </summary>+ public static readonly RoutedUICommand MirrorToggled = new("Mirror toggled", nameof(MirrorToggled), typeof(PartCommands));}diff --git a/WaveDudeNext.WPF/Converters/LensIconConverter.cs b/WaveDudeNext.WPF/Converters/LensIconConverter.csnew file mode 100644index 0000000..37650d3--- /dev/null+++ b/WaveDudeNext.WPF/Converters/LensIconConverter.cs@@ -0,0 +1,42 @@+// SPDX-License-Identifier: GPL-3.0-or-later+// Copyright (C) 2026 Alexander Graef <[email protected]>+//+// This file is part of WaveDude Next, a 2D wave simulator.+//+// Based on the work of+// Jeroen Vleggaar (Huygens Optics), author of Wave Dude 2D, Copyright (C) 2026+// <https://www.youtube.com/@HuygensOptics>, <https://www.huygensoptics.com>+// 0x23 (Diffraction Limited), author of WaveSimulator2D+// <https://www.youtube.com/@DiffractionLimited>, <https://github.com/0x23/WaveSimulator2D>+//+// WaveDude Next is free software: you can redistribute it and/or modify it under+// the terms of the GNU General Public License as published by the Free Software+// Foundation, either version 3 of the License, or (at your option) any later+// version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or+// <https://www.gnu.org/licenses/>.++using System.Globalization;+using System.Windows.Data;+using WaveDudeNext.Model;++namespace WaveDudeNext.WPF.Converters;++/// <summary>+/// The icon drawing of a lens or mirror by its radii (2026-10-29, the user's design): <c>Lens</c> followed by the shape of each+/// surface, <c>Convex</c>, <c>Flat</c> or <c>Concave</c>, the name of the theme's <c>IconLens{left}{right}</c> geometry. The+/// inputs are <see cref="LensPart.R1"/> and <see cref="LensPart.R2"/>, signed as the model signs them: R1 above 0 and R2 below+/// 0 bulge outward, 0 is flat; the fit never changes a sign. The kind's own symbol, <c>Lens</c>, stands in until both arrive.+/// </summary>+public sealed class LensIconConverter : IMultiValueConverter+{+ /// <inheritdoc/>+ public object Convert(object[] values, Type targetType, object? parameter, CultureInfo culture) =>+ values is [double r1, double r2] ? "Lens" + Shape(r1) + Shape(-r2) : "Lens";++ /// <summary>The surface's shape for a radius signed so that positive bulges outward.</summary>+ private static string Shape(double outward) => outward > 0.0 ? "Convex" : outward < 0.0 ? "Concave" : "Flat";++ /// <inheritdoc/>+ public object[] ConvertBack(object? value, Type[] targetTypes, object? parameter, CultureInfo culture) =>+ throw new NotSupportedException();+}diff --git a/WaveDudeNext.WPF/Panes/ProjectTree.xaml b/WaveDudeNext.WPF/Panes/ProjectTree.xamlindex 6998820..d03c428 100644--- a/WaveDudeNext.WPF/Panes/ProjectTree.xaml+++ b/WaveDudeNext.WPF/Panes/ProjectTree.xaml@@ -34,6 +34,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<converters:TreeIdConverter x:Key="TreeId" /><converters:IsTypeConverter x:Key="IsType" /><converters:PartIconConverter x:Key="PartIcon" />+ <converters:LensIconConverter x:Key="LensIcon" /><StreamGeometry x:Key="PlusGeometry">M4,0 L4,8 M0,4 L8,4</StreamGeometry><StreamGeometry x:Key="MinusGeometry">M0,4 L8,4</StreamGeometry>@@ -360,7 +361,26 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<CheckBox DockPanel.Dock="Left" Focusable="False" IsTabStop="False" MinHeight="0" Margin="0,0,4,0" VerticalAlignment="Center"IsChecked="{Binding Enabled}" ToolTip="{DynamicResource TipPartEnabled}"AutomationProperties.Name="{DynamicResource TipPartEnabled}" AutomationProperties.AutomationId="{Binding Name, StringFormat='Enabled:{0}'}" />- <controls:IconView DockPanel.Dock="Left" Drawing="{Binding Converter={StaticResource PartIcon}}" Margin="0,0,4,0" VerticalAlignment="Center" />+ <!-- the kind's icon; a lens's follows its radii (2026-10-29, the user's design): the lens template reads them and refreshes+ with them, the other kinds take the kind's drawing; the two templates are scoped here so the rows' templates by+ type stay untouched -->+ <ContentControl DockPanel.Dock="Left" Content="{Binding}" Focusable="False" IsTabStop="False" Margin="0,0,4,0" VerticalAlignment="Center">+ <ContentControl.Resources>+ <DataTemplate DataType="{x:Type model:LensPart}">+ <controls:IconView>+ <controls:IconView.Drawing>+ <MultiBinding Converter="{StaticResource LensIcon}">+ <Binding Path="R1" />+ <Binding Path="R2" />+ </MultiBinding>+ </controls:IconView.Drawing>+ </controls:IconView>+ </DataTemplate>+ <DataTemplate DataType="{x:Type model:OpticalPart}">+ <controls:IconView Drawing="{Binding Converter={StaticResource PartIcon}}" />+ </DataTemplate>+ </ContentControl.Resources>+ </ContentControl><TextBlock Text="{Binding Name}" VerticalAlignment="Center" /></DockPanel></DataTemplate>diff --git a/WaveDudeNext.WPF/Strings/Strings.DE.xaml b/WaveDudeNext.WPF/Strings/Strings.DE.xamlindex bab38b5..a8c67ad 100644--- a/WaveDudeNext.WPF/Strings/Strings.DE.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.DE.xaml@@ -128,7 +128,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="MenuProjectAddSource">_Quelle hinzufügen</s:String><s:String x:Key="MenuProjectAddProbe">_Sonde hinzufügen</s:String><s:String x:Key="MenuProjectAddPart">_Bauteil hinzufügen</s:String>- <s:String x:Key="MenuAddLens">_Linse oder Spiegel</s:String>+ <s:String x:Key="MenuAddLens">_Linse/Spiegel</s:String><s:String x:Key="MenuAddPolygon">_Polygon</s:String><s:String x:Key="MenuAddRectangle">_Rechteck</s:String><s:String x:Key="MenuAddEllipse">_Ellipse</s:String>diff --git a/WaveDudeNext.WPF/Strings/Strings.EN.xaml b/WaveDudeNext.WPF/Strings/Strings.EN.xamlindex 47f95f7..0ab6d93 100644--- a/WaveDudeNext.WPF/Strings/Strings.EN.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.EN.xaml@@ -130,7 +130,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="MenuProjectAddSource">Add _source</s:String><s:String x:Key="MenuProjectAddProbe">Add _probe</s:String><s:String x:Key="MenuProjectAddPart">Add p_art</s:String>- <s:String x:Key="MenuAddLens">_Lens or mirror</s:String>+ <s:String x:Key="MenuAddLens">_Lens/Mirror</s:String><s:String x:Key="MenuAddPolygon">_Polygon</s:String><s:String x:Key="MenuAddRectangle">_Rectangle</s:String><s:String x:Key="MenuAddEllipse">_Ellipse</s:String>diff --git a/WaveDudeNext.WPF/Strings/Strings.FR.xaml b/WaveDudeNext.WPF/Strings/Strings.FR.xamlindex 99f70a8..72cd7a1 100644--- a/WaveDudeNext.WPF/Strings/Strings.FR.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.FR.xaml@@ -128,7 +128,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="MenuProjectAddSource">Ajouter une _source</s:String><s:String x:Key="MenuProjectAddProbe">Ajouter une s_onde</s:String><s:String x:Key="MenuProjectAddPart">Ajouter un _composant</s:String>- <s:String x:Key="MenuAddLens">_Lentille ou miroir</s:String>+ <s:String x:Key="MenuAddLens">_Lentille/Miroir</s:String><s:String x:Key="MenuAddPolygon">_Polygone</s:String><s:String x:Key="MenuAddRectangle">_Rectangle</s:String><s:String x:Key="MenuAddEllipse">_Ellipse</s:String>diff --git a/WaveDudeNext.WPF/Strings/Strings.NL.xaml b/WaveDudeNext.WPF/Strings/Strings.NL.xamlindex c6d2ba6..c04604b 100644--- a/WaveDudeNext.WPF/Strings/Strings.NL.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.NL.xaml@@ -128,7 +128,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="MenuProjectAddSource">_Bron toevoegen</s:String><s:String x:Key="MenuProjectAddProbe">_Sonde toevoegen</s:String><s:String x:Key="MenuProjectAddPart">_Onderdeel toevoegen</s:String>- <s:String x:Key="MenuAddLens">_Lens of spiegel</s:String>+ <s:String x:Key="MenuAddLens">_Lens/Spiegel</s:String><s:String x:Key="MenuAddPolygon">_Polygoon</s:String><s:String x:Key="MenuAddRectangle">_Rechthoek</s:String><s:String x:Key="MenuAddEllipse">_Ellips</s:String>diff --git a/WaveDudeNext.WPF/Themes/Controls.xaml b/WaveDudeNext.WPF/Themes/Controls.xamlindex 782799c..d107c04 100644--- a/WaveDudeNext.WPF/Themes/Controls.xaml+++ b/WaveDudeNext.WPF/Themes/Controls.xaml@@ -261,8 +261,20 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<!-- the app's own menu icons (controls:MenuIcon.Drawing, 2026-10-23) for entries the icon font has no glyph for: 16 pxline drawings, stroked at 1 px on half pixels so the lines are crisp at 100 %, a Fill geometry for the solid parts -->- <!-- a biconvex lens -->- <StreamGeometry x:Key="IconLens">M8,1.5 C11.5,4.5 11.5,11.5 8,14.5 C4.5,11.5 4.5,4.5 8,1.5 Z</StreamGeometry>+ <!-- a lens or mirror: the kind's symbol is biconvex; a part's row shows its own profile, each surface convex, flat or concave by+ its radius (2026-10-29, the user's design): a convex surface bows out from a rim 1.5 px off the centre, a flat one is a+ line 2.5 px off, a concave one bows in from a rim 4.5 px off, so a biconcave lens is thick at the rim and thin in the+ middle; the rims are joined along the top and the bottom -->+ <StreamGeometry x:Key="IconLens">M6.5,1.5 C2,4.5 2,11.5 6.5,14.5 L9.5,14.5 C14,11.5 14,4.5 9.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensConvexConvex">M6.5,1.5 C2,4.5 2,11.5 6.5,14.5 L9.5,14.5 C14,11.5 14,4.5 9.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensConvexFlat">M6.5,1.5 C2,4.5 2,11.5 6.5,14.5 L10.5,14.5 L10.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensConvexConcave">M6.5,1.5 C2,4.5 2,11.5 6.5,14.5 L12.5,14.5 C10.5,11.5 10.5,4.5 12.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensFlatConvex">M5.5,1.5 L5.5,14.5 L9.5,14.5 C14,11.5 14,4.5 9.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensFlatFlat">M5.5,1.5 L5.5,14.5 L10.5,14.5 L10.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensFlatConcave">M5.5,1.5 L5.5,14.5 L12.5,14.5 C10.5,11.5 10.5,4.5 12.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensConcaveConvex">M3.5,1.5 C5.5,4.5 5.5,11.5 3.5,14.5 L9.5,14.5 C14,11.5 14,4.5 9.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensConcaveFlat">M3.5,1.5 C5.5,4.5 5.5,11.5 3.5,14.5 L10.5,14.5 L10.5,1.5 Z</StreamGeometry>+ <StreamGeometry x:Key="IconLensConcaveConcave">M3.5,1.5 C5.5,4.5 5.5,11.5 3.5,14.5 L12.5,14.5 C10.5,11.5 10.5,4.5 12.5,1.5 Z</StreamGeometry><!-- an S-bent fibre --><StreamGeometry x:Key="IconFiber">M1,13.5 C7,13.5 9,5.5 15,5.5 M1,10.5 C7,10.5 9,2.5 15,2.5</StreamGeometry><!-- alternating layers -->diff --git a/WaveDudeNext.WPF/Views/LensPartView.xaml b/WaveDudeNext.WPF/Views/LensPartView.xamlindex cf67287..ecbd4f5 100644--- a/WaveDudeNext.WPF/Views/LensPartView.xaml+++ b/WaveDudeNext.WPF/Views/LensPartView.xaml@@ -24,7 +24,13 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file orxmlns:converters="clr-namespace:WaveDudeNext.WPF.Converters"xmlns:meta="clr-namespace:WaveDudeNext.WPF.Markup"xmlns:views="clr-namespace:WaveDudeNext.WPF.Views"- xmlns:model="clr-namespace:WaveDudeNext.Model;assembly=WaveDudeNext">+ xmlns:model="clr-namespace:WaveDudeNext.Model;assembly=WaveDudeNext"+ xmlns:commands="clr-namespace:WaveDudeNext.WPF.Commands">++ <!-- the Mirror box's command: the name follows the flag (2026-10-29, the user's design) -->+ <UserControl.CommandBindings>+ <CommandBinding Command="{x:Static commands:PartCommands.MirrorToggled}" Executed="OnMirrorToggled" />+ </UserControl.CommandBindings><UserControl.Resources><converters:LensEdgeConverter x:Key="EdgeThickness" />@@ -44,8 +50,10 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<Label Style="{StaticResource FormSection}" Content="{DynamicResource SectionMaterial}" /><controls:FormPanel>+ <!-- the box toggles the flag through its binding, then its command renames the part to match (Lens 1 to Mirror 1 and back) --><CheckBox controls:FormPanel.FullWidth="True" Content="{meta:Label model:LensPart.Mirror}"- IsChecked="{Binding Mirror}" ToolTip="{meta:Hint model:LensPart.Mirror}" AutomationProperties.AutomationId="PartMirror" />+ IsChecked="{Binding Mirror}" ToolTip="{meta:Hint model:LensPart.Mirror}" AutomationProperties.AutomationId="PartMirror"+ Command="{x:Static commands:PartCommands.MirrorToggled}" CommandParameter="{Binding}" /><TextBlock Style="{StaticResource FormLabel}" Text="{meta:Label model:LensPart.RefractiveIndex}" /><controls:NumberBox Style="{StaticResource GlassOnly}" Text="{Binding RefractiveIndex}" Minimum="1" Maximum="2.55" Increment="0.01"diff --git a/WaveDudeNext.WPF/Views/LensPartView.xaml.cs b/WaveDudeNext.WPF/Views/LensPartView.xaml.csindex ed77aa9..13f6ee8 100644--- a/WaveDudeNext.WPF/Views/LensPartView.xaml.cs+++ b/WaveDudeNext.WPF/Views/LensPartView.xaml.cs@@ -16,14 +16,31 @@// <https://www.gnu.org/licenses/>.using System.Windows.Controls;+using System.Windows.Input;+using WaveDudeNext.Model;+using WaveDudeNext.WPF.Commands;namespace WaveDudeNext.WPF.Views;-/// <summary>Editor for a <see cref="WaveDudeNext.Model.LensPart"/>: a lens or a curved or flat mirror.</summary>+/// <summary>Editor for a <see cref="LensPart"/>: a lens or a curved or flat mirror.</summary>public partial class LensPartView : UserControl{public LensPartView(){InitializeComponent();}++ /// <summary>+ /// <see cref="PartCommands.MirrorToggled"/>: the Mirror box was ticked or unticked by the user, its binding has set the+ /// flag, and the name follows it, Lens becoming Mirror and back (<see cref="LensPart.MirrorName"/>; 2026-10-29, the user's+ /// design). Here and not in the setter, so a loaded, pasted or undone name stays what it was; the flag and the name land+ /// in one undo step.+ /// </summary>+ private void OnMirrorToggled(object sender, ExecutedRoutedEventArgs e)+ {+ if (e.Parameter is LensPart lens)+ {+ lens.Name = LensPart.MirrorName(lens.Name, lens.Mirror);+ }+ }}diff --git a/WaveDudeNext/Model/OpticalPart.cs b/WaveDudeNext/Model/OpticalPart.csindex 4bfd506..2b36170 100644--- a/WaveDudeNext/Model/OpticalPart.cs+++ b/WaveDudeNext/Model/OpticalPart.cs@@ -19,6 +19,7 @@ using System.Collections.ObjectModel;using System.Collections.Specialized;using System.ComponentModel;using System.ComponentModel.DataAnnotations;+using System.Text.RegularExpressions;using System.Xml.Serialization;using WaveDudeNext.Parts;@@ -287,6 +288,18 @@ public sealed class LensPart : OpticalPartset => SetProperty(ref _mirror, value);}+ /// <summary>+ /// <paramref name="name"/> with the word Lens replaced by Mirror when <paramref name="mirror"/> is set and Mirror by Lens+ /// when not, so "Lens 1" ticked as a mirror reads "Mirror 1" and unticked "Lens 1" again (2026-10-29, the user's design); a+ /// name with neither word is as given. The English stems, whatever the language, as <see cref="NameStem"/> is. The window+ /// applies it when the user ticks the box, not the setter, so a loaded, pasted or undone name stays what it was.+ /// </summary>+ public static string MirrorName(string name, bool mirror) =>+ mirror ? WordLens.Replace(name, "Mirror") : WordMirror.Replace(name, "Lens");++ private static readonly Regex WordLens = new(@"\bLens\b", RegexOptions.CultureInvariant);+ private static readonly Regex WordMirror = new(@"\bMirror\b", RegexOptions.CultureInvariant);+/// <summary>Refractive index of the glass, 1.00 to 2.55 in steps of 0.01; not used by a mirror.</summary>[XmlAttribute][DefaultValue(DefaultIndex)]diff --git a/_tools/library_check/Program.cs b/_tools/library_check/Program.csindex 74c7368..38f27eb 100644--- a/_tools/library_check/Program.cs+++ b/_tools/library_check/Program.cs@@ -2633,6 +2633,11 @@ internal static class Programshaped = new LensPart { X = 500, Y = 300, Diameter = 100, Thickness = 20, R1 = 0, R2 = 0 };shaped.SetVertex(1, -30.0, -0.3, 10.0);Check(shaped.R1 == 56.94 && shaped.Thickness == 40, $"a vertex dragged against a rim a fraction of a pixel off gets a radius of two decimals, {shaped.R1}, rounded up");+ // the name follows the Mirror box (2026-10-29, the user's design): the word Lens becomes Mirror and back, whole words only, other names untouched+ Check(LensPart.MirrorName("Lens 1", true) == "Mirror 1" && LensPart.MirrorName("Mirror 1", false) == "Lens 1", "MirrorName: Lens 1 ticked is Mirror 1, unticked Lens 1 again");+ Check(LensPart.MirrorName("Lens 1", false) == "Lens 1" && LensPart.MirrorName("Mirror 1", true) == "Mirror 1", "MirrorName: a name that already matches the flag is as given");+ Check(LensPart.MirrorName("Lensing stage", true) == "Lensing stage" && LensPart.MirrorName("Objective", true) == "Objective" && LensPart.MirrorName("lens 2", true) == "lens 2",+ "MirrorName: whole words in the user's case only; other names are as given");lens.Diameter = 100;lens.Thickness = 40;lens.R1 = 300;