integration version
fixed bug with angle difference with near vertical lines, when it goes throught -Pi/2 to Pi/2