Rev 12533 | Blame | Compare with Previous | Last modification | View Log | RSS feed
!!!!!!
!! Javacurve.poly / Javacurve.polygon
!!!!!!
!!almost the same as segment
!set precision=!getopt precision in $(replyoption$i)
!default precision=6
!if $n<2
:badrep
reply$i=
test=NaN
!exit
!endif
!if $wims_read_parm=nocompare
m_reply$i =$rlist
!goto drawing
!endif
!if $m<2
Test=bad $i
!exit
!endif
!ifval $n!=$m
mean=1000
!goto diag
!endif
curvecomp_xrange=0,1000
curvecomp_yrange=0,1000
curvecomp_option=discrete1 discrete2
curvecomp_1=$glist
curvecomp_2=$rlist
curvecomp_tolerance=$[2*$precision+3]
tt=!exec curvecomp
!distribute words $tt into mean1, mean2
mean=$[max($mean1,$mean2)/2]
!if NaN isin $mean or Inf isin $mean or $mean1=$empty
!goto badrep
!endif
:diag
test=$mean
!if $mean<$precision
diareply$i=good
!advance freegot
!else
!if $mean<$[2*$precision]
precreply$i=yes
!advance precgood
!endif
diareply$i=bad
!endif
:drawing
!if $(replytype$i)=javacurve
primitive1=polygon $color1,$rlist
!if $wims_read_parm!=nocompare
primitive2=polygon $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
script$i=!append line brd$i.create('line',[p$i[$m/2],p$i[1]],{strokeColor:'$color2', straightFirst:false, straightLast:false}); to $(script$i)
!endif
script$i=!append line q[0] = brd$i.create('point',[$(rlist[1]),$(rlist[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[2*$j-1]),$(rlist[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
script$i=!append line brd$i.create('line',[q[$n/2],q[1]],{strokeColor:'$color1',straightFirst:false, straightLast:false}); to $(script$i)