1
0

Small changes

This commit is contained in:
Ruben
2019-05-17 15:13:33 +02:00
parent 19644edced
commit b847e1777a
2 changed files with 5 additions and 7 deletions

View File

@@ -21,14 +21,12 @@ namespace TMI_practicum
return Math.Round(Math.Sqrt(Math.Pow(X - otherCircle.X, 2) + Math.Pow(Y - otherCircle.Y, 2)), 15);
}
public
IEnumerable<Intersection> FindIntersections(Circle c1)
public IEnumerable<Intersection> FindIntersections(Circle c1)
{
IList<Intersection> intersections;
double d = Distance(c1);
if (d > R + c1.R || d < Math.Abs(R - c1.R) || d == 0.0 && R - c1.R == 0.0) return null;
if (d > R + c1.R || d < Math.Abs(R - c1.R) || (d == 0.0 && R - c1.R == 0.0)) return null;
double a = Math.Round((R * R - c1.R * c1.R + d * d) / (2.0*d), 15);
double px = Math.Round(X + a * (c1.X - X) / d, 15);
double py = Math.Round(Y + a * (c1.Y - Y) / d, 15);