From 69e87562a5fa7bbf79a4f4014954e48dd648acaa Mon Sep 17 00:00:00 2001 From: Arthur Bols Date: Fri, 24 May 2019 11:57:38 +0200 Subject: [PATCH] fixes --- README.txt | 3 +-- TMI-practicum/SweepLineEffAlgorithm.cs | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.txt b/README.txt index cecb375..0c797f3 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ Het programma kan op volgende manieren uitgevoerd worden: - mono TMI_practicum.exe invoer.txt uitvoer.txt -- mono TMI_practicum.exe invoer.txt (de uitvoer wordt in output.txt geplaatst. +- mono TMI_practicum.exe invoer.txt (de uitvoer wordt in output.txt geplaatst.) - mono TMI_practicum.exe (zonder argument wordt 'input.txt' gezocht en de uitvoer in output.txt geplaatst.) Alle dll's moeten in de map naast het uitvoerbaar bestand staan. @@ -9,4 +9,3 @@ Alle dll's moeten in de map naast het uitvoerbaar bestand staan. Voor algoritme 1 en 2 werken alle gevallen. Voor algoritme 3 werken de gevallen waarbij een bepaalde cirkel volledig in een andere cirkel gelegen is en dan snijdt met een andere cirkel niet. -De uitvoer wordt in output.txt geplaatst. diff --git a/TMI-practicum/SweepLineEffAlgorithm.cs b/TMI-practicum/SweepLineEffAlgorithm.cs index c44465a..cce66c2 100644 --- a/TMI-practicum/SweepLineEffAlgorithm.cs +++ b/TMI-practicum/SweepLineEffAlgorithm.cs @@ -116,6 +116,7 @@ namespace TMI_practicum if (intersects == null) return; foreach (var intersection in intersects) { + if (intersections.Contains(intersection)) continue; events.Add(new Event(Event.EventType.Intersection, intersection.X, circle, intersection.Y, new[] {new C5.KeyValuePair(segment, circle), neighbour})); @@ -239,7 +240,7 @@ namespace TMI_practicum private static double CalculateY(Circle circle, SegmentKey.SegmentType type) { - if (_sweepline > circle.X + circle.R || _sweepline < circle.X - circle.R) return circle.Y; + if (_sweepline >= circle.X + circle.R || _sweepline <= circle.X - circle.R) return circle.Y; return type == SegmentKey.SegmentType.Upper ? Math.Round(Math.Sqrt(circle.R * circle.R - Math.Pow(_sweepline - circle.X, 2)) + circle.Y, 14) : Math.Round(-Math.Sqrt(circle.R * circle.R - Math.Pow(_sweepline - circle.X, 2)) + circle.Y, 14);