MATLAB: Rotation of a two orthogonal vectors

3d vectorMATLABmattrixquartenionrotation

I have two orthogonal vectors: direction – [1 0 0] and polarization – [0 0 1]. I put a "look at" point in position [5 5 5], which changes direction vector to [0.707 0.707 0.707]. Using that I need to transform my polarization vector to [-0.707 -0.707 0.707] to keep original orthogonality. More general task can be formulated as follows. I have a bunch of somehow oriented vectors in 3D space. Using a single 3D point, I redirect a single vector from the set of vectors. How to transform another vectors from the bunch to keep the original structure of relative directions? As I know the task is called as "Look At Rotation".

Best Answer

Hi Dmitry
you have to build the 3D rotation matrix and then apply it to each vector
You also have to apply a -v_look_at, not v_look_at you have defined in the question, because when you shift view point up to [5 5 5], when you look down back to director and pol, you see -2^-.5*[1 1 1], all negative values, not 2^-.5*[1 1 1].
If you apply -v_look_at then it works as you want.
For an accepted answer, do you want me to implement it? or perhams DIY and vote click?
in any case, Спасибо for time and attention
John BG
Related Question