xd_mat = np.float32(np.clip(xcenter + fact_mat * xu_mat, 0, width - 1))