Add some new line segment manipulation algorithms