Closed sftrabbit closed 7 years ago
As I mentioned in the corresponding issue, it would be great if this could also be fixed in D3 v3, where the fix is simply to change the call to Math.acos
in src/svg/arc.js
to d3_acos
(which already exists and is imported).
Great, thanks!
With apologies, but there will be no future releases of v3.
Due to floating point imprecision, computing the angle between two vectors with
theta = acos((a . b) / sqrt(|a||b|))
gives NaN when(a . b) / sqrt(|a||b|)
is outside the domain ofacos
. We can use a clamped version of acos to avoid this, which clamps to [-1, 1].