フィルターのクリア

How to build a quaternion from a normal vector?

49 ビュー (過去 30 日間)
Thomas Sherk
Thomas Sherk 2021 年 4 月 9 日
編集済み: James Tursa 2021 年 4 月 9 日
I have a plane and the normal vector. I want to be able to rotate points along the normal vector through some point on the plane.
I have done this before but cannot find the script, and I find the quaternion documentation somewhat dense. Just wanted to see if someone knew off the top of their head.
Thanks.
  2 件のコメント
James Tursa
James Tursa 2021 年 4 月 9 日
What does "through some point on the plane" mean? Certainly you can use the normal vector as the eigen-axis of the quaternion for the rotation, but I don't understand what that point on the plane has to do with it.
Thomas Sherk
Thomas Sherk 2021 年 4 月 9 日
Sorry, I did not mean to write that. Do you know that function to call?

サインインしてコメントする。

回答 (1 件)

James Tursa
James Tursa 2021 年 4 月 9 日
編集済み: James Tursa 2021 年 4 月 9 日
If you have the Aerospace Toolbox, you could do the following
n = 1x3 unit normal vector
a = angle to rotate in radians
v = 1x3 the vector you want to rotate
q = [cos(a/2) sin(a/2)*n]; % the quaternion used for the rotation
vnew = quatrotate(q,v);
This may do the opposite of what you want, however, depending on which direction you want to rotate. You may need to flip the sign of the angle. If you need to do this manually using conjugates and multiplies instead of using quatrotate from the Aerospace Toolbox, see this link:

カテゴリ

Help Center および File ExchangeQuaternion Math についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by