In case 's' is exactly 1 we can miss a collision (distSqLine < radiusSq == true) and this causes 'leg' to become NaN later when the square-root of a negative is computed. We can't skip collision detection just because 's' is 1 so we should either go into the middle or last branch. Both computes the same result but the last branch is faster.