Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

GRAFIKA KOMPUTER

TUGAS 4

Disusun Oleh :
FERNANDO SETIAWAN
(1607115863)

PRODI TEKNIK INFORMATIKA S1


JURUSAN TEKNIK ELEKTRO
FAKULTAS TEKNIK
UNIVERSITAS RIAU
PEKANBARU
2018
TUGAS A
TUGAS B
TUGAS C

1. Fungsi shape() a. rotateX()


size(480, 480, P3D);
stroke(255); background(0);
noFill(); pushMatrix();
rotateX(PI/5);
translate(width/2,width/2);
beginShape(); //bottom
vertex(0, 0, 0); vertex(0,
0, -100); vertex(100, 0, -
100); vertex(100, 0, 0);
//left vertex(0,0,0);
vertex(0,0,-100);
vertex(0,100,-100);
vertex(0,100,0); //top
vertex(0, 100, -100);
vertex(100, 100, -100);
vertex(100, 100, 0);
vertex(0, 100, 0); //right
vertex(100,100,0);
vertex(100,100,-100); vertex(100,0,-100);
vertex(100,0,0); //front vertex(0,0,-100);
vertex(100,0,-100); vertex(100,100,-100);
vertex(0,100,-100); //back vertex(0,0,0);
vertex(100,0,0); vertex(100,100,0); vertex(0,100,0);
endShape(CLOSE); popMatrix();

b. rotateY()
size(480, 480, P3D);
stroke(255); background(0);
noFill(); pushMatrix();
rotateY(PI/5);
translate(width/2,width/2);
beginShape(); //bottom
vertex(0, 0, 0); vertex(0,
0, -100); vertex(100, 0, -
100); vertex(100, 0, 0);
//left vertex(0,0,0);
vertex(0,0,-100);
vertex(0,100,-100);
vertex(0,100,0); //top
vertex(0, 100, -100);
vertex(100, 100, -100); vertex(100, 100, 0);
vertex(0, 100, 0); //right vertex(100,100,0);
vertex(100,100,-100); vertex(100,0,-100);
vertex(100,0,0); //front vertex(0,0,-100);
vertex(100,0,-100); vertex(100,100,-100);
vertex(0,100,-100); //back vertex(0,0,0);
vertex(100,0,0); vertex(100,100,0); vertex(0,100,0);
endShape(CLOSE); popMatrix();

c. rotateZ()
size(480, 480, P3D);
stroke(255); background(0);
noFill(); pushMatrix();
rotateZ(PI/5);
translate(width/2,width/2);
beginShape(); //bottom
vertex(0, 0, 0); vertex(0,
0, -100); vertex(100, 0, -
100); vertex(100, 0, 0);
//left vertex(0,0,0);
vertex(0,0,-100);
vertex(0,100,-100);
vertex(0,100,0); //top
vertex(0, 100, -100);
vertex(100, 100, -100);
vertex(100, 100, 0);
vertex(0, 100, 0); //right
vertex(100,100,0); vertex(100,100,-100);
vertex(100,0,-100); vertex(100,0,0); //front
vertex(0,0,-100); vertex(100,0,-100);
vertex(100,100,-100); vertex(0,100,-100); //back
vertex(0,0,0); vertex(100,0,0); vertex(100,100,0);
vertex(0,100,0); endShape(CLOSE); popMatrix();

2. Fungsi quad() a. rotateX()


size(400, 400, P3D); stroke(255);
background(0); noFill(); rotateX(PI/7);
translate(width/2,width/2,0);
beginShape(); quad(0, 0, 0, 100, 100,
100, 100, 0); endShape();
b. size(400, 400, P3D);

rotateY()

stroke(255); background(0); noFill();


rotateY(PI/7);
translate(width/2,width/2,0);
beginShape(); quad(0, 0, 0, 100, 100,
100, 100, 0); endShape();
c.
rotateZ()
size(400, 400, P3D); stroke(255);
background(0); noFill(); rotateZ(PI/7);
translate(width/2,width/2,0);
beginShape(); quad(0, 0, 0, 100, 100,
100, 100, 0); endShape();

gabungan

stroke(255); background(0); noFill();


rotateX(PI/7); rotateY(PI/7);
d. size(400, 400, P3D);

rotateZ(PI/7); translate(width/2,-
(width/4)); beginShape(); quad(0, 0,
0, 100, 100, 100, 100, 0); endShape();
3. Fungsi rect() a. rotateX()
size(400, 400, P3D);
stroke(255); background(0);
rectMode(CENTER);
fill(254);
translate(width/2,width/2);
rotateX(PI/5);
beginShape(); rect(0, 0,
100, 100);
endShape();
b.
size(400, 400, P3D);

rotateY()

stroke(255); background(0);
rectMode(CENTER);
fill(254);
translate(width/2,width/2);
rotateY(PI/5);
beginShape(); rect(0, 0,
100, 100);
endShape();
c.
size(400, 400, P3D);

rotateZ()

stroke(255); background(0);
rectMode(CENTER);
fill(254);
translate(width/2,width/2);
rotateZ(PI/5);
beginShape(); rect(0, 0,
100, 100);
endShape();
d.
size(400, 400, P3D);

gabungan

stroke(255); background(0);
rectMode(CENTER);
fill(254);
translate(width/2,width/2);
rotateX(PI/5);
rotateY(PI/5);
rotateZ(PI/5);
beginShape(); rect(0, 0,
100, 100); endShape();

You might also like