Répondre à : jsxgraph et exercices à étapes : rafraîchissement de la figure

Accueil Forums Programmation WIMS Programmation dans le langage wims jsxgraph et exercices à étapes : rafraîchissement de la figure Répondre à : jsxgraph et exercices à étapes : rafraîchissement de la figure

#3085
Julien
Modérateur
Up
0
Down
::

Bonjour,

Merci de poster un code qui fonctionne afin qu’on puisse se concentrer sur le problème…

\title{richard}
\css{<style type="text/css">
.jxgbox {margin-left:auto;margin-right:auto;}
.jsxgraph_button {text-align:center;}
</style>}

\computeanswer{no}
\format{html}
\precision{1000}

\range{-5..5}

\integer{angleincident=30}

\integer{rayon=300}
\integer{xpix=2*\rayon*1.2}
\integer{ypix=2*\rayon*1.2}

\real{xmin=-1.2}
\real{xmax=1.2}

\real{ysize=1}
\real{ymin=-0.2}
\real{ymax=1.2}

%%% dessin du rapporteur
\text{rapporteur=linewidth 1
frect 0,0,\xpix,\ypix/2,lightgray
}
\for{i=90 to 180 step 10}{
     \real{ang=floor((\i*3.14/180)*1000)/1000}
     \text{rapporteur=\rapporteur
     line \xpix/2+\rayon*cos(\ang), \ypix/2-\rayon*sin(\ang), \xpix/2+\rayon*1.1*cos(\ang),\ypix/2-\rayon*1.1*sin(\ang), black}
}
\for{i=90 to 180 step 30}{
     \text{rapporteur=\rapporteur
     text black, \xpix/2+\rayon*1.1*cos(\i*3.14/180),\ypix/2-\rayon*1.1*sin(\i*3.14/180),large, \i}
}
\text{rapporteur=\rapporteur
line \xpix/2-0.1*\rayon, \ypix/2, \xpix/2+0.1*\rayon, \ypix/2, black
line \xpix/2, \ypix/2-0.1*\rayon, \xpix/2, \ypix/2+0.1*\rayon, black
}
\text{dessin= draw( \xpix,\ypix 

		\rapporteur
)
}
%%% fin du dessin

\text{choix=oui,non}
\text{reponse=2}

\matrix{nstep = r1}
\nextstep{\nstep}
\integer{ok=0}

\real{ecart1=}
\real{angle=}
\real{longueur=}
\real{coss=}

\statement{ 
        \if{\ok=0}{
             <p>1. <b>Tracer un trait passant par le centre et la graduation 120. (\angle)</b></p>
             \embed{r1,\xpix x \ypix
                  \dessin
                  sline}
        }
        \if{\ok=1}{
             <p>1. Le trait a été tracé correctement.</p>
             <p>2. <b>cliquez sur NON.</b></p>
             \embed{r2,1}\embed{r2,2}
             }
reply1=\reply1
<br />
angle=\angle
<br />
ecart1=\ecart1
<br />
ok=\ok
<br />
angleincidence=\angleincidence <br />
longueur =\longueur    <br />rep=\rep<br />coss=\coss
}

\answer{}{\jstest}{type=jsxgraphcurve} {option=color1=blue color2=blue precision=8}
\answer{}{\reponse;\choix}{type=click} {option=noanalyzeprint}

\matrix{rep=\reply1}
\real{longueur=sqrt((\rep[4]-\rep[2])*(\rep[4]-\rep[2])+(\rep[3]-\rep[1])*(\rep[3]-\rep[1]))}
\real{coss=(\rep[3]-\rep[1])/\longueur}

\if{\coss=0}{\real{angle=90}}{\real{angle=atan((\rep[4]-\rep[2])/(\rep[3]-\rep[1]))/3.14159*180}}

\if{\angle<0}{\real{angle=180+(\angle)}}

\real{ecart1=abs(\angle+\angleincident-90)}
\condition{Votre tracé s'écarte de la valeur attendue de \ecart1 deg}{\ecart1<1}

\if{\ok=1}{\text{nstep =}}

\if{\ok=0}{
   \if{\ecart1<1}
   {
   \text{nstep = r2}
   \integer{ok=1}
   }
   {\text{nstep = r1}}
}

A priori ton exo fonctionne sur une version plus ancienne de Wims « WIMS-4.07c compilé le 2014-06-25. »

Bernadette, des modif ont eu lieu dans le module oef qui pourrait impacter ou pas ??

  • Cette réponse a été modifiée le il y a 8 années et 7 mois par Julien.