update
This commit is contained in:
@@ -23,7 +23,7 @@ namespace TMI_practicum
|
||||
|
||||
public IList<Intersection> FindIntersections(Circle c1)
|
||||
{
|
||||
var intersections = new List<Intersection>();
|
||||
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;
|
||||
|
||||
@@ -35,13 +35,15 @@ namespace TMI_practicum
|
||||
double htemp = Math.Round(R * R - a * a, 15);
|
||||
if (htemp == 0)
|
||||
{
|
||||
intersections.Add(new Intersection(px, py));
|
||||
intersections = new Intersection[1];
|
||||
intersections[0] = new Intersection(px, py);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersections = new Intersection[2];
|
||||
double h = Math.Round(Math.Sqrt(htemp), 15);
|
||||
intersections.Add(new Intersection(px + h * (c1.Y - Y) / d, py - h * (c1.X - X) / d));
|
||||
intersections.Add(new Intersection(px - h * (c1.Y - Y) / d, py + h * (c1.X - X) / d));
|
||||
intersections[0] = new Intersection(px + h * (c1.Y - Y) / d, py - h * (c1.X - X) / d);
|
||||
intersections[1] = new Intersection(px - h * (c1.Y - Y) / d, py + h * (c1.X - X) / d);
|
||||
}
|
||||
|
||||
return intersections;
|
||||
|
Reference in New Issue
Block a user