testing new way to compute distance map