diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-10-01 16:30:34 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-10-01 16:30:34 -0500 |
commit | b3d1ed27ce55875a74b0308e71257c4f480dad93 (patch) | |
tree | ae6c10beeba1d6cdbd70beb23662a160067bd25c /src | |
parent | 804e5d0aa1436e426e2c7892ac4b407f7bd6270f (diff) | |
download | sddm-b3d1ed27ce55875a74b0308e71257c4f480dad93.tar.gz sddm-b3d1ed27ce55875a74b0308e71257c4f480dad93.tar.bz2 sddm-b3d1ed27ce55875a74b0308e71257c4f480dad93.zip |
fall back to old scattering rms calculation when n = 0
Diffstat (limited to 'src')
-rw-r--r-- | src/path.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -155,9 +155,12 @@ path *path_init(double *pos, double *dir, double T0, double range, double theta0 * * Since there is no nice closed form solution for this, we estimate it by * evaluating the result at the middle of the track. */ - p->theta0 = 4*range*pow(theta0,2)*gsl_sf_psi_n(1,p->n-0.5)/pow(M_PI,2); - - p->theta0 = fmax(MIN_THETA0, p->theta0); + if (p->n > 0) { + p->theta0 = 4*range*pow(theta0,2)*gsl_sf_psi_n(1,p->n-0.5)/pow(M_PI,2); + p->theta0 = fmax(MIN_THETA0, p->theta0); + } else { + p->theta0 = theta0; + } p->s = s; p->x = x; @@ -195,7 +198,10 @@ void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t normalize(dir); - *theta0 = p->theta0; + if (p->n > 0) + *theta0 = p->theta0; + else + *theta0 = fmax(MIN_THETA0,p->theta0*sqrt(s)); } void path_free(path *p) |