First version for line simplification.

Added intersection checking.