bug fix on is_polygon_in_polygon_xy#1130
Conversation
tomvanmele
left a comment
There was a problem hiding this comment.
thanks for identifying the problem and proposing a fix. could you add a test and include one or more boundary cases?
|
instead of -j-1 i would suggest: |
|
@worbit that is indeed much simpler and generates the same loop of edges :) |
|
also here some lint that makes the tests fail... |
|
Hello, Looking back at this polygon-in-polygon-fix i noticed it wasn't available yet. Is something missing ? And, my personal curiosity, wondering about the '[Merge branch 'main' into polygon-in-polygon-fix]' thing, is it part of the process before merging back a fix to the main ? I was about to submit a bunch of new polygon predicates (intersection, containment) that would require polygon-in-polygon to work fine. Thanks ! |
|
Hello, @tomvanmele nope, as that fix was still open here, #1153 only contains new methods, but not that fix as well (i.e. is_polygon_in_polygon is wrong in #1153) |
|
@gonzalocasas this would also be one for LTS |
The is_polygon_in_polygon method was sometimes mistaking returning polygon2 was inside polygon1 while it wasn't. Issue occurs when edge intersection check is required inside is_polygon_in_polygon_xy to 'help decide'. Lines are first created, both for the contour polygon and the polygon to check on. Here is part of the code :
for j in range(len(polygon2)):
line = [polygon2[-j], polygon2[j - 1]]
should be [... , polygon2[-j - 1]] to accurately loop through all the edges of polygon2
What type of change is this?
Checklist
CHANGELOG.mdfile in theUnreleasedsection under the most fitting heading (e.g.Added,Changed,Removed).invoke test).invoke lint).compas.datastructures.Mesh.