Im stuck on the java script for line segment intersection.
If i have coordinates (a,b) and (c,d).....each a,b,c and d have each of their own (x,y) coordinates in array form. i.e a = (x[0], y[0]), b = (x[1], y[1]) and so on.
Now consider what happens if we move along one segment from one end to the other and then we turn to face each of the end points of the other segment
We observe that (a,b) meets (c,d) iff leftturn(a,b,c) xor leftturn(a,b,d) andleftturn(c,d,a) xorleftturn(c,d,b)
What would be the java code if the user was asked to input coordinates for each of the seperate line segments...and then check if a traversal such as (a,b,c) is a left or right turn and so on ?