Calculating the length of line segments in a scale