initial implementation sweeplineff
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user