function animate(object)
% set object in prescribed motion
[s1,s2,s3]=sphere(10); 
 axon = [0;1;1];angle=0;
% get object definition: nodes, connectivity index (axes)
[R,Index,X,Y,Z] = feval(object);
% reorient object by prescribed rotation-translation
d0=[0;-4;-3];v0 = [.5;0;1];d=d0; % define translation vector
% awkward way of doing this: bunch all vectors in 
% rewrite QUATMUL.M so it accepts arbitrary matrix arguments!
 for kk = 1:12
    angle = kk * pi / 12; d = d0+kk*v0-.5*(kk/4)^2*[0;0;1];   
    for i = 1:length(R)
       zz=d+rotate(R(i,:)',axon,angle);r(i,:)=zz';
    end
    x(1,:)=d';y(1,:)=d';z(1,:)=d';
    zz=d+rotate(X(2,:)',axon,angle);x(2,:)=zz';
    zz=d+rotate(Y(2,:)',axon,angle);y(2,:)=zz';
    zz=d+rotate(Z(2,:)',axon,angle);z(2,:)=zz';
    figure; hold on; grid on
    axis([-10,10,-10,10,-10,10]);
    view(20,40);

    for i=1:length(R)
       contour3(.1*s1+r(i,1),.1*s2+r(i,2),.1*s3+r(i,3));
    end
    g=r(1,:);
    for i=2:length(Index)
       g=[g;r(Index(i),:)];
    end
    plot3(g(:,1),g(:,2),g(:,3),'k-','LineWidth',1)
    plot3(x(:,1),x(:,2),x(:,3),'r-');
    plot3(y(:,1),y(:,2),y(:,3),'g-');
    plot3(z(:,1),z(:,2),z(:,3),'b-');
    hold off
    pause(1)
 end

function [R,Index,X,Y,Z]=octa1
s2=sqrt(2);
R=[1,1,0;1,-1,0;-1,-1,0;-1,1,0;0,0,s2;0,0,-s2];
X=[0,0,0;2,0,0];  Y=[0,0,0;0,2,0];  Z=[0,0,0;0,0,2];
Index=[1,2,3,4,1,5,3,6,1,2,5,4,6,2];