Line intersection implemented in full

Those if statements are painful.