added intersection logic for curves