In the selecting the best candidate step, the distance is measured for each candidate from the starting point.
But it's unclear that which points of the boundary box area are chosen. (for P1 and P2)
It would be
(1) the center point of the boundary box
(2) the center point of edges of each element
(3) the closest point along the edges of each element (Implementation in Blink)