how I would find line lengths highlighted with other color (with question marks) on the picture below? I know coordinates and size of these rectangles.
My goal is to find 'the closest' rectangle to the green one, but 'closest' is a quite abstract definition, so I decided that 'closest' would be one with shortest highlighted line on the picture below. Maybe there are other simpler ways to find 'closest' rectangle?