拡大縮小の行列 glScalef(x,y,z)

scale.png
(1)
\begin{align} \left[ \begin{array}{cc} x & 0 & 0 & 0 \\ 0 & y & 0 & 0 \\ 0 & 0 & z & 0 \\ 0 & 0 & 0 & 1\\ \end{array} \right] \end{align}

改善の余地あり、かな。

void glScale(T _x,T _y,T _z){
            mat4<T> temp(_x,0.0,0.0,0.0,
                    0.0,_y,0.0,0.0,
                    0.0,0.0,_z,0.0,
                    0.0,0.0,0.0,1.0);
            *this=*this*temp;
        }

サポートサイト Wikidot.com