1
0

initial implementation sweeplineff

This commit is contained in:
2019-05-18 18:34:20 +02:00
parent d0151ca13a
commit ec65d0d925
4 changed files with 201 additions and 10 deletions

View File

@@ -10,6 +10,8 @@ namespace TMI_practicum
{
public static void Main(string[] args)
{
//SweepLineEffAlgorithm.Solve(null);
if (args.Length < 1)
{
Console.WriteLine("Please enter a file.");
@@ -22,26 +24,26 @@ namespace TMI_practicum
Environment.Exit(1);
}
var parsed = ParseFile(args[0]);
var (algorithm, _, circles) = ParseFile(args[0]);
IEnumerable<Intersection> solved;
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
switch (parsed.Algorithm)
switch (algorithm)
{
case 1:
solved = SimpleAlgorithm.Solve(parsed.Circles);
solved = SimpleAlgorithm.Solve(circles);
break;
case 2:
solved = SweepLineAlgorithm.Solve(parsed.Circles);
solved = SweepLineAlgorithm.Solve(circles);
break;
case 3:
solved = SweepLineEffAlgorithm.Solve(parsed.Circles);
solved = SweepLineEffAlgorithm.Solve(circles);
break;
default:
throw new ArgumentException("Algorithm with id: " + parsed.Algorithm + " is not defined!");
throw new ArgumentException("Algorithm with id: " + algorithm + " is not defined!");
}
stopwatch.Stop();
@@ -95,7 +97,7 @@ namespace TMI_practicum
{
foreach (var intersection in intersections)
{
sw.WriteLine("{0}\t{1}", intersection.X, intersection.Y);
sw.WriteLine("{0:0.000000000000000}\t{1:0.000000000000000}", intersection.X, intersection.Y);
}
sw.WriteLine("\r\n{0}", time);