1
0

perf fixes

This commit is contained in:
2019-05-15 16:58:33 +02:00
parent de4d08b938
commit 311da13574
3 changed files with 8 additions and 7 deletions

View File

@@ -6,10 +6,10 @@ namespace TMI_practicum
{
public static class SweepLineAlgorithm
{
public static IEnumerable<Intersection> Solve(IList<Circle> circles)
public static IEnumerable<Intersection> Solve(IEnumerable<Circle> circles)
{
var events = new PriorityQueue<Event>();
var intersections = new HashSet<Intersection>();
var intersections = new Stack<Intersection>();
var active = new List<Circle>();
foreach (var circle in circles)
@@ -38,7 +38,7 @@ namespace TMI_practicum
return intersections;
}
private static void CheckIntersections(IEnumerable<Circle> active, Circle circle, HashSet<Intersection> intersections)
private static void CheckIntersections(IEnumerable<Circle> active, Circle circle, Stack<Intersection> intersections)
{
foreach (var otherCircle in active)
{
@@ -49,7 +49,7 @@ namespace TMI_practicum
foreach (var intersection in intersects)
{
intersections.Add(intersection);
intersections.Push(intersection);
}
}
}