diff --git a/Engine/Ascii3dEngine.Engine.csproj b/Engine/Ascii3dEngine.Engine.csproj index a60314e..d084534 100644 --- a/Engine/Ascii3dEngine.Engine.csproj +++ b/Engine/Ascii3dEngine.Engine.csproj @@ -8,7 +8,7 @@ - + diff --git a/Engine/Support/MotionMatrix.cs b/Engine/Support/MotionMatrix.cs index 9bd0b4f..58d2b52 100644 --- a/Engine/Support/MotionMatrix.cs +++ b/Engine/Support/MotionMatrix.cs @@ -1,8 +1,8 @@ // This class holds information necessary to transformation point in 3D space // The types of transformations that it supports are as follows -// - Scaling in 3 dimentions independently +// - Scaling in 3 dimensions independently // - Rotating about each of the 3 axes independently -// - Translation to a different center in 3 dimentions independently +// - Translation to a different center in 3 dimensions independently // // This also has the ability to undo this transition, this allows us to take the intersection points that and map them back // to where they should have landed without any of the transformation @@ -10,7 +10,7 @@ // Some things to note // Order of operations is important, we could have use 4d transformation matrixes // Doing so that would allow us to simply apply each change to the matrix as given and we could undo them by computing the inverse matrix -// Commuting the inverse matrix of an arbitary 4x4 matrix should be doable (assuming it determinate is not 0, which this should not) +// Commuting the inverse matrix of an arbitrary 4x4 matrix should be doable (assuming it determinate is not 0, which this should not) // But that can be computationally expensive. // Plus b/c of order of operating matters it get tricky // Basically translate laterally along the X axis, then rotate about the Y axis is very different if those operations are reversed diff --git a/TechDemo/Ascii3dEngine.TechDemo.csproj b/TechDemo/Ascii3dEngine.TechDemo.csproj index 604758a..03f5e9e 100644 --- a/TechDemo/Ascii3dEngine.TechDemo.csproj +++ b/TechDemo/Ascii3dEngine.TechDemo.csproj @@ -9,7 +9,7 @@ - + diff --git a/Tests/Ascii3dEngine.Tests.csproj b/Tests/Ascii3dEngine.Tests.csproj index 40c3d3f..c892fac 100644 --- a/Tests/Ascii3dEngine.Tests.csproj +++ b/Tests/Ascii3dEngine.Tests.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/Tests/ColorUtilitesTests.cs b/Tests/ColorUtilitesTests.cs index cfbc12e..dbf0967 100644 --- a/Tests/ColorUtilitesTests.cs +++ b/Tests/ColorUtilitesTests.cs @@ -1,5 +1,3 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - namespace Ascii3dEngine.Tests { [TestClass] diff --git a/Tests/MotionMatrixTests.cs b/Tests/MotionMatrixTests.cs index 063b415..7ac9a95 100644 --- a/Tests/MotionMatrixTests.cs +++ b/Tests/MotionMatrixTests.cs @@ -1,12 +1,11 @@ using MathNet.Numerics.LinearAlgebra.Double; -using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Ascii3dEngine.Tests { [TestClass] public class MotionMatrixTests { - [TestMethod("Page 224 Practice Exercise 5.2.4 Build One - Understanding")] + [TestMethod(DisplayName = "Page 224 Practice Exercise 5.2.4 Build One - Understanding")] public void Exercise_5_2_4_Understanding() { // The order of operations in the exercise are different @@ -67,7 +66,7 @@ public void Exercise_5_2_4_Understanding() TestUtilities.AssertVectorsAreEqual(expectedVector, result, delta: 0.001); } - [TestMethod("Page 224 Practice Exercise 5.2.4 Build One - Code")] + [TestMethod(DisplayName = "Page 224 Practice Exercise 5.2.4 Build One - Code")] public void Exercise_5_2_4_Code() { var radians = Utilities.DegreesToRadians(45); @@ -114,7 +113,7 @@ public void Exercise_5_2_4_Code() Assert.AreEqual(expectedPoint, actual); } - [TestMethod("Page 228 Practice Exercise 5.2.22 Tow successive rotations")] + [TestMethod(DisplayName = "Page 228 Practice Exercise 5.2.22 Tow successive rotations")] public void Exercise_5_2_22() { var random = TestUtilities.NewTestRandom; @@ -149,7 +148,7 @@ public void Exercise_5_2_22() } } - [TestMethod("Page 237 Practice Exercise 5.3.2 Rotate points")] + [TestMethod(DisplayName = "Page 237 Practice Exercise 5.3.2 Rotate points")] public void Exercise_5_3_2() { var motionMatrix = new MotionMatrix().RotateByY(Utilities.DegreesToRadians(30)); @@ -159,7 +158,7 @@ public void Exercise_5_3_2() TestUtilities.AssertPointsAreEqual(new (4.598, 1, 1.964), actual, 3); } - [TestMethod("Page 239 Example 5.3.3")] + [TestMethod(DisplayName = "Page 239 Example 5.3.3")] public void Example_5_3_3() { var actual = new MotionMatrix() diff --git a/Tests/TestUtilities.cs b/Tests/TestUtilities.cs index aa12757..7972e5c 100644 --- a/Tests/TestUtilities.cs +++ b/Tests/TestUtilities.cs @@ -1,5 +1,4 @@ using MathNet.Numerics.LinearAlgebra; -using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Ascii3dEngine.Tests { diff --git a/Tests/UtilitiesTests.cs b/Tests/UtilitiesTests.cs index 6cfc39f..f30dae7 100644 --- a/Tests/UtilitiesTests.cs +++ b/Tests/UtilitiesTests.cs @@ -1,13 +1,12 @@ using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra.Double; -using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Ascii3dEngine.Tests { [TestClass] public class UtilitiesTests { - [TestMethod("Check for bug that broke 'Looking Right'")] + [TestMethod(DisplayName = "Check for bug that broke 'Looking Right'")] public void CheckAffineTransformationForRotatingAroundUnitWithSource() { var from = new Point3D(0, 3, 0); @@ -23,7 +22,7 @@ public void CheckAffineTransformationForRotatingAroundUnitWithSource() TestUtilities.AssertPointsAreEqual(expected, actual, round: 15); } - [TestMethod("Page 216 Practice Exercise 5.2.1 Apply The Transform")] + [TestMethod(DisplayName = "Page 216 Practice Exercise 5.2.1 Apply The Transform")] public void Exercise_5_2_1() { // The practice exercise is in 2d @@ -42,7 +41,7 @@ public void Exercise_5_2_1() Assert.AreEqual(Q, actual); } - [TestMethod("Page 220 Example 5.2.1")] + [TestMethod(DisplayName = "Page 220 Example 5.2.1")] public void Example_5_2_1() { // The practice exercise is in 2d @@ -77,7 +76,7 @@ public void Example_5_2_1() Assert.AreEqual(actual.Length, Q.Length, "The Transformation should should not have changed their Length"); } - [DataTestMethod] + [TestMethod] [DataRow( 2, 3, -45, 3.5355, 0.7071, DisplayName = "Page 220 Practice Exercise 5.2.3 Rotate a point A")] [DataRow( 1, 1, -180, -1.0, -1.0, DisplayName = "Page 220 Practice Exercise 5.2.3 Rotate a point B")] [DataRow(60, 61, 4, 55.5987, 65.0368, DisplayName = "Page 220 Practice Exercise 5.2.3 Rotate a point C")] @@ -93,7 +92,7 @@ public void Exercise_5_2_3(int pX, int pY, int degrees, double qX, double qY) Assert.AreEqual(actual.Length, Q.Length, delta: 0.0001); } - [TestMethod("Page 223 Exercise 5.2.5 What is the inverse of a rotation")] + [TestMethod(DisplayName = "Page 223 Exercise 5.2.5 What is the inverse of a rotation")] public void Exercise_5_2_5() { var random = TestUtilities.NewTestRandom; @@ -118,7 +117,7 @@ public void Exercise_5_2_5() } } - [TestMethod("Page 224 Example 5.2.4")] + [TestMethod(DisplayName = "Page 224 Example 5.2.4")] public void Example_5_2_4() { var radians = Utilities.DegreesToRadians(45); @@ -148,7 +147,7 @@ public void Example_5_2_4() } - [TestMethod("Page 241 Example 5.3.4 Rotating about an axis")] + [TestMethod(DisplayName = "Page 241 Example 5.3.4 Rotating about an axis")] public void Example_5_3_4() { var u = Point3D.Identity.Normalized(); diff --git a/Tools/Ascii3dEngine.Tools.csproj b/Tools/Ascii3dEngine.Tools.csproj index c5a2cda..4d788f5 100644 --- a/Tools/Ascii3dEngine.Tools.csproj +++ b/Tools/Ascii3dEngine.Tools.csproj @@ -9,7 +9,7 @@ - + diff --git a/Tools/CharProcessor.cs b/Tools/CharProcessor.cs index 10a1a19..2904867 100644 --- a/Tools/CharProcessor.cs +++ b/Tools/CharProcessor.cs @@ -205,16 +205,18 @@ public static (int[] Counts, int Width, int Height, Rgb24[] NamedColors) Compute return (charCounts, charWidth, charHeight, colors); } - private static void AssertIsColor(Rgb24[,] imageData, int pixelRow, int pixelCol, Color color) + private static void AssertIsColor(Rgb24[,] imageData, int pixelRow, int pixelCol, Rgb24 color) { var found = imageData[pixelRow, pixelCol]; - var expected = color.ToPixel(); - if (!AreClose(found, expected)) + if (!AreClose(found, color)) { - throw new ApplicationException($"At {nameof(pixelRow)}: {pixelRow}, {nameof(pixelCol)}: {pixelCol}, {nameof(found)}: {found}, {nameof(expected)}: {expected}"); + throw new ApplicationException($"At {nameof(pixelRow)}: {pixelRow}, {nameof(pixelCol)}: {pixelCol}, {nameof(found)}: {found}, {nameof(color)}: {color}"); } } + private static void AssertIsColor(Rgb24[,] imageData, int pixelRow, int pixelCol, Color color) + => AssertIsColor(imageData, pixelRow, pixelCol, color.ToPixel()); + private static int Check(Rgb24[,] imageData, int at, int start, bool across, Color color, int max = -1) { if (max == -1)