New segments_to_arrow function for visualization