Menu

Possible bug in netrule::IsLineInFreeZone2

2016-01-19
2016-01-30
  • Evan VanderZee

    Evan VanderZee - 2016-01-19

    It looks to me like there may be a mistake on what are currently lines 152 and 153 of libsrc/meshing/netrule2.cpp.

    These lines read

          left  = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() + c <  1e-7;
          right = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() + c > -1e-7;
    

    I think the correct computation would be to write instead

          left  = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() * ny + c <  1e-7;
          right = transfreezone.Get(i).X() * nx + transfreezone.Get(i).Y() * ny + c > -1e-7;
    

    Here is what I think this section of code is doing. The objective is to determine whether a boundary point of thhe free zone is to the left or right of a potential edge. The variables nx and ny tell the direction of the 2-dimensional normal vector to the potential edge, and c is the negative of the deviation of the potential edge from the origin along that normal vector. (Notice also that when c is calculated, the variable ny is involved.) The free zone boundary point will be left or right of the potential edge depending on whether its deviation along the normal is more than or less than the deviation of the potential edge.

    Am I misunderstanding something? If not, please make the suggested change.

     
  • Joachim Schoeberl

    You are right !
    Thanks, I included your fix.

     

Log in to post a comment.