ロドリゲスの回転公式
Rodrigues' rotation formula
公式
射影される位置ベクトルを$ \bm r・回転軸となる単位ベクトルを$ \bm u・回転する角度$ \thetaとしたとき、 $ \begin{aligned} \bm r' &= \bm r \cos \theta + \bm u (\bm u \cdot \bm r) (1 - \cos \theta) + (\bm u \times \bm r) \sin \theta \\ &= \bm r \cos \theta + \{ \bm u \times (\bm u \times \bm r) + \bm r \} (1 - \cos \theta) + (\bm u \times \bm r) \sin \theta \\ &= \bm r + (\bm u \times \bm r) \sin \theta + (1 - \cos \theta) \{ \bm u \times (\bm u \times \bm r) \} \end{aligned}
2行目の$ \bm u (\bm u \cdot \bm r) = \{ \bm u \times (\bm u \times \bm r) + \bm r \}の部分は、ベクトル三重積ならびに$ \bm uが単位ベクトルであることを用いて計算しているらしい code:glsl
vec3 rodrigues(vec3 p, vec3 axis, float angle) {
return mix(axis * dot(axis, p), p, cos(angle)) + cross(axis, p) * sin(angle);
}
https://gyazo.com/48dafc55f12e3afec7e1e68c40774210
行列
いわゆる Matrix3.fromAxisAngle
回転軸となる単位ベクトル$ \bm u・回転する角度$ \thetaを用いて、 $ \bf R = \begin{bmatrix} u_x^2 (1 - \cos \theta) + \cos \theta & u_x u_y (1 - \cos \theta) - u_z \sin \theta & u_x u_z (1 - \cos \theta) + u_y \sin \theta \\ u_x u_y (1 - \cos \theta) + u_z \sin \theta & u_y^2 (1 - \cos \theta) + \cos \theta & u_y u_z (1 - \cos \theta) - u_x \sin \theta \\ u_x u_z (1 - \cos \theta) - u_y \sin \theta & u_y u_z (1 - \cos \theta) + u_x \sin \theta & u_z^2 (1 - \cos \theta) + \cos \theta \end{bmatrix}
分解
$ \bf U = \begin{bmatrix} 0 & -u_z & u_y \\ u_z & 0 & -u_x \\ -u_y & u_x & 0 \end{bmatrix}とおき、
$ \bf R = \bf I + \sin \theta \ \bf U + (1 - \cos \theta) \ \bf U^2