d3 / d3-shape

Graphical primitives for visualization, such as lines and areas.
https://d3js.org/d3-shape
ISC License
2.47k stars 304 forks source link

Unexpected arcs when corner radius is nonzero #199

Closed tkonopka closed 1 year ago

tkonopka commented 2 years ago

Hello and thank you for providing this library.

I traced some unexpected behavior in another library (reported here) to arcs in d3-shape. It only affects extremely short arcs when cornerRadius is nonzero.

In this example, the first two rows show expected behavior. In the third row, the angles are very similar, and the generated arcs are invisible (as expected). The angles are even more similar in the fourth row, but one of the arcs flips direction (unexpected).

This is not too much bother because it is straightforward to filter out such arcs before rendering, but mentioning it here as a curiosity.

https://codesandbox.io/s/dry-pine-7m88p9?file=/src/App.js

mbostock commented 1 year ago

Reproduction https://observablehq.com/d/41da02e4ede0cabc