Move calc_scale_factor to range.hpp.