function L=polylength(x,y,close)
% polylength <Calculate length of polyline. close=true for perimeter of polygon.>
% Usage:: L=polylength(x,y,close[false])
%

% revision history:
% 04/13/21 Mark D. Shattuck <mds> polylength.m

%% Parse Input
if(~exist('close','var') || isempty(close))
	close=false;
end

%% Main
if(close)
  x=[x x(1)];
  y=[y y(1)];
end
L=sum(hypot(diff(x),diff(y)));

