Implemented and tested generalized distance transform in C for performance.