#<select name="graad" size="1">
#<option value="0">de moeilijkheidsgraad mag gewoon oplopen</option>
#<option value="1">ik wil de gemakkelijkste sommetjes</option>
#<option value="2">ik wil de makkelijke sommetjes</option>
#<option value="3">ik wil de gewone sommetjes</option>
#<option value="4">ik wil de moeilijke sommetjes</option>
#<option value="5">ik wil de moeilijkste sommetjes</option>
#</select>
#voor alle tellers
bewerking=bewerking1.proc
!set n=$teller

!if $graad=0 
    R=$teller
!else
    R=$graad
!endif   
#voor alle tellers opgave$n=
    
#een willekeurig punt $A 
X1=!randitem -4,-3,-2,-1,0,1,2
Y1=!randitem 4,5,6,7,8,9
dx=!randitem 4,5,8
dy=!randitem -5,-4,-2,1,2
    
#nog een willekeurig net punt
X2=$[$X1+($dx)]
Y2=$[$Y1+($dy)]
    
#de lijn door X1Y1 X2Y2 y=m1x+q
m1=$[$dy/$dx]
q1=$[$Y1-($m1)*$X1]
    
#de lijn loodrecht hierop is dus in X1Y1
m2=$[-1*$dx/$dy]
q2=$[$Y1-($m2)*$X1]
    
#eem mooie Y3
Y3=!randitem -8,-7,-6,-5,-4
    
#bijpassende X3-waarde
X3=$[($Y3-($q2))/($m2)]

#lengte AC is dus (X1:Y1) -- (X2:Y2)
#lengte AB is dus (X1:Y1) -- (X3:Y3)
#lengte BC is dus (X2:Y3) -- (X3:Y3)

tussen=!exec pari sqrt(($X1-$X2)^2 + ($Y1-$Y2)^2)\
sqrt(($X1-$X3)^2 + ($Y1-$Y3)^2)\
sqrt(($X2-$X3)^2 + ($Y2-$Y3)^2)

AC=!line 1 of $tussen
AB=!line 2 of $tussen
BC=!line 3 of $tussen
     
PI=3.141592654
hoekC=!exec pari round(100*(acos($AC/$BC))*180/$PI)
hoekC=$[$hoekC/100]
hoekB=$[90-$hoekC]
    
########PLAATJE############
keuze=!randitem 1,1
A=!item $keuze of  A,D,K,P
B=!item $keuze of  B,E,L,Q
C=!item $keuze of  C,F,M,R

optie=!randitem 1,2
!if $optie=1
    lengte=$AB
    punt=$B
!else
    lengte=$AC
    punt=$C
!endif

!if $R=1
    GOED$n=$[(round(100*($lengte)))/100]
    !if $taal=nl
	nivo_title=Bereken de lengte van een zijde in een rechthoekige driehoek
	somtekst$n=<p align="left">Gegeven is:\
	<ul>\
	<li> <img src="$module_dir/gifs/Delta.gif" alt="&delta;">&nbsp; <em>$A$B$C</em>\
	<li> <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$A</em>=90<sup>o</sup><br>\
	<li> De co&ouml;rdinaten zijn:\
	<ul>\
	<li>$A: ($X1;$Y1)\
	<li>$B: ($X3;$Y3)\
	<li>$C: ($X2;$Y2)\
	</ul>\
	</ul><p>\
	Bepaal de lengte van $A$punt <br>\
	<font size="-1" color=$fontcolor3>ik heb het liefst een exact antwoord;<br>\
	gebruik dan bijvoorbeeld <em>sqrt(7)</em> voor &radic;7 <br>\
	ik keur een antwoord afgerond op minimaal twee decimalen echter niet af...<br></font>

	antwoord$n=Het goede -afgeronde- antwoord is: $(GOED$n)
    !else
	nivo_title=Calculate the side of a right-angled triangle.
	somtekst$n=<p align="left">Given:\
	<ul>\
	<li> <img src="$module_dir/gifs/Delta.gif" alt="&delta;">&nbsp; <em>$A$B$C</em>\
	<li> <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$A</em>=90<sup>o</sup><br>\
	<li> the co&ouml;rdinates are:\
	<ul>\
	<li>$A: ($X1;$Y1)\
	<li>$B: ($X3;$Y3)\
	<li>$C: ($X2;$Y2)\
	</ul>\
	</ul><p>\
	Calculate the length of  $A$punt <br>\
	<font size="-1" color=$fontcolor3>I prefer an precise answer<br>\
	in that case, use <em>sqrt(7)</em> for  &radic;7 <br>\
	However an answer rounded off at two decimals will also be accepted...<br></font>
	
	antwoord$n=the correct -rounded off-- answer is: $(GOED$n)
    
    !endif
    !if $wims_user=supervisor and $printbaar=0
	opgave$n=$A$punt = <input size="20" name="ANT$n" value="$(GOED$n)"></p>
    !else
	opgave$n=$A$punt = <input size="20" name="ANT$n" value="$(ANT$n)"></p>
    !endif
!endif

!if $R=2 or $R=3
    !if $taal=nl
	sin=!randitem sinus,cosinus,tangens
	hoek=!randitem $B,$C
	!if ($sin=sinus and $hoek=$B) or ($sin=cosinus and $hoek=$C)
	    goed=$AC/$BC
	    !goto KANBETER
	!endif
	!if ($sin=cosinus and $hoek=$B) or ($sin=sinus and $hoek=$C)
	    goed=$AB/$BC
	    !goto KANBETER
	!endif
	!if $sin=tangens and $hoek=$B
	    goed=$AC/$AB
	!else
    	    goed=$AB/$AC
	!endif
	:KANBETER
	nivo_title=Bepaal de $sin 
	somtekst$n=<p align="left">Gegeven is:\
	<ul>\
	<li> <img src="$module_dir/gifs/Delta.gif" alt="&delta;">&nbsp; <em>$A$B$C</em>\
	<li> <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$A</em>=90<sup>o</sup><br>\
	<li> De co&ouml;rdinaten zijn:\
	<ul>\
	<li>$A: ($X1;$Y1)\
	<li>$B: ($X3;$Y3)\
	<li>$C: ($X2;$Y2)\
	</ul>\
	</ul><p><br>\
	Bepaal de $sin van <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$hoek</em><br>\
	<font size="-1" color=$fontcolor3> in twee decimalen nauwkeurig</font> 
	GOED$n=$[(round($goed*100))/100]	
	antwoord$n=Het goede -afgeronde- antwoord is:  $(GOED$n)
    !else
	sin=!randitem sine,cosine,tangent
	hoek=!randitem $B,$C
	!if ($sin=sine and $hoek=$B) or ($sin=cosine and $hoek=$C)
	    goed=$AC/$BC
	    !goto KANBETER
	!endif
	!if ($sin=cosine and $hoek=$B) or ($sin=sine and $hoek=$C)
	    goed=$AB/$BC
	    !goto KANBETER
	!endif
	!if $sin=tangent and $hoek=$B
	    goed=$AC/$AB
	!else
    	    goed=$AB/$AC
	!endif
	:KANBETER
	nivo_title=Calculate the $sin 
	somtekst$n=<p align="left">Given:\
	<ul>\
	<li> <img src="$module_dir/gifs/Delta.gif" alt="&delta;">&nbsp; <em>$A$B$C</em>\
	<li> <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$A</em>=90<sup>o</sup><br>\
	<li> the co&ouml;rdinates are:\
	<ul>\
	<li>$A: ($X1;$Y1)\
	<li>$B: ($X3;$Y3)\
	<li>$C: ($X2;$Y2)\
	</ul>\
	</ul><p><br>\
	Calculate the $sin of <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$hoek</em><br>\
	<font size="-1" color=$fontcolor3> at two decimals accurately</font> 
	GOED$n=$[(round($goed*100))/100]	
	antwoord$n=the correct -rounded off- answer is:  $(GOED$n)
    !endif
    !if $wims_user=supervisor and $printbaar=0
	opgave$n=$sin<em><img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;$hoek</em> = <input size="20" name="ANT$n" value="$(GOED$n)"></p>
    !else
	opgave$n=$sin<em><img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;$hoek</em> = <input size="20" name="ANT$n" value="$(ANT$n)"></p>
    !endif
!endif
 
!if $R>3 
    hoek=!randitem $B,$C
    !if $hoek=$B
	goed=$hoekB
    !else
	goed=$hoekC
    !endif
    !if $taal=nl
	nivo_title=Bepaal de grootte van <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;$hoek 
	somtekst$n=<p align="left">Gegeven is:\
	<ul>\
	<li> <img src="$module_dir/gifs/Delta.gif" alt="&delta;">&nbsp; <em>$A$B$C</em>\
	<li> <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$A</em>=90<sup>o</sup><br>\
	<li> De co&ouml;rdinaten zijn:\
	<ul>\
	<li>$A: ($X1;$Y1)\
	<li>$B: ($X3;$Y3)\
	<li>$C: ($X2;$Y2)\
	</ul>\
	</ul><p><br>\
	Bepaal de grootte van <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$hoek</em><br>\
	<font size="-1" color=$fontcolor3> in twee decimalen nauwkeurig</font> 

	GOED$n=$goed	
	antwoord$n=Het goede antwoord is:  $(GOED$n)
    !else
	nivo_title=Calculate the size of <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;$hoek 
	somtekst$n=<p align="left">Given:\
	<ul>\
	<li> <img src="$module_dir/gifs/Delta.gif" alt="&delta;">&nbsp; <em>$A$B$C</em>\
	<li> <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$A</em>=90<sup>o</sup><br>\
	<li> the co&ouml;rdinates are:\
	<ul>\
	<li>$A: ($X1;$Y1)\
	<li>$B: ($X3;$Y3)\
	<li>$C: ($X2;$Y2)\
	</ul>\
	</ul><p><br>\
	Calculate the size of <img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;<em>$hoek</em><br>\
	<font size="-1" color=$fontcolor3> at two decimals accurately</font> 

	GOED$n=$goed	
	antwoord$n=the correct -rounded off- answer is:  $(GOED$n)    
    !endif
    !if $wims_user=supervisor and $printbaar=0
	opgave$n=<em><img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;$hoek</em> = <input size="20" name="ANT$n" value="$(GOED$n)"></p>
    !else
	opgave$n=<em><img src="$module_dir/gifs/hoek.gif" alt="&ang;">&nbsp;$hoek</em> = <input size="20" name="ANT$n" value="$(ANT$n)"></p>
    !endif
!endif

    
hint=<p align="left">Algemene Hint:<br>


!if $PLAATJE=1
    knipperen=0
    XSIZE=300
    YSIZE=300
    TRANSPARENT=white
    XRANGE= -18,10
    YRANGE= -12,16
    XSCHAAL=2
    YSCHAAL=2
    !readproc $authordir/ruitjespapier.proc 
    
    
    plaatje$n=$ruitjespapier\
    linewidth 2 \
    triangle $X1,$Y1,$X2,$Y2,$X3,$Y3,red\
    linewidth 8\
    points green,$X1,$Y1,$X2,$Y2,$X3,$Y3\
    text black,$[$X1-1],$[$Y1+1.8],huge,$A\
    text black,$[$X2-0.5],$[$Y2+1],huge,$C\
    text black,$[$X3+0.5],$[$Y3+0.5],huge,$B\
!endif