The proximity of blue shape to the red one is computed like this :
For each point of blue the distance to the red is computed using perpendicular projection. The proximity value returned is equal to maximal value of all of this distances.
To do that the implemented algorithm
1 - sampling shapes by points then calculating the distance from each sample point from one shape to another
2 - find the position which gives the maximal distance
3 - improve the proximity value basing on the exact shapes using the points found on step 2 as a start position
It may happen that for some point of blue shape no distance to red shape exist using perpendicular projection.
This is typically the case here :
\image html Shape_proximity_1.png
In the case of no perpendicular projection of a point on blue shape exists, instead of perpendicular projection the minimal distance to border point of red shape is considered.
The distance from EndBlue Point is taken using EndRed Point (black line represents the distance for EndBlue).