File: javacurve.curve

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (106 lines) | stat: -rw-r--r-- 3,168 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
!set precision=!getopt precision in $(replyoption$i)

!if $n<2
  :badrep
  reply$i=
  test=NaN
  !exit
!endif
!if $wims_read_parm=nocompare
    !goto drawing
!endif
!if $m<2
  Test=bad $i
  !exit
!endif

!!for the moment assume that linecnt =1
!set linecnt=!itemcnt $(rlist[;1])
!set n=!itemcnt $(rlist[1;])

!default precision=8
!!tol1	= 10,   8,   7,   6,   5,   4,  3.5,   3, 2.5,   2
!!tol2	= 50,  40,  30,  25,  20,   17,  15,  13,11.5,  10
!set precision1=$precision
!set precision2=$[5*$precision]

var=!varlist $(glist[1])
!if $var issametext x
  !distribute items $(glist) into f,xrange1,xrange2,yrange1,yrange2
  glist=!values floor((-$xrange1+x)*$xsize/($xrange2-($xrange1))),\
		floor((-$f+$yrange2)*$ysize/($yrange2-($yrange1))) for\
		x=$xrange1 to $xrange2 step 0.02
  m=!itemcnt $glist
  !goto begin
!endif
!if $var issametext t
  !distribute items $(glist) into f,g,trange1,trange2,xrange1,xrange2,yrange1,yrange2
  glist=!values floor((-$xrange1+$f)*$xsize/($xrange2-($xrange1))),\
		floor((-$g+$yrange2)*$ysize/($yrange2-($yrange1))) for\
		t=$trange1 to $trange2 step 0.02
  m=!itemcnt $glist
  !goto begin
!endif

:begin

curvecomp_xrange=0,$xsize
curvecomp_yrange=0,$ysize

!!curvecomp_option=discrete1 discrete2
curvecomp_1=$glist
curvecomp_2=$(rlist[1;])
curvecomp_tolerance=$precision2

tt=!exec curvecomp
!distribute words $tt into mean1, mean2
mean=$[max($mean1,$mean2)]

!if NaN isin $mean or Inf isin $mean or $mean1=$empty
 !goto badrep
!endif

:diag
test=$mean

!if $mean<$[$precision1]
  diareply$i=good
  !advance freegot
!else
  !if $mean<[2*$precision1]
    diareply$i=bad
    precreply$i=yes
    !advance precgood
  !else
    !if $mean<$[$precision2]
     partialgood$i=yes
     diareply$i=good
     freegot=$[$freegot + max(0,1-($mean-$precision1)/($precision2-$precision1))]
    !endif
  !endif

!endif

:drawing
!if $(replytype$i)=javacurve
  primitive1=polyline $color1,$rlist
  !if $wims_read_parm!=nocompare
    primitive2=polyline $color2,$glist
  !endif
  !exit
!endif

!! $(replytype$i)=jsxgraphcurve
!if $wims_read_parm!=nocompare
  script$i=!append line p$i[0] = brd$i.create('point',[$(glist[1]),$(glist[2])],{face:'', size:'0',fixed:true,name:'',showInfobox:false,strokeColor:'$color2'}); to $(script$i)
  !for j=1 to $m/2
    script$i=!append line p$i[$j] = brd$i.create('point',[$(glist[2*$j-1]),$(glist[2*$j])],{face:'', size:'0',fixed:true,name:'',showInfobox:false,strokeColor:'$color2'}); to $(script$i)
    script$i=!append line brd$i.create('line',[p$i[$[$j-1]],p$i[$j]],{strokeColor:'$color2', straightFirst:false, straightLast:false}); to $(script$i)
  !next
!endif
nb=1
script$i=!append line q[0] = brd$i.create('point',[$(rlist[$nb;1]),$(rlist[$nb;2])],{face:'', size:'8',fixed:true,name:'',showInfobox:false,strokeColor:'$color1'}); to $(script$i)
!for j=1 to $n/2
  script$i=!append line q[$j] = brd$i.create('point',[$(rlist[$nb;2*$j-1]),$(rlist[$nb;2*$j])],{face:'', size:'8',fixed:true,name:'',showInfobox:false,strokeColor:'$color1'}); to $(script$i)
  script$i=!append line brd$i.create('line',[q[$[$j-1]],q[$j]],{strokeColor:'$color1',straightFirst:false, straightLast:false}); to $(script$i)
!next