Efficient Vector Rotation Matrix Routine

バージョン 1.1.0.0 (33.5 KB) 作成者: Darin Koblick
Efficient Method to Determine a Matrix Needed to Rotate One Vector to Another
ダウンロード: 603
更新 2014/4/23

ライセンスの表示

Suppose you have a unit vector described by f = [ai bj ck] and you would like to rotate f such that its result is t = [di ej fk]. This routine will find R(f,t) such that R(f,t)*f’ = t’. Where R(f,t) is known as the 3 x 3 transformation matrix needed to rotate f into t.
This MATLAB routine was based on a published article titled “Efficiently Building a Matrix to Rotate One Vector to Another” written by Tomas Moller and John Hughes in 1999.

This method features no square roots or trigonometric function calls and is reported to be faster than any other vector rotation matrix method tested by Moller and Hughes. In fact, the Goldman method (fastest method tested) was 50% slower than this routine in conversion speed tests.

Working Example:

Unit Vector f:
>> f = rand(1,3);
>> f = f./norm(f);

Unit Vector t:
>> t = rand(1,3);
>> t = t./norm(t);

The transformation matrix R(f,t) is found:
>> R = vecRotMat(f,t);

Now, test that R*f’= t’
>> R*f’

引用

Darin Koblick (2024). Efficient Vector Rotation Matrix Routine (https://www.mathworks.com/matlabcentral/fileexchange/37597-efficient-vector-rotation-matrix-routine), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2012a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersLinear Algebra についてさらに検索
謝辞

ヒントを与えたファイル: rotVecAroundArbAxis(unitVec2Rotate,rotationAxisUnitVec,theta)

Community Treasure Hunt

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

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

Added robustness to parallel vector check. Added extra check to account for vectors that are parallel and have two or more identical values. Rotation error was found to be on the order of 1e-15.

1.0.0.0