1
0
This commit is contained in:
2019-05-24 11:57:38 +02:00
parent 91cc0bce3a
commit 69e87562a5
2 changed files with 3 additions and 3 deletions

View File

@@ -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<SegmentKey, Circle>(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);