diff options
author | tlatorre <tlatorre@uchicago.edu> | 2018-09-20 14:12:48 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2018-09-20 14:12:48 -0500 |
commit | 378ecbc7af093382ed6b4faa4ceb645de1f00f1d (patch) | |
tree | 72b85254f6ff3c4741c3885f31643ad0fcd8ace8 /src/path.c | |
parent | 84ceeeac9ae55cdb0496505c9005daa28c5d977d (diff) | |
download | sddm-378ecbc7af093382ed6b4faa4ceb645de1f00f1d.tar.gz sddm-378ecbc7af093382ed6b4faa4ceb645de1f00f1d.tar.bz2 sddm-378ecbc7af093382ed6b4faa4ceb645de1f00f1d.zip |
make sure direction vector is normalized in path_eval()
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; } |