///withoutPrompt function play(T,X,XI) scf(1);clf();h=gcf(); h.pixmap = "on"; h.figure_size = [1400 600]; h.children.axes_visible=['off','off','off'] ; h.children.isoview='on'; h.children.tight_limits = "on" h.children.margins = [0,0,0,0]; XXX=[-XI-l2:0.2:3*XI+l2]; FY=[];XC=[]; for x=XXX, th=atan(Fx(x)); XC=[XC,x+sin(th)*r2] FY=[FY,F(x)-cos(th)*r2]; end h.children.data_bounds=[min(XC),min(FY);max(XC),max(FY)+d]; xfpoly([XC(1),XC,XC($)],[min(FY)-d,FY,min(FY)-d]); hfp = gce(); hfp.foreground = 5; drawlater() h.pixel_drawing_mode='xor' l3=1.15*l2; // car body length (half) for animation realtimeinit(1); // intialize real time operation for i=1:size(T,'*') t=T(i); X=XX(:,i); x=X(1);xd=X(2);y=X(3);yd=X(4);th=X(5);thd=X(6);xsi=X(7);eta=X(8); x0=x+xsi*sin(th)-l2*cos(th); x1=x+eta*sin(th)+l2*cos(th); y0=y-xsi*cos(th)-l2*sin(th); y1=y-eta*cos(th)+l2*sin(th); xp=[x0,x-l2*cos(th);x+l2*cos(th),x1]'; yp=[y0,y-l2*sin(th);y+l2*sin(th),y1]'; xpp=[x-l3*cos(th);x+l3*cos(th)]; ypp=[y-l3*sin(th);y+l3*sin(th)]; W1=[x0-r2,y0+r2,2*r2,2*r2,0,360*64]; W2=[x1-r2,y1+r2,2*r2,2*r2,0,360*64]; if i==1 then xpoly(xpp,ypp); hp1 = gce(); hp1.thickness=10; xpolys(xp,yp); hp2 = gce();hp21=hp2.children(1);hp22=hp2.children(2) xfarcs([W1',W2']); ha = gce();ha1=ha.children(1);ha2=ha.children(2) realtime(t); draw([hp1,hp2,ha])//draw car else draw([hp1,hp2,ha])//erase car hp1.data=[xpp,ypp]; hp21.data=[xp(:,1),yp(:,1)]; hp22.data=[xp(:,2),yp(:,2)]; ha1.data=W1; ha2.data=W2; realtime(t); draw([hp1,hp2,ha])//draw car end show_pixmap() end h.pixel_drawing_mode='copy' drawnow() show_pixmap() endfunction ///\withPrompt{}