Mercurial > repos > public > sbplib
diff +grid/Curve.m @ 105:1df4f3704b76 feature/arclen-param
Added error checking for all methods that use the derivative gp. Removed that from the to do list. Updated some comments.
author | Martin Almquist <martin.almquist@it.uu.se> |
---|---|
date | Mon, 07 Dec 2015 18:51:41 +0100 |
parents | ffd9e68f63cc |
children | 06c3034966b7 |
line wrap: on
line diff
--- a/+grid/Curve.m Mon Dec 07 18:46:59 2015 +0100 +++ b/+grid/Curve.m Mon Dec 07 18:51:41 2015 +0100 @@ -7,11 +7,9 @@ end methods %TODO: - % Errors or FD if there is no derivative function added. - % Concatenation of curves % Subsections of curves - % Stretching of curve parameter - semi-done + % Stretching of curve parameter - done for arc length. % Curve to cell array of linesegments % The curve parameter t must be in [0,1]. @@ -35,6 +33,7 @@ end function n = normal(obj,t) + assert(~isempty(obj.gp),'Curve has no derivative!'); deriv = obj.gp(t); normalization = sqrt(sum(deriv.^2,1)); n = [-deriv(2,:)./normalization; deriv(1,:)./normalization]; @@ -93,6 +92,7 @@ % Arc length parameterization. function curve = arcLengthParametrization(obj,N) default_arg('N',100); + assert(~isempty(obj.gp),'Curve has no derivative!'); % Construct arcLength function using splines tvec = linspace(0,1,N);