Finding the length of a line segment