Transformation matrix - pivot point
Hi everyone. I'm trying to figure out matrix transformations, more specifically, how to change pivot/origin center. So, when you apply following transformation, rotate, scale and translate:
matrix.mat[0][0] = cosf(angle) * scale;
matrix.mat[0][1] = sinf(angle) * scale;
matrix.mat[1][0] = -sinf(angle) * scale;
matrix.mat[1][1] = -sinf(angle) * scale;
matrix.mat[2][0] = position_x;
matrix.mat[2][1] = position_y;
matrix.mat[2][2] = 1;it works fine, just the issue is it's origin is upper left corner, but I want origin to be in the center. Now, I know I need to first translate by layers half, then rotate by custom angle, and then translate back, but I don't know how that should look like in terms of matrix transformation (code than I posted). Any help would be much appreciated.
