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

25 lines
748 B
C#

using System.Collections.Generic;
namespace TMI_practicum
{
public static class SimpleAlgorithm
{
public static IEnumerable<Intersection> Solve(IList<Circle> circles)
{
var intersections = new List<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) intersections.AddRange(c1.FindIntersections(c2));
}
}
return intersections;
}
}
}