Www.rgpvonline.com



Computer Graphics & Multi-media (IT-602)

VI sem

Examination June 2014

UNIT-I

1. a) Explain computer graphics? Indicate four practical applications of computer graphics.

Ans. Computer graphics remains one of the most existing and rapidly growing computer fields. Computer graphics may be defined as a pictorial representation or graphical representation of objects in a computer.

Applications: Computers have become a powerful tool for the rapid and economical production of pictures. There is virtually no area in which graphical displays cannot be used to some advantage, and so it is not surprising to find the use of computer graphics so widespread. Computer graphics used routinely in such diverse areas as science, engineering, medicine, business, industry, government, art, entertainment, advertising, education, and training. Out of these four practical applications are given below:

1. Computer Aided Design : A major use of computer graphics is in design processes, particularly for engineering and architectural systems, but almost all products are now computer designed. Generally referred to as CAD, computer-aided design methods are now routinely used in the design of buildings, automobiles, aircraft, watercraft, spacecraft, computers, textiles, and many, many other products. For some design applications; object are first displayed in a wireframe outline form that shows the overall sham and internal features of objects. Wireframe displays also allow designers to quickly see the effects of interactive adjustments to design shapes.

2. Computer Art: Computer graphics methods are widely used in both fine art and commercial art applications. Artists use a variety of computer methods, including special purpose hardware, artist's paintbrush such as Lumens, other paint packages such as Pixelpaint and Superpaint, specially developed software, symbolic mathematics packages such as Mathematics ,CAD packages, desktop publishing software, and animation packages that provide facilities for designing object shapes and specifying object motions. The basic idea behind a paintbrush program that allows artists to "paint" pictures on the screen of a video monitor. Actually, the picture is usually painted electronically on a graphics tablet using a stylus, which can simulate different brush strokes, brush widths, and colors.

3. Entertainment: Computer graphics methods are now commonly used in making motion pictures, music videos, and television shows. Sometimes the graphics scenes are displayed by themselves, and sometimes graphics objects are combined with the actors and live scenes. Many TV series regularly employ computer graphics methods .Music videos use graphic in several ways. Graphics objects can be combined with the live action, or graphics and image processing techniques can be used to produce a transformation of one person or object into another i.e. morphing.

4. Education and Training: Computer-generated models of physical, financial, and economic systems are often used as educational aids. Models of physical systems, physiological systems, population trends, or equipment, such as the color coded diagram, can help trainees to understand the operation of the system. For some training applications, special systems are designed. Examples of such specialized systems are the simulators for practice sessions or training of ship captains, aircraft pilots, heavy-equipment operators, and air traffic control personnel. Some simulators have no video screens; for example, a flight simulator with only a control panel for instrument flying. But most simulators provide graphics screens for visual operation. The keyboard is used to input parameters affecting the airplane performance or the environment, and the pen plotter is used to chart the path of the aircraft during a training session.

1. b) Explain Rubber band techniques.

Ans. Rubber banding is a very simple, but useful technique for positioning. The user, if he wants to draw a line, say, specifies the end point sand as he moves from one point to another, the program displays the line being drawn. The effect is similar to an elastic line being stretched from one point to another and hence the name for the technique. By altering the end points, the position of the line can be modified. The technique can be extended to draw rectangles, arcs, circles etc. The technique is very useful when figures that pass through several intermediate points are to be drawn. In such cases, just by looking at the end points, it may not be possible to judge the course of the line. Hence, the positioning can be done dynamically , however, rubber band techniques normally demand fairly powerful local processing to ensure that lines are drawn fast enough.

2. Explain the working of raster and random scan displays and differentiate.

Ans. The most common type of graphics monitor employing a CRT is the raster-scan display, based on television technology. In a raster-scan system, the electron beam is swept across the screen, one row at a time from top to bottom. As the electron beam moves across each row, the beam intensity is turned on and off to create a pattern of illuminated spots. Picture definition is stored in a memory area called the refresh buffer or frame buffer. This memory area holds the set of intensity values for all the screen points. Stored intensity values are then retrieved from the refresh buffer and "painted" on the screen one row scan line at a time Fig. Each screen point is referred to as a pixel or pel shortened forms of picture element. The capability of a raster-scan system to store intensity information for each screen point makes it well suited for the realistic display of scenes containing subtle shading and color patterns. Home television sets and printers are examples of other systems using raster-scan methods. Intensity range for pixel positions depends on the capability of the raster system. In a simple black-and-white system, each screen point is either on or off, so only one bit per pixel is needed to control the intensity of screen positions. For a bi-level system, a bit value of 1 indicates that the electron beam is to be turned on at that position, and a value of 0 indicates that the beam intensity is to be off. Additional bits are needed when color and intensity variations can be displayed. Up to 24 bits per pixel are included in high-quality systems, which can require several megabytes of storage for the frame buffer, depending on the resolution of the system.. On a black-and-white system with one bit per pixel, the frame buffer is commonly called a bitmap. For systems with multiple bits per pixel, the frame buffer is after referred to as a pixmap.

