Subversion Repositories wimsdev

Rev

Rev 4162 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if  $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
4
slib_title=Utility for a clickable graphic paper sheet
5
slib_parms=8\
6
8,x_dimension (cm) \
7
8,y_dimension (cm) \
8
1,x_orig (cm) \
9
1,y_orig (cm) \
10
1,x_step (delta x for 1 cm on the paper or max value for x and optional label ) \
11
1,y_step (delta y for 1 cm on the paper or max value for y and optional label) \
12
0,click_x (from the mouse)\
13
0,click_y (from the mouse)
14
slib_author=Georges KHAZNADAR
15
slib_out= list of coordinates (x, y,) in the viewport space
16
slib_comment=for usage with Modtool, do not forget to declare\
17
click_x and click_y (as reply) in the file var.def, \
18
and do not forget to write a line '!set ins_tag=form click' before\
19
the command '!insdraw'. The 6 first parameters are the same as in\
20
slib/graphpaper/millimetre
21
slib_example= 12,8,0,0,1,1,125,13\
22
12,8,0,0,1 max t (ms),1 max U (V),125,13
23
 
24
 
25
!exit
26
 
27
:proc
28
 
29
!reset slib_xd, slib_yd, slib_xo, slib_yo, slib_xs, slib_ys, slib_xc, slib_yc, slib_x, slib_y, slib_labx, slib_laby, slib_maxx, slib_maxy
30
 
31
slib_parm=!item 1 to 8 of $wims_read_parm
32
!distribute item $slib_parm into slib_xd, slib_yd, slib_xo, slib_yo, slib_xs, slib_ys, slib_xc, slib_yc
33
 
34
!default slib_xd=8
35
!default slib_yd=8
36
!default slib_xo=1
37
!default slib_yo=1
38
!default slib_xs=1
39
!default slib_ys=1
40
!default slib_xc=0
41
!default slib_yc=0
42
 
43
slib_labx=!word 2 to -1 of $slib_xs
44
slib_laby=!word 2 to -1 of $slib_ys
45
slib_xs=!word 1 of $slib_xs
46
slib_ys=!word 1 of $slib_ys
47
 
48
slib_maxx=!word 1 of $slib_labx
49
!if $slib_maxx = max
50
  slib_labx = !word 2 to -1 of $slib_labx
51
  !! we need to compute the X step slib_xs, given the values
52
  !! of the total width slib_xd, abscissa of origin slib_xo
53
  !! and knowing that slib_xs currently means a maximum value.
54
  !! slib_xd-slib_xo must be be sufficient to display ticks greater
55
  !! than the current value of slib_xs, the tick step being a multiple
56
  !! of 1, 2 or 5.
57
  slib_log=$[log10($slib_xs/($slib_xd-$slib_xo))]
58
  slib_logint=$[floor($slib_log)]
59
  slib_logmant=$[$slib_log-$slib_logint]
60
  !if $slib_logmant > $[log10(5)]
61
     slib_xs=1e$[$slib_logint+1]
62
  !else
63
    !if $slib_logmant > $[log10(2)]
64
      slib_xs=5e$slib_logint
65
    !else
66
      slib_xs=2e$slib_logint
67
    !endif
68
  !endif
69
!else
70
  slib_maxx=$empty
71
!endif
72
 
73
slib_maxy=!word 1 of $slib_laby
74
!if $slib_maxy = max
75
  slib_laby = !word 2 to -1 of $slib_laby
76
  !! we need to compute the Y step slib_ys, given the values
77
  !! of the total height slib_yd, ordinate of origin slib_yo
78
  !! and knowing that slib_ys currently means a maximum value.
79
  !! slib_yd-slib_yo must be be sufficient to display ticks greater
80
  !! than the current value of slib_ys, the tick step being a multiple
81
  !! of 1, 2 or 5.
82
  slib_log=$[log10($slib_ys/($slib_yd-$slib_yo))]
83
  slib_logint=$[floor($slib_log)]
84
  slib_logmant=$[$slib_log-$slib_logint]
85
  !if $slib_logmant > $[log10(5)]
86
     slib_ys=1e$[$slib_logint+1]
87
  !else
88
    !if $slib_logmant > $[log10(2)]
89
      slib_ys=5e$slib_logint
90
    !else
91
      slib_ys=2e$slib_logint
92
    !endif
93
  !endif
94
!else
95
  slib_maxy=$empty
96
!endif
97
 
98
 
99
!!!!!! values from millimetre !!!!
100
!! new 60*$slib_xd,60*$slib_yd
101
!! xrange -0.5, 10*$slib_xd-0.5
102
!! yrange -0.5, 10*$slib_yd-0.5
103
 
104
slib_x=$[($slib_xc/60-0.05-$slib_xo)*$slib_xs]
105
slib_y=$[(-$slib_yc/60-0.05+$slib_yd-$slib_yo)*$slib_ys]
106
 
107
slib_out= $slib_x, $slib_y,