!goto $wims_read_parm

:def
title=Tracée de courbe implicite
synonyme=tracée implicite, tracer courbe implicite, courbe implicite 2D,tracer courbe plane implicite, courbe plane implicite
input=equation
!exit

:proc
formula=!item 1 of $formula
fml=!mathsubst X=x in $fml
fml=!mathsubst Y=y in $fml
eq==
!if $eq isin $formula
 f=!translate internal = to , in $formula
 !distribute items $f into f1,f2
 !if $f2=$empty or $f1=$empty
  error=bad_formula
  !exit
 !endif
 fml=$f1 - ($f2)
!else
 fml=$formula
!endif
result=$fml
x1=$[$xrange1]
x2=$[$xrange2]
y1=$[$yrange1]
y2=$[$yrange2]
s1=$[$picturesize1]
s2=$[$picturesize2]
!distribute item -2,2,-2,2,260,260 into dx1,dx2,dy1,dy2,ds1,ds2
!for r in x1,x2,y1,y2,s1,s2
 !if NaN isin $($r)
  $r=
 !endif
 !default $r=$(d$r)
!next r
insdraw_size=$s1,$s2
!exit

:output
Courbe plane implicite définie par
!htmlmath $formula
&nbsp;:
 <div class="wimscenter">
!insdraw xrange $x1,$x2\
yrange $y1,$y2\
arrow $x1,0,$x2,0,10,grey\
arrow 0,$y1,0,$y2,10,grey\
levelcurve red,$fml,0

</div>
!exit

