$$ \begin{bmatrix} S_x & 0 & 0 & 0 \\ 0 & S_y & 0 & 0 \\ 0 & 0 & S_z & 0 \\ 0 & 0 & 0 & 1\end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} S_x\cdot x \\ S_y\cdot y \\ S_z\cdot z \\ 1 \end{bmatrix} $$
// 크기 조절 함수
static Mat4x4 MakeScale(float x, float y, float z) {
Mat4x4 matrix;
matrix.MakeIdentity();
matrix.m[0][0] = x;
matrix.m[1][1] = y;
matrix.m[2][2] = z;
return matrix;
}
$$ \begin{bmatrix} 1 & 0 & 0 & T_x \\ 0 & 1 & 0 & T_y \\ 0 & 0 & 1 & T_z \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix} = \begin{bmatrix} x+T_x \\ y+T_x \\ z+T_z \\ 1 \end{bmatrix} $$
// 이동 함수
static Mat4x4 MakeTranslation(float x, float y, float z) {
Mat4x4 matrix;
matrix.MakeIdentity();
matrix.m[3][0] = x;
matrix.m[3][1] = y;
matrix.m[3][2] = z;
return matrix;
}