Docsity

Computer Graphics: Transformations, Polygon Surfaces, and Visible Surface Detection, Study Guides, Projects, Research of Computer Graphics

Toggle sidebar
bg1
COMPLETE R17A0517 COMPUTER GREPHICS FINAL STUDY GUIDE
L
T/P/D C
3 -/-/- 3
Objectives:
CORE ELECTIVE – I
(R17A0517) Computer Graphics
To make students understand about fundamentals of Graphics to enable them to design
animated scenes for virtual object creations.
To make the student present the content graphically.
UNIT-I:
Introduction: Application areas of Computer Graphics, overview of graphics systems, video-
display devices, raster-scan systems, random scan systems, graphics monitors and work
stations and input devices
Output primitives: Points and lines, line drawing algorithms, mid-point circle and ellipse
algorithms.Filled area primitives: Scan line polygon fill algorithm, boundary-fill and flood-fill
algorithms
UNIT-II:
2-D geometrical transforms: Translation, scaling, rotation, reflection and shear
transformations, matrix representations and homogeneous coordinates, composite transforms,
transformations between coordinate systems
2-D viewing : The viewing pipeline, viewing coordinate reference frame, window to view-port
coordinate transformation, viewing functions, Cohen-Sutherland and Cyrus-beck line clipping
algorithms, Sutherland –Hodgeman polygon clipping algorithm
UNIT-III:
3-D object representation : Polygon surfaces, quadric surfaces, spline representation, Hermite
curve, Bezier curve and B-Spline curves, Bezier and B-Spline surfaces. Basic illumination models,
polygon rendering methods.
3-D Geometric transformations: Translation, rotation, scaling, reflection and shear
transformations, composite transformations.3-D viewing : Viewing pipeline, viewing
coordinates, view volume and general projection transforms and clipping.
UNIT-IV:
Visible surface detection methods: Classification, back-face detection, depth-buffer, scan-line,
depth sorting, BSP-tree methods, area sub-division and octree methods
UNIT-V:
Computer animation: Design of animation sequence, general computer animation functions,
raster animation, computer animation languages, key frame systems, motion specifications
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
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48

Partial preview of the text

Download Computer Graphics: Transformations, Polygon Surfaces, and Visible Surface Detection and more Study Guides, Projects, Research Computer Graphics in PDF only on Docsity!

COMPLETE R17A0517 COMPUTER GREPHICS FINAL STUDY GUIDE

L T/P/D C

3 -/-/- 3

Objectives:

CORE ELECTIVE – I

(R17A0517) Computer Graphics

 To make students understand about fundamentals of Graphics to enable them to design

animated scenes for virtual object creations.

 To make the student present the content graphically.

UNIT-I:

Introduction: Application areas of Computer Graphics, overview of graphics systems, video-

display devices, raster-scan systems, random scan systems, graphics monitors and work

stations and input devices

Output primitives : Points and lines, line drawing algorithms, mid-point circle and ellipse

algorithms.Filled area primitives: Scan line polygon fill algorithm, boundary-fill and flood-fill

algorithms

UNIT-II:

2-D geometrical transforms : Translation, scaling, rotation, reflection and shear

transformations, matrix representations and homogeneous coordinates, composite transforms,

transformations between coordinate systems

2-D viewing : The viewing pipeline, viewing coordinate reference frame, window to view-port

coordinate transformation, viewing functions, Cohen-Sutherland and Cyrus-beck line clipping

algorithms, Sutherland –Hodgeman polygon clipping algorithm

UNIT-III:

3-D object representation : Polygon surfaces, quadric surfaces, spline representation, Hermite

curve, Bezier curve and B-Spline curves, Bezier and B-Spline surfaces. Basic illumination models,

polygon rendering methods.

3-D Geometric transformations : Translation, rotation, scaling, reflection and shear

transformations, composite transformations.3-D viewing : Viewing pipeline, viewing

coordinates, view volume and general projection transforms and clipping.

UNIT-IV:

Visible surface detection methods : Classification, back-face detection, depth-buffer, scan-line,

depth sorting, BSP-tree methods, area sub-division and octree methods

UNIT-V:

Computer animation : Design of animation sequence, general computer animation functions,

raster animation, computer animation languages, key frame systems, motion specifications

