function p = linkage_pos(th,r)
%
% given angles of lengths of links, find positions of ends
%
nlink = length(th); npos = nlink+1;
%
p = zeros(2,npos);
%
% calculate unit vectors
nvec = linkage_vec(th);
%
p(:,1) = [0.0 0.0]';
%
for i_link = 1:nlink;
	p(:,i_link+1) = p(:,i_link) + nvec(:,i_link)*r(i_link);
end;
