diff --git a/.run/SDFMapCreator.run.xml b/.run/SDFMapCreator.run.xml
new file mode 100644
index 0000000..ad24374
--- /dev/null
+++ b/.run/SDFMapCreator.run.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SDFMapCreator/Program.cs b/SDFMapCreator/Program.cs
index 700c872..f5f470b 100644
--- a/SDFMapCreator/Program.cs
+++ b/SDFMapCreator/Program.cs
@@ -35,17 +35,6 @@ public static class Program {
var pixels = ImageUtil.LoadImage($"./{imagesPath}{Path.DirectorySeparatorChar}{i + 1:00}.png");
Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
}
-
- /*
- var pixels = ImageUtil.LoadImage($"./sphereempty.png");
- Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
- pixels = ImageUtil.LoadImage($"./spherehalf.png");
- Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
- pixels = ImageUtil.LoadImage($"./spherecut.png");
- Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
- pixels = ImageUtil.LoadImage($"./spherefull.png");
- Images.Add(new(pixels, pixels.GetLength(0), pixels.GetLength(1)));
- */
//check if all the images in Images are the same resolution
if (Images.Select(img => (img.Width, img.Height)).Distinct().Count() > 1) {
@@ -171,29 +160,6 @@ public static class Program {
static Vector3[,] Gradient(TransitionMaskData mask, SDFData sdfA, SDFData sdfB) {
var sw = new Stopwatch();
sw.Start();
- /*Vector3[,] temp = new Vector3[width, height];
-
- var min = MAX;
- var max = MIN;
-
- Console.WriteLine("Running gradient generation...");
- Parallel.For(0, width * height, parallelOptions, (i) =>
- {
- int x = (int)(i % width);
- int y = (int)(i / width);
-
- if (mask.Mask[x, y].X == 0 || mask.Mask[x, y].Y > 0) return;
-
- var a = sdfA.SDF[x, y].X;
- var b = sdfB.SDF[x, y].X;
-
- var gradient = a / (a + b);
- temp[x, y] = new(Remap(gradient, 0, 1, MIN, MAX));
-
- if (gradient < min) min = gradient;
- if (gradient > max) max = gradient;
- });*/
-
kernels.Gradient(mask.Mask, sdfA.SDF, sdfB.SDF, out var temp);
Console.WriteLine($"Gradient Time: {sw.Elapsed.TotalSeconds:N4}s ({width * height / (float)sw.Elapsed.TotalSeconds:N0} pixels/s)");
return temp;
@@ -235,8 +201,7 @@ public static class Program {
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- static float EuclideanDistance(Vector2 a, Vector2 b) =>
- MathF.Sqrt(MathF.Pow(a.X - b.X, 2) + MathF.Pow(a.Y - b.Y, 2));
+ static float EuclideanDistance(Vector2 a, Vector2 b) => MathF.Sqrt(MathF.Pow(a.X - b.X, 2) + MathF.Pow(a.Y - b.Y, 2));
static Vector3[,] GetABMask(Vector3[,] A, Vector3[,] B) {
kernels.ABMask(A, B, out var temp);
diff --git a/SDFMapCreator/SDFMapCreator.csproj b/SDFMapCreator/SDFMapCreator.csproj
index b805c83..825581d 100644
--- a/SDFMapCreator/SDFMapCreator.csproj
+++ b/SDFMapCreator/SDFMapCreator.csproj
@@ -5,9 +5,15 @@
net8.0
enable
enable
+ SDFMapTool
+ Circle2Labs
+ SDFMapTool
+ 1.0
+ 1.0
+
diff --git a/SDFMapCreator/SdfKernels.Kernels.cs b/SDFMapCreator/SdfKernels.Kernels.cs
index fa5d860..ae8566b 100644
--- a/SDFMapCreator/SdfKernels.Kernels.cs
+++ b/SDFMapCreator/SdfKernels.Kernels.cs
@@ -132,12 +132,6 @@ public partial class SdfKernels {
gradient.X += i * image[x + i, y].X;
gradient.Y += i * image[x, y + i].X;
}
-
- /*
- output[x, y] = new Vector3(float.Abs((gradient.X * 0.5f) + 0.5f),
- float.Abs((gradient.Y * 0.5f) + 0.5f), 0.5f);
- return;
- */
if (gradient == Vector2.Zero) {
output[x, y] = value;