Implemented line intersection function and tests.