Docsity

Output Primitives-Computer Graphics-Lecture Slides, Slides of Computer Graphics

Partial preview of the text

Download Output Primitives-Computer Graphics-Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

Computer Graphics

Output Primitives: How a picture may bedescribed

Defining a Picture ^ Picture may be defined^ 

As a set of intensities for pixels in a picture  As a set of complex objects or basic geometricstructures

^ The basic geometric structures are referredto as output primitives

Points ^ Single Coordinate Position^ 

Set the bit value(color code) corresponding to a specifiedscreen position within the frame buffer

^ A point is drawn in a horizontal scan whenever avalue 1 is encountered in the frame buffer

x

y^

setPixel (

x ,^ y

getPixel (

x ,^ y

Lines ^ Intermediate Positions between TwoEndpoints^ 

DDA, Bresenham’s line algorithms

Jaggies= Aliasing

Jaggies are due to rounding of pixel positions, less evident on high resolution machines

DDA ^ Digital differential analyzer finds the differencebetween the current point and the next point to bedrawn ^ Distance to the next point depends upon the slopeof the line ^ Moves the distance required in both x and ydirection ^ Draws the point ^ Appropriate modifications are made to the framebuffer

DDA Algorithm ^ Digital Differential Analyzer^ 

0 < Slope <= 1^ ^

Unit x interval = 1

x

y

x

y

m y y^

k k^

  1

DDA Algorithm ^ Digital DifferentialAnalyzer^ 

0 < Slope <= 1^ ^

Unit x interval = 1

^ Slope > 1^ 

Unit y interval = 1

^ -1 <= Slope < 0^ 

Unit x interval = -

m y y^

k k^

x1 ^1

y

x

y

DDA Algorithm ^ Digital Differential Analyzer^ 

Slope >= 1^ ^

Unit x interval = 1

^ 0 < Slope < 1^ 

Unit y interval = 1

^ -1 <= Slope < 0^ 

Unit x interval = -

^ Slope < -1^ 

Unit y interval = -

m x x^

k k

1

1

x1 

y

x

y

DDA algorithm: Pros and Cons ^ Pros^ 

Fast method for calculating Pixel Positions  No need for multiplication (slow operation)

^ Cons^ 

Round-off error causes the line to drift away  Rounding and floating point operations are timeconsuming

Quiz 1 ^ __________ or ____________ may be used for focusand deflection. (2) ^ Main components of a CRT are ___________ and_______________ (2) ^ What is the difference between Raster and Randomscan displays? (1) ^ How long will it take to fill the frame buffer if 10000 bitsare transferred per second? (5)^ 

For a 640X480 frame buffer with 12 bits per pixel.  For a 1280X1024 frame buffer with 24 bits per pixel.  Can you achieve a 30 fps in any of the configurations above?

Bresenham

’s Algorithm(cont.)

^ Initial Value of d ^ Update d

^

 ^

^

b a yx F

c yb

xa

y xF

(^00)

0

0

0 0

^  
^  

 ^

^

^

c by ax yx F^

  

^

2 ,

b

a

d^

^

^

 , ,^2

then, 0 if

   

   

b a x y d

d^

,^2

then, 0

if

  

 

^

a x d

d