corrected calculating intersection line