2
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

クオータニオンの値から回転軸と角度を求める

Posted at

3Dグラフィックのプログラミングをしていて、デバッガーで回転量の値を見たけどクオータニオンで表されていていったいどのような回転を表すのか全然わからない……と思ったので考えてみました。

クオータニオンで回転を表現する場合、各成分には次のような値が入っています。

axis = 回転軸
radian = 角度

q.x = axis.x * sin(radian / 2);
q.y = axis.y * sin(radian / 2);
q.z = axis.z * sin(radian / 2);
q.w = cos(radian / 2)

したがって、逆にaxis,radianを求めるように式を変形すれば良いのです。
q.w = cos(radian / 2)の式からradian / 2 = acos(q.w)というふうに変形できるので、これを残りの三つに代入するだけです。

axis.x = q.x / asin(acos(q.w));
axis.y = q.x / asin(acos(q.w));
axis.z = q.x / asin(acos(q.w));
radian = acos(q.w) * 2;

参考: http://qiita.com/kenjihiranabe/items/945232fbde58fab45681

2
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?