-
Notifications
You must be signed in to change notification settings - Fork 37
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
Near-circular arcs generate empty paths when rounding is used #38
Comments
jasondavies
added a commit
to jasondavies/d3-path
that referenced
this issue
Oct 10, 2024
When rounding is used, it's possible for `arc()` to generate empty arcs in the case where the start and end points are almost coincident, and become coincident after rounding is applied. This adds a check for coincident points after rounding is applied, and splits the arc into two if coincident points are detected. Fixes d3#38.
jasondavies
added a commit
to jasondavies/d3-path
that referenced
this issue
Oct 10, 2024
When rounding is used, it's possible for `arc()` to generate empty arcs in the case where the start and end points are almost coincident, and become coincident after rounding is applied. This adds a check for coincident points after rounding is applied, and splits the arc into two if coincident points are detected. Fixes d3#38.
Arguably it's simple enough to work around by disabling rounding for d3.arc, in which case it's probably fine for d3-path to rely on the 2π angle check and generate two arc commands as it does currently. However, rounding is on by default for d3.arc. |
jasondavies
added a commit
to jasondavies/d3-shape
that referenced
this issue
Oct 17, 2024
This is the edge case with endAngle close to 2π (with d3-arc's default rounding of digits=3) that led to the fix to d3-path.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I encountered this edge case when using d3-shape:
Now, d3.arc uses
digits(3)
by default, which means it's using d3-path with rounding.Since there's no ambiguity when using d3-path's arc for a complete or near-circle (unlike arcTo which is undefined for coincident start/end points), and complete circular arcs are supported, I think this is a bug in d3-path, rather than d3-shape.
I traced it back to the rounding used in d3-path: nothing special is done to check for coincident points after rounding when drawing arcs.
The text was updated successfully, but these errors were encountered: