1
0
Files
tmi-practicum-2018-2019/TMI-practicum/SimpleAlgorithm.cs
2019-05-15 16:46:55 +02:00

29 lines
871 B
C#

using System.Collections.Generic;
namespace TMI_practicum
{
public static class SimpleAlgorithm
{
public static IEnumerable<Intersection> Solve(IList<Circle> circles)
{
var intersections = new HashSet<Intersection>();
for (int i = 0; i < circles.Count - 1; i++)
{
for (int j = i + 1; j < circles.Count; j++)
{
var c1 = circles[i];
var c2 = circles[j];
var intersects = c1.FindIntersections(c2);
if (intersects == null) continue;
foreach (var intersect in intersects)
{
intersections.Add(intersect);
}
}
}
return intersections;
}
}
}