16
IT- 601: Computer Graphics Lecture-00 Jesmin Akhter Lecturer,IIT Jahangirnagar University, Savar, Dhaka,Bangladesh 08/25/22

IT- 601: Computer Graphics Lecture-00

  • Upload
    mahdis

  • View
    28

  • Download
    4

Embed Size (px)

DESCRIPTION

Jesmin Akhter Lecturer,IIT Jahangirnagar University, Savar , Dhaka,Bangladesh. IT- 601: Computer Graphics Lecture-00. Course Overview. Tutorial 01 Introduction(L00 ) Scan Conversion(L01+L02+L03) Two – Dimnnsional Traformations (L04+L05+L06). - PowerPoint PPT Presentation

Citation preview

Page 1: IT- 601: Computer Graphics Lecture-00

IT- 601: Computer Graphics

Lecture-00

Jesmin Akhter Lecturer,IIT

Jahangirnagar University, Savar, Dhaka,Bangladesh

04/20/23

Page 2: IT- 601: Computer Graphics Lecture-00

Course Overview Tutorial 01

Introduction(L00) Scan Conversion(L01+L02+L03) Two – Dimnnsional Traformations(L04+L05+L06). ---------------------------------------------------------------- Tutorial 02 Two – Dimnnsional Viewing and Clipping (L07+L08+L09) Three – Dimnnsional Traformations(L10+L11+L12) Mathematics of Projection(L13+L14+L15) ----------------------------------------------------------------- Tutorial 03 Geometric Representation(L16+L17) Hidden Surfaces(L18+L19)) Color Model(L20) --------------------------------------------------------------- Mathematics for two dimensional Computer Graphics(L21) Image Representation(L22)

2.5 Sets

2 Sets

1.5 Sets

1 Set

Page 3: IT- 601: Computer Graphics Lecture-00

Course Policy• No late homework is acceptable.• Cheating directly affects the reputation of

Department and the University and lowers the morale of other students.

• Cheating in homework and exam will not be tolerated.

• An automatic grade of 0 will be assigned for any student caught cheating.

• Presenting another person’s work as your own constitutes cheating.

Page 4: IT- 601: Computer Graphics Lecture-00

Primary Focus

Develop thinking ability.

– problem solving skills. – formal thinking.

Page 5: IT- 601: Computer Graphics Lecture-00

Goals

Intro 5

• Be very familiar with a collection of Computer Graphics algorithms.

• Be intimately familiar with mathematics for Computer Graphics

• Be able to apply techniques in practical problems.

Page 6: IT- 601: Computer Graphics Lecture-00

Textbook & References

• Schaum’s ouTlines series, THEORY AND PROBLEM OF COMPUTER GRAPHICS ,Second Edition,McGraw Hill.

Page 7: IT- 601: Computer Graphics Lecture-00

How to Succeed in this Course• Start early on all assignments. DON'T

procrastinate.• Complete all reading before class.• Participate in class.• Think in class.• Review after each class.• Be formal and precise on all problem sets and

in-class exams.

Page 8: IT- 601: Computer Graphics Lecture-00

IT- 601: Computer GraphicsChapter 3

Scan ConversionLecture-01

Jesmin Akhter Lecturer,IIT

Jahangirnagar University, Savar, Dhaka,Bangladesh

04/20/23

Page 9: IT- 601: Computer Graphics Lecture-00

Scan Conversion

• Graphics System convert – each primitive(points ,lines, circles, ellipses etc.)

from its geometric definition into a set of pixels that make up the picture in the image space.

– This Conversion task is referred to as Scan Conversion.

Page 10: IT- 601: Computer Graphics Lecture-00

Scan Converting a point

• (x,y) where x and y are real numbers within an image area.

• Need to be scan converted at pixel location ),( yx

Page 11: IT- 601: Computer Graphics Lecture-00

Scan Converting a line• Line drawing is accomplished by calculating

intermediate positions along the line path between two specified end points.

• It is defined by the line equation y=mx+b, m is slope and b the y intercept of the line.

• Two end points are p1(x1,y1) and p2(x2,y2)• Line equation describes the coordinates of all

the points that lie between the two end points.

y=mx+b

p1(x1,y1)

p2(x2,y2)

x

y

b

Page 12: IT- 601: Computer Graphics Lecture-00

Direct use of the Line Equation

• Scan convert p1 and p2 to pixel coordinates

• then for every integer value of x between

and excluding calculate the corresponding value of y using the equation and scan convert (x,y).

• then for every integer value of x between and excluding calculate the corresponding value of x using the equation and scan convert (x,y).

.xyb and

)x-x)/(y-y(mset then )y,x( and )y,x(

11

12122211

m

2,1 xx and

,1|| mIf

,1|| mIf

2,1 yy and

Page 13: IT- 601: Computer Graphics Lecture-00

• The digital differential analyzer (DDA) is an incremental scan-conversion method.

• Characterized by Performing calculations at each step using results from the preceding step.

• At each step i calculate (xi,yi) point on the line.• Next point (xi+1,yi+1)•

haveWexxxandyyywheremxy iiii ,,/ 11

myxx

or

xmyy

ii

ii

/1

1

DDA Algorithm

Page 14: IT- 601: Computer Graphics Lecture-00

(xi, Round(yj))

(xi+1, yj+m) (xi, yj)

(xi+1, Round(yj+m))

Desired Line

x1 x2

y2

y1

DDA Algorithm

Page 15: IT- 601: Computer Graphics Lecture-00

DDA Algorithm• DDA (“Digital Differential Analyzer”)• Assume 0 m 1 .

1

)(

1

11

xmyy

xmy

Bxxm

Bmxy

ii

i

i

ii

(xi,yi)

(xi,Round(yi))

(xi,Round(yi+m))

(xi,yi +m)

Desired Line

void Line(int x0, int y0, int x1, int y1, int value) {double y = y0;double m = (y1 – y0) / (x1 – x0); // 0 <= m <= 1for (int x = x0; x <= x1; x++) {

WritePixel(x, Round(y), value);y += m;

}} Require to eliminate floating point operations & variables

Page 16: IT- 601: Computer Graphics Lecture-00

DDA ALGORITHM• DDA algorithm is faster than the direct use of the line equation since it

calculates points on the line without any floating point multiplication• Cumulative error occurs.