2-D Viewing-Computer Graphics-Lecture Slides, Slides of Computer Graphics

Graphics is a fascinating area in Computer Science. It has wide applications both in research and industry. This course will teach the fundamentals of Computer Graphics. It deals with science of image formation and rendering on a computer screen. This lecture includes: 2, D, Viewing, Graphics, Package, Translation, Rotation, Scaling, Transformation, Coordinates, Primitive, Composite, Placement

Typology: Slides

2011/2012

Uploaded on 08/09/2012

parnika
parnika 🇮🇳

4.6

(12)

60 documents

1 / 39

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COMPUTER GRAPHICS
2-D Viewing
What is involved in effective viewing of graphics?
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27

Partial preview of the text

Download 2-D Viewing-Computer Graphics-Lecture Slides and more Slides Computer Graphics in PDF only on Docsity!

COMPUTER

G^ RAPHICS

2-D ViewingWhat is involved in effective viewing of graphics?

Introduction ^ Graphics package allow a user to specify whichpart of a picture or output primitive is to bedisplayed^ ^

Cartesian coordinate values (World Coordinates) maybe used to specify the picture part to be displayed in2D referred to as picture area ^ Selected picture parts can then be mapped ontothe device coordinates ^ Transformation from World Coordinates toDevice Coordinates involve operations such astranslation, rotation and scaling ^ Parts not to be shown are deleted or clipped

Window to Viewport CoordinateTransformation ^ Normalized coordinates are used to select theviewport limits once the window extents aredefined ^ Relative placement of objects with respect to thewindow is maintained

Window to Viewport

Hence, scaling operation is involved.First scaling is done and then translation is appliedRelative proportions are maintained if sx=sy

2D R

ENDERING

PIPELINE

7

3D PrimitivesClipping Viewport Transformation

Scan Conversion

Image

Clip portions of geometric primitivesresiding outside windowTransform the clipped primitivesfrom screen to image coordinatesFill pixel representing primitivesin screen coordinates

2D Primitives

Viewing Pipeline ^ World coordinate area selected for display is referred to asa Window^ ^

Window defines what is to be viewed ^ The area on the display device where the window ismapped is referred to as the viewport^ ^

Viewport defines where it is to be displayed ^ Viewports and windows are generally rectangles^ ^

Polygon shapes and circles may also be used but they takelonger to be processed ^ Mapping from the world co-ordinate scene to devicecoordinates is referred to as viewing transformation ^ Term window here is not to be confused with the Windowin your OS; they do not mean the same thing ^ Window rectangles may have any orientation

CLIPPING ^ Avoid Drawing Parts of Primitives OutsideWindow^ ^

Window defines part of scene being viewed  Must draw geometric primitives only inside window

CLIPPING ^ Avoid Drawing Parts of Primitives OutsideWindow^ ^

Points  Lines  Polygons  Circles  etc.

POINT

CLIPPING

^ Is Point(x,y) Inside the Clip Window?

13

(x, y)

wx

wy2^ wy1wx

Inside =

(x>=wx1) &&(x<=wx2) &&(y>=wy1) &&(y<=wy2);

LINE

C^ LIPPING

^ Find the Part of a Line Inside the Clip Window

14

P^7

P^8 P

10

P^9

P^1

P^2

P^5

P^4

P^3

P^6

Before Clipping

LINE CLIPPING ^ Line clipping operation involves the following^ ^

Test whether the line is within the window  If its not, determine if its entirely outside the window  If its not either of the above, determine intersectionpoints with the clipping boundaries ^ The inside outside tests are carried out bychecking the endpoints^ ^

A line with both endpoints within the clippingboundary is completely inside  A line with both endpoints out is completely outside  Otherwise its partly in and partly out

COHEN

-SUTHERLAND

LINE

CLIPPING

^ Use Simple Tests to Classify Easy Cases First

17

P^7

P^8 P

10

P^9

P^1

P^2

P^5

P^4

P^3

P^6

CLIPPING ^ For lines which are not completely inside oroutside, intersection points must be found ^ Slope intercept form of the line equation is usedto compute the intersection pointy=y1+m(x-x1)^ ^

x is set to either xw

or xwmin

for verticalmax

boundariesx=x1+(y-y1)/m  y is set to either yw

or ywmin

for horizontalmax

boundaries

COHEN

-SUTHERLAND

LINE

CLIPPING

^ Classify Some Lines Quickly by AND of Bit CodesRepresenting Regions of Two Endpoints (Must Be0)

20 P^10

P^5

P^6

P^9

P^7

0101 P^801000110

1001 P 1 1000 P^21010

P^4

P^3

Bit 4 Bit 3

Bit 2

Bit 1