Straight line detection and recursive toPoly