How do you use a Rotation Matrix in 2-D?

In summary, A 2D Rotation Matrix represents a rotation of a vector around an arbitrary origin. You can calculate the coordinates of the vector's endpoint using the matrix, or you can use the coordinates of the origin and the vector's tail.
  • #1
Saladsamurai
3,020
7
I am having some trouble deciphering what the input and output of a 2D Rotation Matrix actually represent.

All example online have the vectors oriented at the origin. I know you can move them anywhere so long as you maintain their length and orientation, but here is my question:

Let's say I have a vector that is not located at the origin. Call its initial point (x0, y0) and its terminal point (x1, y1)

Now let's say that it has rotated through the positive angle of Phi. It's initial point is clearly still (x0, y0) and its new terminal point is (x2, y2).

Using only (x0, y0) and angle Phi, how can I find the coordinate (x0, y0) ?

I know that the Rotation Vector is defined as:

RM.jpg



My issue is that since they chose the origin, x1 and y1 in their example could be either the coordinates OR the components.

So, for the general 2D case: Do I plug in the coordiantes or components? And are the results the coordinates or components?

I am under the impression that it is the latter in both cases. And so in order to obtain the actual coordinates of my new vectors endpoint, I must add the resulting components to the initial coordinate (x0, y0)

Does that sound right?
 
Last edited:
Physics news on Phys.org
  • #2
Well, you can move it to the origin, rotate it, and move it back.

So if v = (x0, y0) and w = (x1, y1), then: a) calculate w - v; b) apply the rotation matrix to obtain a new vector z; c) calculate z + v.
 
  • #3
If the tail of the vector r that you want to rotate is not at the origin, then find the position vector R of the tail with respect to the arbitrary origin and use the matrix to rotate the sum R+r. The result will be the coordinates of the tip of rotated vector r. To find the coordinates of the rotated tail, use the matrix once more on R.
 
  • #4
I just wrote a code to test a few cases of what I said in the OP, and this is the formula I came up with. I think it is consistent with what you guys are saying:

r_x = x1 - x0
r_y = y1 - y0

x2 = x0 + (r_x * Cos(theta) - r_y * Sin(theta))
y2 = y0 + (r_y * Cos(theta) + r_x * Sin(theta))
 

1. How do I represent a rotation in 2-D using a Rotation Matrix?

A Rotation Matrix is a 2x2 matrix that is used to represent the rotation of an object in 2-D space. It contains a combination of sine and cosine values that can be used to rotate an object around a fixed point.

2. What is the formula for a Rotation Matrix in 2-D?

The formula for a Rotation Matrix in 2-D is:
cos(theta) -sin(theta)
sin(theta) cos(theta)
where theta represents the angle of rotation.

3. How do I multiply a Rotation Matrix with a coordinate point?

To rotate a coordinate point (x,y) using a Rotation Matrix, you simply need to multiply the coordinates with the Rotation Matrix. The resulting coordinates will be the rotated point.

4. Can a Rotation Matrix be used for both clockwise and counterclockwise rotations?

Yes, a Rotation Matrix can be used for both clockwise and counterclockwise rotations. The direction of rotation depends on the sign of the angle used in the formula. A positive angle will result in a counterclockwise rotation, while a negative angle will result in a clockwise rotation.

5. How do I determine the angle of rotation from a given Rotation Matrix?

The angle of rotation can be determined by taking the arccosine of the first element in the first row of the Rotation Matrix. This will give you the cosine value of the angle. To find the sine value, you can take the arcsine of the second element in the first row. The angle can then be calculated using the inverse trigonometric function:
theta = arctan(sine value/cosine value)

Similar threads

Replies
7
Views
267
  • Mechanics
Replies
14
Views
1K
Replies
2
Views
971
Replies
1
Views
536
  • Introductory Physics Homework Help
Replies
13
Views
2K
  • Introductory Physics Homework Help
Replies
7
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
25
Views
3K
  • Differential Geometry
Replies
1
Views
1K
Back
Top