|
@@ -20,7 +20,7 @@ namespace Tests
|
|
//Test point
|
|
//Test point
|
|
List<Point> expectedResult = new List<Point>();
|
|
List<Point> expectedResult = new List<Point>();
|
|
expectedResult.Add(new Point(1, 2));
|
|
expectedResult.Add(new Point(1, 2));
|
|
- List<Point> actualResult = SketchAssistant.Line.BresenhamLineAlgorithm(new Point(1, 2), new Point(1, 2));
|
|
|
|
|
|
+ List<Point> actualResult = SketchAssistant.GeometryCalculator.BresenhamLineAlgorithm(new Point(1, 2), new Point(1, 2));
|
|
Assert.AreEqual(1, actualResult.Count);
|
|
Assert.AreEqual(1, actualResult.Count);
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
{
|
|
{
|
|
@@ -34,7 +34,7 @@ namespace Tests
|
|
//Test line going from left to right
|
|
//Test line going from left to right
|
|
List<Point> expectedResult = new List<Point>();
|
|
List<Point> expectedResult = new List<Point>();
|
|
for (int i = 1; i <= 6; i++) { expectedResult.Add(new Point(i, 2)); }
|
|
for (int i = 1; i <= 6; i++) { expectedResult.Add(new Point(i, 2)); }
|
|
- List<Point> actualResult = SketchAssistant.Line.BresenhamLineAlgorithm(new Point(1, 2), new Point(6, 2));
|
|
|
|
|
|
+ List<Point> actualResult = SketchAssistant.GeometryCalculator.BresenhamLineAlgorithm(new Point(1, 2), new Point(6, 2));
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
{
|
|
{
|
|
@@ -48,7 +48,7 @@ namespace Tests
|
|
//Test line going from right to left
|
|
//Test line going from right to left
|
|
List<Point> expectedResult = new List<Point>();
|
|
List<Point> expectedResult = new List<Point>();
|
|
for (int i = 6; i >= 1; i--) { expectedResult.Add(new Point(i, 2)); }
|
|
for (int i = 6; i >= 1; i--) { expectedResult.Add(new Point(i, 2)); }
|
|
- List<Point> actualResult = SketchAssistant.Line.BresenhamLineAlgorithm(new Point(6, 2), new Point(1, 2));
|
|
|
|
|
|
+ List<Point> actualResult = SketchAssistant.GeometryCalculator.BresenhamLineAlgorithm(new Point(6, 2), new Point(1, 2));
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
{
|
|
{
|
|
@@ -62,7 +62,7 @@ namespace Tests
|
|
//Test line going from top to bottom
|
|
//Test line going from top to bottom
|
|
List<Point> expectedResult = new List<Point>();
|
|
List<Point> expectedResult = new List<Point>();
|
|
for (int i = 5; i <= 25; i++) { expectedResult.Add(new Point(7, i)); }
|
|
for (int i = 5; i <= 25; i++) { expectedResult.Add(new Point(7, i)); }
|
|
- List<Point> actualResult = SketchAssistant.Line.BresenhamLineAlgorithm(new Point(7, 5), new Point(7, 25));
|
|
|
|
|
|
+ List<Point> actualResult = SketchAssistant.GeometryCalculator.BresenhamLineAlgorithm(new Point(7, 5), new Point(7, 25));
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
{
|
|
{
|
|
@@ -76,7 +76,7 @@ namespace Tests
|
|
//Test line going from bottom to top
|
|
//Test line going from bottom to top
|
|
List<Point> expectedResult = new List<Point>();
|
|
List<Point> expectedResult = new List<Point>();
|
|
for (int i = 25; i >= 5; i--) { expectedResult.Add(new Point(7, i)); }
|
|
for (int i = 25; i >= 5; i--) { expectedResult.Add(new Point(7, i)); }
|
|
- List<Point> actualResult = SketchAssistant.Line.BresenhamLineAlgorithm(new Point(7, 25), new Point(7, 5));
|
|
|
|
|
|
+ List<Point> actualResult = SketchAssistant.GeometryCalculator.BresenhamLineAlgorithm(new Point(7, 25), new Point(7, 5));
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
{
|
|
{
|
|
@@ -90,7 +90,7 @@ namespace Tests
|
|
//Test exactly diagonal line from top left to bottom right
|
|
//Test exactly diagonal line from top left to bottom right
|
|
List<Point> expectedResult = new List<Point>();
|
|
List<Point> expectedResult = new List<Point>();
|
|
for (int i = 5; i <= 25; i++) { expectedResult.Add(new Point(i + 2, i)); }
|
|
for (int i = 5; i <= 25; i++) { expectedResult.Add(new Point(i + 2, i)); }
|
|
- List<Point> actualResult = SketchAssistant.Line.BresenhamLineAlgorithm(new Point(7, 5), new Point(27, 25));
|
|
|
|
|
|
+ List<Point> actualResult = SketchAssistant.GeometryCalculator.BresenhamLineAlgorithm(new Point(7, 5), new Point(27, 25));
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
{
|
|
{
|
|
@@ -104,7 +104,7 @@ namespace Tests
|
|
//Test exactly diagonal line from bottom right to top left
|
|
//Test exactly diagonal line from bottom right to top left
|
|
List<Point> expectedResult = new List<Point>();
|
|
List<Point> expectedResult = new List<Point>();
|
|
for (int i = 25; i >= 5; i--) { expectedResult.Add(new Point(i + 2, i)); }
|
|
for (int i = 25; i >= 5; i--) { expectedResult.Add(new Point(i + 2, i)); }
|
|
- List<Point> actualResult = SketchAssistant.Line.BresenhamLineAlgorithm(new Point(27, 25), new Point(7, 5));
|
|
|
|
|
|
+ List<Point> actualResult = SketchAssistant.GeometryCalculator.BresenhamLineAlgorithm(new Point(27, 25), new Point(7, 5));
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
Assert.AreEqual(expectedResult.Count, actualResult.Count);
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
for (int i = 0; i < actualResult.Count; i++)
|
|
{
|
|
{
|