grid squares for segments
fixed some bugs with grid
fixed some bugs with grid
code is much faster, but not fast enough
code is much faster, but not fast enough
min dismax distance system
optimizations