I am the admin from project VisGame and am writing to ask if any of the developers would answer this question.

Background:

Mouse Input event MouseMoveDirection( Angle, Force)

I have a event firing when ever you move the mouse (using DX8 input) but I would like to be able to also have the above event.

Question:

How do you get the angle returned by two segments (points-vectors) from a X and Y values back into one angle value?

Code:

This is what I am testing out on my computer. (it's in VB but the math is 80% the same - also I suing words in the example code for understanding)

Type Vector

X as double

Y as double

end type

U, V, Alpha, Beta, Angle are all of type Vector

Theta is of type Double

'Some test values

U.X = 1: U.Y = 3

V.X = 4: V.Y = 1

'||Vector|| = Magnitude = Squar_root ( (Vector.X ^ 2) + (Vector.Y ^2) )

Alpha.X = cosign( U.x / ||U|| )

Alpha.Y = sign( U.y / ||U|| )

Beta.X = cosign( V.x / ||V|| )

Beta.Y = sign( V.y / ||V|| )

Now as I understand it you can get the angle between U and V (using a zero vector) like so:

Theta = Alpha - Beta ' Get the angle

but this dose not work in VB so you wright it this way

Angle.X = Alpha.X - Beta.X ' Get the angle for X

Angle.Y = Alpha.Y - Beta.Y ' Get the angle for Y

Again, my question is how do you get these values back into one angle as they should be. If any one can help me please jump in and show me the way.

--

Cip2 out