TEXT BOOKS:

  1. “Computer Graphics C version ”, Donald Hearn and M.Pauline Baker, Pearson Education
  2. “Computer Graphics Principles & practice”, second edition in C, Foley, VanDam, Feiner

and Hughes, Pearson Education.

REFERENCES:

  1. Computer Graphics”, second Edition, Donald Hearn and M.Pauline Baker, PHI/Pearson

Education.

  1. Computer Graphics Second edition”, Zhigand xiang, Roy Plastock, Schaum’s outlines,

Tata Mc-Graw hill edition.

  1. rocedural elements for Computer Graphics, David F Rogers, Tata Mc Graw hill, 2

nd

edition.

  1. Principles of Interactive Computer Graphics”, Neuman and Sproul, TMH.
  2. Principles of Computer Graphics, Shalini Govil, Pai, 2005, Springer.
  3. Computer Graphics, Steven Harrington, TMH

Outcomes:

 Students can animate scenes entertainment.

 Will be able to work in computer aided design for content presentation..

 Better analogy data with pictorial representation.

UNIT- 1

Overview of Computer Graphics

Application of Computer Graphics

Computer-Aided Design for engineering and architectural systems etc.

Objects maybe displayed in a wireframe outline form. Multi-window environment is also

favored for producing various zooming scales and views.

Animations are useful for testing performance.

Presentation Graphics

To produce illustrations which summarize various kinds of data. Except 2D, 3D graphics are good tools for reporting more complex data.

Computer Art

Painting packages are available. With cordless, pressure-sensitive stylus, artists can

produce electronic paintings which simulate different brush strokes, brush widths, and colors. Photorealistic techniques, morphing and animations are very useful in commercial

art. For films, 24 frames per second are required. For video monitor, 30 frames per

second are required.

Entertainment

Motion pictures, Music videos, and TV shows, Computer games

Education and Training

Training with computer-generated models of specialized systems such as the training of

ship captains and aircraft pilots.

Visualization

For analyzing scientific, engineering, medical and business data or behavior. Converting data to visual form can help to understand mass volume of data very efficiently.

Image Processing

Image processing is to apply techniques to modify or interpret existing pictures. It is

widely used in medical applications.

Graphical User Interface

Multiple window, icons, menus allow a computer setup to be utilized more efficiently.

Video Display devices

Cathode-Ray Tubes (CRT) - still the most common video display device presently

Electrostatic deflection of the electron beam in a CRT

An electron gun emits a beam of electrons, which passes through focusing and deflection

systems and hits on the phosphor-coated screen. The number of points displayed on a CRT is

referred to as r esolutions (eg. 1024x768). Different phosphors emit small light spots of

different colors, which can combine to form a range of colors. A common methodology for

color CRT display is the Shadow-mask meth

Illustration of a shadow-mask CRT

The light emitted by phosphor fades very rapidly, so it needs to redraw the picture repeatedly.

There are 2 kinds of redrawing mechanisms: Raster-Scan and Random-Scan

Raster-Scan

The electron beam is swept across the screen one row at a time from top to bottom. As it

moves across each row, the beam intensity is turned on and off to create a pattern of

illuminated spots. This scanning process is called refreshing. Each complete scanning of a

screen is normally called a frame.

The refreshing rate, called the frame rate , is normally 60 to 80 frames per second, or

described as 60 Hz to 80 Hz.

Picture definition is stored in a memory area called the frame buffer. This frame buffer

stores the intensity values for all the screen points. Each screen point is called a pixel (picture

element).

On black and white systems, the frame buffer storing the values of the pixels is called a

bitmap. Each entry in the bitmap is a 1-bit data which determine the on (1) and off (0) of the

intensity of the pixel.

On color systems, the frame buffer storing the values of the pixels is called a pixmap

(Though nowadays many graphics libraries name it as bitmap too). Each entry in the pixmap

Bresenham's Line Algorithm 4

The basic concept is:

  • A line can be specified in the form:

y = mx + c

  • Let m be between 0 to 1, then the slope of the line is between 0 and 45 degrees.
  • For the x-coordinate of the left end point of the line, compute the corresponding y value

according to the line equation. Thus we get the left end point as (x1,y1), where y1 may

not be an integer.

  • Calculate the distance of (x1,y1) from the center of the pixel immediately above it and call

