How to find rotation around axis such that x axis aligns to some vector?

46 Views Asked by At

Given at 3D transformation matrix T and a 3D vector V. How can I find a rotation that keeps the Z vector in T the same, but aligns the x vector in T as much as possible with V?

I am working with C++ and Eigen, and code is appreciated.

1

There are 1 best solutions below

2
On

If I understand your question, I believe the below figure and equations show the general approach. You can just multiply out the final matrix product to get your transformed coordinates in the T coordinate system. I hope this helps.

enter image description here