comparison +parametrization/Curve.m @ 1103:7f4aae76e06a feature/dataspline

In Curve.arcLengthParametrization(), upgrade linear interpolation to monotonicity-preserving cubic splines.
author Martin Almquist <malmquist@stanford.edu>
date Tue, 09 Apr 2019 13:19:55 -0700
parents 36d092a00040
children 60c875c18de3
comparison
equal deleted inserted replaced
1098:36d092a00040 1103:7f4aae76e06a
102 102
103 % Construct arcLength function using splines 103 % Construct arcLength function using splines
104 tvec = linspace(0,1,N); 104 tvec = linspace(0,1,N);
105 arcVec = obj.arcLength(0,tvec); 105 arcVec = obj.arcLength(0,tvec);
106 106
107 % t as a function of arcLength. Use linear interpolation to preserve monotonicity. 107 % t as a function of arcLength. Monotonicity-preserving cubic splines.
108 tFunc = @(arcLen)interp1(arcVec,tvec,arcLen, 'linear', 'extrap'); 108 tFunc = @(arcLen) pchip(arcVec,tvec,arcLen);
109 109
110 L = obj.arcLength(0,1); 110 L = obj.arcLength(0,1);
111 arcPar = @(s) tFunc(s*L); 111 arcPar = @(s) tFunc(s*L);
112 112
113 % New function and derivative 113 % New function and derivative