25 lines
748 B
C#
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;
|
|
}
|
|
}
|
|
} |