diff options
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -36,6 +36,8 @@ path *path_init(double *pos, double *dir, double T0, double range, double theta0 path *p = malloc(sizeof(path)); + p->theta0 = theta0; + p->pos[0] = pos[0]; p->pos[1] = pos[1]; p->pos[2] = pos[2]; @@ -114,10 +116,13 @@ path *path_init(double *pos, double *dir, double T0, double range, double theta0 return p; } -void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t) +void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t, double *theta0) { double normal[3], k[3], tmp[3], phi; + if (s > p->spline[0]->x[p->spline[0]->size-1]) + s = p->spline[0]->x[p->spline[0]->size-1]; + tmp[0] = gsl_spline_eval(p->spline[0],s,p->acc[0]); tmp[1] = gsl_spline_eval(p->spline[1],s,p->acc[1]); tmp[2] = gsl_spline_eval(p->spline[2],s,p->acc[2]); @@ -146,6 +151,9 @@ void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t normalize(tmp); rotate(dir,tmp,normal,phi); + + /* FIXME: This should be the *residual* scattering RMS. */ + *theta0 = p->theta0*sqrt(s); } void path_free(path *p) |