1
0
This commit is contained in:
2019-05-19 13:23:10 +02:00
parent 71e650e373
commit c022a2915b
2 changed files with 9 additions and 11 deletions

View File

@@ -25,13 +25,12 @@ namespace TMI_practicum
var (algorithm, _, circles) = ParseFile(args[0]); var (algorithm, _, circles) = ParseFile(args[0]);
Stopwatch stopwatch = new Stopwatch(); Stopwatch stopwatch = new Stopwatch();
IEnumerable<Intersection> solved; IEnumerable<Intersection> solved;
stopwatch.Start(); stopwatch.Start();
switch (algorithm) switch (algorithm)
{ {
case 1: case 1:
@@ -56,10 +55,11 @@ namespace TMI_practicum
{ {
var circles = new List<Circle>(); var circles = new List<Circle>();
Random rnd = new Random(); Random rnd = new Random();
for (int i = 0; i < amount; i++) for (int i = 0; i < amount; i++)
{ {
circles.Add(new Circle(Math.Round(rnd.NextDouble() * 1.0, 15), Math.Round(rnd.NextDouble() * 1.0, 15), Math.Round(rnd.NextDouble() * 0.01, 15))); circles.Add(new Circle(Math.Round(rnd.NextDouble() * 1.0, 15), Math.Round(rnd.NextDouble() * 1.0, 15),
Math.Round(rnd.NextDouble() * 0.01, 15)));
} }
return circles; return circles;
@@ -67,9 +67,8 @@ namespace TMI_practicum
private static void GetChartData() private static void GetChartData()
{ {
var stopwatch = new Stopwatch(); var stopwatch = new Stopwatch();
//warmup //warmup
var circles = CreateRandomCircles(20); var circles = CreateRandomCircles(20);
IEnumerable<Intersection> solved = SweepLineEffAlgorithm.Solve(circles); IEnumerable<Intersection> solved = SweepLineEffAlgorithm.Solve(circles);
@@ -98,7 +97,6 @@ namespace TMI_practicum
private static (byte Algorithm, int NbCircles, IList<Circle> Circles) ParseFile(string path) private static (byte Algorithm, int NbCircles, IList<Circle> Circles) ParseFile(string path)
{ {
byte algorithm = 0; byte algorithm = 0;
int nbCircles = 0; int nbCircles = 0;
Circle[] circles = null; Circle[] circles = null;
@@ -125,7 +123,7 @@ namespace TMI_practicum
Environment.Exit(1); Environment.Exit(1);
} }
} }
return (algorithm, nbCircles, circles); return (algorithm, nbCircles, circles);
} }
@@ -149,4 +147,4 @@ namespace TMI_practicum
} }
} }
} }
} }

View File

@@ -131,7 +131,7 @@ namespace TMI_practicum
{ {
private readonly double _x; private readonly double _x;
private readonly double? _y; private readonly double? _y;
public double Y => _y ?? double.MinValue; private double Y => _y ?? double.MinValue;
private readonly SegmentType _type; private readonly SegmentType _type;
private readonly int _identifier; private readonly int _identifier;