perf fixes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user