there point mark coordinate plane the goal simple polyline selfintersection selftouche pass point also polyline consist segment parallel coordinate axis you find minimum number segment polyline consist