How to find intersection of two curves