-
-
Save influx6/e4feb4de817a08c4f57cac9dcfd6d429 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function newCurve = spline3d(curve, dt) | |
| % interpote a 3d curve using spline | |
| % path 3*x | |
| % newPath 3*x | |
| x = curve(1, :); | |
| y = curve(2, :); | |
| z = curve(3, :); | |
| t = cumsum([0;sqrt(diff(x(:)).^2 + diff(y(:)).^2 + diff(z(:)).^2)]); | |
| sx = spline(t,x); | |
| sy = spline(t,y); | |
| sz = spline(t,z); | |
| tt = t(1):dt:t(end); | |
| xp = ppval(sx, tt); | |
| yp = ppval(sy, tt); | |
| zp = ppval(sz, tt); | |
| newCurve = [xp; yp; zp]; | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment