Calculates mesh scaling