Refreshing on raster-scan displays is carried out at the rate of 60 to 80 frames per second, although some systems are designed for higher refresh rates. Refresh rates are described in units of cycles per second, or Hertz, where a cycle corresponds to one frame. Using these units, we would describe a refresh rate of 60 frames per second as simply 60 Hz. At the end of each scan line, the electron beam returns to the left side of the screen to begin displaying the next scan line. The return to the left of the screen, after refreshing each frame displayed in 1/80th to 1/60th of a second, the electron beam returns vertical retrace to the top left comer of the screen to begin the next frame.

[pic]

Figure A raster-scan system displays an object as a set of discrete points across each scan line.

Random-Scan Displays

When operated as a random-scan display unit, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn. Randoms can monitors draw a picture one line at a time and for this reason are also referred to as vector displays or stroke-writing or calligraphic displays. The component lines of a picture can be drawn and refreshed by a random-scan system in any specified order shown in Fig . A pen plotter operates in a similar way and is an example of a random-scan, hard-copy device. Refresh rate on a random-scan system depends on the number of lines to be displayed. Picture definition is now stored as a set of line drawing commands in an area of memory referred to as the refresh display file. Sometimes the refresh display file is called the display list, display program, or simply the refresh buffer. To display a specified picture, the system cycles through the set of commands in the display file, drawing each component line in turn. After all line drawing commands have been processed, the system cycles back to the first line command in the list. Random-scan displays are designed to draw all the component lines of a picture 30 to 60 times each second. High quality vector systems are capable of handling approximately 100,000 "short" lines at this refresh rate.

When a small set of lines is to be displayed, each refresh cycle is delayed to avoid refresh rates greater than 60 frames per second. Otherwise, faster refreshing of the set of lines could burn out the phosphor. Random-scan systems are designed for line drawing applications and cannot display realistic shaded scenes. Since picture definition is stored as a set of line drawing instructions and not as a set of intensity values for all screen points, vector displays generally have higher resolution than raster systems. Also, vector displays produce smooth line drawings because the CRT beam directly follows the line path. A raster system, in contrast, produces jagged lines that are plotted as d h t e point sets.

[pic]

Figure. A random-scan system draws the component lines of an object in any order specified.

Difference between Raster and Random Scan Displays

|In this, the electron beam is swept across the |In this, the electron beam is directed only to the parts of |

|screen, one row at a time from top to bottom. |the screen where a picture is to be drown. |

|The pattern is created by illuminated spots |Here a picture is drawn one line at a time |

|Refreshing on Raster Scan display is carried out |Refresh cycle is displayed to aroid refresh rate greater than |

|at the rate of 60 to 80 frames per second. |60 frames per second for small set of lines. Refresh rate |

| |depends on number of lines to |

| |be displayed. |

|This display porous produces smooth line drawings |In this display it produces jagged lines that are potted as |

|as the CRT beam directly follows the line path. |discrete point sets. |

|This provides higher resolution. |This provides lower resolution. |

UNIT-II

3. Explain with an example the working of Bresenham’s midpoint circle drawing algorithm. Choose a circle and calculate pixels in the path of this circle in only first quadrant.

Ans. A circle with centre (xc, yc) and radius r can be represented in equation form in three ways

1. Analytical representation: r2 = (x – xc) 2 + (y – yc)2

2. Implicit representation : (x – xc) 2+ (y – yc) 2 – r2 = 0

3. Parametric representation: x = xc + r cosθ

y = yc +ysinθ

A circle is symmetrical in nature. Eight – way symmetry can be used by reflecting each point about each 45° axis. The points obtained in this case are given below with illustration by figure.

P1 = (x, y) P5 = (-x, -y)

P2 = (y, x) P6 = (-y, -x)

P3 = (-y, x) P7 = (y, -x)

P4 = (-x, y) P8 = (x, -y)

Figure. Eight way symmetry of a circle

Bresenham’s Circle

Bresenham’s method of drawing the circle is an efficient method because it avoids trigonometric and square root calculation by adopting only integer operation involving squares of the pixel separation distances.

The Bresenham’s method consider the eight – way symmetry of the circle.It plots 1/8th parts of the circle from 90° to 45°. As circle is drawn from 90° to 45°, the x moves in +ve direction and y moves in the –ve direction.

To achieve best approximation to the circle we have to select those pixels in the raster that falls the least distance from the true circle. Let us observe the 90° to 45° portion of the circle, each new point closest to the true circle can be found by applying either of the two options:

a) Increment in +ve x direction by one unit

b) to Increment in +ve x direction by one unit and –ve y direction both by one unit.

If Pn is a current point with coordinates(xn,yn) then the next point could be either A or B. We have to select A or B, depending on which is close to the circle, and for that we have to perform some test.

The closer pixel amongst these two can be determined as follows.The distances of pixels A and B from the origin (0,0) are given by

dA =[pic]

dA = [pic] and dB = [pic]

The distance of pixels A and B from the true circle whose radius r given as

