view +parametrization/dataSpline.m @ 1098:36d092a00040 feature/dataspline

Bugfix Curve.arcLengthParametrization() by using linear interpolation instead of higher-order spline for parameter as a funciton of arclength. Generalize dataSpline() to curves in higher dimensions.
author Martin Almquist <malmquist@stanford.edu>
date Tue, 09 Apr 2019 09:50:44 -0700
parents fdff002ebb32
children 60c875c18de3
line wrap: on
line source

% dataSpline calculates a Curve through the points f_i using cubic spline interpolation.
% The spline curve is parametrized with the arc length parametrization
% to facilitate better grids.
%
% f 	- m x D matrix of m points in D dimensions
function C = dataSpline(f)
	m = size(f, 1);

	t = linspace(0,1,m);

	pp_g = spapi(4, t, f');
	pp_gp = fnder(pp_g);

	g  = @(t) fnval(pp_g, t);
	gp = @(t) fnval(pp_gp, t);

	C = parametrization.Curve(g, gp);
	C = C.arcLengthParametrization();
end