fix bug found by Evan VanderZee

This commit is contained in:
Joachim Schöberl 2016-01-30 21:56:12 +01:00
parent 2a2b728d55
commit 6ab4195c8d

View File

@ -119,8 +119,6 @@ int netrule :: IsInFreeZone2 (const Point2d & p) const
int netrule :: IsLineInFreeZone2 (const Point2d & p1, const Point2d & p2) const int netrule :: IsLineInFreeZone2 (const Point2d & p1, const Point2d & p2) const
{ {
int left, right, allleft, allright;
if ( (p1.X() > fzmaxx && p2.X() > fzmaxx) || if ( (p1.X() > fzmaxx && p2.X() > fzmaxx) ||
(p1.X() < fzminx && p2.X() < fzminx) || (p1.X() < fzminx && p2.X() < fzminx) ||
(p1.Y() > fzmaxy && p2.Y() > fzmaxy) || (p1.Y() > fzmaxy && p2.Y() > fzmaxy) ||
@ -144,21 +142,20 @@ int netrule :: IsLineInFreeZone2 (const Point2d & p1, const Point2d & p2) const
ny /= nl; ny /= nl;
double c = - (p1.X() * nx + p1.Y() * ny); double c = - (p1.X() * nx + p1.Y() * ny);
allleft = 1; bool allleft = true;
allright = 1; bool allright = true;
for (int i = 1; i <= transfreezone.Size(); i++) for (int i = 1; i <= transfreezone.Size(); i++)
{ {
left = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() + c < 1e-7; bool left = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() * ny + c < 1e-7;
right = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() + c > -1e-7; bool right = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() * ny + c > -1e-7;
if (!left) allleft = false;
if (!left) allleft = 0; if (!right) allright = false;
if (!right) allright = 0;
} }
if (allleft || allright) return 0; if (allleft || allright) return false;
} }
return 1; return true;
} }
int netrule :: ConvexFreeZone () const int netrule :: ConvexFreeZone () const