Skip to content

Commit

Permalink
Fix rounding error in clipper.cpp
Browse files Browse the repository at this point in the history
This fixes half of #1486 (test failure in t/geometry.t)
  • Loading branch information
olasd committed Nov 3, 2013
1 parent 849d69d commit 067cc1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions xs/src/clipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3335,11 +3335,11 @@ void DoSquare(double mul)
a1 = std::fabs(a2 - a1);
if (a1 > pi) a1 = pi * 2 - a1;
double dx = std::tan((pi - a1) / 4) * std::fabs(m_delta * mul);
pt1 = IntPoint((long64)(pt1.X -normals[m_k].Y * dx),
(long64)(pt1.Y + normals[m_k].X * dx));
pt1 = IntPoint((long64)Round(pt1.X -normals[m_k].Y * dx),
(long64)Round(pt1.Y + normals[m_k].X * dx));
AddPoint(pt1);
pt2 = IntPoint((long64)(pt2.X + normals[m_j].Y * dx),
(long64)(pt2.Y -normals[m_j].X * dx));
pt2 = IntPoint((long64)Round(pt2.X + normals[m_j].Y * dx),
(long64)Round(pt2.Y -normals[m_j].X * dx));
AddPoint(pt2);
}
else
Expand Down

0 comments on commit 067cc1a

Please sign in to comment.