From 378ecbc7af093382ed6b4faa4ceb645de1f00f1d Mon Sep 17 00:00:00 2001 From: tlatorre Date: Thu, 20 Sep 2018 14:12:48 -0500 Subject: make sure direction vector is normalized in path_eval() --- src/path.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/path.c b/src/path.c index 2083dc1..9634479 100644 --- a/src/path.c +++ b/src/path.c @@ -184,10 +184,17 @@ void path_eval(path *p, double s, double *pos, double *dir, double *T, double *t *T = interp1d(s,p->s,p->T,N); *t = interp1d(s,p->s,p->t,N); + /* Technically we should be interpolating between the direction vectors + * using an algorithm like Slerp (see https://en.wikipedia.org/wiki/Slerp), + * but since we expect the direction vectors to be pretty close to each + * other, we just linearly interpolate and then normalize it. */ + dir[0] = interp1d(s,p->s,p->dx,N); dir[1] = interp1d(s,p->s,p->dy,N); dir[2] = interp1d(s,p->s,p->dz,N); + normalize(dir); + *theta0 = p->theta0; } -- cgit