1.As you already know the indices of all three lines from the 2nd image. If not following is the way
2. Next force the all pixel with zero of r2 and c2 in 1st image. the find the indices the all white pixel in first image
3. Calculate the distances between all sets of [r1,c1] and [r2,c2]. Tou can proceed the first index pair of (r2,c2) with all indices pair in image 1, which are [r1,c1]. Next another index pair of (r2,c2) with all indices pair in image1..so on
At last you will get the distances between all three lines and all other white pixels in the image.
Hope it helps!