Menu

#68 Fix render bug for CW X-Y0 circles

Unstable (example)
closed-accepted
nobody
None
5
2018-04-22
2018-03-19
Dan Sheadel
No

See attached file for example file. This should contain 4 full circles, drawn from X+Y0, X0Y+,X-Y0, and X0Y-. However, due to a bug, this file deterministically fails to render the 3rd arc.

The issue is that calculated floating point values should be zero, but are actually very small with opposite signs. When put into atan2, that arc returns alfa and beta of -pi and pi. The subsequent angle processing then manipulates this into an incorrect, zero-length arc (pi to pi), instead of a (pi,3pi) arc as would be expected.

This patch resolves the value by simply checking the values, and forcibly declaring values below epsilon to be zero. The subsequent math then works correctly, and the arc is handled correctly.

Patch is intended to stem from git commit e571679

Impact of this bug:
This bug seems to only impact the rendering, and does not corrupt or mangle files. So using GerbV with this bug will not result in production of a failed board. It will, however, be very misleading, and potentially result in confusion.
Several design tools, notably Ultiboard, default to this arc pattern for full circles, so it is a fairly common pattern to see in the wild.

2 Attachments

Discussion

  • Sergey Alyoshin

    Sergey Alyoshin - 2018-03-26

    I can't see repository by link from fix.patch

     
  • Dan Sheadel

    Dan Sheadel - 2018-03-26

    Oops. Copy paste error. Here's the actual patch.

     
  • Sergey Alyoshin

    Sergey Alyoshin - 2018-04-22
    • status: open --> closed-accepted
     
  • Sergey Alyoshin

    Sergey Alyoshin - 2018-04-22

    Applied as git f4b3c1135966a0d2cf145eb8cd3e3c5d93af1307.

     

Log in to post a comment.