modify the line intersection part

old one works for line, new one works for line segment