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 selected part shows its outline, a size grip and point handles; dragging them stays smooth
Alexander Graef5fdadc2e87e9
diff --git a/CLAUDE.md b/CLAUDE.mdindex 4d6a69d..7c8b720 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -150,7 +150,9 @@ FrameStore: native memory up to the budget, the rest in a temp file (%LOCALAPPDAper kind; painted into the scene's red channel (4 × 4 supersampled, a mirror by the pixel-centre test as red 0, acoating band of √n, later parts over earlier ones; a part's centre is the corner of pixel (X, Y), so even sizes coverwhole pixels). A part edit is a simulation edit. Tree folder "Parts", "+ Part" opens a menu of kinds (Space, arrows,- Enter), a handle plus a rotation lever on the pictures, the shape shows through the glowing outline.+ Enter), a handle plus a rotation lever on the pictures; while selected, the outline as painted in the accent colour,+ a size grip on a corner or vertex (rectangle, lens, polygon, triangle, GRIN, Bragg) and a handle per point of an outline+ or fibre (2026-10-19); the shape shows through the glowing outline otherwise.- File types `.wdproj` / `.wdscheme` are registered per user at start-up; unsaved edits ask on close.## Numbers (workstation: 10-core Xeon without AVX2, RTX 2080, 64 GB)@@ -159,7 +161,8 @@ GPU step at 1080p 0.25–0.5 ms, CPU 6–14 ms; OpenCL build 0.3 s; a full-HD ruthe GPU readback. Renderer per 2880×1080 layer on ten cores: 8-bit 1.0 ms, 16-bit 2.0; vector rows gain 2× percore over scalar. Presenter about 7 ms a frame quiet, 20 during a run. JPEG 1080p at 4:4:4: WIC 26 ms a framesingle-threaded (9 ms a frame in a sequence job on half the cores), in-house 9.8 ms on ten cores (15 in a job);-MP4 job 16 ms a frame. Laptop (2 cores, HD 520, HDD): iGPU 4.3 ms a step against CPU 14.7; the ball+MP4 job 16 ms a frame. Part painter on a Full HD canvas (ten cores): a 400 × 330 outline 30 ms, a 400 px lens 5, a hexagon 8;+the glowing edges 22 ms; the preview's scene pictures about 100 ms more, so the scene rebuild is coalesced at background priority. Laptop (2 cores, HD 520, HDD): iGPU 4.3 ms a step against CPU 14.7; the balllens run 105 s full quality (disk-bound), 61 s at half resolution with every second frame, in RAM. Settled by thesenumbers: no GPU JPEG, no OpenCL colouring at presentation, no `Vector256`, no Direct3D display path.diff --git a/OpticalParts.md b/OpticalParts.mdindex 02213fd..c297a4c 100644--- a/OpticalParts.md+++ b/OpticalParts.md@@ -18,8 +18,11 @@ shown), `OutlinePart` (points). The "+ Part" menu lists the optics, a separator,source's circular crosshair with an inner ring (a lens-shaped glyph read as squashed). A lens's diameter and centrethickness are its bulk: radii too curved for them are raised to the smallest that fits (`LensPart.FitRadii`), so the lensalways fills its diameter; the form shows the edge thickness (a diameter of 2000 with radii of 300 had given a tiny lens).-A "Concave (diverging)" box shows the lens's state from the lensmaker's sign and, ticked, flips both radii. Not built: stage 3 (`PartCheck.ps1`, the three-examples) and the selected part's accent outline. The open points at the end still stand.+A "Concave (diverging)" box shows the lens's state from the lensmaker's sign and, ticked, flips both radii.+While a part is selected the overlay draws its outline (`OpticalPart.Outline()`, the painted shape) in the accent colour,+a size grip on a corner or vertex sets the extents by drag or arrow keys, and an outline's or fibre's points each have a+handle (2026-10-19). Not built: stage 3 (`PartCheck.ps1`, the three+examples). The open points at the end still stand.## What is askeddiff --git a/WaveDudeNext.WPF/Controls/MarkerThumb.cs b/WaveDudeNext.WPF/Controls/MarkerThumb.csindex 2926c8e..ee928f4 100644--- a/WaveDudeNext.WPF/Controls/MarkerThumb.cs+++ b/WaveDudeNext.WPF/Controls/MarkerThumb.cs@@ -31,6 +31,10 @@ public enum MarkerRolePart,/// <summary>The rotation handle of an optical part: sits on the part's axis beyond its reach and turns it.</summary>PartAngle,+ /// <summary>The size grip of an optical part: a corner or vertex of its outline that sets its extents (2026-10-19).</summary>+ PartGrip,+ /// <summary>One point of an outline's or fibre's point list (<see cref="MarkerThumb.Index"/> says which).</summary>+ PartPoint,/// <summary>Point A of a probe (the point of a point probe, the start of a line probe).</summary>ProbeA,/// <summary>Point B of a line probe.</summary>@@ -68,13 +72,18 @@ public sealed class MarkerThumb : Thumb/// <param name="item">The source, part or probe.</param>/// <param name="role">Which point of it.</param>- public MarkerThumb(object item, MarkerRole role)+ /// <param name="index">For <see cref="MarkerRole.PartPoint"/>, the index in the part's point list.</param>+ public MarkerThumb(object item, MarkerRole role, int index = -1){Item = item;Role = role;+ Index = index;Focusable = true;}+ /// <summary>For a point handle, the index in the part's point list; -1 otherwise.</summary>+ public int Index { get; }+/// <summary>The source, part or probe this handle moves.</summary>public object Item { get; }diff --git a/WaveDudeNext.WPF/Controls/SceneOverlay.cs b/WaveDudeNext.WPF/Controls/SceneOverlay.csindex f09d9ef..8041e9f 100644--- a/WaveDudeNext.WPF/Controls/SceneOverlay.cs+++ b/WaveDudeNext.WPF/Controls/SceneOverlay.cs@@ -15,6 +15,7 @@// version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or// <https://www.gnu.org/licenses/>.+using System.Collections.ObjectModel;using System.Collections.Specialized;using System.ComponentModel;using System.Globalization;@@ -33,8 +34,9 @@ namespace WaveDudeNext.WPF.Controls;/// handles (<see cref="MarkerThumb"/>): a source's position, a part's centre, a point probe's point, a line probe's two/// ends with the line between them, plus the emitters of a composite source as dots, its rotation handle on/// the row axis (shown while the source is selected; drag turns the array; Shift snaps to 15°; the arrow keys-/// turn it by a degree, 2026-10-14), the same handle on a part's axis (2026-10-18; the part's shape itself shows-/// through the glowing outline of the scene) and the item names as labels. Dragging a handle, or moving it with the arrow keys while it has keyboard focus, writes the+/// turn it by a degree, 2026-10-14), the same handle on a part's axis (2026-10-18), and, while a part is selected, its+/// outline in the accent colour with a size grip on a corner or vertex (drag sets the extents) and a handle on each+/// point of an outline's or fibre's list (2026-10-19, the user's request), plus the item names as labels. Dragging a handle, or moving it with the arrow keys while it has keyboard focus, writes the/// new canvas coordinates to the model; grabbing or focusing a handle makes its item the/// <see cref="SelectedItem"/>. The overlay fills the same rectangle as the picture (an/// <see cref="Image"/> with <see cref="Stretch.Uniform"/>), so it maps canvas pixels to its own@@ -72,6 +74,14 @@ public sealed class SceneOverlay : Panelpublic static readonly DependencyProperty PartStyleProperty = DependencyProperty.Register(nameof(PartStyle), typeof(Style), typeof(SceneOverlay), new PropertyMetadata(null, (d, _) => ((SceneOverlay)d).Rebuild()));+ /// <summary>Identifies the <see cref="GripStyle"/> property.</summary>+ public static readonly DependencyProperty GripStyleProperty = DependencyProperty.Register(+ nameof(GripStyle), typeof(Style), typeof(SceneOverlay), new PropertyMetadata(null, (d, _) => ((SceneOverlay)d).Rebuild()));++ /// <summary>Identifies the <see cref="PointStyle"/> property.</summary>+ public static readonly DependencyProperty PointStyleProperty = DependencyProperty.Register(+ nameof(PointStyle), typeof(Style), typeof(SceneOverlay), new PropertyMetadata(null, (d, _) => ((SceneOverlay)d).Rebuild()));+/// <summary>Identifies the <see cref="AngleStyle"/> property.</summary>public static readonly DependencyProperty AngleStyleProperty = DependencyProperty.Register(nameof(AngleStyle), typeof(Style), typeof(SceneOverlay), new PropertyMetadata(null, (d, _) => ((SceneOverlay)d).Rebuild()));@@ -107,6 +117,7 @@ public sealed class SceneOverlay : Panelprivate static readonly Typeface LabelTypeface = new("Segoe UI");private readonly HashSet<INotifyPropertyChanged> _subscribed = [];+ private readonly HashSet<INotifyCollectionChanged> _pointLists = [];private bool _regenerating;public SceneOverlay()@@ -173,6 +184,20 @@ public sealed class SceneOverlay : Panelset => SetValue(PartStyleProperty, value);}+ /// <summary>Style of a part's size grip (a <see cref="MarkerThumb"/> style).</summary>+ public Style? GripStyle+ {+ get => (Style?)GetValue(GripStyleProperty);+ set => SetValue(GripStyleProperty, value);+ }++ /// <summary>Style of the handles on an outline's or fibre's points (a <see cref="MarkerThumb"/> style).</summary>+ public Style? PointStyle+ {+ get => (Style?)GetValue(PointStyleProperty);+ set => SetValue(PointStyleProperty, value);+ }+/// <summary>Style of the rotation handles of composite sources and parts (a <see cref="MarkerThumb"/> style).</summary>public Style? AngleStyle{@@ -238,6 +263,11 @@ public sealed class SceneOverlay : Panelitem.PropertyChanged -= OnItemPropertyChanged;}_subscribed.Clear();+ foreach (INotifyCollectionChanged list in _pointLists)+ {+ list.CollectionChanged -= OnCollectionChanged;+ }+ _pointLists.Clear();Children.Clear();if (Project is not { } project){@@ -263,6 +293,23 @@ public sealed class SceneOverlay : PanelSubscribe(part);AddThumb(part, MarkerRole.Part, PartStyle, part.Name, "Part:" + part.Name);AddThumb(part, MarkerRole.PartAngle, AngleStyle, part.Name, "PartAngle:" + part.Name, "TipAngleMarkerFormat");+ if (GripOf(part) != null)+ {+ AddThumb(part, MarkerRole.PartGrip, GripStyle, part.Name, "PartGrip:" + part.Name, "TipGripFormat");+ }+ if (PointsOf(part) is { } points)+ {+ // the list and its points: a point added, removed or moved rebuilds or re-arranges+ if (_pointLists.Add(points))+ {+ points.CollectionChanged += OnCollectionChanged;+ }+ for (int i = 0; i < points.Count; i++)+ {+ Subscribe(points[i]);+ AddThumb(part, MarkerRole.PartPoint, PointStyle, part.Name, $"PartPoint:{part.Name}:{i}", "TipPointFormat", i);+ }+ }}foreach (Probe probe in project.Probes){@@ -289,10 +336,10 @@ public sealed class SceneOverlay : Panel}}- private void AddThumb(object item, MarkerRole role, Style? style, string name, string automationId, string tipKey = "TipMarkerFormat")+ private void AddThumb(object item, MarkerRole role, Style? style, string name, string automationId, string tipKey = "TipMarkerFormat", int index = -1){- var thumb = new MarkerThumb(item, role) { Style = style };- thumb.ToolTip = TryFindResource(tipKey) is string format ? string.Format(CultureInfo.CurrentUICulture, format, name) : name;+ var thumb = new MarkerThumb(item, role, index) { Style = style };+ thumb.ToolTip = TryFindResource(tipKey) is string format ? string.Format(CultureInfo.CurrentUICulture, format, name, index) : name;AutomationProperties.SetName(thumb, name);AutomationProperties.SetAutomationId(thumb, automationId);thumb.DragStarted += OnDragStarted;@@ -308,6 +355,7 @@ public sealed class SceneOverlay : Panel{case Probe when e.PropertyName is nameof(Probe.Kind) or nameof(Probe.Layer):case Source when e.PropertyName == nameof(Source.Array):+ case OutlinePart or FiberPart when e.PropertyName == "Points":Rebuild();return;case Source source:@@ -351,9 +399,9 @@ public sealed class SceneOverlay : Panelforeach (MarkerThumb thumb in Children){thumb.IsSelectedMarker = ReferenceEquals(thumb.Item, selected);- if (thumb.Role is MarkerRole.SourceAngle or MarkerRole.PartAngle)+ if (thumb.Role is MarkerRole.SourceAngle or MarkerRole.PartAngle or MarkerRole.PartGrip or MarkerRole.PartPoint){- // the rotation handle only while its source or part is selected (the user's rule, 2026-10-14); collapsed, it is out of the Tab cycle too+ // the rotation handle, grip and point handles only while their source or part is selected (the user's rule, 2026-10-14); collapsed, they are out of the Tab cycle toothumb.Visibility = thumb.IsSelectedMarker ? Visibility.Visible : Visibility.Collapsed;}}@@ -393,6 +441,81 @@ public sealed class SceneOverlay : Panel/// <summary>The centre of canvas pixel (x, y) in this element's coordinates at its current size.</summary>private Point ToView(int x, int y) => ToView(x, y, RenderSize);+ /// <summary>A continuous canvas point (pixel (x, y) spanning [x, x + 1)) in this element's coordinates, for an element of <paramref name="size"/>.</summary>+ private Point ToViewExact(double x, double y, Size size)+ {+ double scale = ScaleFor(size);+ double originX = (size.Width - CanvasWidth * scale) / 2;+ double originY = (size.Height - CanvasHeight * scale) / 2;+ return new Point(originX + x * scale, originY + y * scale);+ }++ // ---------------------------------------------------------------- a part's grip and points++ /// <summary>The point list a part's handles edit: an outline's or a fibre's; null for the other kinds.</summary>+ private static ObservableCollection<PartPoint>? PointsOf(OpticalPart part) => part switch+ {+ OutlinePart outline => outline.Points,+ FiberPart fiber => fiber.Points,+ _ => null,+ };++ /// <summary>+ /// Where a part's size grip sits in the part frame: the corner of a rectangle, lens (thickness, diameter), GRIN lens+ /// or Bragg stack, the first vertex of a polygon, the second end of a triangle's base; null for a kind without one.+ /// </summary>+ private static (double X, double Y)? GripOf(OpticalPart part) => part switch+ {+ RectanglePart rectangle => (rectangle.Length / 2.0, rectangle.Width / 2.0),+ LensPart lens => (lens.Thickness / 2.0, lens.Diameter / 2.0),+ PolygonPart polygon => polygon.Vertices()[0],+ TrianglePart triangle => triangle.Vertices()[1],+ GrinLensPart grin => (grin.Length / 2.0, grin.Diameter / 2.0),+ BraggReflectorPart bragg => (bragg.Length / 2.0, bragg.Width / 2.0),+ _ => null,+ };++ /// <summary>Sets the extents a grip stands for from the grip's new canvas position: whole pixels, never below the kind's least size.</summary>+ private static void SetGrip(OpticalPart part, double canvasX, double canvasY)+ {+ (double x, double y) = part.ToFrame(canvasX, canvasY);+ int across = (int)Math.Round(2.0 * Math.Abs(y));+ int along = (int)Math.Round(2.0 * Math.Abs(x));+ switch (part)+ {+ case RectanglePart rectangle:+ rectangle.Length = Math.Max(1, along);+ rectangle.Width = Math.Max(1, across);+ break;+ case LensPart lens:+ lens.Thickness = Math.Max(1, along);+ lens.Diameter = Math.Max(2, across);+ break;+ case PolygonPart polygon:+ // the vertex stays on its ray; its distance is the circumradius+ polygon.Side = Math.Max(2, (int)Math.Round(2.0 * Math.Sqrt(x * x + y * y) * Math.Sin(Math.PI / Math.Clamp(polygon.Sides, PolygonPart.MinSides, PolygonPart.MaxSides))));+ break;+ case TrianglePart triangle:+ triangle.Base = Math.Max(2, across);+ break;+ case GrinLensPart grin:+ grin.Length = Math.Max(1, along);+ grin.Diameter = Math.Max(2, across);+ break;+ case BraggReflectorPart bragg:+ bragg.Width = Math.Max(2, across);+ break;+ }+ }++ /// <summary>The canvas position of a grip or point handle (continuous coordinates), or null when the handle has nothing to stand on.</summary>+ private static (double X, double Y)? CanvasOf(MarkerThumb thumb) => (thumb.Item, thumb.Role) switch+ {+ (OpticalPart part, MarkerRole.PartGrip) when GripOf(part) is { } grip => part.ToCanvas(grip.X, grip.Y),+ (OpticalPart part, MarkerRole.PartPoint) when PointsOf(part) is { } points && thumb.Index >= 0 && thumb.Index < points.Count => part.ToCanvas(points[thumb.Index].X, points[thumb.Index].Y),+ _ => null,+ };+/// <summary>The picture's rectangle in this element's coordinates for an element of <paramref name="size"/>: the canvas at its uniform scale, centred (the element fills the cell, the picture is letterboxed in it).</summary>private Rect PictureRect(Size size){@@ -457,6 +580,7 @@ public sealed class SceneOverlay : Panelprivate static (int X, int Y) PointOf(MarkerThumb thumb) => (thumb.Item, thumb.Role) switch{(Source source, _) => (source.X, source.Y),+ (OpticalPart, MarkerRole.PartGrip or MarkerRole.PartPoint) when CanvasOf(thumb) is { } canvas => ((int)Math.Round(canvas.X), (int)Math.Round(canvas.Y)),(OpticalPart part, _) => (part.X, part.Y),(Probe probe, MarkerRole.ProbeB) => (probe.BX, probe.BY),(Probe probe, _) => (probe.AX, probe.AY),@@ -473,6 +597,17 @@ public sealed class SceneOverlay : Panelsource.X = x;source.Y = y;break;+ case (OpticalPart part, MarkerRole.PartGrip):+ SetGrip(part, x, y);+ break;+ case (OpticalPart part, MarkerRole.PartPoint):+ if (PointsOf(part) is { } points && thumb.Index >= 0 && thumb.Index < points.Count)+ {+ (double fx, double fy) = part.ToFrame(x, y);+ points[thumb.Index].X = (int)Math.Round(fx);+ points[thumb.Index].Y = (int)Math.Round(fy);+ }+ break;case (OpticalPart part, _):part.X = x;part.Y = y;@@ -517,11 +652,16 @@ public sealed class SceneOverlay : Panelforeach (MarkerThumb thumb in Children){(int x, int y) = PointOf(thumb);- Point centre = thumb.Role is MarkerRole.SourceAngle or MarkerRole.PartAngle ? AnglePoint(thumb.Item, finalSize) : ToView(x, y, finalSize);+ Point centre = thumb.Role switch+ {+ MarkerRole.SourceAngle or MarkerRole.PartAngle => AnglePoint(thumb.Item, finalSize),+ MarkerRole.PartGrip or MarkerRole.PartPoint when CanvasOf(thumb) is { } canvas => ToViewExact(canvas.X, canvas.Y, finalSize),+ _ => ToView(x, y, finalSize),+ };Size size = thumb.DesiredSize;var rect = new Rect(centre.X - size.Width / 2, centre.Y - size.Height / 2, size.Width, size.Height);thumb.Arrange(rect);- if (thumb.Role is MarkerRole.SourceAngle or MarkerRole.PartAngle)+ if (thumb.Role is MarkerRole.SourceAngle or MarkerRole.PartAngle or MarkerRole.PartGrip or MarkerRole.PartPoint){// the rotation handle stays on the row axis, however far out; what falls outside the picture is clipped// (2026-10-16, the user's rule: the lever bending to keep the handle inside made no sense). The other@@ -583,6 +723,25 @@ public sealed class SceneOverlay : Panel}if (selected is OpticalPart selectedPart && project.Parts.Contains(selectedPart)){+ // the part's outline as painted, in the accent colour, so the shape reads apart from the scene's glow+ (double X, double Y)[] outline = selectedPart.Outline();+ if (outline.Length >= 2)+ {+ var geometry = new StreamGeometry();+ using (StreamGeometryContext context = geometry.Open())+ {+ (double x0, double y0) = selectedPart.ToCanvas(outline[0].X, outline[0].Y);+ context.BeginFigure(ToViewExact(x0, y0, RenderSize), false, selectedPart.OutlineClosed);+ for (int i = 1; i < outline.Length; i++)+ {+ (double x, double y) = selectedPart.ToCanvas(outline[i].X, outline[i].Y);+ context.LineTo(ToViewExact(x, y, RenderSize), true, true);+ }+ }+ geometry.Freeze();+ dc.DrawGeometry(null, new Pen(HaloBrush, 3.0) { LineJoin = PenLineJoin.Round }, geometry);+ dc.DrawGeometry(null, new Pen(AccentBrush, 1.0) { LineJoin = PenLineJoin.Round }, geometry);+ }// the part's axis from the centre to its rotation handle, the lever, while it is selectedPoint axisEnd = AnglePoint(selectedPart, RenderSize);dc.DrawLine(new Pen(HaloBrush, 3.0), ToView(selectedPart.X, selectedPart.Y), axisEnd);@@ -591,7 +750,7 @@ public sealed class SceneOverlay : Paneldc.Pop();foreach (MarkerThumb thumb in Children.OfType<MarkerThumb>().OrderBy(thumb => thumb.IsSelectedMarker)){- if (thumb.Role is MarkerRole.ProbeB or MarkerRole.SourceAngle or MarkerRole.PartAngle)+ if (thumb.Role is MarkerRole.ProbeB or MarkerRole.SourceAngle or MarkerRole.PartAngle or MarkerRole.PartGrip or MarkerRole.PartPoint){continue;}diff --git a/WaveDudeNext.WPF/MainWindow.Live.cs b/WaveDudeNext.WPF/MainWindow.Live.csindex b4a4a59..67817ef 100644--- a/WaveDudeNext.WPF/MainWindow.Live.cs+++ b/WaveDudeNext.WPF/MainWindow.Live.cs@@ -438,8 +438,29 @@ public partial class MainWindow}}- /// <summary>Hands the preview the scene pixels (null for a canvas without parts, or when the image cannot be read: that is logged once the run reports it).</summary>+ /// <summary>+ /// Hands the preview the scene pixels (null for a canvas without parts, or when the image cannot be read: that is+ /// logged once the run reports it). Coalesced at background priority: a drag of a part fires a change per mouse+ /// move, and composing the scene plus rebuilding its pictures is far too slow to do for each (2026-10-19); the+ /// overlay draws the selected part's outline itself, so what the user drags stays live meanwhile.+ /// </summary>private void UpdateScenePixels()+ {+ if (_scenePixelsPending)+ {+ return;+ }+ _scenePixelsPending = true;+ Dispatcher.InvokeAsync(() =>+ {+ _scenePixelsPending = false;+ UpdateScenePixelsNow();+ }, DispatcherPriority.Background);+ }++ private bool _scenePixelsPending;++ private void UpdateScenePixelsNow(){if (previewPane == null){@@ -447,7 +468,11 @@ public partial class MainWindow}try{- previewPane.ScenePixels = LoadSceneImage();+ long started = System.Diagnostics.Stopwatch.GetTimestamp();+ ScenePixels? pixels = LoadSceneImage();+ long painted = System.Diagnostics.Stopwatch.GetTimestamp();+ previewPane.ScenePixels = pixels;+ Logger.Debug("Scene pixels updated: composed in {Paint:0.0} ms, pictures in {Pictures:0.0} ms", System.Diagnostics.Stopwatch.GetElapsedTime(started, painted).TotalMilliseconds, System.Diagnostics.Stopwatch.GetElapsedTime(painted).TotalMilliseconds);}catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or NotSupportedException or FileFormatException or RunSpecException){diff --git a/WaveDudeNext.WPF/Panes/PreviewPane.xaml b/WaveDudeNext.WPF/Panes/PreviewPane.xamlindex 71d4560..a682b81 100644--- a/WaveDudeNext.WPF/Panes/PreviewPane.xaml+++ b/WaveDudeNext.WPF/Panes/PreviewPane.xaml@@ -221,6 +221,36 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or</Setter.Value></Setter></Style>+ <!-- a part's size grip: a small filled square on the outline's corner; the point handles: a small ring -->+ <Style x:Key="PartGripMarker" TargetType="{x:Type controls:MarkerThumb}" BasedOn="{StaticResource MarkerBase}">+ <Setter Property="Width" Value="14" />+ <Setter Property="Height" Value="14" />+ <Setter Property="Cursor" Value="SizeNWSE" />+ <Setter Property="Template">+ <Setter.Value>+ <ControlTemplate TargetType="{x:Type controls:MarkerThumb}">+ <Grid Background="Transparent">+ <Rectangle Width="9" Height="9" Fill="Black" Opacity="0.75" />+ <Rectangle Width="7" Height="7" Fill="{TemplateBinding BorderBrush}" />+ </Grid>+ </ControlTemplate>+ </Setter.Value>+ </Setter>+ </Style>+ <Style x:Key="PartPointMarker" TargetType="{x:Type controls:MarkerThumb}" BasedOn="{StaticResource MarkerBase}">+ <Setter Property="Width" Value="14" />+ <Setter Property="Height" Value="14" />+ <Setter Property="Template">+ <Setter.Value>+ <ControlTemplate TargetType="{x:Type controls:MarkerThumb}">+ <Grid Background="Transparent">+ <Ellipse Width="10" Height="10" Fill="{TemplateBinding Background}" Stroke="Black" StrokeThickness="{TemplateBinding HaloThickness}" Opacity="0.75" />+ <Ellipse Width="10" Height="10" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="{TemplateBinding StrokeThickness}" />+ </Grid>+ </ControlTemplate>+ </Setter.Value>+ </Setter>+ </Style><StreamGeometry x:Key="AngleGlyph">M15,10 A5,5 0 1 1 12.5,5.67 M12.5,5.67 L9.2,5.3 M12.5,5.67 L13,9</StreamGeometry><Style x:Key="AngleMarker" TargetType="{x:Type controls:MarkerThumb}" BasedOn="{StaticResource MarkerBase}"><Setter Property="Cursor" Value="Hand" />@@ -502,7 +532,7 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file orStretch="Uniform" IsHitTestVisible="False" /><!-- the handles: sources, emitter dots, probe points and lines. Styled here, not implicitly: WPF appliesimplicit styles inside a template only to Controls, and the overlay is a Panel -->- <controls:SceneOverlay SourceStyle="{StaticResource SourceMarker}" PartStyle="{StaticResource PartMarker}" ProbeStyle="{StaticResource ProbeMarker}" AngleStyle="{StaticResource AngleMarker}"+ <controls:SceneOverlay SourceStyle="{StaticResource SourceMarker}" PartStyle="{StaticResource PartMarker}" GripStyle="{StaticResource PartGripMarker}" PointStyle="{StaticResource PartPointMarker}" ProbeStyle="{StaticResource ProbeMarker}" AngleStyle="{StaticResource AngleMarker}"LineBrush="White" LabelBrush="White" AccentBrush="{DynamicResource Accent}"Project="{Binding Project, RelativeSource={RelativeSource AncestorType={x:Type local:PreviewPane}}}"CanvasWidth="{Binding CanvasWidth, RelativeSource={RelativeSource AncestorType={x:Type local:PreviewPane}}}"diff --git a/WaveDudeNext.WPF/Strings/Strings.DE.xaml b/WaveDudeNext.WPF/Strings/Strings.DE.xamlindex 286d4b8..f7dac9c 100644--- a/WaveDudeNext.WPF/Strings/Strings.DE.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.DE.xaml@@ -178,6 +178,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="TipPreviewShowIntensity">Intensitätsbild anzeigen</s:String><s:String x:Key="TipMarkerFormat">{0}: zum Verschieben ziehen; mit Tastaturfokus bewegen die Pfeiltasten um ein Pixel, mit Umschalt um zehn</s:String><s:String x:Key="TipAngleMarkerFormat">{0}: zum Drehen des Rasters ziehen (Umschalt rastet auf 15 Grad ein); mit Tastaturfokus drehen die Pfeiltasten um ein Grad, mit Umschalt um zehn</s:String>+ <s:String x:Key="TipGripFormat">{0}: zum Ändern der Größe ziehen; mit Tastaturfokus bewegen die Pfeiltasten den Griff um ein Pixel, mit Umschalt um zehn</s:String>+ <s:String x:Key="TipPointFormat">{0}, Punkt {1}: zum Verschieben ziehen; mit Tastaturfokus bewegen die Pfeiltasten um ein Pixel, mit Umschalt um zehn</s:String><s:String x:Key="TipProbeBoxFormat">Diagramm von {0}: zum Verschieben des Kastens ziehen; mit Tastaturfokus bewegen die Pfeiltasten um ein Pixel, mit Umschalt um zehn</s:String><s:String x:Key="TipProbeBoxCornerFormat">Diagramm von {0}: zum Ändern der Kastengröße ziehen (rastet auf den festen Größen ein); mit Tastaturfokus ändern die Pfeiltasten die Größe um ein Pixel, mit Umschalt um zehn</s:String><s:String x:Key="LabelPreviewStep">Schritt</s:String>diff --git a/WaveDudeNext.WPF/Strings/Strings.EN.xaml b/WaveDudeNext.WPF/Strings/Strings.EN.xamlindex 18e1dd1..f83381a 100644--- a/WaveDudeNext.WPF/Strings/Strings.EN.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.EN.xaml@@ -180,6 +180,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="TipPreviewShowIntensity">Show the intensity picture</s:String><s:String x:Key="TipMarkerFormat">{0}: drag to move; with keyboard focus the arrow keys move it by a pixel, ten with Shift</s:String><s:String x:Key="TipAngleMarkerFormat">{0}: drag to turn the array (Shift snaps to 15 degrees); with keyboard focus the arrow keys turn it by a degree, ten with Shift</s:String>+ <s:String x:Key="TipGripFormat">{0}: drag to resize; with keyboard focus the arrow keys move the grip by a pixel, ten with Shift</s:String>+ <s:String x:Key="TipPointFormat">{0}, point {1}: drag to move it; with keyboard focus the arrow keys move it by a pixel, ten with Shift</s:String><s:String x:Key="TipProbeBoxFormat">Graph of {0}: drag to move the box; with keyboard focus the arrow keys move it by a pixel, ten with Shift</s:String><s:String x:Key="TipProbeBoxCornerFormat">Graph of {0}: drag to resize the box (it snaps to the fixed sizes); with keyboard focus the arrow keys resize it by a pixel, ten with Shift</s:String><s:String x:Key="LabelPreviewStep">step</s:String>diff --git a/WaveDudeNext.WPF/Strings/Strings.FR.xaml b/WaveDudeNext.WPF/Strings/Strings.FR.xamlindex fc173e3..e48e90b 100644--- a/WaveDudeNext.WPF/Strings/Strings.FR.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.FR.xaml@@ -178,6 +178,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="TipPreviewShowIntensity">Afficher l'image de l'intensité</s:String><s:String x:Key="TipMarkerFormat">{0} : glisser pour déplacer ; avec le focus clavier, les flèches déplacent d'un pixel, de dix avec Maj</s:String><s:String x:Key="TipAngleMarkerFormat">{0} : glisser pour tourner la grille (Maj aligne sur 15 degrés) ; avec le focus clavier, les flèches la tournent d'un degré, de dix avec Maj</s:String>+ <s:String x:Key="TipGripFormat">{0} : glisser pour redimensionner ; avec le focus clavier, les flèches déplacent la poignée d'un pixel, de dix avec Maj</s:String>+ <s:String x:Key="TipPointFormat">{0}, point {1} : glisser pour déplacer ; avec le focus clavier, les flèches déplacent d'un pixel, de dix avec Maj</s:String><s:String x:Key="TipProbeBoxFormat">Graphique de {0} : glisser pour déplacer le cadre ; avec le focus clavier, les flèches le déplacent d'un pixel, de dix avec Maj</s:String><s:String x:Key="TipProbeBoxCornerFormat">Graphique de {0} : glisser pour redimensionner le cadre (il s'aligne sur les tailles fixes) ; avec le focus clavier, les flèches le redimensionnent d'un pixel, de dix avec Maj</s:String><s:String x:Key="LabelPreviewStep">pas</s:String>diff --git a/WaveDudeNext.WPF/Strings/Strings.NL.xaml b/WaveDudeNext.WPF/Strings/Strings.NL.xamlindex 3539e7f..488eb2e 100644--- a/WaveDudeNext.WPF/Strings/Strings.NL.xaml+++ b/WaveDudeNext.WPF/Strings/Strings.NL.xaml@@ -178,6 +178,8 @@ version. It is distributed WITHOUT ANY WARRANTY. See the LICENSE.md file or<s:String x:Key="TipPreviewShowIntensity">Intensiteitsbeeld tonen</s:String><s:String x:Key="TipMarkerFormat">{0}: slepen om te verplaatsen; met toetsenbordfocus verplaatsen de pijltoetsen één pixel, tien met Shift</s:String><s:String x:Key="TipAngleMarkerFormat">{0}: slepen om het raster te draaien (Shift klikt vast op 15 graden); met toetsenbordfocus draaien de pijltoetsen het één graad, tien met Shift</s:String>+ <s:String x:Key="TipGripFormat">{0}: slepen om de grootte te wijzigen; met toetsenbordfocus verplaatsen de pijltoetsen de greep één pixel, tien met Shift</s:String>+ <s:String x:Key="TipPointFormat">{0}, punt {1}: slepen om te verplaatsen; met toetsenbordfocus verplaatsen de pijltoetsen één pixel, tien met Shift</s:String><s:String x:Key="TipProbeBoxFormat">Grafiek van {0}: slepen om het kader te verplaatsen; met toetsenbordfocus verplaatsen de pijltoetsen het één pixel, tien met Shift</s:String><s:String x:Key="TipProbeBoxCornerFormat">Grafiek van {0}: slepen om het kader te vergroten of verkleinen (het klikt vast op de vaste maten); met toetsenbordfocus wijzigen de pijltoetsen de maat één pixel, tien met Shift</s:String><s:String x:Key="LabelPreviewStep">stap</s:String>diff --git a/WaveDudeNext/Model/OpticalPart.cs b/WaveDudeNext/Model/OpticalPart.csindex 9942b3c..77def84 100644--- a/WaveDudeNext/Model/OpticalPart.cs+++ b/WaveDudeNext/Model/OpticalPart.cs@@ -130,6 +130,38 @@ public abstract class OpticalPart : ObservableObject[Browsable(false)]public abstract double AxisReach { get; }+ /// <summary>+ /// The part's outline for drawing, as points in the part frame (relative to the centre, before rotation, canvas+ /// pixels): a closed polygon unless <see cref="OutlineClosed"/> says otherwise. Out-of-range values are guarded as+ /// the painter guards them, so the drawn outline is the painted one. UI thread.+ /// </summary>+ public abstract (double X, double Y)[] Outline();++ /// <summary>Whether <see cref="Outline"/> closes back to its first point (a fibre's path does not).</summary>+ [XmlIgnore]+ [Browsable(false)]+ public virtual bool OutlineClosed => true;++ /// <summary>Maps a point of the part frame to canvas coordinates: the centre at (X, Y), the frame turned by the angle (counter-clockwise on the screen).</summary>+ public (double X, double Y) ToCanvas(double x, double y)+ {+ double radians = Angle * Math.PI / 180.0;+ double cos = Math.Cos(radians);+ double sin = Math.Sin(radians);+ return (X + x * cos + y * sin, Y + y * cos - x * sin);+ }++ /// <summary>Maps canvas coordinates into the part frame (the inverse of <see cref="ToCanvas"/>).</summary>+ public (double X, double Y) ToFrame(double canvasX, double canvasY)+ {+ double radians = Angle * Math.PI / 180.0;+ double cos = Math.Cos(radians);+ double sin = Math.Sin(radians);+ double ox = canvasX - X;+ double oy = canvasY - Y;+ return (ox * cos - oy * sin, ox * sin + oy * cos);+ }+/// <summary>Clamps every value into its valid range; the angle is brought into (-180, 180].</summary>public virtual void Normalize(){@@ -358,6 +390,37 @@ public sealed class LensPart : OpticalPart}}+ /// <summary>Points per surface of the drawn outline.</summary>+ private const int OutlineSteps = 32;++ /// <inheritdoc/>+ public override (double X, double Y)[] Outline()+ {+ (double r1, double r2) = FitRadii(Diameter, Thickness, R1, R2);+ double half = Math.Max(2, Diameter) / 2.0;+ double vertex = Math.Max(1, Thickness) / 2.0;+ var points = new (double X, double Y)[2 * (OutlineSteps + 1)];+ for (int i = 0; i <= OutlineSteps; i++)+ {+ // down the first surface, then up the second+ double y = -half + 2.0 * half * i / OutlineSteps;+ points[i] = (-vertex + SurfaceSag(r1, y), y);+ points[2 * OutlineSteps + 1 - i] = (vertex + SurfaceSag(r2, y), y);+ }+ return points;+ }++ /// <summary>Where a surface of signed <paramref name="radius"/> lies along x' at <paramref name="y"/> from the axis, relative to its vertex: 0 for flat, positive toward +x'.</summary>+ private static double SurfaceSag(double radius, double y)+ {+ if (radius == 0.0)+ {+ return 0.0;+ }+ double inside = Math.Max(0.0, radius * radius - y * y);+ return radius - Math.CopySign(Math.Sqrt(inside), radius);+ }+/// <summary>Thickness at the rim in pixels: the centre thickness less what the convex surfaces take, plus what the concave ones add; never negative after <see cref="FitRadii"/>.</summary>[XmlIgnore][Browsable(false)]@@ -494,6 +557,9 @@ public abstract class ShapePart : OpticalPart/// <inheritdoc/>public override double AxisReach => Vertices().Select(v => Math.Abs(v.X)).DefaultIfEmpty(0.0).Max();+ /// <inheritdoc/>+ public override (double X, double Y)[] Outline() => Vertices();+/// <inheritdoc/>public override void Normalize(){@@ -937,6 +1003,12 @@ public sealed class FiberPart : OpticalPart/// <inheritdoc/>public override double AxisReach => (Points.Count > 0 ? Points.Max(p => Math.Abs(p.X)) : 0) + OuterRadius;+ /// <summary>The path itself; the core and cladding bands show through the scene outline.</summary>+ public override (double X, double Y)[] Outline() => Points.Select(p => ((double)p.X, (double)p.Y)).ToArray();++ /// <inheritdoc/>+ public override bool OutlineClosed => false;+/// <summary>/// The default straight path, from (-100, 0) to (100, 0). Given to a new fibre by <see cref="Project.AddPart"/>, not by/// the constructor: <see cref="XmlSerializer"/> appends a file's points to the list it finds, so the constructor's list@@ -1076,6 +1148,14 @@ public sealed class BraggReflectorPart : OpticalPart/// <inheritdoc/>public override double AxisReach => Length / 2.0;+ /// <inheritdoc/>+ public override (double X, double Y)[] Outline()+ {+ double l = Math.Clamp(Pairs, 1, MaxPairs) * (Math.Max(1, Thickness1) + Math.Max(1, Thickness2)) / 2.0;+ double w = Math.Max(1, Width) / 2.0;+ return [(-l, -w), (l, -w), (l, w), (-l, w)];+ }+/// <inheritdoc/>public override void Normalize(){@@ -1178,6 +1258,14 @@ public sealed class GrinLensPart : OpticalPart/// <inheritdoc/>public override double AxisReach => Length / 2.0;+ /// <inheritdoc/>+ public override (double X, double Y)[] Outline()+ {+ double l = Math.Max(1, Length) / 2.0;+ double d = Math.Max(1, Diameter) / 2.0;+ return [(-l, -d), (l, -d), (l, d), (-l, d)];+ }+/// <inheritdoc/>public override void Normalize(){diff --git a/WaveDudeNext/Parts/PartPainter.cs b/WaveDudeNext/Parts/PartPainter.csindex 067377a..121c9c4 100644--- a/WaveDudeNext/Parts/PartPainter.cs+++ b/WaveDudeNext/Parts/PartPainter.cs@@ -28,7 +28,10 @@ namespace WaveDudeNext.Parts;/// touched. Parts are painted in list order, a later one over an earlier one. Refractive parts are supersampled/// 4 × 4 per pixel and the sample indices averaged, a sample outside the part counting the pixel's existing index/// (red 0 as 1); a mirror part tests the pixel centre alone and writes red 0, since an averaged mirror edge would-/// clamp to glass. Pure geometry, no UI; any thread. The per-kind tests are in <see cref="PartShape"/> so the+/// clamp to glass. Only pixels near an edge (the outline, the coating band's inner edge, a Bragg layer) are+/// supersampled: the shape's depth at the pixel centre is an exact distance, so a pixel farther than a sample's+/// reach from every edge takes its centre's index in one go (2026-10-19, a drag of a part was sluggish).+/// Pure geometry, no UI; any thread. The per-kind tests are in <see cref="PartShape"/> so the/// harness can check them./// </summary>public static class PartPainter@@ -38,6 +41,9 @@ public static class PartPainter/// <summary>Samples per pixel edge for refractive parts.</summary>public const int Supersample = 4;+ /// <summary>How far a sample can lie from the pixel centre, with a margin: beyond this depth from an edge, every sample falls on the same side.</summary>+ private const double SampleReach = 0.6;+/// <summary>/// The scene pixels with the enabled parts painted in: <paramref name="image"/> itself (the same reference, so/// callers comparing by reference see no change) when no part is enabled, else a copy of the image, or a blank@@ -121,12 +127,28 @@ public static class PartPainter}const double step = 1.0 / Supersample;const double half = step / 2.0;+ int coating = shape.CoatingWidth;+ bool innerEdges = shape.HasInnerEdges;Parallel.For(y0, y1 + 1, y =>{int row = y * stride;for (int x = x0; x <= x1; x++){int offset = row + x * 4 + 2;+ double depth = shape.DepthAt(x + 0.5, y + 0.5);+ if (depth < -SampleReach)+ {+ continue; // every sample outside+ }+ if (!innerEdges && depth > SampleReach && (coating == 0 || Math.Abs(depth - coating) > SampleReach))+ {+ // every sample inside, all in the body or all in the coating band: the centre's index stands for the pixel+ if (shape.IndexAt(x + 0.5, y + 0.5) is { } whole)+ {+ bgra[offset] = (byte)Math.Clamp((int)Math.Round(whole * 100.0), 1, 255);+ }+ continue;+ }int red = bgra[offset];// red 0 is a mirror the engine reads as index 1000; averaging it in as glass of index 1 is the user's ruledouble existing = red == 0 ? 1.0 : red / 100.0;diff --git a/WaveDudeNext/Parts/PartShape.cs b/WaveDudeNext/Parts/PartShape.csindex 9ef3115..2e54401 100644--- a/WaveDudeNext/Parts/PartShape.cs+++ b/WaveDudeNext/Parts/PartShape.cs@@ -68,6 +68,30 @@ public abstract class PartShape/// <summary>Thickness of the anti-reflection band inside the outline in pixels; 0 for none.</summary>protected abstract int Coating { get; }+ /// <summary>The coating band's thickness in pixels, for the painter's shortcut past pixels well inside the body or the band.</summary>+ public int CoatingWidth => Coating;++ /// <summary>+ /// Whether the index steps somewhere inside the outline (a Bragg stack's layers), so a pixel well inside still+ /// needs its samples; false where the inside is one index or varies smoothly (the GRIN profile).+ /// </summary>+ public virtual bool HasInnerEdges => false;++ /// <summary>How far inside the outline the canvas point lies, in pixels (negative outside): the exact distance for straight and circular edges, so the painter can tell a pixel wholly inside or outside from one sample.</summary>+ public double DepthAt(double canvasX, double canvasY)+ {+ (double x, double y) = ToFrame(canvasX, canvasY);+ return Depth(x, y);+ }++ /// <summary>Maps a canvas point into the part frame: the inverse of the composite source's turn (x = dx cos + dy sin, y = dy cos - dx sin), the transpose.</summary>+ private (double X, double Y) ToFrame(double canvasX, double canvasY)+ {+ double ox = canvasX - _centreX;+ double oy = canvasY - _centreY;+ return (ox * _cos - oy * _sin, ox * _sin + oy * _cos);+ }+/// <summary>Farthest the outline reaches from the centre, in pixels (a bound, not necessarily tight).</summary>protected abstract double Extent { get; }@@ -95,11 +119,7 @@ public abstract class PartShape/// </summary>public double? IndexAt(double canvasX, double canvasY){- // the inverse of the composite source's turn (x = dx cos + dy sin, y = dy cos - dx sin): the transpose- double ox = canvasX - _centreX;- double oy = canvasY - _centreY;- double x = ox * _cos - oy * _sin;- double y = ox * _sin + oy * _cos;+ (double x, double y) = ToFrame(canvasX, canvasY);double depth = Depth(x, y);if (depth < 0.0){@@ -298,6 +318,7 @@ public abstract class PartShapepublic override bool IsMirror => false;protected override int Coating => 0;+ public override bool HasInnerEdges => true;protected override double Extent => Math.Sqrt(_halfLength * _halfLength + _halfWidth * _halfWidth);protected override double Depth(double x, double y) => Math.Min(_halfLength - Math.Abs(x), _halfWidth - Math.Abs(y));diff --git a/WaveDudeNext/Rendering/GlowingEdges.cs b/WaveDudeNext/Rendering/GlowingEdges.csindex cf7eb45..6bb039d 100644--- a/WaveDudeNext/Rendering/GlowingEdges.cs+++ b/WaveDudeNext/Rendering/GlowingEdges.cs@@ -42,7 +42,7 @@ public static class GlowingEdges/// <param name="width">Width in pixels.</param>/// <param name="height">Height in pixels.</param>/// <param name="strideBytes">Bytes per source row (at least width × 4).</param>- public static byte[] Compute(ReadOnlySpan<byte> bgra, int width, int height, int strideBytes)+ public static byte[] Compute(byte[] bgra, int width, int height, int strideBytes){var result = new byte[width * height * 4];for (int i = 3; i < result.Length; i += 4)@@ -53,7 +53,8 @@ public static class GlowingEdges{return result;}- for (int y = 1; y < height - 1; y++)+ // rows are independent: a Full HD canvas took 60 ms on one core (2026-10-19)+ Parallel.For(1, height - 1, y =>{int rowUp = (y - 1) * strideBytes;int rowMid = y * strideBytes;@@ -81,7 +82,7 @@ public static class GlowingEdgesresult[dst + channel] = (byte)Math.Min(255.0, magnitude);}}- }+ });return result;}diff --git a/_tools/library_check/Program.cs b/_tools/library_check/Program.csindex f57b731..ab0bf71 100644--- a/_tools/library_check/Program.cs+++ b/_tools/library_check/Program.cs@@ -185,6 +185,47 @@ internal static class Program}return 0;}+ if (args.Length > 0 && args[0] == "bench-paint")+ {+ // how long the part painter takes on a Full HD canvas: an outline, a lens, a polygon (2026-10-19, a drag was sluggish)+ var project = new Project();+ project.Scene.Width = 1920;+ project.Scene.Height = 1080;+ var outline = (OutlinePart)project.AddPart(PartKind.Outline);+ foreach ((int px, int py) in new[] { (-200, -150), (200, -120), (150, 180), (-180, 120) })+ {+ outline.Points.Add(new PartPoint { X = px, Y = py });+ }+ var lens = (LensPart)project.AddPart(PartKind.Lens);+ lens.Diameter = 400;+ var polygon = (PolygonPart)project.AddPart(PartKind.Polygon);+ polygon.Side = 150;+ foreach (OpticalPart part in project.Parts)+ {+ var single = new List<OpticalPart> { part };+ PartPainter.Paint(null, 1920, 1080, 1.0, single);+ var timer = Stopwatch.StartNew();+ for (int i = 0; i < 10; i++)+ {+ PartPainter.Paint(null, 1920, 1080, 1.0, single);+ }+ Console.WriteLine($" {part.Kind}: {timer.Elapsed.TotalMilliseconds / 10:0.0} ms per paint");+ }+ var blank = Stopwatch.StartNew();+ for (int i = 0; i < 10; i++)+ {+ PartPainter.Paint(null, 1920, 1080, 1.0, [new OutlinePart { Name = "empty" }]);+ }+ Console.WriteLine($" blank canvas alone: {blank.Elapsed.TotalMilliseconds / 10:0.0} ms");+ var edges = Stopwatch.StartNew();+ ScenePixels painted = PartPainter.Paint(null, 1920, 1080, 1.0, project.Parts)!;+ for (int i = 0; i < 10; i++)+ {+ GlowingEdges.Compute(painted.Bgra, painted.Width, painted.Height, painted.StrideBytes);+ }+ Console.WriteLine($" glowing edges: {edges.Elapsed.TotalMilliseconds / 10:0.0} ms");+ return 0;+ }if (args.Length > 0 && args[0] == "bench-render"){BenchRender(args.Length > 1 ? int.Parse(args[1]) : 1920, args.Length > 2 ? int.Parse(args[2]) : 1080, args.Length > 3 && args[3] == "load");