Інформація про навчальний заклад

ВУЗ:
Національний університет Львівська політехніка
Інститут:
Не вказано
Факультет:
Не вказано
Кафедра:
Кафедра автоматизованих систем управління

Інформація про роботу

Рік:
2009
Тип роботи:
Лабораторна робота
Предмет:
Інформаційні технології
Група:
КН- 411

Частина тексту файла (без зображень, графіків і формул):

Міністерство освіти і науки України Національний університет «Львівська політехніка» Інститут комп’ютерних наук та інформаційних технологій Кафедра автоматизованих систем управління  Лабораторна робота №2 З курсу: «Комп’ютерна графіка» Тема:Основи комп‘ютерної графіки. Робота в просторовій системі координат Мета: Ознайомлення з основами комп‘ютерної графіки в просторовій системі координат. ТЕОРЕТИЧНІ ОСНОВИ Для кращого сприйняття форми об'єкта необхідно мати його зображення в тривимірному просторі. У багатьох випадках наочне представлення про об'єкт можна одержати шляхом виконання операцій обертання і переносу, а також побудови проекцій. Введемо однорідні координати. Точка в тривимірному просторі  задається чотиримірним вектором  або ж . Перетворення з однорідних координат описується співвідношеннями  де T - деяка матриця перетворення.  Ця матриця може бути представлена у вигляді 4 окремих частин  Матриця 3x3 здійснює лінійне перетворення у виді зміни масштабу, зсуву й обертання. Матриця-рядок 1х3 робить перенос, а матриця-стовпець 3х1 - перетворення в перспективі. Останній скалярний елемент виконує загальну зміну масштабу. Повне перетворення, отримане шляхом впливу на вектор положення матрицею 4x4 і нормалізації перетвореного вектора, будемо називати білінійним перетворенням. Воно забезпечує виконання комплексу операцій зсуву, часткової зміни масштабу, обертання, відображення, переносу, а також зміни масштабу зображення в цілому. Тривимірна зміна масштабу:  Тривимірний зсув: Недіагональні елементи верхньої лівої під матриці 3х3 від загальної матриці перетворення розміру 4х4 здійснюють зсуви в трьох вимірах, тобто . Відображення в просторі: При відображенні щодо площини xy змінюється тільки знак координати z. Отже, матриця перетворення для відображення щодо площини xy має вигляд  Відображення одиничного куба щодо площини ху показане на мал.2.7. Для відображення щодо площини уz  а для відображення щодо площини xz  Просторовий перенос: Тривимірний лінійний перенос зображення задається виразом  Тривимірне обертання навколо довільної осі: Розглянута процедура полягає в переносі зображення і заданої осі обертання, що забезпечує обертання навколо осі, що проходить через початок координат. Метод тривимірного обертання полягає в лінійному переносі, обертанні навколо початку координат і зворотньому лінійному переносі у вихідне положення. Якщо вісь, навколо якої виконується обертання, проходить через точку А = , то матриця перетворення визначається наступним виразом:  де елементи матриці обертання R розміру 4х4 визначаються в загальному випадку співвідношенням   Текст программного коду: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, StdCtrls, ExtCtrls; type TForm1 = class(TForm) StringGrid2: TStringGrid; Button1: TButton; RadioGroup1: TRadioGroup; Image1: TImage; Label1: TLabel; Label2: TLabel; Button2: TButton; Edit1: TEdit; Edit2: TEdit; Edit3: TEdit; Edit4: TEdit; Label3: TLabel; procedure Button1Click(Sender: TObject); procedure koord(); procedure draw_P(); procedure clean(); procedure Button2Click(Sender: TObject); procedure RadioGroup1Click(Sender: TObject); // procedure RadioGroup1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; x0,y0,z0,delta,delta_zx,delta_zy:integer; //kyb:array[0..7] of array[0..2] of integer; x:array[0..7]of array[0..3] of double; a:array[0..3]of array[0..3] of double; kyb:array[0..7] of array[0..3] of double; implementation procedure TForm1.clean(); var i,j:integer; begin for i:=0 to 3 do for j:=0 to 3 do StringGrid2.Cells[i,j]:=' '; end; procedure TForm1.koord(); var delta_p,x1,x2,x3,x4,y1,y2,y3,y4,i,z:integer; begin x0:=round(image1.Width/2); y0:=round((image1.Height)/2); with image1.Canvas do begin if (image1.Width-x0)>(image1.Height-y0) then delta:=round((image1.Height-y0)/10) else delta:=round((image1.Width-x0)/10); x1:=x0; x2:=x0; x3:=x0; x4:=x0; y1:=y0; y2:=y0; y3:=y0; y4:=y0; for i:=0 to 10 do begin delta_p:=delta; MoveTo(x0,y1); LineTo(x0,y1-delta_p); moveto(x0-2,y1-delta_p); LineTo (x0+2,y1-delta_p); y1:=y1-delta_p; MoveTo(x3,y0); LineTo(x3+delta_p,y0); moveto(x3+delta_p,y0-2); LineTo (x3+delta_p,y0+2); x3:= x3+delta_p; ///////////////////////***************** z:=delta_p; MoveTo(x4,y2); LineTo(x4-round(z*cos(0.5)),y2+round(z*sin(0.5))); moveto(x4-round(z*cos(0.5)),y2+round(z*sin(0.5))-2); LineTo (x4-round(z*cos(0.5)),y2+round(z*sin(0.5))+2); x4:= x4-round(z*cos(0.5)); y2:=y2+round(z*sin(0.5)); z:=z+delta_p; end; end; end; procedure TForm1.draw_P();//(x_k,y_k:integer); var x1,y1,x2,y2,i:integer; begin with image1.Canvas do begin // pen.Color:=clgray; pen.Width:=5; for i:=0 to 7 do begin delta_zx:=round(x[i,2]*delta*cos(0.5)); delta_zy:=round(x[i,2]*delta*sin(0.5)); x1:=round(x0+x[i,0]*delta); y1:=round(y0-x[i,1]*delta); if x[i,2]=0 then begin MoveTo(x1,y1); //t LineTo(x1,y1); end else begin MoveTo((x1-delta_zx),y1+delta_zy); LineTo(x1-delta_zx,y1+delta_zy); end; end; //for //pen.Color:=clgreen; pen.Width:=1; MoveTo(round(x0+x[1,0]*delta-(x[1,2]*delta*cos(0.5))),round(y0-x[1,1]*delta+(x[1,2]*delta*sin(0.5)))); LineTo(round(x0+x[3,0]*delta-(x[3,2]*delta*cos(0.5))),round(y0-x[3,1]*delta+(x[3,2]*delta*sin(0.5)))); MoveTo(round(x0+x[3,0]*delta-(x[3,2]*delta*cos(0.5))),round(y0-x[3,1]*delta+(x[3,2]*delta*sin(0.5)))); LineTo(round(x0+x[7,0]*delta-(x[7,2]*delta*cos(0.5))),round(y0-x[7,1]*delta+(x[7,2]*delta*sin(0.5)))); MoveTo(round(x0+x[7,0]*delta-(x[7,2]*delta*cos(0.5))),round(y0-x[7,1]*delta+(x[7,2]*delta*sin(0.5)))); LineTo(round(x0+x[5,0]*delta-(x[5,2]*delta*cos(0.5))),round(y0-x[5,1]*delta+(x[5,2]*delta*sin(0.5)))); MoveTo(round(x0+x[5,0]*delta-(x[5,2]*delta*cos(0.5))),round(y0-x[5,1]*delta+(x[5,2]*delta*sin(0.5)))); LineTo(round(x0+x[1,0]*delta-(x[1,2]*delta*cos(0.5))),round(y0-x[1,1]*delta+(x[1,2]*delta*sin(0.5)))); ///***************** i:=1; while i<8 do begin MoveTo(round(x0+x[i,0]*delta-(x[i,2]*delta*cos(0.5))),round(y0-x[i,1]*delta+(x[i,2]*delta*sin(0.5)))); LineTo(round(x0+x[i-1,0]*delta-(x[i-1,2]*delta*cos(0.5))),round(y0-x[i-1,1]*delta+(x[i-1,2]*delta*sin(0.5)))); i:=i+2; end; //*********** MoveTo(round(x0+x[0,0]*delta-(x[0,2]*delta*cos(0.5))),round(y0-x[0,1]*delta+(x[0,2]*delta*sin(0.5)))); //t LineTo(round(x0+x[4,0]*delta-(x[4,2]*delta*cos(0.5))),round(y0-x[4,1]*delta+(x[4,2]*delta*sin(0.5)))); MoveTo(round(x0+x[4,0]*delta-(x[4,2]*delta*cos(0.5))),round(y0-x[4,1]*delta+(x[4,2]*delta*sin(0.5)))); //t LineTo(round(x0+x[6,0]*delta-(x[6,2]*delta*cos(0.5))),round(y0-x[6,1]*delta+(x[6,2]*delta*sin(0.5)))); MoveTo(round(x0+x[6,0]*delta-(x[6,2]*delta*cos(0.5))),round(y0-x[6,1]*delta+(x[6,2]*delta*sin(0.5)))); //t LineTo(round(x0+x[2,0]*delta-(x[2,2]*delta*cos(0.5))),round(y0-x[2,1]*delta+(x[2,2]*delta*sin(0.5)))); MoveTo(round(x0+x[2,0]*delta-(x[2,2]*delta*cos(0.5))),round(y0-x[2,1]*delta+(x[2,2]*delta*sin(0.5)))); //t LineTo(round(x0+x[0,0]*delta-(x[0,2]*delta*cos(0.5))),round(y0-x[0,1]*delta+(x[0,2]*delta*sin(0.5)))); ///*************** end; end; {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var str: array[0..2] of array[0..2] of integer; //x:array[0..7]of array[0..3] of integer; //a:array[0..3]of array[0..3] of integer; //kyb:array[0..7] of array[0..3] of integer; i,j,l:integer; n1,n2,n3,teta:double; begin image1.Canvas.FillRect(Rect(0,0,image1.Width,image1.Height)); image1.Transparent:=true; koord(); kyb[0,0]:=0; kyb[0,1]:=0; kyb[0,2]:=0; kyb[1,0]:=0; kyb[1,1]:=0; kyb[1,2]:=strtofloat(Edit1.text); kyb[2,0]:=0; kyb[2,1]:=strtofloat(Edit1.text); kyb[2,2]:=0; kyb[3,0]:=0; kyb[3,1]:=strtofloat(Edit1.text); kyb[3,2]:=strtofloat(Edit1.text); kyb[4,0]:=strtofloat(Edit1.text); kyb[4,1]:=0; kyb[4,2]:=0; kyb[5,0]:=strtofloat(Edit1.text); kyb[5,1]:=0; kyb[5,2]:=strtofloat(Edit1.text); kyb[6,0]:=strtofloat(Edit1.text); kyb[6,1]:=strtofloat(Edit1.text); kyb[6,2]:=0; kyb[7,0]:=strtofloat(Edit1.text); kyb[7,1]:=strtofloat(Edit1.text); kyb[7,2]:=strtofloat(Edit1.text); kyb[7,3]:=1; kyb[6,3]:=1; kyb[5,3]:=1; kyb[4,3]:=1; kyb[3,3]:=1; kyb[2,3]:=1; kyb[1,3]:=1; kyb[0,3]:=1; for i:=0 to 7 do for j:=0 to 3 do x[i,j]:=kyb[i,j]; with image1.Canvas do begin pen.Color:=clred; pen.Width:=1; draw_p; ///////////////11111111111 end; //matrucja peretvorennja if RadioGroup1.ItemIndex=2 then begin a[0,0]:=strtofloat(StringGrid2.Cells[0,0]); a[0,1]:=strtofloat(StringGrid2.Cells[1,0]); a[0,2]:=strtofloat(StringGrid2.Cells[2,0]); a[0,3]:=strtofloat(StringGrid2.Cells[3,0]); a[1,0]:=strtofloat(StringGrid2.Cells[0,1]); a[1,1]:=cos(3.141592654/180*strtofloat(StringGrid2.Cells[1,1])); a[1,2]:=sin(3.141592654/180*strtofloat(StringGrid2.Cells[2,1])); a[1,3]:=strtofloat(StringGrid2.Cells[3,1]); a[2,0]:=strtofloat(StringGrid2.Cells[0,2]); a[2,1]:=-sin(3.141592654/180*strtofloat(StringGrid2.Cells[1,2])); a[2,2]:=cos(3.141592654/180*strtofloat(StringGrid2.Cells[2,2])); a[2,3]:=strtofloat(StringGrid2.Cells[3,2]); a[3,0]:=strtofloat(StringGrid2.Cells[0,3]); a[3,1]:=strtofloat(StringGrid2.Cells[1,3]); a[3,2]:=strtofloat(StringGrid2.Cells[2,3]); a[3,3]:=strtofloat(StringGrid2.Cells[3,3]); end else if RadioGroup1.ItemIndex=3 then begin a[0,0]:=cos(3.141592654/180*strtofloat(StringGrid2.Cells[0,0])); a[0,1]:=strtofloat(StringGrid2.Cells[1,0]); a[0,2]:=-sin(3.141592654/180*strtofloat(StringGrid2.Cells[2,0])); a[0,3]:=strtofloat(StringGrid2.Cells[3,0]); a[1,0]:=strtofloat(StringGrid2.Cells[0,1]); a[1,1]:=cos(3.141592654/180*strtofloat(StringGrid2.Cells[1,1])); a[1,2]:=strtofloat(StringGrid2.Cells[2,1]); a[1,3]:=strtofloat(StringGrid2.Cells[3,1]); a[2,0]:=sin(3.141592654/180*strtofloat(StringGrid2.Cells[0,2])); a[2,1]:=strtofloat(StringGrid2.Cells[1,2]); a[2,2]:=cos(3.141592654/180*strtofloat(StringGrid2.Cells[2,2])); a[2,3]:=strtofloat(StringGrid2.Cells[3,2]); a[3,0]:=strtofloat(StringGrid2.Cells[0,3]); a[3,1]:=strtofloat(StringGrid2.Cells[1,3]); a[3,2]:=strtofloat(StringGrid2.Cells[2,3]); a[3,3]:=strtofloat(StringGrid2.Cells[3,3]); end else if RadioGroup1.ItemIndex=4 then begin a[0,0]:=cos(3.141592654/180*strtofloat(StringGrid2.Cells[0,0])); a[0,1]:=sin(3.141592654/180*strtofloat(StringGrid2.Cells[1,0])); a[0,2]:=strtofloat(StringGrid2.Cells[2,0]); a[0,3]:=strtofloat(StringGrid2.Cells[3,0]); a[1,0]:=-sin(3.141592654/180*strtofloat(StringGrid2.Cells[0,1])); a[1,1]:=cos(3.141592654/180*strtofloat(StringGrid2.Cells[1,1])); a[1,2]:=strtofloat(StringGrid2.Cells[2,1]); a[1,3]:=strtofloat(StringGrid2.Cells[3,1]); a[2,0]:=strtofloat(StringGrid2.Cells[0,2]); a[2,1]:=strtofloat(StringGrid2.Cells[1,2]); a[2,2]:=strtofloat(StringGrid2.Cells[2,2]); a[2,3]:=strtofloat(StringGrid2.Cells[3,2]); a[3,0]:=strtofloat(StringGrid2.Cells[0,3]); a[3,1]:=strtofloat(StringGrid2.Cells[1,3]); a[3,2]:=strtofloat(StringGrid2.Cells[2,3]); a[3,3]:=strtofloat(StringGrid2.Cells[3,3]); end else if RadioGroup1.ItemIndex=7 then begin n1:=cos(3.141592654/180*strtofloat(Edit2.Text)); n2:=cos(3.141592654/180*strtofloat(Edit3.Text)); n3:=cos(3.141592654/180*strtofloat(Edit4.Text)); teta:= 3.141592654/180*strtofloat(StringGrid2.Cells[0,0]); a[0,0]:=n1*n1+(1-n1*n1)*cos(teta); a[0,1]:=n1*n2*(1-cos(teta))+n3*sin(teta); a[0,2]:=n1*n3*(1-cos(teta))-n2*sin(teta); a[0,3]:=strtofloat(StringGrid2.Cells[3,0]); a[1,0]:=n1*n2*(1-cos(teta))-n3*sin(teta); a[1,1]:= n2*n2+(1-n2*n2)*cos(teta); a[1,2]:=n2*n3*(1-cos(teta))+n1*sin(teta); a[1,3]:=strtofloat(StringGrid2.Cells[3,1]); a[2,0]:=n1*n3*(1-cos(teta))+n2*sin(teta); a[2,1]:=n2*n3*(1-cos(teta))-n1*sin(teta); a[2,2]:=n3*n3+(1-n3*n3)*cos(teta); a[2,3]:=strtofloat(StringGrid2.Cells[3,2]); a[3,0]:=strtofloat(StringGrid2.Cells[0,3]); a[3,1]:=strtofloat(StringGrid2.Cells[1,3]); a[3,2]:=strtofloat(StringGrid2.Cells[2,3]); a[3,3]:=strtofloat(StringGrid2.Cells[3,3]); end else begin a[0,0]:=strtofloat(StringGrid2.Cells[0,0]); a[0,1]:=strtofloat(StringGrid2.Cells[1,0]); a[0,2]:=strtofloat(StringGrid2.Cells[2,0]); a[0,3]:=strtofloat(StringGrid2.Cells[3,0]); a[1,0]:=strtofloat(StringGrid2.Cells[0,1]); a[1,1]:=strtofloat(StringGrid2.Cells[1,1]); a[1,2]:=strtofloat(StringGrid2.Cells[2,1]); a[1,3]:=strtofloat(StringGrid2.Cells[3,1]); a[2,0]:=strtofloat(StringGrid2.Cells[0,2]); a[2,1]:=strtofloat(StringGrid2.Cells[1,2]); a[2,2]:=strtofloat(StringGrid2.Cells[2,2]); a[2,3]:=strtofloat(StringGrid2.Cells[3,2]); a[3,0]:=strtofloat(StringGrid2.Cells[0,3]); a[3,1]:=strtofloat(StringGrid2.Cells[1,3]); a[3,2]:=strtofloat(StringGrid2.Cells[2,3]); a[3,3]:=strtofloat(StringGrid2.Cells[3,3]); end; i:=0; while i<=7 do begin j:=0; while j<=3 do begin x[i,j] := 0; l:=0; while l<=3 do begin x[i,j] := x[i,j]+kyb[i,l]*a[l,j]; Inc(l); end; Inc(j); end; Inc(i); end; with image1.Canvas do begin pen.Color:=clgreen; pen.Width:=1; draw_p; ///////////////11111111111 end; end; procedure TForm1.Button2Click(Sender: TObject); begin image1.Canvas.FillRect(Rect(0,0,image1.Width,image1.Height)); image1.Transparent:=true; koord(); end; procedure TForm1.RadioGroup1Click(Sender: TObject); begin clean; case RadioGroup1.ItemIndex of 0: begin Label3.Visible:=false; Edit2.Visible:=false; Edit3.Visible:=false; Edit4.Visible:=false; //////////////////////////************ //StringGrid2.Cells[0,0]:=inttostr(2); StringGrid2.Cells[1,0]:=floattostr(0); StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); StringGrid2.Cells[0,1]:=floattostr(0); //StringGrid2.Cells[1,1]:=floattostr(2); StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); StringGrid2.Cells[0,2]:=floattostr(0); StringGrid2.Cells[1,2]:=floattostr(0); //StringGrid2.Cells[2,2]:=floattostr(2); StringGrid2.Cells[3,2]:=floattostr(0); StringGrid2.Cells[0,3]:=floattostr(0); StringGrid2.Cells[1,3]:=floattostr(0); StringGrid2.Cells[2,3]:=floattostr(0); StringGrid2.Cells[3,3]:=floattostr(1); end; 1: begin Label3.Visible:=false; Edit2.Visible:=false; Edit3.Visible:=false; Edit4.Visible:=false; StringGrid2.Cells[0,0]:=inttostr(1); //StringGrid2.Cells[1,0]:=floattostr(0); //StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); //StringGrid2.Cells[0,1]:=floattostr(0); StringGrid2.Cells[1,1]:=floattostr(1); //StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); //StringGrid2.Cells[0,2]:=floattostr(0); //StringGrid2.Cells[1,2]:=floattostr(0); StringGrid2.Cells[2,2]:=floattostr(1); StringGrid2.Cells[3,2]:=floattostr(0); StringGrid2.Cells[0,3]:=floattostr(0); StringGrid2.Cells[1,3]:=floattostr(0); StringGrid2.Cells[2,3]:=floattostr(0); StringGrid2.Cells[3,3]:=floattostr(1); end; 2: begin Label3.Visible:=false; Edit2.Visible:=false; Edit3.Visible:=false; Edit4.Visible:=false; StringGrid2.Cells[0,0]:=inttostr(1); StringGrid2.Cells[1,0]:=floattostr(0); StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); StringGrid2.Cells[0,1]:=floattostr(0); //StringGrid2.Cells[1,1]:=floattostr(1); //StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); StringGrid2.Cells[0,2]:=floattostr(0); //StringGrid2.Cells[1,2]:=floattostr(0); //StringGrid2.Cells[2,2]:=floattostr(1); StringGrid2.Cells[3,2]:=floattostr(0); StringGrid2.Cells[0,3]:=floattostr(0); StringGrid2.Cells[1,3]:=floattostr(0); StringGrid2.Cells[2,3]:=floattostr(0); StringGrid2.Cells[3,3]:=floattostr(1); end; 3: begin Label3.Visible:=false; Edit2.Visible:=false; Edit3.Visible:=false; Edit4.Visible:=false; //StringGrid2.Cells[0,0]:=inttostr(1); StringGrid2.Cells[1,0]:=floattostr(0); //StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); StringGrid2.Cells[0,1]:=floattostr(0); StringGrid2.Cells[1,1]:=floattostr(1); StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); //StringGrid2.Cells[0,2]:=floattostr(0); StringGrid2.Cells[1,2]:=floattostr(0); //StringGrid2.Cells[2,2]:=floattostr(1); StringGrid2.Cells[3,2]:=floattostr(0); StringGrid2.Cells[0,3]:=floattostr(0); StringGrid2.Cells[1,3]:=floattostr(0); StringGrid2.Cells[2,3]:=floattostr(0); StringGrid2.Cells[3,3]:=floattostr(1); end; 4: begin Label3.Visible:=false; Edit2.Visible:=false; Edit3.Visible:=false; Edit4.Visible:=false; //StringGrid2.Cells[0,0]:=inttostr(1); //StringGrid2.Cells[1,0]:=floattostr(0); StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); //StringGrid2.Cells[0,1]:=floattostr(0); //StringGrid2.Cells[1,1]:=floattostr(1); StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); StringGrid2.Cells[0,2]:=floattostr(0); StringGrid2.Cells[1,2]:=floattostr(0); StringGrid2.Cells[2,2]:=floattostr(1); StringGrid2.Cells[3,2]:=floattostr(0); StringGrid2.Cells[0,3]:=floattostr(0); StringGrid2.Cells[1,3]:=floattostr(0); StringGrid2.Cells[2,3]:=floattostr(0); StringGrid2.Cells[3,3]:=floattostr(1); end; 5: begin Label3.Visible:=false; Edit2.Visible:=false; Edit3.Visible:=false; Edit4.Visible:=false; //StringGrid2.Cells[0,0]:=inttostr(1); StringGrid2.Cells[1,0]:=floattostr(0); StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); StringGrid2.Cells[0,1]:=floattostr(0); //StringGrid2.Cells[1,1]:=floattostr(1); StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); StringGrid2.Cells[0,2]:=floattostr(0); StringGrid2.Cells[1,2]:=floattostr(0); //StringGrid2.Cells[2,2]:=floattostr(1); StringGrid2.Cells[3,2]:=floattostr(0); StringGrid2.Cells[0,3]:=floattostr(0); StringGrid2.Cells[1,3]:=floattostr(0); StringGrid2.Cells[2,3]:=floattostr(0); //StringGrid2.Cells[3,3]:=floattostr(1); end; 6: begin Label3.Visible:=false; Edit2.Visible:=false; Edit3.Visible:=false; Edit4.Visible:=false; StringGrid2.Cells[0,0]:=inttostr(1); StringGrid2.Cells[1,0]:=floattostr(0); StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); StringGrid2.Cells[0,1]:=floattostr(0); StringGrid2.Cells[1,1]:=floattostr(1); StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); StringGrid2.Cells[0,2]:=floattostr(0); StringGrid2.Cells[1,2]:=floattostr(0); StringGrid2.Cells[2,2]:=floattostr(1); StringGrid2.Cells[3,2]:=floattostr(0); //StringGrid2.Cells[0,3]:=floattostr(0); //StringGrid2.Cells[1,3]:=floattostr(0); //StringGrid2.Cells[2,3]:=floattostr(0); StringGrid2.Cells[3,3]:=floattostr(1); end; 7: begin //StringGrid2.Cells[0,0]:=inttostr(1); //StringGrid2.Cells[1,0]:=floattostr(0); //StringGrid2.Cells[2,0]:=floattostr(0); StringGrid2.Cells[3,0]:=floattostr(0); //StringGrid2.Cells[0,1]:=floattostr(0); //StringGrid2.Cells[1,1]:=floattostr(1); //StringGrid2.Cells[2,1]:=floattostr(0); StringGrid2.Cells[3,1]:=floattostr(0); //StringGrid2.Cells[0,2]:=floattostr(0); //StringGrid2.Cells[1,2]:=floattostr(0); //StringGrid2.Cells[2,2]:=floattostr(1); StringGrid2.Cells[3,2]:=floattostr(0); StringGrid2.Cells[0,3]:=floattostr(0); StringGrid2.Cells[1,3]:=floattostr(0); StringGrid2.Cells[2,3]:=floattostr(0); StringGrid2.Cells[3,3]:=floattostr(1); Label3.Visible:=true; Edit2.Visible:=true; Edit3.Visible:=true; Edit4.Visible:=true; end; end; end; end. Результати роботи програми:  Рис.1 Зміна масштабу  Рис.2 Зсув  Рис.3 Поворот навколо осі х  Рис.4 Поворот навколо осі у  Рис.5 Поворот навколо осі z  Рис.6 Відображення  Рис.7 Просторовий перенос  Рис.8 Тривимірне обертання навколо довільної осі Висновок: На даній лабораторній роботі я ознайомилась з основами комп‘ютерної графіки в просторовій системі координат. Здійснила зміна масштабу, зсув, поворот навколо осей х,y,z, відображення, просторовий перенос і тривимірне обертання навколо довільної осі.
Антиботан аватар за замовчуванням

01.01.1970 03:01-

Коментарі

Ви не можете залишити коментар. Для цього, будь ласка, увійдіть або зареєструйтесь.

Ділись своїми роботами та отримуй миттєві бонуси!

Маєш корисні навчальні матеріали, які припадають пилом на твоєму комп'ютері? Розрахункові, лабораторні, практичні чи контрольні роботи — завантажуй їх прямо зараз і одразу отримуй бали на свій рахунок! Заархівуй всі файли в один .zip (до 100 МБ) або завантажуй кожен файл окремо. Внесок у спільноту – це легкий спосіб допомогти іншим та отримати додаткові можливості на сайті. Твої старі роботи можуть приносити тобі нові нагороди!
Нічого не вибрано
0%

Оголошення від адміністратора

Антиботан аватар за замовчуванням

Подякувати Студентському архіву довільною сумою

Admin

26.02.2023 12:38

Дякуємо, що користуєтесь нашим архівом!