Cast modifier not exactly equivalent to "To Sphere"

Hi guys!

“It is equivalent to the To Sphere tool in Edit Mode”

As per thread title, I just found out that the Cast modifier does not “exactly” do the same as the Mesh->Transform->To Sphere in the Edit mode. The problem is in the vertex distribution.

I am trying to transform a pyramid to a sphere, but the cast modifier does not distribute the vertices as equally as the To Sphere transformation does. I need it in a modifier format, though, to be able to animate the transition.

Does anyone know how the Cast modifier works and how this can be mended? Maybe Shape keys?

Here is the screenshot of the comparison between both:

As you can see, the results are very different.

I thank you for your help,

Found out what the problem is. The cast modifier deforms the mesh according to it’s origin(kind of obvious, I guess), so just setting the origin to geometry solved the problem.