~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to demos/simulation/bike/macros/velo3.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function []=velo3()
 
2
// Version roues a rayons ( qui tournent avec la roue !)
 
3
// la formule donnant l'angle de rotation est sans doute fausse
 
4
// j'ai suppose que la roue tournait avec la
 
5
// vitesse angulaire xx(6,i) pour la roue rear
 
6
// et que le temps d'integration etait de 1
 
7
// => theta (i) = xx(6,i)*i/imax
 
8
// Copyright INRIA
 
9
  ct=-cos(t);cp=cos(p);st=-sin(t);sp=sin(p);
 
10
  xe=[xmin,xmax,xmax,xmin,xmin]
 
11
  ye=[ymin,ymin,ymax,ymax,ymin]
 
12
  box=[ xe,xe; ye,ye ; zmin*ones(1,5),zmax*ones(1,5)];
 
13
  all=[ct -st 0; cp*st  cp*ct sp]*box
 
14
  //Bounds of window
 
15
  xmax=maxi(all(1,:));xmin=mini(all(1,:));
 
16
  ymax=maxi(all(2,:));ymin=mini(all(2,:));
 
17
  dx=0;dy=0;
 
18
  xb=[xmin-dx,xmax+dx]
 
19
  yb=[ymin-dy,ymax+dy]
 
20
 
 
21
  //Window definition
 
22
  isoview(xb(1),xb(2),yb(1),yb(2))
 
23
  plot2d(all(1,1:5)',all(2,1:5)',[1,-1],"000")
 
24
  // ground trajectory
 
25
 
 
26
  //plot2d((ct*xprear(1,:)-st*xprear(2,:))',...
 
27
  //     (cp*(st*xprear(1,:)+ct*xprear(2,:))+sp*xprear(3,:))',...
 
28
  //     [1,-1],"000");
 
29
 
 
30
  //plot2d((ct*xpfront(1,:)-st*xpfront(2,:))',...
 
31
  //     (cp*(st*xpfront(1,:)+ct*xpfront(2,:))+sp*xpfront(3,:))',...
 
32
  //     [1,-1],"000");
 
33
 
 
34
  [n1,n2]=size(xfrontar);
 
35
  xset("alufunction",6)
 
36
  if ~isdef('velo_rti') then   velo_rti=0.03;end 
 
37
  realtimeinit(velo_rti);
 
38
  realtime(0)
 
39
  for i=1:n2-1,velod(i);realtime(i);velod(i);
 
40
    ww=i:i+1;
 
41
    plot2d((ct*xprear(1,ww)-st*xprear(2,ww))',...
 
42
           (cp*(st*xprear(1,ww)+ct*xprear(2,ww))+sp*xprear(3,ww))',...
 
43
           [1,-1],"000");
 
44
    plot2d((ct*xpfront(1,ww)-st*xpfront(2,ww))',...
 
45
           (cp*(st*xpfront(1,ww)+ct*xpfront(2,ww))+sp*xpfront(3,ww))',...
 
46
           [1,-1],"000");
 
47
  end
 
48
  velod(n2-1);
 
49
  xset("alufunction",3);
 
50
endfunction