Replace compute_distance2line and compute_distance2electron with their C counterparts