   Spherical harmonics, what am I doing wrong ?
  Rather a long shot this one, but I'm getting seriously POed at this :-)  I'm working through this  paper and this book trying to get my head round the wonderful world of spherical harmonics...Anyone else had any luck with this ?  I have go to the point where I can deconstruct a function into its SH coefficents (and the coefficents I get are the same as those listed in the paper).  But when I reconstruct the function using the coefficents I get nothing like the results shown in the paper.  I get a three node shape (the original function has two nodes), and there is weird discontinuity in one of the nodes, along the axis, as if one half had been shifted by a couple of degrees(hard to see in screenshot).  Its not my rendering function (the original function renders fine, just as it appears in the paper).Here is a screenshot:Here is the source of my reconstruct function, the SphericalHarmonicBasis function it calls is pretty much identical to the SH function from the paper.  I call this function at each interval from theta=0 to theta=2*PI and from phi=0 to  phi=PI, to generate my reconstructed function.double ReconstructSH(double *pCoeff, int order,double theta,double phi){double res=0.0;int l,m,n;for (l = 0, n = 0; l < order; l++){for (m = -l; m <= l; m++, n++){res += pCoeff[n] * SphericalHarmonicBasis(theta, phi, m, l );}}return res;}Anyone *any* ideas........   
  Actually just worked this out....  Looking carefully my coefficents were NOT the same as the ones from the paper, in certain cases they are wrong.  Guess my deconstruct function is wrong.