# thales, raaklijnen aan cirkel
n=$counter
mathview=0
inputs=0
questiontype=4
math=0
!if $level=0
    R=$counter
!else
    R=$level
!endif
showToolBar=true
showMenuBar=false                                                                                             
framePossible=true
# 6 | 10 | 15 | 2 | 3 | 4 | 16 | 40 "
ggb=ggb/nogrid.ggb
!if $R>0
    plaatje=B1.jpg
    list_of_things=['circle','point','line']; 
    checkfile=exos/checkfile7.proc
    customToolBar=" 0 | 2 | 10 | 34 | 40 | 6 | 41 | 42 "
    !if $teaching=1
	thales=<p align="center"><h3>Thales</h3></p>
    !else
	thales=&nbsp;
    !endif
    answer$n=7,4,0,4,1
    # 7 punten 4 cirkel 0 polygon 4 lijn type=1
    r=!randint 3,4,5,6,7,8
    # cirkel x^2+y^2=r^2
    # willekeurig punt op deze cirkel
    deel=60
    xs=!randint 30,$[$deel*$r]
    xs=$[$xs/100]
    ys=$[sqrt(($r)^2-($xs)^2)]

    # richting van de straal M(0:0)
    #rc_straal=$ys/$xs
    rc1=$[-1*$xs/$ys]
    q1=$[$ys - ($rc1*$xs)]
    L1=$rc1*x - 1*y =$[(-1*($q1))] 
    xa=$[-1*($q1)/($rc1)]
    ya=0
    # tweede snijpunt
    ys2=$[-1*$ys]
    # tweede lijn
    # rc_straal=$ys2/$xs
    rc2=$[-1*$xs/$ys2]
    #lijn2 door A
    q2=$[$ys2 - ($rc2*$xs)]
    L2=$rc2*x - 1*y =$[(-1*($q2))] 
    var1=$rc1,$rc2
    var2=$xs,$ys,$xs,$ys2
    var3=$[0.5*$xa]
    ss=!record 98 of lang/remarks.$taal
    #@$thales Gegeven is de cirkel <b>C</b> met Centrum M<br>Gegeven is een punt <b>A</b> buiten de cirkel<br>Construeer met passer&lineaal de raaklijnen aan de cirkel<br>En teken ook de raakpunten.<br><small>Laat alle hulplijnen in de tekening staan</small>
    question$n=$ss

    appletcommand=document.applets[0].evalCommand("Mm_x=0");\
    document.applets[0].evalCommand("Mm_y=0");\
    document.applets[0].evalCommand("Ma_x=$xa");\
    document.applets[0].evalCommand("Ma_y=$ya");\
    document.applets[0].evalCommand("A = (Ma_x,Ma_y)");\
    document.applets[0].evalCommand("M = (Mm_x,Mm_y)");\
    document.applets[0].evalCommand("C: x^2 + y^2 = $r^2");\
    document.applets[0].setColor('C',255,0,0);\
    document.applets[0].setColor('A',255,0,0);\
    document.applets[0].setColor('M',255,0,0);

#    document.applets[0].evalCommand("Ms_x=$xs");\
#    document.applets[0].evalCommand("Ms_y=$ys");\
#    document.applets[0].evalCommand("M2_x=$xs");\
#    document.applets[0].evalCommand("M2_y=$ys2");\
#    document.applets[0].evalCommand("S1 = (Ms_x,Ms_y)");\
#    document.applets[0].evalCommand("S2 = (M2_x,M2_y)");\
#    document.applets[0].evalCommand("L1:$L1");\
#    document.applets[0].evalCommand("L2:$L2");\
    
!endif

textanswer$n=<img src=$module_dir/gifs/$plaatje width="345"> 
!if $teaching=1
    exotext=!record 16 of lang/remarks.$taal
    #@ <font color=blue>klik</font></a> hier voor wat info
    exotext=<a onclick='window.open("$module_dir/gifs/$plaatje"," ","width=345,height=280,left=0,top=0")'>$exotext
!else
    exotext=$empty
!endif
