aboutsummaryrefslogtreecommitdiff
path: root/src/mtx_spherical_harmonics/chebyshev12.c
diff options
context:
space:
mode:
authorFranz Zotter <fzotter@users.sourceforge.net>2009-06-17 08:39:06 +0000
committerFranz Zotter <fzotter@users.sourceforge.net>2009-06-17 08:39:06 +0000
commit243b48abf7922957fc3e0876bf9f12f893a8327f (patch)
tree49b015b2b8b4941152174c7e1212f1a139f49fe3 /src/mtx_spherical_harmonics/chebyshev12.c
parent8e1cc253f0fd94d792f6bef9f0ac83cb2f41ffac (diff)
modified the chebyshev12 routine to put out readily normalized circular harmonics and added
[mtx_circular_harmonics] to the file mtx_spherical_harmonics, as well as a corresponding helpfile. why: useful for circular (1D) ambisonics, e.g. ... svn path=/trunk/externals/iem/iemmatrix/; revision=11792
Diffstat (limited to 'src/mtx_spherical_harmonics/chebyshev12.c')
-rw-r--r--src/mtx_spherical_harmonics/chebyshev12.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mtx_spherical_harmonics/chebyshev12.c b/src/mtx_spherical_harmonics/chebyshev12.c
index 462341b..64af232 100644
--- a/src/mtx_spherical_harmonics/chebyshev12.c
+++ b/src/mtx_spherical_harmonics/chebyshev12.c
@@ -1,5 +1,5 @@
/*
- Evaluates all circular harmonics
+ Evaluates all fully normalized circular harmonics
at the angles phi up to the order nmax.
using the recurrence for the Chebyshev
polynomials of the first and second kind
@@ -42,6 +42,8 @@ void chebyshev12(double *phi, Cheby12WorkSpace *wc) {
const int incr=2*wc->nmax+1;
double *cosphi;
double *sinphi;
+ const double oneoversqrt2pi=1.0/sqrt(2.0*M_PI);
+ const double oneoversqrtpi=1.0/sqrt(M_PI);
// memory allocation
if ((wc!=0)&&(phi!=0)) {
if ((cosphi=(double*)calloc(wc->l,sizeof(double)))==0) {
@@ -56,9 +58,9 @@ void chebyshev12(double *phi, Cheby12WorkSpace *wc) {
cosphi[l]=cos(phi[l]);
sinphi[l]=sin(phi[l]);
// initial value T_0=1
- wc->t[l0]=1;
- wc->t[l0+1]=cosphi[l];
- wc->t[l0-1]=sinphi[l];
+ wc->t[l0]=oneoversqrt2pi;
+ wc->t[l0+1]=cosphi[l]*oneoversqrtpi;
+ wc->t[l0-1]=sinphi[l]*oneoversqrtpi;
}
// recurrence for n>1
for (n=2; n<=wc->nmax; n++) {