Using distance between segment and point in std::max_element.