| 7 |
|
|
| 8 |
|
double SHFunc::getValueAt(double costheta, double phi) { |
| 9 |
|
|
| 10 |
< |
double f, p, phase; |
| 10 |
> |
double p, phase; |
| 11 |
|
|
| 12 |
– |
// incredibly inefficient way to get the normalization |
| 13 |
– |
|
| 14 |
– |
// normalization factor: |
| 15 |
– |
f = sqrt( (2*L+1)/(4.0*M_PI) * Fact(L-M) / Fact(L+M) ); |
| 12 |
|
// associated Legendre polynomial |
| 13 |
|
p = LegendreP(L,M,costheta); |
| 14 |
|
|
| 18 |
|
phase = cos((double)M * phi); |
| 19 |
|
} |
| 20 |
|
|
| 21 |
< |
return coefficient*f*p*phase; |
| 21 |
> |
return coefficient*p*phase; |
| 22 |
|
|
| 23 |
|
} |
| 24 |
|
//-----------------------------------------------------------------------------// |
| 71 |
|
} |
| 72 |
|
} |
| 73 |
|
|
| 78 |
– |
double SHFunc::Fact(double n) { |
| 79 |
– |
|
| 80 |
– |
if (n < 0.0) return NAN; |
| 81 |
– |
else { |
| 82 |
– |
if (n < 2.0) return 1.0; |
| 83 |
– |
else |
| 84 |
– |
return n*Fact(n-1.0); |
| 85 |
– |
} |
| 86 |
– |
|
| 87 |
– |
} |