rearranged NDW, fixed bugs map_points_to_line and split_lines_equal