UTS GRAFIKA KOMPUTER

Hitung lokasi 7 titik pertama yang dilewati oleh garis (15,71) – (114,210) menggunakan algoritma Bresenham.

Gambarkan hasil perhitungannya.

Garis (15,71) – (114,210). X1=15, X2=114, Y1=71, Y2=210.

dx = (X2 – X10) = (114 – 15) = 99

dy = (Y2 – Y1) = (210 – 71) = 139

  • e = 2*dy-dx = 2*139-99 = 179

d1=2*dy= 2*139 = 278

d2=2*(dy-dx)=2*(139-99)=80

x = 15, y = 71

  • e =179 >= 0

e = e + d2 = 179 + 80 = 259

x = x + 1 = 15 + 1 = 16

y = y + 1 = 71 + 1 = 72

  • e = 259 >= 0

e = e + d2 = 259 + 80 = 339

x = x + 1 = 16 + 1 = 17

y = y + 1 = 72 + 1 = 73

  • e = 339 >= 0

e = e + d2 = 339 + 80 = 419

x = x + 1 = 17 + 1 = 18

y = y + 1 = 73 + 1 = 74

  • e = 419 >= 0

e = e + d2 = 419 + 80 = 499

x = x + 1 = 18 + 1 = 19

y = y + 1 = 74 + 1 = 75

  • e = 499 >= 0

e = e + d2 = 499 + 80 = 579

x = x + 1 = 19 + 1 = 20

y = y + 1 = 75 + 1 = 76

  • e = 579 >= 0

e = e + d2 = 579 + 80 = 659

x = x + 1 = 20 + 1 = 21

y = y + 1 = 76 + 1 = 77

download

Advertisements

One thought on “UTS GRAFIKA KOMPUTER

  1. oi lur berkunjunglah ke blog gw.. godofvaganzagameware.blogspot.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s