Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program grafik; {$N+}
- uses Graph,crt;
- var
- i,j,k,za,c1:longInt;
- Q,W,e:INTEGER;
- a:array[1..3,1..3] of extended;
- fil:text;
- Z,X,C,B,D,Y,dis:EXTENDED;
- name:string[120];
- t:char;
- begin
- writeln('инициализация графики');
- repeat
- writeln('*');
- Q:=detect;
- InitGraph ( Q, W ,'C:\BP\BGI');{'F:\APPS\TP6\BGI' );}
- e:=graphresult;
- write(e:5);
- until (e=0) ;
- for c1:=14 to 20 do begin
- settextstyle(0,0,1);
- str(c1,name);
- name:='data'+name+'.txt';
- writeln('увязка файла');
- repeat {$I-}
- write('*');
- assign (fil,name);
- {$I+}
- until IOResult=0 ;
- writeln('открытие файла');
- repeat {$I-}
- write('*');
- reset(fil);
- {$I+}
- until IOResult=0 ;
- writeln('чтение файла');
- for i:=1 to 3 do begin
- for j:=1 to 3 do begin
- writeln('*');
- read(fil,a[i,j]);
- end;
- end;
- setlinestyle(4,34952,1);
- Rectangle( 0, 0,201,201);
- Rectangle(210, 0,411,201);
- Rectangle(420, 0,621,201);
- Rectangle( 0,250,201,451);
- Rectangle(210,250,411,451);
- Rectangle(420,250,621,451);
- outtextxy( 0,202,'< xy > -100<Z<+3100');
- outtextxy( 0,452,'< xy > +100>Z>-3100');
- outtextxy(210,202,'< xz > -3100<y<+3100');
- outtextxy(210,452,'< xz > +3100>y>-3100');
- outtextxy(420,202,'< zy > -3100<x<+3100');
- outtextxy(420,452,'< zy > +3100>x>-3100');
- line(100, 0,100,200);
- line(310, 0,310,200);
- line(520, 0,520,200);
- line(100,250,100,450);
- line(310,250,310,450);
- line(520,250,520,450);
- line( 0,100,200,100);
- line(210,100,410,100);
- line(420,100,620,100);
- line( 0,350,200,350);
- line(210,350,410,350);
- line(420,350,620,350);
- {окно 4.....................................................................}
- for i:=-99 to 100 do begin
- x:=i;
- b:=a[1,1]+a[1,2]*x+a[1,3]*X*X; {C}
- C:=a[2,1]+a[2,2]*X+a[2,3]*x*x; {B}
- D:=a[3,1]+a[3,2]*X+a[3,3]*X*X; {A}
- for j:=-100 to 99 do begin
- Y:=J;
- z:=b+C*Y+D*Y*Y;
- for k:=0 to 14 do begin
- za:=-k*(200);
- if ((za-100<=z)and(za+100>z)) then PUTPIXEL(TRUNC(X+100),TRUNC(Y*(-1)+350),k+1);
- end;
- end;
- PUTPIXEL(TRUNC(X+100),460,2);
- end;
- {окно 1.....................................................................}
- for i:=-99 to 100 do begin
- x:=i;
- b:=a[1,1]+a[1,2]*x+a[1,3]*X*X; {C}
- C:=a[2,1]+a[2,2]*X+a[2,3]*x*x; {B}
- D:=a[3,1]+a[3,2]*X+a[3,3]*X*X; {A}
- for j:=-100 to 99 do begin
- Y:=J;
- z:=b+C*Y+D*Y*Y;
- for k:=0 to 14 do begin
- za:=k*200;
- if ((za-100<=z)and(za+100>z)) then PUTPIXEL(TRUNC(X+100),TRUNC(Y*(-1)+100),k+1);
- end;
- end;
- PUTPIXEL(TRUNC(X+100),210,2);
- end;
- {окно второе................................................................}
- for i:=-99 to 100 do begin
- x:=i;
- b:=a[1,1]+a[1,2]*x+a[1,3]*X*X; {C}
- C:=a[2,1]+a[2,2]*X+a[2,3]*x*x; {B}
- D:=a[3,1]+a[3,2]*X+a[3,3]*X*X; {A}
- for j:=-3100 to 3100 do begin
- Y:=J;
- z:=b+C*Y+D*Y*Y;
- for k:=0 to 14 do begin
- za:=k*(200);
- if ((za-100<=Y)and(za+100>Y)and(Z>=-100)and(Z<=99)) then PUTPIXEL(TRUNC(X+310),TRUNC(z*(-1)+100),k+1);
- end;
- end;
- PUTPIXEL(TRUNC(X+310),210,2);
- end;
- {окно 5.....................................................................}
- for i:=-99 to 100 do begin
- x:=i;
- b:=a[1,1]+a[1,2]*x+a[1,3]*X*X; {C}
- C:=a[2,1]+a[2,2]*X+a[2,3]*x*x; {B}
- D:=a[3,1]+a[3,2]*X+a[3,3]*X*X; {A}
- for j:=-3100 to 3100 do begin
- Y:=J;
- z:=b+C*Y+D*Y*Y;
- for k:=0 to 14 do begin
- za:=-k*(200);
- if ((za-100<=Y)and(za+100>Y)and(Z>=-100)and(Z<=99)) then PUTPIXEL(TRUNC(X+310),TRUNC(z*(-1)+350),k+1);
- end;
- end;
- PUTPIXEL(TRUNC(X+310),460,2);
- end;
- {окно 3.....................................................................}
- for i:=-3100 to 3100 do begin
- x:=i;
- b:=a[1,1]+a[1,2]*x+a[1,3]*X*X; {C}
- C:=a[2,1]+a[2,2]*X+a[2,3]*x*x; {B}
- D:=a[3,1]+a[3,2]*X+a[3,3]*X*X; {A}
- for j:=-100 to 99 do begin
- Y:=J;
- z:=b+C*Y+D*Y*Y;
- for k:=0 to 14 do begin
- za:=k*(200);
- if ((za-100<=X)and(za+100>X)and(Z>=-99)and(Z<=100)) then PUTPIXEL(TRUNC(z+520),TRUNC(y*(-1)+100),k+1);
- end;
- end;
- PUTPIXEL(TRUNC((X+3100)/31+420),210,2);
- end;
- {окно 6.....................................................................}
- for i:=-3100 to 3100 do begin
- x:=i;
- b:=a[1,1]+a[1,2]*x+a[1,3]*X*X; {C}
- C:=a[2,1]+a[2,2]*X+a[2,3]*x*x; {B}
- D:=a[3,1]+a[3,2]*X+a[3,3]*X*X; {A}
- for j:=-100 to 99 do begin
- Y:=J;
- z:=b+C*Y+D*Y*Y;
- for k:=0 to 14 do begin
- za:=-k*(200);
- if ((za-100<=X)and(za+100>X)and(Z>=-99)and(Z<=100)) then PUTPIXEL(TRUNC(z+520),TRUNC(y*(-1)+350),k+1);
- end;
- end;
- PUTPIXEL(TRUNC((X+3100)/31+420),460,2);
- end;
- t:=readkey;
- cleardevice;
- Rectangle( 0, 0, 1,402);
- settextstyle(4,0,2);
- outtextxy( 0,450,'< xyz > '+name);
- for i:=-1990 to 2000 do begin
- x:=i*0.1;
- b:=a[1,1]+a[1,2]*x+a[1,3]*X*X; {C}
- C:=a[2,1]+a[2,2]*X+a[2,3]*x*x; {B}
- D:=a[3,1]+a[3,2]*X+a[3,3]*X*X; {A}
- for j:=-2000 to 1990 do begin
- Y:=J*0.1;
- z:=b+C*Y+D*Y*Y;
- for k:=-10 to 10 do begin
- za:=k*8;
- if ((za-4<=z)and(za+4>z)) then PUTPIXEL(TRUNC(X+340-z),TRUNC(Y*(-1)+200+z),k+1);
- end;
- end;
- PUTPIXEL(1,TRUNC(X+201),15);
- end;
- t:=readkey;
- cleardevice;
- end;
- closegraph ;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement