I've written pure Python port with separate C++ binding (available on PyPI), according to pseudo-randomized tests it is equivalent to the original C++ code.
Also locally I've tried to use Fractions instead of integers for coordinates, but without success, it seems that this kind of generalization requires deep understanding of the underlying algorithm which I unfortunately don't have.
I've written pure Python port with separate C++ binding (available on PyPI), according to pseudo-randomized tests it is equivalent to the original C++ code.
Also locally I've tried to use
Fractions instead of integers for coordinates, but without success, it seems that this kind of generalization requires deep understanding of the underlying algorithm which I unfortunately don't have.