Use math.max in ptSegDistSq