Align two Arbitrary 2D vectors

  • Thread starter Peter5897
  • Start date
  • Tags
    2d Vectors
In summary, to align two arbitrary 3D vectors in 2D, you can use the cross product to find the angle between them, and then use the rotation matrix with that angle to align them. This method is more efficient and accurate than simply using the dot product and arccos.
  • #1
Peter5897
16
0
I've got a computer graphics final coming up and for some reason my brain is crapping out when it comes to, what should be, a simple problem.

I know how to align two arbitrary 3D vectors (axis-angle) but 2D in 2D I'm having trouble remembering how to do it.

On my review sheet it states

Homework Statement



In 2D, computer the 3x3 matrix that aligns V = (Vx, Vy) with W = (Wx, Wy)

Homework Equations



I suppose the rotation matrix would be a start.

----------------------------
| cos(theta) -sin(theta) 0 |
| sin(theta) cos(theta) 0 |
| 0 0 1 |
---------------------------

The Attempt at a Solution



I know that theta = arccos(v dot w) but I believe that on a test shoving in an arccos won't be sufficient. IE

--------------------------------------------------
| cos(arccos(v dot w)) -sin(arccos(v dot w)) 0 |
| sin(arccos(v dot w)) cos(arccos(v dot w)) 0 |
| 0 0 1 |
---------------------------------------------------

Pretty gross looking if you ask me.

My question to you is, what am I forgetting? I believe there must be some simple linear algebra theorem that I am currently drawing a blank on, or is this really the best way?

Thanks for any insight you guys could bring,
-Peter

PS, sorry for my awful attempt at making matrices, the formatting seems to change during the submission process.

PPS, probably should have put this in the pre-calc section... whoops.
 
Last edited:
Physics news on Phys.org
  • #2
The answer is to use the cross product of the two vectors to find the angle between them. You can then use the rotation matrix with that angle to align the two vectors.So, in this case, you'd calculate the cross product as follows:V x W = (Vx * Wy - Vy * Wx, Vy * Wx - Vx * Wy)Then use that result to find the angle between them using:theta = arctan2(V x W)Finally, use the theta in the rotation matrix to find the 3x3 matrix that will align V and W:----------------------------| cos(theta) -sin(theta) 0 || sin(theta) cos(theta) 0 || 0 0 1 |---------------------------
 

What is the purpose of aligning two arbitrary 2D vectors?

The purpose of aligning two arbitrary 2D vectors is to find the relative orientation between them. This can be useful in various applications such as robotics, computer graphics, and motion analysis.

How do you calculate the angle between two arbitrary 2D vectors?

The angle between two arbitrary 2D vectors can be calculated using the dot product formula: θ = cos⁻¹(a · b / |a||b|), where a and b are the two vectors and |a| and |b| are their magnitudes. Alternatively, you can also use the cross product formula: θ = sin⁻¹(|a x b| / |a||b|).

What is the difference between aligning two arbitrary 2D vectors and finding their dot product?

Aligning two arbitrary 2D vectors involves finding the relative orientation between them, while finding their dot product gives a measure of their similarity or dissimilarity. The dot product is a scalar value, while alignment results in a new vector that has the same direction as one of the original vectors but with a different magnitude.

Can two arbitrary 2D vectors be aligned if they are parallel or anti-parallel?

No, two arbitrary 2D vectors cannot be aligned if they are parallel or anti-parallel. This is because parallel vectors have the same direction and anti-parallel vectors have opposite directions, so they cannot be aligned to have the same orientation.

Are there any limitations to aligning two arbitrary 2D vectors?

Yes, there are some limitations to aligning two arbitrary 2D vectors. This method only works for 2D vectors and cannot be directly applied to higher dimensions. It also assumes that the vectors have non-zero lengths and are not collinear. Additionally, it does not take into account the magnitudes of the vectors, only their orientations.

Similar threads

  • Calculus and Beyond Homework Help
Replies
3
Views
875
  • Introductory Physics Homework Help
Replies
7
Views
211
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
1K
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
6
Views
225
  • Calculus and Beyond Homework Help
Replies
11
Views
2K
  • Calculus and Beyond Homework Help
Replies
10
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
1K
Back
Top