-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter out None element from vertices for clipping_polygon #1113
Conversation
Actually, never mind, I think this is not the correct way to handle the error. |
Hi, @mozman , I've updated the merge request to add a more proper handling of the error case. Could you please review now? Basically, if clipping edge and polygon edge are in parallel and overlapping, given the default absolute tolerance, In such case, the modification conservatively preserve the polygon vertex during clipping instead of |
@kkkkkom Please add test cases to the |
Thanks for reviewing, yes, I will add testcase and fix the pipeline |
Hi, @mozman , actually, never mind, I think regarding my specific issue, there is no need for code change, but needs to provide a smaller However, I would like to set a smaller default
Is that correct? If so, could you please let me know how to rebuild the cython extension so I can test the changes locally? |
@kkkkkom The tolerances should be passed to the functions, if this is not possible, that's the issue to fix. I will not accept a change of the (arbitrary) global tolerance - what is best for you is maybe not ideal for the next user, there is no perfect value. Therefor all functions (should) have a tolerance argument. This link shows how to build https://ezdxf.mozman.at/docs/setup.html#build-and-install-from-source There is also a |
clip_polygon() When clipping edge and polygon edge is parallel and overlapping, `is_inside()` and `edge_intersection()` gives non-consistant results, and cause error. Using consistent tolerance to resolve the error.
Hi, @mozman , thanks for reviewing. Let me post the original issue that I encountered, so I can describe the here in a more clear way. So the issue came from a very high level API (render a viewport in paperspace) with a deep trace like below:
Then I did some initial debug, and figured out that the function
Above should raise an error. If we pass in a smaller abs_tol into the edge_intersection() function, it can avoid the error. But as you can see, there is a deep call stack to expose the Then on a second thought, I think a more proper way is just to use the consistent |
return intersection_line_line_2d( | ||
(edge_start, edge_end), (clip_start, clip_end) | ||
(edge_start, edge_end), (clip_start, clip_end), abs_tol=0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix for this is to change the algorithm and check for None values!
You should report such issues as bug report. |
Thanks, will report a bug issue. |
Actually I saw you already updated the fix, thanks! |
Dear @mozman , could you please review this minor merge request?
During viewport drawing in
paperspace
, theNone
element fromclipped.copy()
is raising errors for later processing, thus filtering them out to avoid the errors.It produces same rendering results as compared to autodesk online viewer at https://viewer.autodesk.com/
Could you please review and see if this is a safe filtering and can be merged?