Skip to content

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

C#

The frame cache's space message and the presenter's scale factor are formatted invariant, so the log has no decimal comma

Alexander Graef60fd47997612
diff --git a/WaveDudeNext.WPF/Rendering/FramePresenter.cs b/WaveDudeNext.WPF/Rendering/FramePresenter.cs
index 504b067..5a95888 100644
--- a/WaveDudeNext.WPF/Rendering/FramePresenter.cs
+++ b/WaveDudeNext.WPF/Rendering/FramePresenter.cs
@@ -16,6 +16,7 @@
// <https://www.gnu.org/licenses/>.
using System.Diagnostics;
+using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Media;
@@ -233,9 +234,13 @@ public sealed class FramePresenter
screen = new ScreenRenderer(sourceWidth, sourceHeight, width, height);
_screens[(int)layer] = screen;
double scale = width / (double)sourceWidth;
+ // the factor is text before NLog formats the entry, so it takes the invariant culture here, as NLog's own
+ // parameters do (2026-11-03, the user's rule: no "1,29×" in the log)
+ string how = width == sourceWidth && height == sourceHeight ? "1:1"
+ : scale < 1 ? string.Create(CultureInfo.InvariantCulture, $"{1 / scale:0.##}× smaller, each pixel the mean of the samples it covers")
+ : string.Create(CultureInfo.InvariantCulture, $"{scale:0.##}× larger, blended between the nearest samples");
Logger.Debug("Preview {Layer}: 16-bit frames of {SourceWidth}×{SourceHeight} drawn at {Width}×{Height} screen pixels ({How})",
- layer, sourceWidth, sourceHeight, width, height,
- width == sourceWidth && height == sourceHeight ? "1:1" : scale < 1 ? $"{1 / scale:0.##}× smaller, each pixel the mean of the samples it covers" : $"{scale:0.##}× larger, blended between the nearest samples");
+ layer, sourceWidth, sourceHeight, width, height, how);
}
return screen;
}
diff --git a/WaveDudeNext/Runs/FrameCache.cs b/WaveDudeNext/Runs/FrameCache.cs
index d98f601..b8cbaef 100644
--- a/WaveDudeNext/Runs/FrameCache.cs
+++ b/WaveDudeNext/Runs/FrameCache.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.Globalization;
using NLog;
namespace WaveDudeNext.Runs;
@@ -54,8 +55,11 @@ public static class FrameCache
long needed = bytes + (64L << 20);
if (drive.AvailableFreeSpace < needed)
{
+ // the text reaches the log, the status bar and the dialog alike, so its numbers take the decimal point of every
+ // other number in the log (2026-11-03, the user's rule: a report's reader must not trip over "1806,2 GB")
throw new RunSpecException(
- $"The run needs {bytes / (1024.0 * 1024 * 1024):0.#} GB of frame cache on {drive.Name}, but only {drive.AvailableFreeSpace / (1024.0 * 1024 * 1024):0.#} GB is free. "
+ string.Create(CultureInfo.InvariantCulture,
+ $"The run needs {bytes / (1024.0 * 1024 * 1024):0.#} GB of frame cache on {drive.Name}, but only {drive.AvailableFreeSpace / (1024.0 * 1024 * 1024):0.#} GB is free. ")
+ "Reduce the canvas, the steps or raise 'Visualize every', or turn the intensity preview off.");
}
}