「ゲームプログラミング/3Dグラフィック」の版間の差分

削除された内容 追加された内容
914 行
 
 
実際にこの公式を3D-CGの回転計算で使うときは、原点を中心とした回転の公式
:<math> \begin{pmatrix}
\cos \theta & - \sin \theta \\
947 行
 
 
y軸を中心にした回転(公転)の場合、x軸成分とz軸成分とが移動するので、式は、移動後の(x,z)座標の位置
:<math> \begin{pmatrix}
\cos \theta & - \sin \theta \\
963 行
</math>
になる。
 
 
 
さらに、回転(公転)の中心になる座標は、カメラ位置の座標なので、カメラ位置の(x,y,z)座標成分をそれぞれ xc, yc ,zc とすると、移動後の(x,z)座標の位置は
 
:<math> \begin{pmatrix}
\cos \theta & - \sin \theta \\
\sin \theta & \cos \theta
\end{pmatrix}
 
\begin{pmatrix} x - x_c \\ z - z_c \end{pmatrix}
= (x - x_c) \begin{pmatrix} \cos \theta
\\ \sin \theta \end{pmatrix}
 
+
 
(z - z_c) \begin{pmatrix} - \sin \theta
\\ \cos \theta \end{pmatrix}
</math>
 
である。
 
<syntaxhighlight lang="c">