Menu

#205 Bug in ClipperOffset

*
open
nobody
None
1
2021-07-20
2021-07-20
No

Hi,

if you run ClipperOffset with distance 2 and join type jtSquare on this polygon, the output polygon cuts off one corner of the input polygon, see attached image.

{ 500, 70 },
{ 200, 70 },
{ 30, 20 },
{ 200, 20 }

The bug is located in ClipperOffset::OffsetPoint(): the assignment "k = j" should not only done at the end of the method, but also at the other return point:

@@ -4140,6 +4141,7 @@ void ClipperOffset::OffsetPoint(int j, int& k, JoinType jointype)
     {
       m_destPoly.push_back(IntPoint(Round(m_srcPoly[j].X + m_normals[k].X * m_delta),
         Round(m_srcPoly[j].Y + m_normals[k].Y * m_delta)));

+      k = j;
       return; 
     }
     //else angle => 180 degrees   
1 Attachments

Discussion

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB