I know I should know this, but I just can't figure it out/find the solution. I can do it by hand, but I can't put it in an algorithm... (working in c++, but pseudocode should be fine).
I have a vector, and I want to find another vector based on the angle with it.
v is known, angle alpha is known and the magnitude of w is known. How can I find w?
Thanks!
Given a position vector →v=⟨a,b⟩,the magnitude is found by |v|=√a2+b2. The direction is equal to the angle formed with the x-axis, or with the y-axis, depending on the application. For a position vector, the direction is found by tanθ=(ba)⇒θ=tan−1(ba), as illustrated in Figure 8.8.
To rotate a vector v = (x, y)
by an angle alpha
clockwise about the origin, you can multiply by the matrix:
[ cos alpha sin alpha ]
[ -sin alpha cos alpha ]
Thus the rotated vector with the same magnitude will be
(x cos alpha + y sin alpha, -x sin alpha + y cos alpha).
To change the magnitude from |v| to |w|, multiply both co-ordinates by |w|/|v|.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With