Đồ hoạ phẳng & Đồ hoạ không gian - Pdf 14

báo cáo bài tập lớn môn đồ hoạ
Đề tài II
I/ Giới thiệu đề tài:
Đồ hoạ máy tính là một trong các lĩnh vực mà ngành tin học quan tâm và đã đ ợc
đa vào chơng trình đào tạo chính khoá cho ngành tin học tại các trờng Đại học. Nội
dung chủ yếu của môn học là nghiên cứu các thuật toán, các kỹ thuật vẽ hình trên máy
tính, giúp sinh viên có thể xây dựng các phần mềm về đồ hoạ máy tính.
Là sinh viên Cao đẳng tin học, chúng em cũng đợc tiếp xúc làm quen với một số
kỹ thuật đồ hoạ trên máy vi tính thông qua các bài giảng và giáo trình do Thày Dơng
Viết Thắng biên soạn. Với kiến thức còn nhiều hạn chế nên ở đề tài này mục tiêu của
chúng em chủ yếu là vận dụng một số kiến thức học đợc đa vào vận dụng thực tế thông
qua bài tập lớn.
Trong phần Những bài tập lớn Đồ hoạ, nhóm chúng em thực hiện đề II bao gồm
cả Đồ hoạ phẳng và Đồ hoạ không gian. Nội dung đề tài cụ thể gồm:
Đồ hoạ phẳng:
1. Vẽ đồ thị hàm bậc ba / bậc nhất lên cửa sổ (c1,h1,c2,h2).
2. Vẽ đồ thị hàm số theo tham số x=f1(t), y=f2(t) lên cửa sổ (c1,h1,c2,h2). (*)
3. Vẽ đồ thị hàm số độc cực r=f() lên cửa sổ (c1,h1,c2,h2). (*)
4. Vẽ hình sao n cánh tự quay quanh tâm lên cửa sổ (c1,h1,c2,h2). (*)
Đồ hoạ không gian:
1. Vẽ khối đa diện đều có phân biệt nét khuất.
Trong đề tài, có một số mục đánh dấu (*) chúng em không giải thích còn lại
phần giải thích của chúng em kèm sau mỗi thủ tục của chơng trình. Trong báo cáo này
chúng em có mô tả các thủ tục vẽ bằng một số hình ảnh minh hoạ cho thêm phần sinh
động ( Hình ảnh minh hoạ ở cuối báo cáo).
II/ Unit chơng trình:
Unit UnitDT2;
Interface
Var c,h,d,C1,h1,c2,m,h2,Co,Ho,Xn,Yn,R2,R1,mau,goc:Integer;
X0,DE,Y0,x2,x1,y2,y1:Real;
XA,YA,ZA, XB,YB,ZB, XC,YC,ZC,

