Closed nedbat closed 7 years ago
From testing higher precision numbers and looking into these issues further, I think this algorithm only works with quantized input.
I'd like to check on using cgal's method since its very robust, its roughly similar (uses a sweepline to track intersections) http://doc.cgal.org/latest/Sweep_line_2/index.html
What do you mean by quantized input? What is the source of the non-determinism?
In line 418, event_set is
{
Event(0x7f205de2c828, s0=(0, 0), s1=(2, 0), p=(0, 0), type=2, slope=0.0),
Event(0x7f205de2cdc8, s0=(1, 0), s1=(2, 1), p=(1, 0), type=2, slope=1.0),
}
Or with reversed order.
I've been experimenting with a Hypothesis test: https://github.com/nedbat/isect_segments-bentley_ottmann/tree/hypothesis
It found this case that fails, but only sometimes: