Prettify code bits in this blog
Sun, 30 Mar 2014 13:05:34 +0100
As you may have noticed, I've been trying to update this site a bit this weekend. Apart from drawing some simple emoticons , I also added the "share" buttons, and added more quotes to the top banner.

Today, I have added Prettify, so in case I want to post bits of code, they should be nicely formatted. Here's a test,

/**
 * @return a point sample of a Spherical Harmonic basis function
 *  l is the band, range [0..N]
 *  m in the range [-l..l]
 *  theta in the range [0..Pi]
 *  phi in the range [0..2*Pi]
 */
double SphericalHarmonics::SH(int l, int m, double theta, double phi)
{

    const double sqrt2 = sqrt(2.0);
    if(m==0) return K(l,0)*P(l,m,cos(theta));
    else if(m>0) return sqrt2*K(l,m)*cos(m*phi)*P(l,m,cos(theta));
    else return sqrt2*K(l,-m)*sin(-m*phi)*P(l,-m,cos(theta));
}
This code, by the way, is part of my Harmoniker app that you can find in github.

◀️ Older | Newer ▶️

⏪ Previous year | Next year ⏩