Michael H. answered 07/13/19
In-depth knowledge combined with clunky use of technology!
I don't know Python, so I'll give this in psuedo-code. You can just replace "if min1 <= min2: result = max1 - min2 else: result = max2 - min1 " with something to the effect that result = smaller of (max1,max2) - larger of (min1,min2).
That will work because what you're looking for is the magnitude of the intersection of the two line segments.
Michael H.
Of course, if you don't have a "smaller of" operation in Python, you can indeed do this with comparisons, thus: if max2 <= max1 then let b = max2 else b = max1 if min2 >= min1 then let a = min2 else a = min1 result = b - a07/13/19