rodrigues_vector_ro​tation

バージョン 2.0.0 (1.94 KB) 作成者: Duijnhouwer
Rotate one 3D-vector around another
ダウンロード: 43
更新 2020/4/12

ライセンスの表示

rodrigues_vector_rotation - rotate a 3D vector around another

Rotate vector v around (unit) vector k by theta_rad following the right hand rule.

Vector k will be made a unit vector internally. So its length is irrelevant as long a its greater than 0.

This function is vectorized:
- v can be a 3xN matrix of N vectors that are each rotated around k.
*OR*
- theta_rad can be a vector of N angles.
In either case the output will be 3xN matrix.

Example:
k=[-1;-1;1];
k=k(:)/norm(k);
v=[k(1:2);0];
theta_rads=0:pi/90:(2*pi);
vr = qx.rodrigues_vector_rotation(v,k,theta_rads);
oo=zeros(size(theta_rads));
quiver3(0,0,0,k(1),k(2),k(3),'r','LineWidth',2);
hold on
quiver3(oo,oo,oo,vr(1,:),vr(2,:),vr(3,:));
axis equal
rotate3d('on')

Reference: https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula

Note: the vectorization for multiple vectors is not a true vectorization, internally a for-loop is used. If you, dear reader, can manage do this without one please let me know how.

引用

Duijnhouwer (2024). rodrigues_vector_rotation (https://www.mathworks.com/matlabcentral/fileexchange/74970-rodrigues_vector_rotation), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2020a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
タグ タグを追加

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
2.0.0

Vectorized the function, that is, you can now rotate a matrix of many matrices at once, or you can provide multiple angles to return multiple rotated versions of a. k can only be one value at this moment.

1.0.0