!!Calculs pour le dessin
pas=5
data=
h=!exec maxima diff($f,x)
g=!exec maxima diff ($f,y)
grille=$[$xy_size/($pas)]

!if $fieldtype=directionnel
!for a=-$pas to $pas step 1
u=$[$centrex+(($a)*$xy_size/$pas)]
fx=!mathsubst x=($u) in $h
gx=!mathsubst x=($u) in $g
  !for b=-$pas to $pas step 1
  v=$[$centrey+(($b)*$xy_size/$pas)]
  A=!evalsubst y=($v) in $fx
  B=!evalsubst y=($v) in $gx
  N=$[(($A)^2+($B)^2)^(1/2)]
    !if $N>=0.001
    data=!append line arrow $u,$v,$[$u+($A)/$N*$grille],$[$v+($B)/$N*($grille)],6,green to $data
    !endif
  !next b
!next a


!else
grille=!eval 4*$grille*$pas

N=0
!for a=-$pas to $pas step 1
u=$[$centrex+(($a)*$xy_size/$pas)]
fx=!mathsubst x=($u) in $h
gx=!mathsubst x=($u) in $g
  !for b=-$pas to $pas step 1
  v=$[$centrey+(($b)*$xy_size/$pas)]
  A=!evalsubst y=($v) in $fx
  B=!evalsubst y=($v) in $gx
  M=$[(($A)^2+($B)^2)^(1/2)]
 !if $M notsametext NaN
  N=!eval max($N,$M)
  !endif 
  !next b
!next a

!for a=-$pas to $pas step 1
u1=$[$centrex+(($a)*$xy_size/$pas)]
fx=!mathsubst x=($u1) in $h
gx=!mathsubst x=($u1) in $g
  !for b=-$pas to $pas step 1
  v=$[$centrey+(($b)*$xy_size/$pas)]
  A=!evalsubst y=($v) in $fx
  B=!evalsubst y=($v) in $gx
  !if $[(($A)^2+($B)^2)] < 100
  data=!append line arrow $u1,$v,$[$u1+($A)/($N)*$grille],$[$v+($B)/($N)*$grille],6,green to $data
  !endif
  !next b
!next a

!endif
status=waiting
wims_module_log=$cmd

