function L = band_wheel(d1,d2,d)
%% band_wheel: calculation of band-wheel length
%
% Syntax:
% [L] = band_wheel(d1,d2,d);
% Example:
% L = band_wheel(4,8,12)
% Input:
% d1 ... diameter of 1st wheel
% d2 ... diameter of 2nd wheel
% d ... distance between wheels
% Output:
% L ... length of band-wheel
%
% ver. 2, 03-2013, miloslav.capek@fel.cvut.cz

r1 = d1/2; % radius of 1st wheel
r2 = d2/2; % radius of 2nd wheel
L2 = sqrt(d^2 - (r2-r1)^2); % length of l2 segment
phi = asin((r2 - r1)/d); % angle phi
om1 = pi - 2*phi;
om2 = pi + 2*phi;
L1 = om1*r1; % length of 1st arc
L3 = om2*r2; % length of 2nd arc
L = L1 + 2*L2 + L3; % overall length
end