Calculating Jacobian for spherical function

Hello-

I built a deforming vertex program, which converts the vertices to spherical coords first, then translates them in the spherical coordinate system.

I’ve implemented the normal re-calculation via the Jacobian as outlined here. But I’m having trouble understanding how to calculate the actual Jacobian matrix.

I understand partial derivatives and how to find them, but what I’m missing is how to get a Cartesian Jacobian from the spherical functions.

Anyone have input on the maths here? Thanks in advance!

If you understand partial derivatives, you should be able to just build the matrix as the paper describes. You just have to convert your derivatives over. A spherical coordinate system can mean a few different things, but you need to find the relationship between the derivatives. For example in 2D, what would the relationships be here?

For polar coordinates in 2D, where r is constant
x = r * cos (theta)
y = r * sin (theta)

goes to…

dx/dT = -r * sin(T)
dy/dT = r * cos(T)

Thanks for writing back.

Hmmm… been thinking hard about this. I understand what you did there, but am failing to see any relationship outside the explicit one. You took a partial derivate of the radial->cartesian coordinate conversion formula.

Working “dumbly”, I have the following at my disposal:

  • The partial derivatives of each spherical function with regard to the spherical coords
    dFr/dr dFr/dt dFr/dp
    dFt/dr dFt/dt dFt/dp
    dFp/dr dFp/dt dFp/dp

  • The formula to convert a point from spherical to cartesian
    x=r*sin(t)cos§
    y=r
    sin(t)sin§
    z=r
    cos(t)

  • Partial derivatives of these formulas, worked out after your hint
    [b]dx/dr = sin(t)cos§
    dx/dt = rcos§cos(t)
    dx/dp = r
    sin(t)
    -sin§

dy/dr = sin(t)sin§
dy/dt = r
sin§cos(t)
dy/dp = r
sin(t)*cos§

dz/dr = cos(t)
dz/dt = -r*sin(t)
dz/dp = 0[/b]

But I’m not sure how that helps me… I need partial derivatives of functions of cartesian coords:

dFx/dx dFx/dy dFx/dz
dFy/dx dFy/dy dFy/dz
dFz/dx dFz/dy dFz/dz

But there are no such functions Fx, Fy, Fz…

I really want to learn this… I feel like I’m close to understanding. Thanks for your input!

I’m going to restate your problem in slightly different terms, so as to emphasize the right points:
So you have a function, F, that takes rectangular coordinates, and you have a function, g, that takes rectangular coordinates and converts them to spherical ones. (This is the formula you have in the last post). The function you really want is F(g(spherical coordinates)). To evaluate derivatives of composed function, use the chain rule: D(F(g))=DF * Dg. DF is the Jacobian of F with respect to rectangular coordinates and g is the Jacobian of g with respect to spherical coordinates. These should both be 3x3 matrices. When you evaluate DF, there will be x,y, and z’s. You can replace these according to the formula, then multiply the matrices to get the Jacobian of F with respect to spherical coordinates.

Thanks for your input! I’ve been working with this for a few days now. I wanted to come back here with a resounding success story complete with beautiful screen shots, but…

I haven’t solved this, and I’m not sure if I’m misunderstanding you or there was a miscommunication as to what I’m after.

Are you referring to the Jacobian itself? Or the deformation function - because that takes spherical coordinate input…

This seems backwards to me… In my mind, I am thinking like this: I have F, the deformation function which has input/output of spherical coords. I have g- a function to convert spherical to rectangular, and h- a function to convert rectanguar to spherical. What I want is Jacobian of F, specified in rectangular. So its almost like I need the Jacobian of g(F(spherical input)). Or maybe I’m just being dense?