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

« back to all changes in this revision

Viewing changes to macros/scicos_blocks/Hydraulics/vanne_draw_ports.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 vanne_draw_ports(o)
 
2
[orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
 
3
    xset('pattern',default_color(0))
 
4
  // draw input/output ports
 
5
  //------------------------
 
6
 
 
7
  if orient then  //standard orientation
 
8
    // set port shape
 
9
    out2=[ 0  -1
 
10
           1  -1
 
11
           1   1
 
12
           0   1]*diag([xf/7,yf/14])
 
13
    
 
14
    in2= [-1  -1
 
15
           0  -1
 
16
           0   1
 
17
          -1   1]*diag([xf/7,yf/14])
 
18
    //dy=sz(2)/2
 
19
    xset('pattern',default_color(1))
 
20
    //xpoly(out2(:,1)+(orig(1)+sz(1)),..
 
21
        //  out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
 
22
    xpoly(out2(:,1)+(orig(1)+sz(1)),..
 
23
          out2(:,2)+(orig(2)+2*sz(2)/10),"lines",1)
 
24
 
 
25
    //dy=sz(2)/2
 
26
    //xfpoly(in2(:,1)+orig(1),..
 
27
        //   in2(:,2)+(orig(2)+sz(2)-dy),1)
 
28
   
 
29
    xfpoly(in2(:,1)+orig(1),..
 
30
           in2(:,2)+(orig(2)+2*sz(2)/10),1)     
 
31
  else //tilded orientation
 
32
      out2=[0  -1
 
33
           -1  -1
 
34
           -1   1
 
35
            0   1]*diag([xf/7,yf/14])
 
36
      
 
37
      in2= [1  -1
 
38
            0  -1
 
39
            0   1
 
40
            1   1]*diag([xf/7,yf/14])
 
41
 
 
42
      
 
43
      //dy=sz(2)/2
 
44
      xset('pattern',default_color(1))
 
45
      //xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
 
46
        //    out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)  
 
47
      //dy=sz(2)/2
 
48
      //xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
 
49
        //     in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1) 
 
50
      xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
 
51
            out2(:,2)+ones(4,1)*(orig(2)+2*sz(2)/10),"lines",1)  
 
52
      dy=sz(2)/2
 
53
      xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
 
54
             in2(:,2)+ones(4,1)*(orig(2)+2*sz(2)/10),1) 
 
55
  end
 
56
  // valve command port port
 
57
  //------------------------
 
58
  // set port shape
 
59
 
 
60
 
 
61
 
 
62
  in= [-1  1
 
63
        0  0
 
64
        1  1
 
65
       -1  1]*diag([xf/14,yf/7])
 
66
 
 
67
 
 
68
 
 
69
  dx=sz(1)/2
 
70
 
 
71
  xfpoly(in(:,1)+ones(4,1)*(orig(1)+dx),..
 
72
         in(:,2)+ones(4,1)*(orig(2)+sz(2)),1)
 
73
 
 
74
endfunction