fix compare
This commit is contained in:
@@ -62,23 +62,37 @@ namespace TMI_practicum
|
|||||||
Console.WriteLine("start check {0}", i++);
|
Console.WriteLine("start check {0}", i++);
|
||||||
var circles = CreateRandomCircles(5);
|
var circles = CreateRandomCircles(5);
|
||||||
|
|
||||||
var correctSol = SweepLineAlgorithm.Solve(circles);
|
var correctSol = SimpleAlgorithm.Solve(circles);
|
||||||
var solved = SweepLineEffAlgorithm.Solve(circles);
|
var solved = SweepLineAlgorithm.Solve(circles);
|
||||||
|
|
||||||
foreach (var intersection in correctSol)
|
foreach (var intersection in correctSol)
|
||||||
{
|
{
|
||||||
if (solved.Contains(intersection)) continue;
|
if (solved.Contains(intersection)) continue;
|
||||||
|
|
||||||
if (solved.Contains(new Intersection(intersection.X + 10e-15, intersection.Y)) ||
|
if (solved.Contains(new Intersection(intersection.X + 1e-15, intersection.Y)) ||
|
||||||
solved.Contains(new Intersection(intersection.X - 10e-15, intersection.Y)) ||
|
solved.Contains(new Intersection(intersection.X - 1e-15, intersection.Y)) ||
|
||||||
solved.Contains(new Intersection(intersection.X + 10e-15, intersection.Y + 10e-15)) ||
|
solved.Contains(new Intersection(intersection.X + 1e-15, intersection.Y + 1e-15)) ||
|
||||||
solved.Contains(new Intersection(intersection.X + 10e-15, intersection.Y - 10e-15)) ||
|
solved.Contains(new Intersection(intersection.X + 1e-15, intersection.Y - 1e-15)) ||
|
||||||
solved.Contains(new Intersection(intersection.X - 10e-15, intersection.Y - 10e-15)) ||
|
solved.Contains(new Intersection(intersection.X - 1e-15, intersection.Y + 1e-15)) ||
|
||||||
solved.Contains(new Intersection(intersection.X - 10e-15, intersection.Y - 10e-15)) ||
|
solved.Contains(new Intersection(intersection.X - 1e-15, intersection.Y - 1e-15)) ||
|
||||||
solved.Contains(new Intersection(intersection.X, intersection.Y + 10e-15)) ||
|
solved.Contains(new Intersection(intersection.X, intersection.Y + 1e-15)) ||
|
||||||
solved.Contains(new Intersection(intersection.X, intersection.Y - 10e-15))
|
solved.Contains(new Intersection(intersection.X, intersection.Y - 1e-15))
|
||||||
) continue;
|
) continue;
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
foreach (var ints in solved)
|
||||||
|
{
|
||||||
|
if (Math.Abs(ints.X - intersection.X) < 1e-12 &&
|
||||||
|
Math.Abs(ints.Y - intersection.Y) < 1e-12)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found) continue;
|
||||||
|
|
||||||
Console.WriteLine(InCircles(circles));
|
Console.WriteLine(InCircles(circles));
|
||||||
|
|
||||||
failed = true;
|
failed = true;
|
||||||
|
Reference in New Issue
Block a user