finish segment intersection detection code

finish segment intersection detection code