Finding the length of a segment