util.cc: fix distancePointToSegment + improve tests.