View Full Version : Calculating Jacobian for spherical function
03-03-2010, 01:12 PM
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 (http://http.developer.nvidia.com/GPUGems/gpugems_ch42.html). 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!
03-03-2010, 02:57 PM
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)
dx/dT = -r * sin(T)
dy/dT = r * cos(T)
03-03-2010, 05:04 PM
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
- Partial derivatives of these formulas, worked out after your hint
dx/dr = sin(t)cos(p)
dx/dt = r*cos(p)*cos(t)
dx/dp = r*sin(t)*-sin(p)
dy/dr = sin(t)*sin(p)
dy/dt = r*sin(p)*cos(t)
dy/dp = r*sin(t)*cos(p)
dz/dr = cos(t)
dz/dt = -r*sin(t)
dz/dp = 0
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!
03-03-2010, 10:39 PM
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.
03-09-2010, 03:42 PM
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.
So you have a function, F, that takes rectangular coordinates.
Are you referring to the Jacobian itself? Or the deformation function - because that takes spherical coordinate input..
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)).
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?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.