Remove the filtering of factors from the brush distance calculation function to simplify its responsibilities and to allow passing a custom radius from the outside. Factor filtering is now done in a separate function. Also rename the distance calculation functions.