Fixes a crash inkscape#5995
Reproduced in 2geom
EllipticalArc a(Point(-256.5, 521.3463753577932), Point(0.8086038425196853, 8.560540346456695e-7), 0, false, true, Point(-257, 521.3463761179462));
auto const time = a.nearestTime(Point(0, 0));
Although it has some extreme values, it seems to me to be a valid EllipticalArc (?).
Tracing code
The interesting feature is that the ray(Y) is very small. This will cause the special case in the EllipticalArc::allNearestTimes since are_near(ray(Y), 0) is true and the rotationAngle() is zero. This causes the EllipticalArc::roots to be run.
However the isChord function will return false since ray(Y) is not exactly equal to zero. The root finding proceeds with
a = -1.61667
b = -0
c = 0.000542072
delta = 0.000876349
s = 2.09808 -> t: -3.28531e-13
s = 357.902 -> t: -0.0640562
Neither of the t values are in the range 0..=1 so no roots are returned.
Fix
I changed isChord to return true if the ray(Y) is close to zero (using the is_near function).
It could be advantagious to also clamp the t values that are very close to being in the range?






















