def transform_matrix_offset_center(matrix, x, y):
 o_x = ((float(x) / 2) + 0.5)
 o_y = ((float(y) / 2) + 0.5)
 offset_matrix = np.array([[1, 0, o_x], [0, 1, o_y], [0, 0, 1]])
 reset_matrix = np.array([[1, 0, (- o_x)], [0, 1, (- o_y)], [0, 0, 1]])
 transform_matrix = np.dot(np.dot(offset_matrix, matrix), reset_matrix)
 return transform_matrix

def transform_matrix_offset_center ( matrix , x , y ) : o_x = ( ( float ( x ) / 2 ) + 0.5 ) o_y = ( ( float ( y ) / 2 ) + 0.5 ) offset_matrix = np . array ( [ [ 1 , 0 , o_x ] , [ 0 , 1 , o_y ] , [ 0 , 0 , 1 ] ] ) reset_matrix = np . array ( [ [ 1 , 0 , ( - o_x ) ] , [ 0 , 1 , ( - o_y ) ] , [ 0 , 0 , 1 ] ] ) transform_matrix = np . dot ( np . dot ( offset_matrix , matrix ) , reset_matrix ) return transform_matrix
return transform matrix offset center .