δA = dA – r and δB = dB – r

Decision variable di as di = δA + δB

If di < 0 then only x is incremented.

Otherwise x is incremented in +ve x direction and y is incremented in –ve direction.

For di < 0

xi+1 = xi + 1 else xi+1 = xi + 1 yi+1 = yi – 1

The equation for di at the starting point i.e. x=0 and y=r is as follows:

di = δA + δB = 3 – 2r

Recompute the new decision value, by substituting new value of xi ,

di+1 = di + 4 xi +6 if di < 0

di+1 = di + 4 (xi - yi) +10 if di >= 0

Alogrithm

Let us define a procedure for Bresenham’s circle drawing algorithm for circle of radius r and centre (xc, yc). xc and yc denote the x-coordinate and y – coordinate of the center of the circle.

1. Set x = 0 and y = r

2. Set d = 3 – 2r

3. Repeat While (x < y)

4. Call Draw Circle(xc, yc, x, y)

5. Set x = x + 1

6. If (d < 0) Then

7. d = d + 4x + 6

8. Else

9. Set y = y – 1

10. d = d + 4(x – y) + 10

[End of If]

11. Call Draw Circle(xc, yc, x, y)

[End of While]

4.Explain the following terms: i) Parametric function ii) Bezier method iii) B spline method

Ans. i) Parametric function: A parametric curve that lies in a plane is defined by two functions, x(t) and y(t), which use the independent parameter t. x(t) and y(t) are coordinate functions, since their values represent the coordinates of points on the curve. As t varies, the coordinates (x(t),

y(t)) sweep out the curve. As an example consider the two functions:

x(t) = sin(t)

y(t) = cos(t)

As t varies from zero to 360, a circle is swept out by (x(t), y(t)).

[pic]

A spline curve is a mathematical representation for which it is easy to build an interface that will allow a user to design and control the shape of complex curves and surfaces. The general approach is that the user enters a sequence of points, and a curve is constructed whose shape closely follows this sequence. The points are called control points. A curve that actually passes

through each control point is called an interpolating curve; a curve that passes near to the control points but not necessarily through them is called an approximating curve.

[pic]

ii)Bezier curve

Bezier curve section can be fitted to any number of control points. The number of control points to be approximated and their relative position determine the degree of the Bezier polynomial. A

Bezier curve can be specified with boundary conditions, with blending function. Suppose we are given n+1 control point positions: Pk =(Xk,Yk,Zk) with k varing from 0 to n. these coordinate points can be blended to produce the following position vector P(u) , which describes the path of an approximating Bezier polynomial function between P0 and Pn.

P(u)= Σn k=0 Pk BEZk ,n(u) ……….. 0≤u≤1.

The Bernstein polynomials:

BEZk ,n(u) =C(n,k) uk (1-u)

C(n,k)= binomial coefficients.

C(n,k)=n!/ k! (n-k)!

BEZk ,n(u) = (1-u) BEZk ,n-1(u) +u BEZk-1 ,n-1(u) ……….. n› k≥ 1

X(u)= Σn k=0 Xk BEZk ,n(u)

Y(u)= Σn k=0 Yk BEZk ,n(u)

3 points : Generate a parabola

4 points : A cubic curve

3 collinear control points : Generate a straight line segment

Bezier curve use because

1. Easy to implement

2. Reasonably powerful in curve design.

3. Efficient methods for determining coordinate positions along a

Bezier curve can be set up using recursive calculations.

C(n,k)=((n-k+1)/k ) C (n,k-1) ………… n≥k

Properties:

1. Bezier curves are always passes through the first and last control points.

2. The slop at the beginning of the curve is along the line joining the first two control points and the slop at the end of the curve is along the line joining the last two end points.

3. It lies within the convex hull of the control points.

Cubic Bezier Curves.

It gives reasonable design flexibility while avoiding the increased calculations needed with higher order polynomials.

BEZ0 ,3(u) = (1-u)3

BEZ1,3(u) = 3u(1-u)2

BEZ2,3(u) = 3u2(1-u)

BEZ3,3(u) = u3

At u=0 and u=1 only non zero blending function is BEZ0,3 and BEZ3,3 respectively. Thus, the cubic curve will always pass through control points P0 and P3

The BEZ1,3 and BEZ2,3 influence the shape of the curve at intermediate values of parameter u, so that the resulting curve tends toward points p1 and p2. BEZ1,3 is max at u=1/3 BEZ2,3 is max at u=2/3.

Bezier curves do not allow for local control of the curve shape. If we reposition any one of the control points, the entire curve will be affected.

iii) B-splines: B-splines are not used very often in 2D graphics software but are used quite extensively in 3D modeling software. They have an advantage over Bezier curves in that they are smoother and easier to control. B-splines consist entirely of smooth curves, but sharp corners can be introduced by joining two spline curve segments. The continuous curve of a b-spline is defined by control points. The equation for k-order B-spline with n+1 control points (P0,P1,...Pn )is P(t)=∑i= 0,Ni,k(t) Pi ,tk-1 ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download