diff options
-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) |