Procedure KG_WriteXYZP(X,Y,Z:real;St:String;color:byte);
Procedure VetrucP(D:integer;Color:byte);
Implementation
Uses Crt,graph;
Procedure MhDoHoa;
var Gd,Gm,ktra:integer;
Path:String;
Begin
Path:='c:\Tp\Bgi';
Repeat
Gd:=detect; InitGraph(Gd,Gm,Path);
Ktra:=GraphResult;
If Ktra <> 0 then
Begin
Write('Loi do hoa! Go lai Path, Neu quen thi
Enter!');
Readln(Path);
if Path='' then Halt(1);
end;
Until Ktra=0;
end;
{**********************}
Procedure
Chu_Bong(c,h,Font,Huong,KThuoc,Mauc,Maub,v:Integer;Tde:string);
Var I:Integer;
Begin
SetTextStyle(Font,Huong,Kthuoc);
SetColor(Maub);
for i:=1 to v do
OutTextXY(C+i,H-i,Tde);

If Cc>= 640 then Cc:=1;
If Cc1>= 640 then Cc1:=1;
Until KeyPressed;
end;
{***********************************}
Procedure AboutNen;
Begin
C1:=10;H1:=10;H2:=470;
Cuaso(c1,h1,C1+620,H1+450,15,7,9,5);
{ Chu_Bong(c1+50,h1,8,0,5,Lightred,cyan,5,'TRUONG DHBK HA NOI');
Chu_Bong(C1+190,h1+50,8,0,4,Lightred,cyan,4,'KHOA CNTT');}
Chu_Bong(C1+90,h1+30,7,0,4,14,cyan,3,'BAI TAP LON MON');
Chu_Bong(C1+260,h1+80,7,0,4,14,cyan,3,'KY THUAT DO HOA');
Chu_Bong(C1+50,H1+170,4,0,4,10,lightred,3,'GIAO VIEN: DUONG VIET
THANG');
Chu_Bong(c1+10,h1+230,7,0,4,10,lightred,3,'THUC HIEN: NHOM G2');
Chu_Bong(C1+280,H1+250,15,0,4,14,cyan,2,'');
cuaso(c1+228,h1+280,c1+410,h1+412,15,8,lightblue,6);
SetColor(10);OutTextxy(C1+200,H1+430,'PRESS ENTER TO RETURN
MAINMENU');
OutTextXY(C1+240,H1+300,'1.DAO VAN DAT (CAP)');
OutTextXY(C1+240,H1+320,'2.NGUYEN CAO DAI');
OutTextXY(C1+240,H1+340,'3.TRINH BUI CHUNG');
OutTextXY(C1+240,H1+360,'4.DINH MINH DUC');
OutTextXY(C1+240,H1+380,'5.TRUONG CONG CHUONG');
End;
{**********************************}
Procedure About;
Begin
ClearDevice;

Luu:=' ';
repeat
Ch:=readkey;
If ch<> #13 then
begin
Gwrite(c,h,ch);
luu:=luu+ch;
end;
Until ch=#13;
End;
{*********************************}
Procedure Greadln(Var c,h:Integer;Var luu:String);
Var ch:char;
Begin
Ch:=' ';
Luu:=' ';
repeat
Ch:=readkey;
If ch<> #13 then
begin
Gwrite(c,h,ch);
luu:=luu+ch;
end;
Until ch=#13;
C:=10;
h:=h+10;
end;
{*********************************}
Procedure Cuaso(C1,H1,C2,H2,Mau_tr,Mau_d,Mau_n,V:Integer);
Var I:integer;

OutTextxy(a+(i-1)*rong+10,b+10,Ten_Muc[i]);
End;
End;
{*******************************}
Procedure Menu_doc(K:Integer);
Var Ten_Muc:array[1..6] of string;
I,Rong,Cao,a,b:integer;
Begin
Ten_Muc[1]:='Do thi bac3/bac1';
Ten_Muc[2]:='Do thi tham so';
Ten_Muc[3]:='Do thi do cuc';
Ten_Muc[4]:='Round Star';
Ten_Muc[5]:='Da dien deu';
a:=20;b:=50;Rong:=150;Cao:=30;
For i:=1 to 5 do
Begin
If i=k then CuaSo(a,b+(I-
1)*Cao,a+Rong,b+i*Cao,8,white,3,4)
Else CuaSo(a,b+(i-1)*Cao-1,a+Rong,b+i*Cao,15,8,9,4);
SetColor(10);
OutTextxy(a+10,b+(i-1)*Cao+10,Ten_Muc[i]);
End;
End;
Procedure Projec(x,y,z:real;Var XProj,YProj:real);
Var Xobs,Yobs,Zobs:real;
Aux1,Aux2,Aux3,Aux4,Aux5,Aux6,Aux7,Aux8:real;
th,ph:real;
Begin
th:=Pi*theta/180;
Ph:=Pi*Phi/180;

End;
Procedure KGPutPixel(x,y,z:real;color:byte);
Var Xp,Yp:Real;c,h:integer;
Begin
Projec(x,y,z,Xp,Yp);
C:=Co+round(Xp*Kx);
H:=Ho-round(Yp*Ky);
PutPixel(C,H,color);
End;
Procedure KGLineto(x,y,z:real;Color:byte);
Var Xp,Yp:Real;c,h:integer;
Begin
SetColor(color);
Projec(x,y,z,Xp,Yp);
C:=Co+round(XP*Kx);
H:=Ho-round(YP*Ky);
lineto(C,H);
End;
Procedure KGLine(x1,y1,z1,x2,y2,z2:real;color:byte);
Begin
KgMoveto(x1,y1,z1);
KgLineto(x2,y2,z2,color);
End;
Procedure KG_WriteXYZ(X,Y,Z:real;St:String;color:byte);
Var Xp,Yp:Real;c,h:integer;
Begin
Projec(x,y,z,Xp,Yp);
C:=Co+round(XP*Kx);
H:=Ho-round(YP*Ky);
SetColor(color);

End;
(*-----------------------------------*)
Procedure KGMovetoP(x,y,z:real);
Var Xp,Yp:Real;c,h:integer;
Begin
ProjecP(x,y,z,Xp,Yp);
C:=Co+round(Xp*Kx);
H:=Ho-round(Yp*Ky);
moveto(C,H);
End;
Procedure KGPutPixelP(x,y,z:real;color:byte);
Var Xp,Yp:Real;c,h:integer;
Begin
ProjecP(x,y,z,Xp,Yp);
C:=Co+round(Xp*Kx);
H:=Ho-round(Yp*Ky);
PutPixel(C,H,color);
End;
Procedure KGLinetoP(x,y,z:real;Color:byte);
Var Xp,Yp:Real;c,h:integer;
Begin
SetColor(color);
ProjecP(x,y,z,Xp,Yp);
C:=Co+round(XP*Kx);
H:=Ho-round(YP*Ky);
lineto(C,H);
End;
Procedure KGLineP(x1,y1,z1,x2,y2,z2:real;color:byte);
Begin
KgMovetoP(x1,y1,z1);

D_Rho=1;
D_DE=20;
const
days : array [0..6] of String[9] =
('Sunday','Monday','Tuesday',
'Wednesday','Thursday','Friday',
'Saturday');
Type chieu=(VuongGoc,PhoiCanh);
Var St:Array[1..MaxDinh,1..3] of Real;
Fc:Array[1..MaxMat,0..MaxCanh] of Integer;
O1,O2,O3:Real;
NF:integer;
Net_Khuat:Boolean;
PhepChieu:Chieu;
Ttn,n:integer;
yy, mm, dd, dow : Word;
hg, mp, sg, hund : Word;
function LeadingZero(w : Word) : String;
Var s : String;
begin
Str(w:0,s);
if Length(s) = 1 then
s := '0' + s;
LeadingZero := s;
end;
Procedure Gio1;
Var S,Stg,Stp,Stgi:String;
Begin
GetTime(hg,mp,sg,hund);str(hg,stg);Str(Mp,stp);Str(Sg,Stgi);
Setcolor(15);

SetColor(mau);
For i:=2 to n+1 do
begin
cc:=c+round(x1[i-1]*Kx);hh:=h-round(y1[i-1]*Ky); {Dinh
trong tiep theo}
lineto(cc,hh);
cc:=c+round(x2[i]*Kx);hh:=h-round(y2[i]*Ky); {Dinh ngoai
tiep theo}
lineto(cc,hh);
end;
SetFillStyle(1,mau);
FloodFill(c,h,mau);
End;
{********************************}
Procedure Quay;
var t:integer;
Begin
t:=70;
While not keypressed do
begin
goc:=goc+10;
VeSao(c,h,R2,R1,n,goc,mau); delay(t);
SetColor(15);
OutTextXY(C-30,320,'VIET NAM');
VeSao(c,h,R2,R1,n,goc,red); delay(t);
end;
End;
{*******************************}
Procedure Dichuyen;
Var ch:char;


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status