Ive been trying to write a Flocking Algorithm in VB.net but ive been having problems making the points move correctly.
Im having serious problems making something move towards something else correctly. I know the Math.Functions are in Radians, thats ok, but i cant work out the correct procedures for the angle between the points to be calulated.
(0,0) ---------------------------------------------(100,0)
| x (10,5)
|
|
|
|
|
|
|
|
| . . . . . . . . . . . . . . . . . . . . . . y(75,80)
|
|
|
|
|
(0,100)
0 Radians points towards the left, (took lots of experimentation to work that out, depressing really)
And to find my angle i use the Soh-Cah-Toa thing, therefore
ATan((80-5)/(75-10)) should be the angle i need.
but it only works correctly in the situation above. If i want the angle from y to x i get stupid results, after changin the Opp and Adj values.
Please help, its driving me mad.
I started programming it to remind me howto do vanilla VB after doing ASP for so long and as im starting Compu Science course in Uni. but its all gone mad.
Toby
Edit: Added Dots to put the Y in correct place after the HTML removes the "white space"
Im having serious problems making something move towards something else correctly. I know the Math.Functions are in Radians, thats ok, but i cant work out the correct procedures for the angle between the points to be calulated.
(0,0) ---------------------------------------------(100,0)
| x (10,5)
|
|
|
|
|
|
|
|
| . . . . . . . . . . . . . . . . . . . . . . y(75,80)
|
|
|
|
|
(0,100)
0 Radians points towards the left, (took lots of experimentation to work that out, depressing really)
And to find my angle i use the Soh-Cah-Toa thing, therefore
ATan((80-5)/(75-10)) should be the angle i need.
but it only works correctly in the situation above. If i want the angle from y to x i get stupid results, after changin the Opp and Adj values.
Please help, its driving me mad.
I started programming it to remind me howto do vanilla VB after doing ASP for so long and as im starting Compu Science course in Uni. but its all gone mad.
Toby
Edit: Added Dots to put the Y in correct place after the HTML removes the "white space"