Small changes
This commit is contained in:
@@ -21,13 +21,11 @@ namespace TMI_practicum
|
|||||||
return Math.Round(Math.Sqrt(Math.Pow(X - otherCircle.X, 2) + Math.Pow(Y - otherCircle.Y, 2)), 15);
|
return Math.Round(Math.Sqrt(Math.Pow(X - otherCircle.X, 2) + Math.Pow(Y - otherCircle.Y, 2)), 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public IEnumerable<Intersection> FindIntersections(Circle c1)
|
||||||
IEnumerable<Intersection> FindIntersections(Circle c1)
|
|
||||||
{
|
{
|
||||||
IList<Intersection> intersections;
|
IList<Intersection> intersections;
|
||||||
double d = Distance(c1);
|
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 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 px = Math.Round(X + a * (c1.X - X) / d, 15);
|
||||||
|
@@ -52,7 +52,7 @@ namespace TMI_practicum
|
|||||||
private static (byte Algorithm, int NbCircles, IList<Circle> Circles) ParseFile(string path)
|
private static (byte Algorithm, int NbCircles, IList<Circle> Circles) ParseFile(string path)
|
||||||
{
|
{
|
||||||
|
|
||||||
byte algoritm = 0;
|
byte algorithm = 0;
|
||||||
int nbCircles = 0;
|
int nbCircles = 0;
|
||||||
Circle[] circles = null;
|
Circle[] circles = null;
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ namespace TMI_practicum
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
algoritm = byte.Parse(file.ReadLine());
|
algorithm = byte.Parse(file.ReadLine());
|
||||||
nbCircles = int.Parse(file.ReadLine());
|
nbCircles = int.Parse(file.ReadLine());
|
||||||
circles = new Circle[nbCircles];
|
circles = new Circle[nbCircles];
|
||||||
string line;
|
string line;
|
||||||
@@ -79,7 +79,7 @@ namespace TMI_practicum
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (algoritm, nbCircles, circles);
|
return (algorithm, nbCircles, circles);
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string OutputFile = "output.txt";
|
private const string OutputFile = "output.txt";
|
||||||
|
Reference in New Issue
Block a user