Program Viewport,animasi,transformasi

  • Uploaded by: ridwan setiawan
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Program Viewport,animasi,transformasi as PDF for free.

More details

  • Words: 263
  • Pages: 5
VIEWPORT, TRANSFORMASI, & ANIMASI Diajukan Untuk Memenuhi Salah Satu Tugas Mata Kuliah Grafik Komputer Dosen : Asep Deddy, M. Kom

Oleh : Hamdan Fauzi (0706043) Ridwan Setiawan (0706073)

SEKOLAH TINGGI TEKNOLOGI GARUT (STTG) 2009

Program Viewport_Transformasi_Animasi; uses crt, graph; var a,b,c,d:real; dr,md,e,f,g,h:integer; mat:array[0..3,0..3] of real; Procedure Trans(a1,a2,a3,a4,a5,a6,a7,a8,a9:real; q:integer); var amat,bmat:array[0..3] of real; w,x:real; o,p,y,z,i,j:integer; begin mat[1,1]:=a1; mat[1,2]:=a2; mat[1,3]:=a3; mat[2,1]:=a4; mat[2,2]:=a5; mat[2,3]:=a6; mat[3,1]:=a7; mat[3,2]:=a8; mat[3,3]:=a9; amat[1]:=10; amat[2]:=10; amat[3]:=1; x:=0; for i:=1 to 3 do begin for j:=1 to 3 do begin w:=(amat[j])*(mat[j,i]); x:=(x+w); end; bmat[i]:=x; x:=0; end; Initgraph(dr,md,'c:\tp\bgi'); line(10,10,60,10); line(60,10,60,60); line(60,60,10,60); line(10,60,10,10); readln; setcolor(yellow); case q of 1:begin o:=round(bmat[1]); p:=round(bmat[2]); y:=(round(bmat[1]-10))+60; z:=(round(bmat[2]-10))+60; line(o,p,y,p); line(y,p,y,z); line(y,z,o,z); line(o,z,o,p); readln; closegraph; end; 2:begin

o:=(round(bmat[1])-10/2); p:=(round(bmat[2])-10/2); line((10-o),(10-p),(60+o),(10-p)); line((60+o),(10-p),(60+o),(60+p)); line((60+o),(60+p),(10-o),(60+p)); line((10-o),(60+p),(10-o),(10-o)); readln; closegraph; end; 3:begin o:=((round(bmat[1]))-10); p:=((round(bmat[2]))-10); line((10+p),(10+o),(60+p),(10+o)); line((60+p),(10+o),(60-o),(60-o)); line((60-o),(60-o),(10-o),(60-o)); line((10-o),(60-o),(10+p),(10+o)); readln; closegraph; end; end; end; begin Repeat Writeln ('=============================='); writeln('|1. Translasi |'); writeln('|2. Scalling |'); writeln('|3. Shearing |'); writeln('|4. Viewport |'); writeln('|5. Animasi |'); writeln('|6. Keluar |'); writeln('============================'); Write('Masukan Pilihan : '); readln(e); clrscr; case e of 1:begin write('Masukan Besar Translasi Untuk x: '); readln(a); write('Masukan Besar Translasi Untuk y: '); readln(b); Trans(1,0,0,0,1,0,a,b,1,e); end; 2:begin write('Masukan Besar Scala: '); readln(a); Trans(a,0,0,0,a,0,0,0,1,e); end; 3:begin write('Masukan Besar Pembebanan Ke Sumbu x: '); readln(a); a:=a/10; b:=0; Trans(1,a,0,b,1,0,0,0,1,e); end; 4:begin write('Masukan panjang sisi segi empat: '); readln(f); write('Masukan Panjang Pemotongan Bangun: '); readln(g); Initgraph(dr,md,'c:\tp\bgi'); SetViewPort(10, 10,g+10, g+10, ClipOn); rectangle(0, 5, f,f+5); readln;

closegraph; end; 5:begin InitGraph(dr,md,'c:\tp\bgi'); f:= 25; g:= GetMaxY; h:=1; Repeat setcolor(h); circle(f ,g div 2,50); Delay(250); ClearDevice; f:=f+25; h:=h+1; Until KeyPressed; CloseGraph; End; else end; until e=6; end.

Output :

1. Translasi

2. Scalling

3. Shearing

4. Viewport

5. Animasi

Related Documents

Program
May 2020 25
Program
October 2019 41
Program
June 2020 15
Program
July 2020 18
Program
April 2020 23
Program
April 2020 34

More Documents from "Otto"