03-31-2009 10:18 AM
Hi,
I am currently working on a project which involves using a set of coordinates to control a car. At the moment, these waypoints are input into an array of x and y and the car is commanded to traverse the line between them.
The problem i have is I cannot work out how, given 3 points, A (being the previous waypoint), B (being the waypoint the car is approaching) and C (being the next waypoint the car will be travelling towards after it has turned) I can calculate whether the car is turning right or left at B.
Thanks, Luc
03-31-2009 10:29 AM
03-31-2009 10:45 AM
It might be easier to do all that using complex numbers (RE,IM) instead of number pairs (X,Y). You can get the difference in vector angle, which you then need to fold into a unique range (e.g. 0..360 or -180..180). Half of the range is "right", and the other half is "left".
See how far you get. 😉
03-31-2009 10:47 AM
03-31-2009 10:47 AM
03-31-2009 11:30 AM
03-31-2009 12:53 PM
03-31-2009 01:04 PM