How to Rotate a Velocity Vector: Maths & Logic

  • Thread starter Thread starter wraithseeker
  • Start date Start date
  • Tags Tags
    Rotating Vector
AI Thread Summary
To change the direction of a velocity vector, a rotation matrix is used, particularly in 2D, where the rotation matrix is defined as \begin{bmatrix} \cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{bmatrix}. For 3D rotations, the process is more complex due to non-commutative properties, requiring specification of an axis of rotation and applying multiple rotations in sequence. The angle used in the rotation matrix represents the angle of rotation, not the new direction. For changing a vector's direction while preserving its magnitude, one should create a unit vector in the desired direction and scale it accordingly.
wraithseeker
Messages
28
Reaction score
0
Lets say I have a velocity vector that's going to the east and I want it's direction to change to somewhere else like west, how would I be able to do that?

What would be the maths required for this? The velocity vector already have a length and a direction.
 
Physics news on Phys.org
You'd use a rotation matrix which is an example of a change of basis. The type of math is linear algebra
 
assuming you're working 2D (no up or down) the matrix to rotate a vector by theta is \begin{bmatrix}<br /> \cos \theta &amp; \sin \theta \\[3pt]<br /> -\sin \theta &amp; \cos \theta \\<br /> \end{bmatrix}
 
I searched wikipedia but it was too confusing so i asked for help here.

EDIT: what about 3D?
 
3D's a little more complicated since rotations do not commute. For example, if you think of an airplane it can do 3 things it can pitch, roll and yaw http://www.ultimatepointer.com/images/YawPitchRoll.jpg Now the thing is that order matters. If you were to roll 90 degrees and then yaw 90 degrees your plane would not be in the same orientation then if you were to yaw 90 degrees then pitch 90 degrees. This means there's no one matrix to rotate any vector to any vector you instead have to think about the orientation and apply multiple in sequence, in the correct sequence (like pitch,roll,yaw). This should help http://en.wikipedia.org/wiki/Rotational_matrix if you haven't found it yet.
 
Last edited by a moderator:
For 2D I still don't really get you, do I multiply it by cos angle and sin angle or the one below?

Or do I subtract it.
 
Have you never covered matrix multiplication?

\begin{bmatrix}<br /> \cos \theta &amp; \sin \theta \\[3pt]<br /> -\sin \theta &amp; \cos \theta \\<br /> \end{bmatrix}\begin{bmatrix}<br /> x \\[3pt]<br /> y\\<br /> \end{bmatrix}=\begin{bmatrix}<br /> \cos\theta x + \sin \theta y \\[3pt]<br /> -\sin \theta x + \cos \theta y\\<br /> \end{bmatrix}

so you get the new x is \cos\theta x + \sin \theta y and the new y is -\sin \theta x + \cos \theta y
 
In general for 2x2 matrices:

\begin{bmatrix}<br /> a&amp; b\\[3pt]<br /> c &amp; d \\<br /> \end{bmatrix}\begin{bmatrix}<br /> x \\[3pt]<br /> y\\<br /> \end{bmatrix}=\begin{bmatrix}<br /> a x + b y \\[3pt]<br /> c x + d y\\<br /> \end{bmatrix}
 
For rotations in 3 dimensions, you need to state an axis of rotation as well as an angle. That's why they are so much complicated.
 
  • #10
Is it taken in radians or degrees currently?

Here's how I tried to apply it

vx = Cos(angle)*vx+ Sin(angle)*vy
vy = -Sin(angle)*vx+Cos(angle)*vy

vx = velocity X
vy = velocity Y
angle = new angle
 
  • #11
Doesn't matter, the cosine of 90 degrees is the same as the cosine of 0.5*\pi. One note, the angle \theta is not the "new" angle, it is the angle of rotation.
 
  • #12
Ok a slighty offtopic question, is rotating a vector the same as changing the direction of a vector? How would you change the direction of a vector?

vx = vx *Cos(angle)
vy = vy *Sin(angle)

or am I wrong?
 
  • #13
wraithseeker said:
Ok a slighty offtopic question, is rotating a vector the same as changing the direction of a vector? How would you change the direction of a vector?

vx = vx *Cos(angle)
vy = vy *Sin(angle)

or am I wrong?

This formula does not preserve the vector's magnitude.
 
  • #14
Where can I find it? I googled to no avail too.
 
  • #15
wraithseeker said:
Where can I find it? I googled to no avail too.

maverick already gave you the rotation matrix for a 2D Cartesian coordinate system. If you want to rotate a vector, you use the appropriate rotation matrix. If you want to make a vector point in a desired absolute direction then you simply make a unit vector that points in the desired direction and scale it to the desired length.
 
  • #16
I tried that but it didn't work that's why I asked about the direction.

vx = Cos(angle)*vx+ Sin(angle)*vy
vy = -Sin(angle)*vx+Cos(angle)*vy

I did something like this.

Imagine actual angle is the front of the person but after setting the values, I set it to be 90 degrees that will be converted to radians but it bugs as the example shown above.

The angle of the ball thrown is always different from any position.
 
  • #17
What example? If it's 90 degrees then the rotation is straightforward:

v_x = v_y;
v_y = -v_x;

If our vector is (0,1), we can see that we easily get the correct vector of (1,0). Note that maverick's rotation matrix is a clockwise rotation with respect to the traditional x-y plane orientation.
 
  • #18
I solved it, thanks guys.
 
  • #19
Hi am new to this forum, i am working on spherical modal analysis. I need some help in rotation . One of the step in my analysis is to align the axis of reference of the field waves of the radiator to the axis of the dielectric lens. How should i proceed and do i have to use rotation matrix? Is rotation matrix different from wigner rotation matrix? Which matrix should i employ ?

If my question is absurd pls ask me so that i can put my question clearly...
 
Back
Top