Open
Conversation
Add guards in rounded_corner_segment_line_arc and rounded_corner_line_arc for three degenerate cases that crash during CurvilinearPolygon rounding: 1. Fillet center coincides with arc center (norm(C_f - O) < atol), producing NaN from the direction vector division 2. Tangent points collapse onto fillet center (fillet_r < atol), producing NaN from zero-length direction vectors 3. Fillet sweep angle below min_angle, producing arcs too small for GMSH to distinguish from a line All three return nothing (skip rounding, leave corner sharp).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
gpeairs
reviewed
Apr 15, 2026
Member
gpeairs
left a comment
There was a problem hiding this comment.
This looks good, one small comment and a question about the TODO.
| # When the fillet sweep angle is tiny, the arc sagitta | ||
| # (r·(1 - cos(dα/2))) is sub-nanometer — GMSH can't distinguish it from | ||
| # a line and rejects it. Skip rounding this corner. | ||
| # TODO: instead of skipping, fall through to line-line rounding |
Member
There was a problem hiding this comment.
Is this TODO needed? If I understand the geometry right, this should also be skipped for being below min_angle in line-line rounding (at least approximately).
Comment on lines
+1720
to
+1727
| catch e | ||
| # Arc too small or degenerate for GMSH — fall back to straight line. | ||
| # This typically happens with fillet arcs at nearly-tangent corners | ||
| # where the sagitta is below GMSH's internal tolerance. | ||
| @debug "addCircleArc failed, falling back to line" p0 = seg.p0 r = seg.r α = seg.α α0 = | ||
| seg.α0 | ||
| return k.add_line(endpoints[1], endpoints[2]) | ||
| end |
Member
There was a problem hiding this comment.
I worry about hiding real changes to geometry under a @debug message. I'd suggest making sure it's not some other error:
catch e
if contains(string(e), <substring of expected error message text>)
@debug ...
return k.add_line(endpoints[1], endpoints[2])
end
rethrow()
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add guards in
rounded_corner_segment_line_arcandrounded_corner_line_arcfor three degenerate cases that crash during CurvilinearPolygon rounding:All three return nothing (skip rounding, leave corner sharp).