function DesenharRobo( P,C,F,Rasto,XYRef )

 figure(1), [AZ,EL] = view; clf(1)
 %-- Elos mecanicos -------------------------------------------------
  H1= plot3( [P(1,1) P(2,1) P(3,1) P(4,1) P(5,1) P(6,1) P(7,1)],...
             [P(1,2) P(2,2) P(3,2) P(4,2) P(5,2) P(6,2) P(7,2)],...
             [P(1,3) P(2,3) P(3,3) P(4,3) P(5,3) P(6,3) P(7,3)],'r',...
             [P(12,1) P(13,1) P(14,1) P(15,1) P(16,1) P(17,1) P(18,1)],...
             [P(12,2) P(13,2) P(14,2) P(15,2) P(16,2) P(17,2) P(18,2)],...
             [P(12,3) P(13,3) P(14,3) P(15,3) P(16,3) P(17,3) P(18,3)],'r',...
             [P(9,1) P(10,1)], [P(9,2) P(10,2)], [P(9,3) P(10,3)], 'r');
  set(H1,'LineWidth', 2.0)
  xlabel(' X (m) '), ylabel(' Y (m) '), zlabel(' Z (m) ')
  axis('equal'), axis([-0.1 1.5 -0.4 0.4 0 0.6]), axis('off')
  if (AZ == 0 & EL == 90), view(125,25), else, view(AZ,EL), end
  zoom(1.5), hold on
 %-- Superficie de contacto -----------------------------------------
  fill3([-0.1 1.5 1.5 -0.1],[-0.4 -0.4 0.4 0.4],[-0.02 -0.02 -0.02 -0.02],'c')
 %-- Pe de suporte --------------------------------------------------
  fill3([-0.075  0.075  0.075 -0.075]+XYRef(1),[-0.035 -0.035  0.035  0.035]+XYRef(2),[0 0  0     0   ],'r')
  fill3([ 0.075  0.075  0.075  0.075]+XYRef(1),[-0.035  0.035  0.035 -0.035]+XYRef(2),[0 0 -0.02 -0.02],'r')
  fill3([-0.075 -0.075 -0.075 -0.075]+XYRef(1),[ 0.035 -0.035 -0.035  0.035]+XYRef(2),[0 0 -0.02 -0.02],'r')
  fill3([ 0.075 -0.075 -0.075  0.075]+XYRef(1),[ 0.035  0.035  0.035  0.035]+XYRef(2),[0 0 -0.02 -0.02],'r')
  fill3([-0.075  0.075  0.075 -0.075]+XYRef(1),[-0.035 -0.035 -0.035 -0.035]+XYRef(2),[0 0 -0.02 -0.02],'r')
  %-- Pe livre ------------------------------------------------------
  fill3(F(1,:,1),F(2,:,1),F(3,:,1),'g')
  fill3(F(1,:,2),F(2,:,2),F(3,:,2),'g')
  fill3(F(1,:,3),F(2,:,3),F(3,:,3),'g')
  fill3(F(1,:,4),F(2,:,4),F(3,:,4),'g')
  fill3(F(1,:,5),F(2,:,5),F(3,:,5),'g')
 %-- Juntas rotacionais ---------------------------------------------  
  surf([C(1,:,1); C(2,:,1)], [C(3,:,1); C(4,:,1)], [C(5,:,1); C(6,:,1)]) 
  surf([C(1,:,2); C(2,:,2)], [C(3,:,2); C(4,:,2)], [C(5,:,2); C(6,:,2)])
  surf([C(1,:,3); C(2,:,3)], [C(3,:,3); C(4,:,3)], [C(5,:,3); C(6,:,3)])
  surf([C(1,:,4); C(2,:,4)], [C(3,:,4); C(4,:,4)], [C(5,:,4); C(6,:,4)])
  surf([C(1,:,5); C(2,:,5)], [C(3,:,5); C(4,:,5)], [C(5,:,5); C(6,:,5)])
  surf([C(1,:,6); C(2,:,6)], [C(3,:,6); C(4,:,6)], [C(5,:,6); C(6,:,6)])
  surf([C(1,:,7); C(2,:,7)], [C(3,:,7); C(4,:,7)], [C(5,:,7); C(6,:,7)])
  surf([C(1,:,8); C(2,:,8)], [C(3,:,8); C(4,:,8)], [C(5,:,8); C(6,:,8)])
  surf([C(1,:,9); C(2,:,9)], [C(3,:,9); C(4,:,9)], [C(5,:,9); C(6,:,9)])
  surf([C(1,:,10);C(2,:,10)],[C(3,:,10);C(4,:,10)],[C(5,:,10);C(6,:,10)])
  surf([C(1,:,11);C(2,:,11)],[C(3,:,11);C(4,:,11)],[C(5,:,11);C(6,:,11)])
  surf([C(1,:,12);C(2,:,12)],[C(3,:,12);C(4,:,12)],[C(5,:,12);C(6,:,12)])
 %-- Secçao da Anca ------------------------------------------------  
  fill3([P(7,1) P(8,1) P(11,1) P(12,1)], [P(7,2) P(8,2) P(11,2) P(12,2)], [P(7,3) P(8,3) P(11,3) P(12,3)], 'y')
 %-- Esfera na extremidade -----------------------------------------
  [X,Y,Z] = sphere(100);
  X=0.025*X+P(10,1); Y=0.025*Y+P(10,2); Z=0.025*Z+P(10,3); surf(X,Y,Z)  
%-- Rasto da ANCA / PE LIVRE ---------------------------------------       
  R_anca(1,:) = Rasto(1,1,:); R_anca(2,:) = Rasto(1,2,:); R_anca(3,:) = Rasto(1,3,:);
  R_pe(1,:)   = Rasto(2,1,:); R_pe(2,:)   = Rasto(2,2,:); R_pe(3,:)   = Rasto(2,3,:);
  plot3( R_anca(1,:),R_anca(2,:),R_anca(3,:),'b-.', ...
         R_pe(1,:),R_pe(2,:),R_pe(3,:),'b-.'  )

