wbt_merge_line_segments function

Merge line segments