Subversion Repositories wimsdev

Rev

Rev 7691 | Blame | Compare with Previous | Last modification | View Log | RSS feed


!set precision=!getopt precision in $(replyoption$i)
!default precision=4

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

xs1=$[min($(rlist[1]),$(rlist[3]))]
xs2=$[max($(rlist[1]),$(rlist[3]))]
ys1=$[min($(rlist[2]),$(rlist[4]))]
ys2=$[max($(rlist[2]),$(rlist[4]))]
!if $wims_read_parm=nocompare
  !goto drawing
!endif

xv1=$[min($(glist[1]),$(glist[3]))]
xv2=$[max($(glist[1]),$(glist[3]))]
xv3=$[min($(glist[5]),$(glist[7]))]
xv4=$[max($(glist[5]),$(glist[7]))]
yv1=$[min($(glist[2]),$(glist[4]))]
yv2=$[max($(glist[2]),$(glist[4]))]
yv3=$[min($(glist[6]),$(glist[8]))]
yv4=$[max($(glist[6]),$(glist[8]))]

tolerance=$precision

xdiff=$[max(abs($xv1-($xs1)),abs($xv2-($xs2)))]
ydiff=$[max(abs($yv1-($ys1)),abs($yv2-($ys2)))]

!if $[$xv1 - $tolerance- $xs1] < 0  and $[$yv1 - $tolerance- $ys1] < 0 \
     and $[$xv2 + $tolerance- $xs2] > 0  and $[$yv2 + $tolerance- $ys2] > 0
  test1 = 1
!else
  test1 = 0
!endif

!if $[$xs1 - $tolerance- $xv3] < 0  and $[$ys1 - $tolerance- $yv3] < 0 \
     and $[$xs2 + $tolerance- $xv4] > 0  and $[$ys2 + $tolerance- $yv4] > 0
  test2 = 1
!else
  test2 = 0
!endif

mean=$[min($test1,$test2)]

!if NaN isin $mean or Inf isin $mean
  !goto badrep
!endif

:diag
test=$mean
!if $mean=1
  diareply$i=good
  !advance freegot
!else
  diareply$i=bad
!endif

:drawing

!if $(replytype$i)=javacurve
  primitive1=polygon $color1,$xs1,$ys1,$xs2,$ys1,$xs2,$ys2,$xs1,$ys2
  !if $wims_read_parm!=nocompare
    primitive2=polygon $color2,$xv1,$yv1,$xv2,$yv1,$xv2,$yv2,$xv1,$yv2\
polygon $color2,$xv3,$yv3,$xv4,$yv3,$xv4,$yv4,$xv3,$yv4
  !endif
  !exit
!endif

!! $(replytype$i)=jsxgraphcurve
!if $wims_read_parm!=nocompare
  !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)
  !next
  !set script$i=$(script$i)\
brd$i.create('line',[[$(glist[1]),$(glist[2])],[$(glist[1]),$(glist[4])]],{strokeColor:'$color2', straightFirst:false, straightLast:false});\
brd$i.create('line',[[$(glist[1]),$(glist[4])],[$(glist[3]),$(glist[4])]],{strokeColor:'$color2', straightFirst:false, straightLast:false});\
brd$i.create('line',[[$(glist[3]),$(glist[4])],[$(glist[3]),$(glist[2])]],{strokeColor:'$color2', straightFirst:false, straightLast:false});\
brd$i.create('line',[[$(glist[3]),$(glist[2])],[$(glist[1]),$(glist[2])]],{strokeColor:'$color2', straightFirst:false, straightLast:false});

!endif
!for j=1 to $n/2
  script$i=!append line q[$j] = brd$i.create('point',[$(rlist[2*$j-1]),$(rlist[2*$j])],{face:'+', size:'8',fixed:true,name:'',strokeColor:'$color1',showInfobox:false}); to $(script$i)
!next
!set script$i=$(script$i)\
brd$i.create('line',[[$(rlist[1]),$(rlist[2])],[$(rlist[1]),$(rlist[4])]],{strokeColor:'$color1', straightFirst:false, straightLast:false});\
brd$i.create('line',[[$(rlist[1]),$(rlist[4])],[$(rlist[3]),$(rlist[4])]],{strokeColor:'$color1', straightFirst:false, straightLast:false});\
brd$i.create('line',[[$(rlist[3]),$(rlist[4])],[$(rlist[3]),$(rlist[2])]],{strokeColor:'$color1', straightFirst:false, straightLast:false});\
brd$i.create('line',[[$(rlist[3]),$(rlist[2])],[$(rlist[1]),$(rlist[2])]],{strokeColor:'$color1', straightFirst:false, straightLast:false});