improved calcIntersectionOfTwoLines method