I'm trying to build upon this answer to rotate an object around an arbitrary point.
I get that if I do:
rot_mat = Matrix.Rotation(-pi / 4, 4, 'Z')
orig_loc, orig_rot, orig_scale = obj.matrix_world.decompose()
orig_loc_mat = Matrix.Translation(orig_loc)
orig_rot_mat = orig_rot.to_matrix().to_4x4()
orig_scale_mat = Matrix.Scale(orig_scale[0],4,(1,0,0)) * Matrix.Scale(orig_scale[1],4,(0,1,0)) * Matrix.Scale(orig_scale[2],4,(0,0,1))
obj.matrix_world = rot_mat @ orig_rot_mat @ orig_scale_mat
instead of
obj.matrix_world = orig_loc_mat @ rot_mat @ orig_rot_mat @ orig_scale_mat
I will have my object rotated correctly and centered on 0.0.
So I guess I need to perform some transform on orig_loc_mat so that the location is also moved.
What's the transform I need to do?