% garagefilm.m simple Simulation der Bewegung
% eines vereinfachten Autos auf einer
% Parkhausrampe
P=[5.15 6.85 6.85 5.15 5.15 ;
    -0.6  -0.6    4.2    4.2    -0.6; 
    0.3   0.3  0.3  0.3  0.3;
    1 1 1 1 1];
t = (0:0.01:1)*2*pi;
xi = 4.2*cos(t);
yi = 4.2*sin(t);
xa = 8.5*cos(t);
ya = 8.5*sin(t);
z = t/2/pi*3;
plot3(xi,yi,z);
hold on
plot3(xa,ya,z);
axis ([-10 10 -10 10 -2 18]);
axis square
for k=1:101
  tx = t(k);
  T = [cos(tx) -sin(tx) 0  0; sin(tx) cos(tx) 0 0; 0 0 1 z(k); 0 0 0 1];
  Q=T*P;
  if k > 1
    delete(ph)
  end
  ph = plot3(Q(1,:),Q(2,:),Q(3,:),'r');
  pause(0.1)
end
hold off