it D

  • Calculate the distance of (x1,y1) from the center of the pixel immediately below it and call

it D

  • If D1 is smaller than D2, it means that the line is closer to the upper pixel than the

lower pixel, then, we set the upper pixel to on; otherwise we set the lower pixel to on.

  • Then increatement x by 1 and repeat the same process until x reaches the right end

point of the line.

  • This method assumes the width of the line to be zero

In computer graphics, a hardware or software implementation of a digital differential analyzer

(DDA) is used for linear interpolation of variables over an interval between start and end point.

DDAs are used for rasterization of lines, triangles and polygons. In its simplest implementation

the DDA Line drawing algorithm interpolates values in interval [(xstart, ystart), (xend, yend)] by

computing for each xi the equations xi = xi−1+1/m, yi = yi−1 + m, where Δx = xend − xstart and

Δy = yend − ystart and m = Δy/Δx.

The dda is a scan conversion line algorithm based on calculating either dy or dx. A line is

sampled at unit intervals in one coordinate and corresponding integer values nearest the line path

are determined for other coordinates.

Considering a line with positive slope, if the slope is less than or equal to 1, we sample at unit x

intervals (dx=1) and compute successive y values as

Subscript k takes integer values starting from 0, for the 1st point and increases by until endpoint

is reached. y value is rounded off to nearest integer to correspond to a screen pixel.

For lines with slope greater than 1, we reverse the role of x and y i.e. we sample at dy=1 and

calculate consecutive x values as

Similar calculations are carried out to determine pixel positions along a line with negative slope.

Thus, if the absolute value of the slope is less than 1, we set dx=1 if i.e. the starting extreme

point is at the left.

This algorithm is very efficient since it use only incremental integer calculations. Instead of

calculating the non-integral values of D1 and D2 for decision of pixel location, it computes a

value, p, which is defined as:

p = (D2-D1)* horizontal length of the line

if p>0, it means D1 is smaller than D2, and we can determine the pixel location accordingly

However, the computation of p is very easy:

The initial value of p is 2 * vertical height of the line - horizontal length of the line.

At succeeding x locations, if p has been smaller than 0, then, we increment p by 2 * vertical

height of the line, otherwise we increment p by 2 * (vertical height of the line - horizontal

length of the line)

All the computations are on integers. The incremental method is applied to

void BresenhamLine(int x1, int y1, int x2, int y2)

