algorithm for bounded quadratic distance transform based on the Felzenszwalb and Huttenlocher algorithm