aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/path.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/path.c b/src/path.c
index 9634479..d26e461 100644
--- a/src/path.c
+++ b/src/path.c
@@ -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)