Working on a 1d distance transform