aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/path.c7
1 files changed, 7 insertions, 0 deletions
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;
}