Jump to content

Spherical Coordinates


sessionbeer

Recommended Posts

Hello,

I'm trying to replicate the same deformation as seen in the gif below. After some research I believe it's got something to do with Spherical Coordinates?

sphere_deform.gif

I implemented the formula from this site  which is:

radius = sqrt(x^2 + y^2 + z^2)
polar = arccos(z/radius)
azimuthal = atan2(y, x)

x = radius * sin(polar) * cos(azimuthal)
y = radius * sin(polar) * sin(azimuthal)
z = radius * cos(polar)

cube_pinch.png

But this results in some pinching of the cube at both poles, so maybe this isn't right, or I haven't done it correctly?

Has any one got any experience with something like this? Any help would be really appreciated.

Thank you

 

sphere_deform.hip

Edited by sessionbeer
Link to comment
Share on other sites

Thanks @galagast and @mestelaUnfortunately I don't think either of those routes are right for this deformation, and after some more research I think I may have titled this post wrong. I'm not sure what the formula is called but I think this is getting pretty close to it:

 

float len = length(@P);
float a   = (fit(len, 0, 2, 0, $PI*0.5));
float r   = chf("radius");

f@x = r * cos(a);
f@y = r * sin(a);

@P.x *= @y;
@P.y *= @y;
@P.z  = @x*2;

I'm basically wrapping a disc shape around a sphere but using the centre point as the front of the sphere, and the sides of the disc as the back of the sphere. This looks like its close but I cant get the points to push out into a proper spherical shape? Can any one spot my silly mistake here and why I can't get the points out into the sphere shape?

Any help would be amazing as I'm so confused why its not working?

Thank you

 

sphere_wrapping_disc.png

sphere_wrapping_disc.hip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...