program geometrie; (***************************************************************************) (* DULON Benjamin *) (* CORITON Willy *) (* Licence Informatique *) (* Groupe 1 *) (* *) (* P R O J E T L I 1 *) (* *) (* **** **** **** * * **** ***** **** * **** *) (* * * * * * * * * * * * * * *) (* * ** ** * * * * ** * **** * ** *) (* * * * * * * * * * * * * * *) (* **** **** **** * * **** * * * * **** *) (* *) (***************************************************************************) BEGIN (************************************************************) (* CLASSE DEFINISSANT LES PROCEDURES DE GRAPHISME UTILISEES *) (************************************************************) pref IIUWGRAPH block (*---------------------------------------------------*) (* PROCEDURE permettant d'utiliser le mode GRAPHIQUE *) (*---------------------------------------------------*) unit initgraph : procedure; begin CALL GRON(1); end initgraph; (*---------------------------------------------------*) (* PROCEDURE permettant de fermer le mode GRAPHIQUE *) (*---------------------------------------------------*) unit closegraph : procedure; begin CALL GROFF; end closegraph; (*-----------------------------------------------------------------*) (* AFFICHAGE en (x,y) d'un RECTANGLE de longueur l et de hauteur h *) (*-----------------------------------------------------------------*) unit rectangle : procedure(x,y,l,h : integer); begin call move(x,y); call draw (x+l,y); call draw(x+l,y+h); call draw(x,y+h); CALL DRAW(x,y); end rectangle; (*--------------------------------------------------------------------*) (* Definition du repere orthonorme *) (*--------------------------------------------------------------------*) Unit reportho:procedure; begin call move(425,10); call draw(425,294); call move(225,154); call draw(625,154); end reportho; (*--------------------------------------------------------------------*) (* ECRITURE d'une CHAINE de caracteres sur l'ecran graphique en (x,y) *) (*--------------------------------------------------------------------*) unit ecrit_text : procedure(x,y : integer;str : string); var ch : arrayof character, lg,i : integer; begin call move (x,y); ch := unpack(str); lg := upper(ch) - lower(ch) + 1; for i := 1 to lg do call hascii(0); call hascii(ord(ch(i))); od; end ecrit_text; (*---------------------------------*) (* LECTURE d'une touche au clavier *) (*---------------------------------*) unit inchar : function : integer; var i : integer; begin do i := inkey; if i =/= 0 then exit; fi; od; result := i; end inchar; (*-------------------------------------------------------------------*) (* LECTURE d'un ENTIER au clavier et AFFICHAGE sur l'ecran graphique *) (*-------------------------------------------------------------------*) unit lire_entier: function(x,y:real):real; var nbchiffre,key,i : integer, valeur : real, negatif : boolean; begin negatif := false; valeur:=0; call move(x,y); for i:=1 to 4 do call hascii(0); od; call move(x,y); DO (* Lecture de la touche *) key := inchar; if key = 45 then negatif := true ; call hascii(key); fi; if (key >= 48 and key <= 57) then call hascii(key); (* Saisie de chiffres *) if (nbchiffre < 3 ) then valeur := valeur*10 + key - 48; fi; fi; if (key = 27) or (key = 13) (* touche ESC ou RETOUR chariot *) then exit; fi; od; if negatif then result := -valeur else result:=valeur; fi; end lire_entier; (*---------------------------------------------------------------------*) (* ECRITURE d'un ENTIER sur l'‚cran graphique au coordonn‚es courantes *) (*---------------------------------------------------------------------*) unit ecrit_entier : procedure (posx,posy:integer, x : real); var val,i,j,val2 : integer, ch,ch2 : arrayof character, dec:boolean; begin array ch dim(1:4); array ch2 dim(1:4); for i:=1 to 4 do ch(i):=chr(48); ch2(i):=chr(48); od; i := 4; j:=4; val:=entier(x); val2:=x-val; do ch(i) := chr(48+(val mod 10)); val := val div 10; if (val = 0) then exit; fi; i := i - 1; od; if val2 = 0 then dec:=true; else do ch2(i):= chr(48+(val2 mod 10)); val2:= val2 div 10; if (val2 = 0) then exit; fi; j := j - 1; od; fi; if x < 0 then call hascii(0); call hascii(45); posx:=posx+4; fi; while i <= 4 do posx:=posx+i; call move(posx,posy); call hascii(0); call hascii(ord(ch(i))); i := i + 1; od; if not dec then call move(posx+8,posy); call hascii(0); call hascii(46); while j <= 4 do call move(posx+8*(j+1),posy); call hascii(0); call hascii(ord(ch2(j))); j := j + 1; od; fi; end ecrit_entier; (* unit ecrit_entier : procedure (x:real); var i,j,n,tail : integer, ch : arrayof character, ok:boolean; begin tail:=0; array ch dim(1:7); for i:=1 to 7 do ch(i):=chr(48); od; i := 7; j:=1; n:=x*100; do; ch(i):=chr(48+(n mod 10)); n:=n div 10; tail:=tail+1; i:=i-1; if (n=0) then exit; fi; od; if tail<3 then ch(j):=chr(48); i:=1; else for i:=1 to tail-2 do ch(i+j-1):=ch(i+8-j-tail); od; fi; ch(i+j):='.'; ch(i+j+1):=ch(6); ch(i+j+2):=ch(7); if ok then tail:=tail+1; fi; for i:=1 to tail+j do call hascii(0); call hascii(ord(ch(i))); od; end ecrit_entier;*) (*----------------------------------------------------------------*) (* PROCEDURE EQUATION QUI RENVOIE LES COORDONNEES DE DEUX DROITES *) (*----------------------------------------------------------------*) unit equation:procedure(output x1,y1,x2,y2:real); begin call ecrit_text(430,320,"abscisse premier point: "); x1:=lire_entier(622,320); call ecrit_text(430,330,"ordonnee premier point: "); y1:=lire_entier(622,330); call ecrit_text(430,320," "); call ecrit_text(430,330," "); call ecrit_text(430,320,"abscisse deuxieme point: "); x1:=lire_entier(622,320); call ecrit_text(430,330,"ordonnee deuxieme point: "); y1:=lire_entier(622,330); call ecrit_text(430,320," "); call ecrit_text(430,330," "); end equation; (*---------------------------------------------------------------*) (* PROCEDURE EQUAT QUI SAISIE LES COORDONNEES A B C DE LA DROITE *) (*---------------------------------------------------------------*) unit equat:procedure(output a,b,c:real); begin call ecrit_text(470,317,"valeur de a: "); a:=lire_entier(574,317); call ecrit_text(470,327,"valeur de b: "); b:=lire_entier(574,327); call ecrit_text(470,337,"valeur de c: "); c:=lire_entier(574,337); call ecrit_text(470,317," "); call ecrit_text(470,327," "); call ecrit_text(470,337," "); end equat; (*--------------------------------*) (* PROCEDURE DE SAISIE D'UN POINT *) (*--------------------------------*) unit def_point:procedure(output x1,y1:real); begin call ecrit_text(500,320,"Abscisse: "); x1:=lire_entier(580,320); call ecrit_text(500,330,"Ordonnee: "); y1:=lire_entier(580,330); call ecrit_text(500,320," "); call ecrit_text(500,330," "); end def_point; (*--------------------------------------------------------*) (* PROCEDURE SOMMAIRE DES DIFFERENTES FONCTIONS PROPOSEES *) (*--------------------------------------------------------*) unit sommaire:procedure; begin call rectangle(1,0,210,306); call ecrit_text (2,10," SOMMAIRE"); call ecrit_text (2,40," 1: Forme geometrique"); call ecrit_text (2,60," 2: Dessiner cercle"); call ecrit_text (2,80," 3: Intersection droites"); call ecrit_text (2,100," 4: Parallelisme "); call ecrit_text (2,120," 5: Perpendicularite"); call ecrit_text (2,140," 6: Point appart. droite"); call ecrit_text (2,160," 7: Point appart. cercle"); call ecrit_text (2,180," 8: Intersection cercles"); call ecrit_text (2,200," 9: Points/droite"); call ecrit_text (2,220," 10: Quitter"); call ecrit_text (2,250," Votre choix : "); end sommaire; unit ecran:procedure; begin call cls; call sommaire; call texte; call graphique; end ecran; unit graphique:procedure; begin call reportho; call rectangle(215,0,420,306); end graphique; unit texte:procedure; begin call rectangle(1,307,635,42); end texte; (*---------------------------------------------------*) (* PROCEDURE POUR SAISIR LES COORDONNEES D'UN CERCLE *) (*---------------------------------------------------*) unit def_cercle:procedure(output x1,y1,r:real); begin call ecrit_text(350,325,"Rayon: "); r:=lire_entier(406,325); call ecrit_text(450,320,"Abscisse du centre: "); x1:=lire_entier(610,320); call ecrit_text(450,330,"Ordonnee du centre: "); y1:=lire_entier(610,330); call ecrit_text(350,325," "); call ecrit_text(450,320," "); call ecrit_text(450,330," "); end def_cercle; (*----------------------------------*) (* PROCEDURE DE DESSIN D'UNE DROITE *) (*----------------------------------*) unit des_droite:procedure(a,b,c:real;output pb:boolean); begin pb:=false; if b=0 then if a=0 then pb:=true; else call move(425-10*c/a,5); call draw(425-10*c/a,295); fi; else call move(625,154+10*((c+20*a)/b)); call draw(225,154+10*((c-20*a)/b)); fi; end des_droite; (*------------------------------------------*) (* PROCEDURE MISE EN ATTENTE MODE GRAPHIQUE *) (*------------------------------------------*) unit attente:procedure; var reponse,rep:integer; begin call ecrit_text (20,295,"< TAPER SUR ENTREE >"); reponse := inkey; (*:=lire_entier(180,295);*) (*reponse := rep + 48 -rep*10;*) while reponse<>13 do (*rep:=lire_entier(180,295);*) reponse := inkey ; (*rep + 48 -rep*10;*) od; end attente; (********************************************************) (* CLASSE DEFINISSANT LES FORMES GEOMETRIQUES UTILISEES *) (********************************************************) unit geoplan :CLASS; (*---------------------*) (* DEFINITION DU POINT *) (*---------------------*) unit pt:class(x,y:real); unit equal:function(q:pt):boolean; (* renvoie une valeur booleenne sur l'egalite de deux points *) begin result:=((q.x=x) and (q.y=y)); end equal; unit dist:function(p:pt):real; (* renvoie la distance entre deux points *) begin if p=none then call erreur; else result:=sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)); fi; end dist; unit memecote:function(l:line,p1:pt):boolean; (* vrai si les deux points sont du meme cote de la droite *) var dx1,dx2:real; begin dx1:=l.a*p1.x+l.b*p1.y+l.c; dx2:=l.a*x+l.b*y+l.c; if (dx1>0 and dx2>0) or (dx1<0 and dx2<0) then result:= true; else result:=false; fi; end memecote; unit calculeq:procedure(p1:pt;output a,b,c:real); (* calcul l'equation de la droite en fonction des deux points *) begin a:=y-p1.y; b:=p1.x-x; c:=x*p1.y - p1.x*y; end calculeq; unit virtual erreur:procedure; begin call ecrit_text(200,325,"Il n'y a pas de point"); end erreur; end pt; (*----------------------*) (* DEFINITION DU CERCLE *) (*----------------------*) unit cercle :class(q:pt,r:real); unit intersec:function(c:cercle):line; (* renvoie la ligne d'intersection entre deux cercles *) var r1,r2:real; begin if c<> none then r1:=-r*r-q.x*q.x-q.y*q.y; r2:=c.r*c.r-c.q.x*c.q.x-c.q.y*c.q.y; result:=new line(q.x-c.q.x,q.y-c.q.y,(r1-r2)/2); else call erreur; fi; end intersec; unit ptappartcercle:function(p:pt,epsilon:real):boolean; (* renvoie une valeur booleenne sur l'appartenance de p au cercle *) begin if (p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y) >= (r-epsilon)*(r-epsilon) and (p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y) <= (r+epsilon)*(r+epsilon) then result:=true; else result:=false; fi; end ptappartcercle; unit virtual erreur:procedure; begin call ecrit_text(200,325,"Il n'y a pas de cercles"); writeln("Il n'y a pas de cercle"); end erreur; end cercle; (*-------------------------*) (* DEFINITION DE LA DROITE *) (*-------------------------*) unit line:class(a,b,c:real); unit meet:function(l:line):pt; (* renvoie le point d'intersection de deux droites *) var t:real; begin if parallele(l) then call ecrit_text(200,325,"Les deux droites sont paralleles"); else if l<> none then t:=1/(l.a*b-l.b*a); result:=new pt((c*l.b-b*l.c)/t,(a*l.c-c*l.a)/t); else call erreur; fi; fi; end meet; unit parallele:function(l:line):boolean; (* renvoie une valeur booleenne sur le parallelisme de deux droites *) begin if l <> none then if a*l.b -b*l.a=0 then result:=true; else result:=false; fi; else call erreur; fi; end parallele; unit perpendiculaire:function(l:line):boolean; (* renvoie une valeur booleenne sur la perpendicularite de deux droites *) begin if l <> none then if a*l.a + b*l.b=0 then result:=true; else result:=false; fi; else call erreur; fi; end perpendiculaire; unit ptappartligne:function(p:pt):boolean; (* renvoie une valeur booleenne sur l'appartenance de p a la droite *) begin if a*p.x + b*p.y +c=0 then result:=true; else result:=false; fi; end ptappartligne; unit virtual erreur:procedure; begin call ecrit_text(200,325,"Pas de droite"); end erreur; var d:real; begin d:=sqrt(a*a+b*b); if d<>0 then a:=a/d; b:=b/d; c:=c/d; fi; end line; END geoplan; (*---------------------------------------------------------*) (* PROCEDURE GOTOXY POUR DEPLACER LE CURSEUR EN MODE TEXTE *) (*---------------------------------------------------------*) unit gotoxy:procedure(ligne,colonne:integer); var i,j:integer, c,d,e,f:char; begin i:=ligne div 10; j:=ligne mod 10; c:=chr(48+i); d:=chr(48+j); i:=colonne div 10; j:=colonne mod 10; e:=chr(48+i); f:=chr(48+j); write(chr(27), "[",c,d,";",e,f,"H"); end gotoxy; (*----------------------------------------------*) (* PROCEDURE POUR EFFACER L'ECRAN EN MODE TEXTE *) (*----------------------------------------------*) unit effacecran:procedure; begin write(chr(27),"[2J"); end effacecran; (*--------------------------------------------------------*) (* PROCEDURE POUR METTRE L'ECRAN EN ATTENTE EN MODE TEXTE *) (*--------------------------------------------------------*) unit attent:procedure; var reponse:char; begin call gotoxy(25,45); writeln("taper sur entree"); reponse:='r'; while reponse='r' do read(reponse); od; end attent; (*****************************************************************************) (* PROGRAMME PRINCIPAL *) (*****************************************************************************) begin pref geoplan block const epsilon=0.1; var p,q,centre,p1,p2:pt, l2,l1:line, c2,c3:cercle, x1,y1,x2,y2,r,a,b,c,a1,b1,c1:real, ch,n,rep,rep2,i:integer, fin,pb,pb1:boolean, t:arrayof arrayof real, tab1,tab2: arrayof integer; begin call effacecran; call gotoxy(3,10); writeln("CORITON willy"); call gotoxy(5,10); writeln("DULON Benjamin"); call gotoxy(7,10); writeln("Licence informatique"); call gotoxy(9,10); writeln("Groupe 1"); call gotoxy(12,10); writeln("PROJET LI1"); call gotoxy(13,10); writeln("----------"); call gotoxy(16,10); writeln("***** ***** ***** ** ** ***** ***** ***** * *****"); call gotoxy(17,10); writeln("* * * * * ** * * * * * * * "); call gotoxy(18,10); writeln("* *** ** * * * * ** * ***** * ** "); call gotoxy(19,10); writeln("* * * * * * * * * * * * * "); call gotoxy(20,10); writeln("***** ***** ***** * * ***** * * * * *****"); call attent; (* OUVERTURE DU MODE GRAPHIQUE *) call initgraph; rep:=0; fin:=false; while not fin do rep:=0; while rep<=0 or rep>10 do call ecran; rep:=lire_entier(160,250); case rep (* dessiner une forme *) when 1: call ecrit_text(10,325,"Combien de sommets : "); n := lire_entier(178,325); array t dim(1:n); for i:=1 to n do array t(i) dim (1:2); od; for i:=1 to n do call ecrit_text(250,315,"Pour le point numero "); call hascii(0); call hascii(i); call ecrit_text(250,325,"Abscisse: "); t(i,1):= lire_entier(338,325); call ecrit_text(250,335,"Ordonn‚e: "); call ecrit_text(250,325," "); call ecrit_text(250,335," "); t(i,2):= lire_entier(338,335); od; call move(10*t(1,1)+425,154-10*t(1,2)); for i:=2 to n do call draw(10*t(i,1)+425,154-10*t(i,2)); od; call draw(10*t(1,1)+425,154-10*t(1,2)); rep:=0; CALL ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* dessiner un cercle *) when 2: call def_cercle(x1,y1,r); call point(x1*10+425,154-y1*10); call cirb(x1*10+425,154-y1*10,r*10,0,0,15,0,1,1); p1:=new pt(x1,y1); c2:= new cercle(p1,r); call ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; rep:=0; (* intersection de deux droites *) when 3: call ecrit_text(10,325,"Equation/P (1/2): "); rep2:=lire_entier(154,325); if rep2 = 2 then call ecrit_text(280,325,"Premiere droite"); call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a,b,c); call ecrit_text(280,325,"Deuxieme droite"); call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a1,b1,c1); else call ecrit_text(200,325,"Coordonnes premiere droite"); call equat(a,b,c); call ecrit_text(200,325,"Coordonnes deuxieme droite"); call equat(a1,b1,c1); fi; l1:= new line(a,b,c); l2:= new line(a1,b1,c1); centre:=l1.meet(l2); array tab1 dim(1:5000); call move(1,307); tab1:=getmap(636,349); call des_droite(a,b,c,pb); call des_droite(a1,b1,c1,pb1); call move(1,307); call putmap(tab1); if pb or pb1 then call ecrit_text(250,325,"Probleme de saisie de droite "); else if centre=/=none then call ecrit_text(200,325,"Le point d'intersection a pour coordonnee : "); call ecrit_entier(560,325,centre.x); (* call ecrit_entier(560,335,centre.y); *) else call ecrit_text(200,325,"Il n'y a pas de point d'intersection"); fi; fi; rep:=0; CALL ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* parallelisme de deux droites *) when 4: call ecrit_text(10,325,"Equation/P (1/2): "); rep2:=lire_entier(154,325); if rep2 = 2 then call ecrit_text(280,325,"Premiere droite"); call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a,b,c); call ecrit_text(280,325,"Deuxieme droite"); call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a1,b1,c1); else call ecrit_text(280,325,"Premiere droite"); call equat(a,b,c); call ecrit_text(280,325,"Deuxieme droite"); call equat(a1,b1,c1); fi; l1:= new line(a,b,c); l2:= new line(a1,b1,c1); array tab1 dim(1:5000); call move(1,307); tab1:=getmap(636,349); call des_droite(a,b,c,pb); call des_droite(a,b,c,pb1); call move(1,307); call putmap(tab1); if pb or pb1 then call ecrit_text(250,325,"Probleme de saisie de droite "); else if l1.parallele(l2) then call ecrit_text(280,325,"Les droites sont paralleles"); else call ecrit_text(280,325,"Les droites ne sont pas paralleles"); fi; fi; rep:=0; call ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* perpendicularite de deux droites *) when 5: call ecrit_text(10,325,"Equation/P (1/2): "); rep2:=lire_entier(154,325); if rep2 = 2 then call ecrit_text(280,325,"Premiere droite"); call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a,b,c); call ecrit_text(280,325,"Deuxieme droite"); call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a1,b1,c1); else call ecrit_text(280,325,"Premiere droite"); call equat(a,b,c); call ecrit_text(280,325,"Deuxieme droite"); call equat(a1,b1,c1); fi; array tab1 dim(1:5000); call move(1,307); tab1:=getmap(636,349); call des_droite(a,b,c,pb); call des_droite(a,b,c,pb); call move(1,307); call putmap(tab1); l1:= new line(a,b,c); l2:= new line(a1,b1,c1); if pb or pb1 then call ecrit_text(250,325,"Probleme de saisie de droite "); else if l1.perpendiculaire(l2) then call ecrit_text(280,325,"Les droites sont perpendiculaires"); else call ecrit_text(280,325,"Les droites ne sont pas perpendiculaires"); fi; fi; rep:=0; call ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* appartenance d'un point a une droite *) when 6: call ecrit_text(10,320,"Determination de la droite"); call ecrit_text(10,330,"Equation/P (1/2): "); rep2:=lire_entier(154,330); if rep2 = 2 then call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a,b,c); else call ecrit_text(300,325,"Coordonnees droite"); call equat(a,b,c); fi; call ecrit_text(300,325,"Coordonnees point "); call def_point(x1,y1); p1:= new pt(x1,y1); l1:= new line(a,b,c); call point(x1,y1); array tab1 dim(1:5000); call move(1,307); tab1:=getmap(636,349); call des_droite(a,b,c,pb); call move(1,307); call putmap(tab1); if pb then call ecrit_text(250,325,"Probleme de saisie de la droite "); else if l1.ptappartligne(p1) then call ecrit_text(250,325,"Le point appartient a la droite"); else call ecrit_text(250,325,"Le point n'appartient pas a la droite"); fi; fi; rep:=0; call ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* appartenance d'un point a un cercle *) when 7: call ecrit_text(200,325,"Determination du point"); call def_point(x1,y1); p1:=new pt(x1,y1); call point(454+10*x1,154-10*y1); call ecrit_text(200,325," "); call ecrit_text(100,325,"Determination du cercle"); call def_cercle(x1,y1,r); call point(x1*10+425,154-y1*10); call cirb(x1*10+425,154-y1*10,r*10,0,0,15,0,1,1); p2:=new pt(x1,y1); c2:= new cercle(p2,r); call ecrit_text(100,325," "); if c2.ptappartcercle(p1,epsilon) then call ecrit_text(250,325,"Le point appartient au cercle"); else call ecrit_text(250,325,"Le point n'appartient pas au cercle"); fi; rep:=0; call ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* intersection entre deux cercles *) when 8: call ecrit_text(10,325,"Pour le premier cercle"); call def_cercle(x1,y1,r); call point(x1*10+425,154-y1*10); call cirb(x1*10+425,154-y1*10,r*10,0,0,15,0,1,1); p1:=new pt(x1,y1); c2:= new cercle(p1,r); call ecrit_text(10,325,"Pour le second cercle "); call def_cercle(x1,y1,r); call point(x1*10+425,154-y1*10); call cirb(x1*10+425,154-y1*10,r*10,0,0,15,0,1,1); p2:=new pt(x1,y1); c3:= new cercle(p2,r); l1:=c2.intersec(c3); call ecrit_text(10,325," "); call ecrit_text(200,325,"La droite a pour equation"); rep:=0; call ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* deux points d'un meme cote d'une droite *) when 9: call ecrit_text(10,320,"Determination de la droite"); call ecrit_text(10,330,"Equation/P (1/2): "); rep2:=lire_entier(154,330); if rep2 = 2 then call equation(x1,y1,x2,y2); p1:= new pt(x1,y1); p2:= new pt(x2,y2); call p1.calculeq(p2,a,b,c); else call ecrit_text(280,325,"Coordonnees droite"); call equat(a,b,c); fi; call ecrit_text(280,325,"Coordonnees premier point "); call def_point(x1,y1); call point(425+10*x1,154-10*y1); p1:= new pt(x1,y1); call ecrit_text(280,325,"Coordonnees second point "); call def_point(x1,y1); call point(425+10*x1,154-10*y1); p2:= new pt(x1,y1); array tab1 dim(1:5000); call move(1,307); tab1:=getmap(636,349); call des_droite(a,b,c,pb); call move(1,307); call putmap(tab1); l1:= new line(a,b,c); if pb then call ecrit_text(250,325,"Probleme de saisie de la droite "); else if p1.memecote(l1,p2) then call ecrit_text(280,325,"Les deux points sont du meme cote"); else call ecrit_text(280,325,"Les deux points ne sont pas du meme cote"); fi; fi; rep:=0; call ecrit_text (20,295,"< TAPER SUR ENTREE >"); call attente; (* quitter *) when 10: ch:=0; while ch<1 or ch>2 do call ecrit_text(10,325,"Voulez-vous vraiment : "); call ecrit_text(220,320,"1: Quitter le programme "); call ecrit_text(220,335,"2: Continuer "); call ecrit_text(450,325,"Votre choix : "); ch:=lire_entier(562,325); call ecrit_text (20,295,"< TAPER SUR ENTREE >"); case ch when 1: fin:=true; when 2: exit;exit;rep:=0; esac; od; esac; od; od; (* FERMETURE DU MODE GRAPHIQUE *) call closegraph; end; end; end; end geometrie;