function out=drawlnks(ctr,lengths,widths,angles,colors) % % ctr=[x0;y0] is the position of the center of the middle link % lengths=[lenrite;lenleft;lenctr] specifies the three lengths % widths =[widrite;widleft;widctr] specifies the three widths % angles =[thetarite;thetaleft;alpha] specifies the three angles % where alpha is the angle of the central link w.r.t. a % fixed frame, and thetaleft and thetarite are the angles % made by the two outside links relative to a completely % straightened out position % colors =[colrite,colleft,colctr] specifies the colors to be used % to draw the respective links % % rite=rot(angles(3)+angles(1))*antenna(lengths(1),widths(1)); rite=rot(angles(3)+angles(1))*makelink(lengths(1),widths(1)); % left=rot(angles(3)+angles(2))*panel(lengths(2),widths(2)); left=rot(angles(3)+angles(2))*makelink(lengths(2),widths(2)); central=rot(angles(3))*makelink(lengths(3),widths(3)); a1=ones(1,size(rite,2)); a2=ones(1,size(left,2)); a3=ones(1,size(central,2)); shiftctr1=ctr*a1; shiftctr2=ctr*a2; shiftctr3=ctr*a3; shiftrot1=rot(angles(3))*[(lengths(3)-widths(3))/2;0]*a1; shiftrot2=rot(angles(3))*[(lengths(3)-widths(3))/2;0]*a2; shiftrite=rot(angles(3)+angles(1))*[(lengths(1)-widths(1))/2;0]*a1; shiftleft=rot(angles(3)+angles(2))*[(lengths(2)-widths(2))/2;0]*a2; rite=rite+shiftctr1+shiftrot1+shiftrite; left=left+shiftctr2-shiftrot2-shiftleft; central=central+shiftctr3; clf diam=1.2*(lengths(3)/2+max(lengths(1:2))); cm=[0;0]; axis([cm(1)-diam,cm(1)+diam,cm(2)-diam,cm(2)+diam]); hold on; circ=[0:12]/6*pi; circ=widths(3)/4*[cos(circ);sin(circ)]; fill(central(1,:),central(2,:),colors(3,:)) fill(circ(1,:),circ(2,:),'g') fill(rite(1,:),rite(2,:),colors(1,:)) fill(left(1,:),left(2,:),colors(2,:)) axis('off')