How is origin calculated during resampling?

I want to resample the image to the specified data, but how to calculate the origin so that the image can be displayed normally.
Example:
origin:(-90.36074829101562, -172.32485961914062, 121.83561706542969)
Spacing:(1.0, 1.0, 1.328125)
Direction:(0.0, 0.0, 1.0, 1.0, -0.0, 0.0, 0.0, -1.0, 0.0)
Size:(256, 256, 128)
resample to
Spacing:(1.0, 1.0, 1.0)
Direction:(1.0, 0.0, 0.0, 0.0, -0.0, -1.0, 0.0, -1.0, 0.0)
Size:(256, 256, 256)
How to calculate new_origin from original data and target data?
resampler.SetOutputOrigin(new_origin)