Merge remote-tracking branch 'origin/master'

This commit is contained in:
mm00
2025-03-28 18:51:46 +01:00

View File

@@ -59,12 +59,15 @@ public class Program {
private const bool outputMasks = true;
private const bool outputSDFs = true;
private const bool outputGradients = true;
static readonly ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = MAX_THREADS };
static List<ImageData> Images = new();
static List<MaskData> Masks = new();
static List<SDFData> SDFs = new();
static List<float3[,]> Gradients = new();
static readonly ParallelOptions parallelOptions = new() { MaxDegreeOfParallelism = MAX_THREADS };
static void ConsoleUpdateLine(string s) {
Console.Write("\r"+s);
}
static void LoadImage(string imgPath) {
var image = new MagickImage(imgPath);
@@ -210,7 +213,7 @@ public class Program {
lock(maskData.Edges) maskData.Edges.Add(new(x, y));
iterCount++;
if (iterCount % (width * height / 100) == 0) {
Console.WriteLine($"Progress: {iterCount/(float)(width*height):P} | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
ConsoleUpdateLine($"Progress: {iterCount/(width*height):P}% | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
}
});
sw.Stop();
@@ -276,7 +279,7 @@ public class Program {
if (minDist > AbsMax) AbsMax = minDist;
iterCount++;
if (iterCount % (width * height / 100) == 0) {
Console.WriteLine($"Progress: {iterCount/(float)(width*height):P} | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
ConsoleUpdateLine($"Progress: {iterCount/(width*height):P}% | {iterCount/(sw.Elapsed.TotalSeconds):N0} pixels/s");
}
});
@@ -362,4 +365,4 @@ public class Program {
static T Remap<T>(T value, T min, T max, T newMin, T newMax)
where T : INumber<T>, ISubtractionOperators<T, T, T>, IMultiplyOperators<T, T, T>, IAdditionOperators<T, T, T>
=> (value - min) / (max - min) * (newMax - newMin) + newMin;
}
}