Hey; I was wondering if there is a simple algorithm that takes an x and y value (the values of the vector), and returns the angle between north and the vector, clockwise? All that I learned in trig class back in school has left me, and Google isn't giving me anything useful.
Name:
Anonymous2008-07-20 19:50
I'm willing to figure it out myself if someone will point me to some similar "angle from 2d vector" code; it doesn't have to match my 'clockwise from north' specifics.
Google isn't giving me anything useful.
It sure did give me. I'm looking right now at the solution to your problem, which was the third result using some very obvious search terms.
>>8
And so what if I am? I embraced my circumphobia a long time ago, etc.
Name:
Anonymous2008-07-21 0:01
Wow you are a FAILURE
Whatever you are trying to use vectors fail will suck. I am guessing it has to do with games/3d if so just STOP and go learn instead.
Name:
Anonymous2008-07-21 0:33
Anyway the way you do this is you have the vector in question. Take it's magnitude and normalize it. Once normalized now you project it onto the Y axis. Do this multiply it by a function that discards X. Once this is done you do a COS lookup and the value is the degrees.
cos(theta) = magnitude Y-component of a normalized vector.
I was just fucking around but you get the picture its not too hard you fuck
Name:
Anonymous2008-07-21 16:02
OP you're probably doing it wrong. You should avoid trig functions like fire. >>13
I am awed by your knowledge of linear algebra.
Name:
Anonymous2008-07-21 16:44
Go west, where the skies are blue
Name:
Anonymous2008-07-21 16:50
>>14 I am awed by your knowledge of linear algebra.
Er, this is something that anyone who took trig should know. And it's wrong anyway. He's mixed it up with sine.
Name:
Anonymous2008-07-21 19:16
>>16
I think he derived that from the formula for the dot product of vectors a and b where b is a unit vector.
Name:
Anonymous2008-07-29 7:55
>>16
It's not wrong you dumbfuck!!!!
Goddamn why do
member v.DegreesFromNorth
with get() =
let z = acos(currDY/v.Length) * 57.2957795
if (currDX > 0.0) then z
else 360.0 - z