GPU-threaded distance functions