{ int x, y, p, const1, const2; /* initialize

variables / p=2(y2-y1)-(x2-x1); const1=2(y2-y1); const2=2((y2-

y1)-(x2-x1));

x=x1;

y=y1;

SetPixel(x,y);

while (x<xend) { x+

+;

if (p<0)

{ p=p+const1;

}

else { y++;

p=p+const2;

}

SetPixel(x,y);

}

}

Bitmap

  • A graphics pattern such as an icon or a character may be needed frequently, or may

need to be re-used.

  • Generating the pattern every time when needed may waste a lot of processing time.
  • A bitmap can be used to store a pattern and duplicate it to many places on the image

or on the screen with simple copying operations.

circ

We would like to choose

the point that is nearest to

the actual circle

So how do we make this choice?

Let’s re-jig the equation of the circle slightly to give us:

The equation evaluates as follows:

f ( x , y ) x

2

y^2 r^2

fcirc ( x , y ) 0,

0,

<0 if ( x , y ) is outside thecircleboundary

=

if

if

( x , y ) is on thecircleboundary

( x , y ) is inside thecircleboundary

By evaluating this function at the midpoint between the candidate pixels we can make our

decision

Assuming we have just plotted the pixel at ( xk,yk ) so we need to choose between ( xk+ 1 ,yk ) and

( xk+ 1 ,yk- 1)

Our decision variable can be defined as:

pk fcirc ( xk 1, yk^1 )

( xk

y^1 2

k

2 r

2

If pk < 0 the midpoint is inside the circle and and the pixel at yk is closer to the circle

Otherwise the midpoint is outside and yk- 1 is closer

coordinate values:

x x xc y y yc

Repeat steps 3 to 5 until x >= y

To see the mid-point circle algorithm in action lets use it to draw a circle centred at (0,0) with

radius 10.

Scan-Line Polygon Fill Algorithm

  • Basic idea: For each scan line crossing a polygon, this algorithm locates the intersection

points of the scan line with the polygon edges. These intersection points are shorted from

left to right. Then, we fill the pixels between each intersection pair.

  • Some scan-line intersection at polygon vertices require special handling. A scan line

passing through a vertex as intersecting the polygon twice. In this case we may or may

not add 2 points to the list of intersections, instead of adding 1 points. This decision

depends on whether the 2 edges at both sides of the vertex are both above, both below, or

one is above and one is below the scan line. Only for the case if both are above or both

are below the scan line, then we will add 2 points.

Inside-Outside Tests:

  • The above algorithm only works for standard polygon shapes. However, for the cases

which the edge of the polygon intersects, we need to identify whether a point is an interior

or exterior point. Students may find interesting descriptions of 2 methods to solve this problem in many text books: odd-even rule and nonzero winding number rule.

Flood-Fill Algorithm

  • Flood-Fill is similar to Boundary-Fill. The difference is that Flood-Fill is to fill an area

which I not defined by a single boundary color.

void BoundaryFill(int x, int y, COLOR fill, COLOR old_color)

{ if (GetPixel(x,y)== old_color) {

SetPixel(x,y,fill);

BoundaryFill(x+1,y,fill,boundary);

BoundaryFill(x-1,y,fill,boundary);

BoundaryFill(x,y+1,fill,boundary);

BoundaryFill(x,y-1,fill,boundary); }

Part –I, UNIT - 2

Two Dimensional Transformations

In many applications, changes in orientations, size, and shape are accomplished with

geometric transformations that alter the coordinate descriptions of objects.

Basic geometric transformations are:

Translation

Rotation Scaling

Other transformations:

Reflection Shear

3.1 Basic Transformations

Translation

We translate a 2D point by adding translation distances, tx and ty, to the original coordinate

position (x,y):

x' = x + tx, y' = y + ty

Alternatively, translation can also be specified by the following transformation matrix:

1 0 t (^) x 0 1 t

Then we can rewrite the formula as:

0 01

1 0 t x

y' = 0 1 t (^) y

1 0 01 1

For example, to translate a triangle with vertices at original coordinates (10,20), (10,10),

(20,10) by tx=5, ty=10, we compute as followings:

Translation of vertex (10,20):

x' 1 0 5 10 1*10 0 * 20 5 *1 15 y' (^) = 0 1 10 20 = 0 10 1 20 10 *1 = (^30)

Translation of

vertex (10,10):

1 0

x' (^1)

x' x

y

y

0 1 1 0 *10^0 ^20 11^1

0 5 10 1*10 0 *10 5 *1 15

The resultant coordinates of the triangle vertices are (15,30), (15,20), and (25,20)

respectively. Exercise: translate a triangle with vertices at original coordinates (10,25), (5,10),

by tx=15, ty=5. Roughly plot the original and resultant triangles.

3.1.2 Rotation About the Origin

To rotate an object about the origin (0,0), we specify the rotation angle ?. Positive and

negative values for the rotation angle define counterclockwise and clockwise rotations

respectively. The followings is the computation of this rotation for a point:

x' = x cos? - y sin? y' = x sin? + y cos?

Alternatively, this rotation can also be specified by the following transformation matrix:

cos sin 0

0 sin (^) cos

0 0 1

Then we can rewrite the formula as:

x' cos sin 0 y' = sin cos^0

1 0 0 1 1

For example, to rotate a triange about the origin with vertices at original coordinates (10,20),

(10,10), (20,10) by 30 degrees, we compute as followings:

cos sin 0 cos 30 sin 30 0 0.866 0.5 0

sin cos 0 = sin 30 cos 30 0 = 0.5 0.866 0

0 0 1 0 0 1 0 0 1

Rotation of vertex (10,20):

x' 0.866 0.5 0 10 0.866 *10 ( 0.5) * 20 0 *1 1. y' =^ 0.5^ 0.866^0 20 =^ 0.5^ *10^ 0.866^ *^20 0 *1^ =^ 22.

1 0 0 1 1 0 10 0 * 20 11 1

x y

Translation of vertex (20,10):

x' 1 0 5 20 1*^20 0 *10^5 *1^25

y' = 0 1 10 10 =^ 0 ^20 110^10 *1^ = 20

1 0 0 1 1 0 *^20 0 10^ 11^1

2