This forum has been archived. All content is frozen. Please use KDE Discuss instead.

rotate a vector anti clockwise

Tags: None
(comma "," separated)
rumbadinesh
Registered Member
Posts
2
Karma
0

rotate a vector anti clockwise

Sat Jan 11, 2020 12:13 pm
I have a vector:
Vector3f v(3,11,0)
How do i rotate this vector anticlockwise with its starting position at point(2,3,0) and get the new end point of newly rotated vector using eigen?
andrew-dy
Registered Member
Posts
15
Karma
0

Re: rotate a vector anti clockwise

Sat Jun 20, 2020 5:53 am
I'm sorry if I don't understand the question, but the wording is ambiguous.

If you want to transpose this vector, run this code:
Code: Select all
Eigen::Transpose<Eigen::Vector3f>(v);

or
Code: Select all
v.transpose();

Note that you can't save the result to v, because it's a Vector3f, a 3 by 1 matrix of floats, and the transpose is a 1 by 3 matrix.
You would have to save it to another variable like so to save it:
Code: Select all
Eigen::RowVector3f w = v.transpose();


If you want to rotate the coordinates of the vector around one or more axes, that would entail multiplying the vector by one or more "rotation matrix".
you can consult Wikipedia on how to build a general set of 3 rotation matrices in 3 dimensions, and in which order to multiply them:
https://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions
Note that the θ symbol represents the angle of rotation by the right hand rule (look at the direction your fingers curl when pointing your thumb in the positive direction along the axis of interest):
https://en.wikipedia.org/wiki/Right-hand_rule#Coordinates


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]