Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
93 views21 pages

CG Unit 1

Computer graphics is concerned with digitally synthesizing and manipulating visual content. An image is a representation of a real-world object on a computer and can be an actual picture, stored video memory, or code generated by a program. Objects are 3D descriptions defined by coordinates, while images are represented as a collection of pixels. Raster scan displays draw images by scanning one row of pixels at a time from top to bottom, storing the image in a frame buffer memory to control intensity and create the picture, while random scan displays directly draw to parts of the screen.

Uploaded by

mahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views21 pages

CG Unit 1

Computer graphics is concerned with digitally synthesizing and manipulating visual content. An image is a representation of a real-world object on a computer and can be an actual picture, stored video memory, or code generated by a program. Objects are 3D descriptions defined by coordinates, while images are represented as a collection of pixels. Raster scan displays draw images by scanning one row of pixels at a time from top to bottom, storing the image in a frame buffer memory to control intensity and create the picture, while random scan displays directly draw to parts of the screen.

Uploaded by

mahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

UNIT 1

TWO MARKS QUESTIONS :


1.WHAT IS COMPUTER GRAPHICS?

Ans: Computer graphics is an art of drawing pictures ,lines, charts etc. using computers with the help of
programming. Computer graphics image is made up of number of pixels. Computer graphics is a field of
computer science that is concerned with digitally synthesizing and manipulating visual contents.

2.DEFINE IMAGE AND OBJECT.

Ans: An image is basically representation of a real-world object on a computer. It can be an actual


picture display, a stored page in a video memory, or a source code generated by program.

Objects are real world entities defined in three-dimensional world coordinates. In computer graphics
we deal with both 2D and 3D descriptions of an object.

3.WRITE ANY 2 APPLICATIONS OF COMPUTER GRAPHICS.

Ans: (i)Computer Art/Digital Art

(ii)Presentation Graphics

(iii)Education

(iv)Training

4.DEFINE PIXEL, RASTERIZATION, SCAN CONVERSION.

Ans: Pixel is the smallest addressable graphical unit represented on the computer screen.

The special procedure determines which pixel will provide the best approximation to the desired picture
or graphics object this process is called Rasterization.

The process of representing continuous picture or graphics object as a collection of discrete pixels is
called as Scan Conversion

5.WRITE ANY TWO DIFFERENCE BETWEEN RANDOM SCAN AND RASTER SCAN DISPLAY.

RASTER SCAN DISPLAY RANDOM SCAN DISPLAY


It draws the image by scanning one row at a time. It draws the image by directing the electron
beam directly to the part of the screen ,where
the images is to be drawn.
They generally have resolution limited to pixel They have higher resolution than the raster scan
size. display.
Lines are jiggered and curves are less smooth Lines plots are straight and curves are smooth
6.DEFINE SCAN LINE.

Ans: Scanline is one line,or row,in a raster scanning pattern,such as a line of video on a cathode ray
tube(CRT) display of a television set or computer monitor.
7.WHAT IS DIGITAL ART?

Ans:Using computer graphics we can create fine and commercial art which include animation
packages, paint packages. Cartoon drawing, paintings, logo design can also be done.
8.WRITE ANY TWO DIFFERENCE BETWEEN RASTER AND VECTOR BASED GRAPHICS?
Ans:
RASTER BASED GRAPHICS VECTOR BASED GRAPHICS
Bitmap images/raster are usually created and Vector based images are usually created and
edited in photo or paint programs such as edited in software like CoralDRAW and
Adobe Photoshop Adobe Illustrator.

Bitmap images are mapped to a grid or an These images have smooth edges and create
array of pixels. curves or shapes.

9.WHAT ARE TWO CATEGORIES OF FLAT PANEL DISPLAY?

Ans:Volatile displays and static displays.


10.DRAW FOUR CONNECTED AND EIGHT CONNECTED REGION.

11. Mention any two drawbacks of Cathode Ray Tubes.

Ans: 1) Big back and take up space on a desk

2)Not suitable for very brightly environment and also produce a lot of heat.

3) They are large, heavy and bulky.

4) consume a lot of electricity and produce a lot of heat.

12. Define horizontal and vertical retrace.

Ans: The return to the left of the screen, after refreshing each scan line, is called the horizontal retrace
of the electron beam. And at the end of each frame (displayed in 1/80th to 1/60th of a second), the
electron beam returns to the top left comer of the screen to begin the next frame is called vertical
retrace.

13. List the different types of LCD display technologies.


Ans: 1)Twisted nematic.
2)In-plane switching
3) Multi-domain vertical alignment
4)Patterned vertical alignment

14. What is twisted nematic?


Ans: A twisted nematic display is a common type of liquid-crystal display(LCD) that consists of a
substance of a substance calles nematic liquid crystal that is confined between two plates of polarized
glass.

15. What is a coordinate system?


Ans: A coordinate system is a framework used to define the positions of points on space in either two or
three dimensions. It is a way to determine the position of a point by a set of numbers that can be
distances from a set of reference planes, angles subtended with an origin, or a combination of both.

16. Why initgraph() is used? Write its syntax.


Ans: The initgraph() function initializes the graphics mode and clears the screen.
Declaration:
Void far initgraph(int far *graphdriver, int far *graphmode, char far *pathtodriver);

Graphdriver is an integer that specifies the graphics driver to be used and graphmode is an integer
that specifies the initial that specifies the initial graphics mode.

17. What is the purpose of using closegraph()?


Ans: a) Closegraph() function closes the graphic mode.
b) deallocates all memory allocated by graphic system.

18. Write the ‘C’ graphics function used to draw (any one)
a) Circle b) rectangle c) ellipse d) polygon

a) Circle:

circle(x,y,radius)

b) rectangle:

rectangle(int left, int top, int right, int bottom)

c) ellipse:

ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius)
d) polygon:

polygon(

FIVE MARKS QUESTIONs


1. DEFINE IMAGE.EXPLAIN THE REPRESENTATION AND STORAGE OF A DIGITAL
IMAGE.

Ans: An image is basically representation of a real-world object on a computer. It can be an actual


picture display, a stored page in a video memory, or a source code generated by program.

Image Representation
Representations of shapes and images may be approximations of the real world or synthetic
constructs that exist only in the computer. Pictures are represented as a collection of discrete
picture element called pixels. It is the smallest addressable screen element. The process of
determining the appropriate pixels for representing pictures or objects is called rasterization.
The process of representing continuous pictures as graphical object(as a collection of discrete
pixel) is called scan conversion.
Rasterization is the task of taking an image described in a vector graphics format (shapes) and
converting it into a raster image (pixels or dots) for output on a video display or printer, or for
storage in a bitmap file format. Digital image is a 2D discrete signal
It is represented as follows:
F(x,y)= f(0,0) f(0,1)---------f(0,n-1)
f(0,0) f(1,1)---------f(0,n-1)
: :
: :
f(M-1,0) f(M-1,1)-------f(M-1,N-1)

2.EXPLAIN RASTER AND VECTOR BASED GRAPHICS.

Ans: Raster and Vector-Based Graphics


There are two kinds of computer graphics: raster and vector. A raster graphic (also called
“bitmap") is basically a large grid, filled with boxes called pixels. When you stand far enough
away from the grid, the individual grid squares blend together and you see a complete photographic
image. Each pixel is assigned a specific color value and location. When editing a raster graphics
(digital photo), you are actually editing pixels rather than objects or shapes (photoshop). Pixels
can be seen by zooming in on a digital image. Raster graphics are generally larger files than vector
image. Images lose quality if enlarged more than 20% of the original size. In bitmap images, each
pixel has an assigned color. The information stored in a bitmap image regarding pixel location and
color forms the image. Bitmap images are edited at the pixel level that slows the color of any
onepixel to change. For raster systems, image manipulation is simply a matter of addressing
memory, together with an image independent method of display and large number of raster
operations.
Additional attributes of bitmap images include:
✓ Bitmap images ae usually created and edited in photo or paint programs such as Adobe
Photoshop.
✓ Bitmap images are mapped to a grid or an array of pixels.
✓ The size of an image is based on the image’s resolution
✓ Bitmap images are not easily scalable.
Bitmap images are used for photorealistic images and may involve complex color variations
A vector drawing system stores a graphic object as a set of primitives; therefore, all vector
graphics are defined by math. All lines, shapes etc., of a vector-based image are independent of
one another. They are points connected by lines of various shapes. More points and more lines
can make more complex shapes.
Additional attributes of vector-based images include:
✓ Vector based images are usually created and edited in software like CoralDRAW and
Adobe Illustrator.
✓ These images have smooth edges and create curves or shapes.
✓ Vector based images are good for precise illustrations, but are not as good as bitmaps for
photorealistic images.
✓ Vector base images are easily scalable due to their use of mathematics formulas.
3.EXPLAIN RASTER SCAN DISPLAY.

Ans:Raster-Scan Displays: The most common type of CRT is the raster-scan display. 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. Each screen point is referred to as a pixel or pel (shortened forms of picture
element). For a 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. Fora 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 colour and intensity variations can
be displayed. On a black-and-white system with one bit per pixel, the frame buffer is commonly
called a bitmap.
Refreshing on raster-scan displays is carried out at the rate of 60 to 80frames per second.
Sometimes, refresh rates are described in units of cycles per second, or Hertz (Hz), 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 scan line, is called the horizontal retrace of the electron beam. And at the end of each frame
(displayed in 1/80th to 1/60th of a second), the electron beam returns to the top left comer of the
screen to begin the next frame is called vertical retrace.

Types of scanning or travelling of beam in Raster scan:


1. Interlaced scanning
2. Non interlaced scanning
Interlaced scanning: Here, each horizontal line of the screen is traced from top to bottom, due to
which fading of display of object may occur. This problem can be solved by non-interlaced
scanning.
Non- Interlaced scanning: Non-interlaced display refresh rate of 30 frames per second used. But it
gives flickers. For interlaced display refresh rate of 60 frames per second is used.
Advantages:
a. Realistic image
b. Million different colors to be generated
c. Shadow scenes are possible
Disadvantages:
a. Low resolution
b. Expensive
4.WRITE NOTE ON RANDOM SCAN DISPLAY.
Ans:Random Scan Display: In random-scan display unit, the electron beam in a CRT is directed only
to the parts of the screen where a picture is to be drawn. Random scan monitors draw a picture one
line at a time and for this reason are also referred to as vector displays. The component lines of a
picture can be drawn and refreshed by a random-scan system in any specified order. 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 refresh display file
or display list. 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. 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.

Random-scan systems are designed for line-drawing applications and cannot display realistic
shaded scenes. Since picture definition is stored as a set off-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 discrete
points.
5.DIFFERENCE BETWEEN RANDOM AND RASTER SCAN DISPLAY.
Ans:Difference between raster scan display and random scan display
Raster scan display Random scan display
It draws the image by scanning one row at a It draws the image by directing the electron
time. beam directly to the part of the screen, where
the image is to be drawn.
They generally have resolution limited to pixel They have higher resolution than the raster
size. scan system.
Lines are jiggered and curves are less smooth. Line plots are straight and curves are smooth.
They are more suited to geometric area They are more suited to line drawing
drawing applications, eg. Monitors, T.V application. Eg. CRO, pen plotter
Cost of raster are lesser than random scan It is costlier than raster scan display
display
Resolution is lesser or lower than random scan Resolution is higher than raster .
display

6.LIST AND EXPLAIN THE APPLICATIONS OF COMPUTER GRAPHICS.


Ans:Application of computer graphics

➢ Computer Art/Digital Art: Using computer graphics we can create fine and commercial
art which include animation packages, paint packages. Cartoon drawing, paintings, logo
design can also be done.
➢ Computer Aided Drawing: Designing of buildings, automobile, aircraft is done with the
help of computer aided drawing, this helps in providing minute details to the drawing and
producing more accurate and sharp drawings with better specifications.
➢ Presentation Graphics: For the preparation of reports or summarizing the financial,
statistical, mathematical, scientific, economic data for research reports, managerial reports,
moreover creation of bar graphs, pie charts, time chart, can be done using the tools present
in computer graphics.
➢ Entertainment/special effects: Computer graphics finds a major part of its utility in the
movie industry and game industry. Used for creating motion pictures, music video,
television shows, cartoon animation films. In the game industry where focus and
interactivity are the key players, computer graphics helps in providing such features in the
efficient way.
➢ Education: Computer generated models are extremely useful for teaching huge number of
concepts and fundamentals in an easy to understand and learn manner.
➢ Training: Specialized system for training like simulators can be used for training the
candidates in a way that can be grasped in a short span of time with better understanding.
Creation of training modules using computer graphics is simple and very useful.
➢ Video Games: It finds a good place in the gaming and animation industry.
➢ Medical Imaging: It can be used to train new doctors on understanding and experimenting
surgery. It is used in molecular biology to study the biological model in genes.
7.WRITE A NOTE ON FLAT PANEL DISPLAY.
Ans: Flat Panel Displays
The flat panel display technology is becoming increasingly common in a wide variety of consumer
devices that include cellular phones, digital cameras, liquid crystal display (LCD), televisions,
computer displays and personal digital assistants (PDAs). These FDPs are lighter and much thinner
than traditional television and video displays that use a CRT. The FDP can be divided into two
categories: volatile displays and static displays.
• Volatile displays
Volatile displays require constant power output to refresh the image on screen many times
a second. Examples of volatile flat panel displays include plasma displays, liquid crystal
displays (LCDs), light emitting diode displays and organic light emitting diode displays
(OLEDs).

A Plasma Panel Display is a type of flat panel display common to large tv displays 30
inches (76cm) or large. They are called “plasma” displays because they use small cells
containing electrically charged ionized gases which are plasmas. Plasma screens are made
out of glass. This may cause glare from reflected objects in the viewing area. Plasma has
superior uniformity than LCD but plasma panels consume very high electric power
compared to LCD and LED usually around 400 – 500 watts.

Plasma panels salso called gas-discharge displays, are constructed by filling the region
between two glass plates with a mixture of gases such as neon. A series of vertical
conducting ribbons is placed on one glass panel and a set of horizontal ribbons is built into
the other glass panel. Firing voltages applied to a pair of horizontal and vertical conductors
cause the gas at the intersection of the two conductors to break down into glowing plasma
of electrons and ions. Picture definition is stored in a refresh buffer, and the firing voltages
are applied to refresh the pixel positions (at the intersections of the conductors)60 times
per second. One disadvantage of plasma panels has been that they were strictly
monochromatic devices, but systems have been developed that are now capable of
displaying colour and grayscale.

Thin-film electroluminescent displays are similar in construction to a plasma panel. The


difference is that the region between the glass plates is filled with a phosphor, such as zinc
sulphide doped with manganese, instead of a gas. When a sufficiently high voltage is
applied to a pair of crossing electrodes, the phosphor becomes a conductor in the area of
the intersection of the two electrodes. Electrical energy is then absorbed by the manganese
atoms, which then release the energy as a spot of light similar to the glowing plasma effect
in a plasma panel. Electroluminescent displays require more power than plasma panels,
and good colour and grey scale displays are hard to achieve. A third type of emissive device
is the light-emitting diode (LED). A matrix of diodes is arranged to form the pixel positions
in the display, and picture definition is stored in a refresh buffer. Picture information is
read from the refresh buffer and converted to voltage levels that are applied to the diodes
to produce the light patterns in the display.

Advantages :
• Refreshing is not required
• Produces a very steady image , totally free of
• flicker.
• Less bulky than a CRT.
• Allows selective writing and selective erasing,
• at a speed of about 20 Micro sec per cell.
Dis advantages:
• Relatively poor resolution of about 60 dots per inch.
• Costlier than CRT’s.

8.EXPLAIN PLASMA DISPLAY PANEL(PDP)


9.WRITE NOTE ON 3D DISPLAY TECHNOLOGY
Ans:3D Display Technology
Many modern 3D display systems including monitors are now capable of conveying a
stereoscopic perception of real world 3D depth to the viewer The perception of 3D depth is
produced by combining both of these 2D offset images in the brain. Although this method is
widely used technique for “3D display," it is effectively the presentation of dual 2D images
which quite different from displaying images in full 3D.
A more recent advancement in display technology called holographic display.
Stereoscopy (also called stereoscopics or 3D imaging) is a technique for creating or enhancing
the illusion of depth in an image by means of stereopsis for binocular vision. Main concept
behind 3D display is to generate a sense of variation in depth. To achieve this, two perspectives
of a single image, each for one eye, is used. The principle is to send an individual image to each
eye. our eyes can correlate these images automatically because each eye sees only one of the
images. Two views are generated. These two views have to be transported separately to the two
eyes. This technology includes use of anaglyph images and polarized glasses. 3D images can be
produced by using 3D camera that uses 2 cameras installed in it which shoot the images as seen
by left and right eye separately.

Different 3D Display Technologies are


 Active Stereo –
3D stereoscopic 3D display technology that separates the stereo frames by alternating the
viewing path to each eye. Used for 3D gaming and the first 3D TVs, liquid crystal (LC) s
hutter glasses are synchronized with alternating stereo frames on screen by an infrared (I
R) emitter on the monitor or TV. Active displays are able to show very detailed 3D
images, but require expensive and somewhat bulky glasses, though they are starting to
look a bit cooler and feel a little better.
 Passive stereo 3D - Passive displays have a special filter that works with the polarized
lenses in the glasses. Your left eye only sees the odd lines and your right eye only sees
the even lines. Without the glasses, the screen looks normal. Passive 3D only offers half
the resolution when in 3D mode, though it can be argued that users really do get the
whole picture.
 Autostereoscopic 3D - This technique does not require use of glasses. This technology is
prohibitively expensive at present and waits for large customer base.
Stages of stereo 3D presentation
 Source: It is responsible for stereo 3D content creation or playback. In this stage left and
right images are generated. It may be done in 2 ways- native stereo and 3D generation.
native stereo- produces images pairs by an application and 3d generation – uses additional
software of stereo image pairs using a monoscopic source.
 Preparation and transmission: This is responsible for preparing 3D image pairs for
display and relaying them to the display device. The prepared images are transmitted to
that disply over a display interface in a format that the display can interpret and use.
 Presentation: The presentation of the prepared image pairs is the responsibility of the
display device. There are two main approaches – use of active, frame sequential, display
with shutter glasses and passive display and polarized glasses. First approach uses active
frame sequential display with shutter glasses while second approach is to use passive
display and polarized glasses.

10.WITH NEAT DIAGRAM EXPLAIN THE WORKING OF CRT.


Ans:Cathode Ray Tubes

A beam of electrons (cathode rays), emitted by an electron gun, passes through focusing and
deflection systems that direct the beam towards specified positions on the phosphor coated screen.
The phosphor then emits a small spot of light at each position contacted by the electron beam.
Because the light emitted by the phosphor fades very rapidly, some method is needed for
maintaining the screen picture. One way to keep the phosphor glowing is to redraw the picture
repeatedly by quickly directing the electron beam back over the same points. This type of display
is called a refresh CRT.
The components of an electron gun in a CRT are the heated metal cathode and a control grid. Heat
is supplied to the cathode by directing current through a coil of wire, called the filament causes
electrons to be “boiled off”. The free electrons are then accelerated toward the phosphor coating
by a high positive voltage. An accelerating anode can be used to accelerate the electrons towards
the screen. Intensity of the electron beam is controlled by setting voltage levels on the control grid.
Since the amount of light emitted by the phosphor coating depends on the number of electrons
striking the screen.
The focusing system in a CRT is needed to force the electron beam to converge into a small spot
as it strikes the phosphor. Otherwise, the electrons would repel each other, and the beam would
spread out as it approaches the screen. Focusing is accomplished with either electric or magnetic
fields. (Fig: 2) With electrostatic focusing, the electron beam passes through a positively charged
metal cylinder that forms an electrostatic lens. The action of the electrostatic lens focuses the
electron beam at the centre of the screen. Spots of light are produced on the screen by the transfer
of the CRT beam energy to the phosphor. After a short time, the excited phosphor electrons begin
dropping back to their stable ground state. We can observe a glowing spot that quickly fades after
all the excited phosphor electrons have returned to their ground energy level.
Different kinds of phosphors are available for use in a CRT. Besides colour, a major difference
between phosphors is their persistence: how long they continue to emit light (that is, have excited
electrons returning to the ground state) after the CRT beam is removed. Persistence is defined as
the time it takes the emitted light from the screen to decay to one-tenth of its original
intensity.
Lower persistence phosphors require higher refresh rates to maintain a picture on the screen
without flicker. A phosphor with low persistence is useful for animation; ahigh-persistence
phosphor is useful for displaying highly complex, static pictures. The graphics monitors are usually
constructed with persistence in the range from 10 to 60microseconds.
The maximum number of points that can be displayed without overlap on a CRT is referred
to as the resolution. A more precise definition of resolution is the number of points per centimetre
that can be plotted horizontally and vertically.
Resolution of a CRT is dependent on the type of phosphor, the intensity to be displayed, and the
focusing and deflection systems. Typical resolution on high-quality systems is1280 by 1024. High
resolution systems are often referred to as high-definition systems. The physical size of a graphics
monitor is given as the length of the screen diagonal.
Another property of video monitors is aspect ratio. Aspect ratio is a number that gives the ratio
of vertical points to horizontal points necessary to produce equal-length lines in both
directions on the screen. (Sometimes aspect ratio is stated in terms of the ratio of horizontal to
vertical points.) An aspect ratio of 3/4 means that a vertical line plotted with three points has the
same length as a horizontal line plotted with four points.

Components of CRT
1. Electron Gun: Electron gun consisting of a series of elements, primarily a heating filament
(heater) and a cathode. The electron gun creates a source of electrons which are focused into a
narrow beam directed at the face of the CRT.
2. Control Grid: It is used to turn the electron beam on and off.
3. Focusing system: It is used to create a clear picture by focusing the electrons into a narrow
beam.
4. Deflection System: It is used to control the direction of the electron beam. It creates an electric
or magnetic field which will bend the electron beam as it passes through the area. In a conventional
CRT, the yoke is linked to a sweep or scan generator. The deflection yoke which is connected to
the sweep generator creates a fluctuating electric or magnetic potential.
5. Phosphorus-coated screen: The inside front surface of every CRT is coated with phosphors.
Phosphors glow when a high-energy electron beam hits them. Phosphorescence is the term used
to characterize the light given off by a phosphor after it has been exposed to an electron beam.
11. WRITE AND EXPLAIN STAGES OF STEREO 3D PRESENTATION.
Ans: A more recent advancement in display technology called holographic display.
Stereoscopy (also called stereoscopics or 3D imaging) is a technique for creating or enhancing the
illusion of depth in an image by means of stereopsis for binocular vision.
Main concept behind 3D display is to generate a sense of variation in depth.
Stages of stereo 3D presentation:
Source: It is responsible for stereo 3D content creation or playback. In this stage left and right
images are generated. It may be done in 2 ways- native stereo and 3D generation. native
stereo- produces images pairs by an application and 3d generation – uses additional software
of stereo image pairs using a monoscopic source.

Preparation and transmission: This is responsible for preparing 3D image pairs for display
and relaying them to the display device. The prepared images are transmitted to that disply
over a display interface in a format that the display can interpret and use.

Presentation: The presentation of the prepared image pairs is the responsibility of the display
device. There are two main approaches – use of active, frame sequential, display with shutter
glasses and passive display and polarized glasses. First approach uses active frame sequential
display with shutter glasses while second approach is to use passive display and polarized
glasses.

12.EXPLAIN ANY THREE ‘C’ GRAPHICS FUNCTIONS WITH EXAMPLE.


Ans:

13.WRITE THE ALGORITHM FOR DDA LINE DRAWING.


Ans: The digital differential analyzer (DDA) is a scan conversion line algorithm based on
calculation either ∆y or ∆x.
ALGORITHM:
Step 1: Get the input of two end pints (x0, y0) and (x1, y1)
Step 2 :Calculate the difference between two end points
dx = x1 - x0;
dy = y1 - y0;
Step 3: Based on the calculated difference in step 2, you need to identify the number of steps to
put pixel. If dx > dy, then you need more steps in x coordinate; otherwise in y coordniate
if (dx > dy)
steps = abs(dx);
else
steps = abs(dy);
Step 4: Calculate the increment in x coordinate and y coordinate
Xinc = dx / (float) steps;
Yinc = dy / (float) steps;
Step 5:Put the pixel by successfully incrementing x and y coordinates accordingly and complete
the drawing of the line
X = X0;
Y = Y0;
for (int i = 0; i <= steps; i++)
{
putpixel (round(X),round(Y),WHITE);
X += Xinc;
Y += Yinc;
}
14) DERIVE THE BRESENHAMS LINE DRAWING ALGORITHM.
Ans: This algorithm is used for scan converting a line. It is an efficient method because it involves only
integer addition, subtractions, and operations.
To illustrate Bresenham's approach, we first consider the scan-conversion process for lines with
positive slope less than 1. Pixel positions along a line path are then determined by sampling at
unitx intervals. Starting from the left endpoint (x0, y0) of a given line, we step to each successive
column (xposition) and plot the pixel whose scan-line y value is closest to the line path. Assuming
we have determined that the pixel at (xk, yk) is to be displayed, we next need to decide which pixel
to plot incolumnxk+1. Our choices are the pixels at positions (xk+l, yk) and (xk +l, yk+l).

At sampling position xk+l, we label vertical pixel separations from the mathematical line path as
d1and d2(Fig. 2). They coordinate on the mathematical line at pixel column position xk+l is
calculated as y=m(xk+1) + C
then, d1= y - yk=m(xk+1) + C - yk
and d2= (yk + 1) – y = yk + 1 - m(xk+1) - C
calculate d1- d2 (substitute the value of d1 and d2)
(d1- d2 ) = [m(xk+1) + C - yk ]- [yk+1- m(xk+1) – C]

= m(xk+1) + C - yk - yk-1 + m(xk+1) + c


= 2 m(xk+1) - 2yk + 2C – 1 (I)
If (d1-d2) < 0 then yk+1= yk
If (d1-d2) > 0 then yk+1 = yk+ 1
In the equation (I) substitute ∆y/ ∆x for m multiply throughout by ∆x and call it as pk (Decision
Parameter).
2 ∆𝑦
(d1-d2) = . (xk+1) - 2yk + 2C – 1
∆𝑥
Multiply ∆x through out the equation, we get
∆x(d1-d2)= ∆x [2 ∆y/ ∆x(xk+1) - 2 yk + 2c – 1]
∆x(d1-d2)= 2 ∆y(xk+1) - 2 ∆xyk + 2 ∆xc – ∆x
∆x(d1-d2)= 2∆yxk - 2 ∆xyk + 2∆y + 2 ∆xc – ∆x
∆x (d1-d2) = 2 ∆yxk– 2∆x yk+ C
Therefore, pk= 2 ∆yxk– 2∆x yk+ C (II) where C is a constant and is equal to
2∆y + 2∆xb - ∆x
The sign of pk is the same as the sign of dl –d2, since ∆x>0for our example. Parameter C is constant
and has the value 2∆y + 2∆xb - ∆x, which is independent of pixel position. If the pixel at yk is
closer to the line path than the pixel at yk+ 1 (that is, d1<d2), then decision parameter pk is negative.
In that case, we plot the lower pixel i.e., (xk+l, yk); otherwise, we plot the upper pixel i.e., (xk +l,
yk +l).
At step k + 1, the decision parameter is evaluated from equation (II) as
pk+1 = 2 ∆yxk+1 – 2∆x yk+1 + C (III)
(III) – (II) gives
pk+1 - pk= 2 ∆y(xk+1 - xk) - 2∆x(yk+1 - yk)
But, xk+1 =xk+ 1. So,
pk+1 = pk+ 2 ∆y - 2∆x(yk+1 - yk)
where the term (yk+1 - yk) is either 0or 1, depending on the sign of parameter pk. The term (yk+1 -
yk) will be 0 if pk is negative or it will be 1 if pkis positive.
Therefore, if pk< 0, pk+1 = pk+ 2∆y
If pk> 0, pk+1 = pk+ 2∆y - 2∆x
This recursive calculation of decision parameters is performed at each integerx-position, starting
at the left coordinate endpoint of the line. The first parameter, p0is evaluated from equation II at
∆𝑦
the starting pixel position (x0, y0) and with m evaluated as ∆𝑥 ,
p0 = 2 ∆yx0 – 2∆x y0 + C , we know that C = 2∆y + 2∆xb - ∆x
p0 = 2 ∆yx0 – 2∆x y0 + 2∆y + 2∆xb - ∆x (IV)
∆𝑦
we also know that y0 = mx0 + b, so b= y0 - mx0= y0 –( ∆𝑥 )x0
Substituting this for b in equation (IV) we get ,
∆𝑦
p0 = 2 ∆yx0 – 2∆x y0 + 2∆y + 2∆x (y0 – ∆𝑥 x0) - ∆x
On Solving, we get,
p0 = 2∆y - ∆x (V)

15) WRITE THE BRESENHAMS LINE DRAWING ALGORITHM.


Ans: This algorithm is used for scan converting a line. It is an efficient method because it involves
only integer addition, subtractions, and operations.
ALGORITHM:
Void lineBres (int xa, int ya , int xb, int yb)
{
int dx = abs( xa- xb ) , dy= abs (ya- yb):
int p = 2 * dy- dx ;
int twoDy= 2 * dy, twoDyDx= 2 * (dy - dx);
int x ,y, xEnd;
/*Determine which point to use as start, which as end* /
if(xa>xb )
{
x = xb;
y= yb;
xEnd= xa;
}
else
{
x = xa;
y= ya;
xEnd= xb;
}
setPixel (x, y);
while (x <xEnd)
{
x++;
if (p <0)
{
setPixel(x,y);
p = p +twoDy;
}
else
{
y++;
setPixel(x,y);
p=p+twoDyDx;
}
}
}

16) DERIVE THE MID POINT CIRCLE GENERATING ALGORITHM.


Ans:The function of a circle, cantered at origin is fcircle(x, y) = x2 + y2 – r2 (1)

< 0 , iff(x, y)isinsidethecircleboundary


fcircle(x, y) { = 0 , iff(x, y)isonthecircleboundary
> 0, iff(x, y)isoutsidethecircleboundary

Fig: 5 shows the mid-point between the two candidate pixels at the sampling position xk+1.
Assume that (xk,yk) is the current pixel that is plotted, whether (xk+1, yk) or (xk+1, yk-1) is closer
to the circle is to be determined. The decision parameter is evaluated at the mid-point between
these two pixels:
1
pk=fcircle(xk+1, yk-2)
1
= (xk+1)2 + (yk-2 )2 – r2 (II)
If pk< 0, this midpoint is inside the circle and the pixel on scan line yk is closer to the circle
boundary. Otherwise, the mid position is outside or on the circle boundary, and we select the pixel
on scanline yk - 1.
Successive decision parameters are obtained using incremental calculations. So, the next
1
decision parameter is pk+1 = fcircle(xk+1+1, yk+1- 2)
1
= [(xk+1)+1]2 + (yk+1-2)2 – r2
2
Or pk+1=pk+ 2(xk+1) + (𝑦𝑘+1 -𝑦𝑘2 ) - (yk+1 – yk) +1 (III)
Where yk+1 is either yk or yk-1 depending on the sign of pk. If pk is negative pk+1 is 2xk+1; if pk is
positive pk+1 is 2xk+1+1-2yk+1.
At the starting point x=0 and y=r. The initial value of the decision variable is obtained by
1
evaluating the equation at the mid-point (1, r-2).
1 1
p0=fcircle(1, r-2) = 1+ (r-2)2 – r2
5
p0=4 - r or p0=1-r (IV)

17) WRITE ALGORITHM FOR MID POINT CIRCLE GENERATING.


1. Ans: Input radius r and centre (xc, yc) and obtain the first point of the circle centred at
origin (x0, y0) =(0,r)
2. Calculate the initial value of the decision variable p as 1 – r.
3. At each xkposition starting at k=0, perform the following test: If pk<0, the next point along
the circle centred on (0, 0) is (xk+1, yk) and pk+1=pk+2xk+1+1 otherwise the next point along
the circle is (xk+1,yk-1) and pk+1=pk+2xk+1+1-2yk+1
4. Determine the symmetry points in the other seven octants.
5. Move each calculated pixel position (x,y) onto the circular path centered on (xc,yc) and plot
the coordinates x=x+xc, y=y+yc.
6. Repeat step 3 through 5 until x≥y.

18. WRITE THE MID POINT ELLIPSE GENERATING ALGORITHM.


Ans: An ellipse is defined as the set of points such that the sum of the distances from two fixed
positions (foci) is same for all points.
ALGORITHM:
1. Input 𝑟𝑥 , 𝑟𝑦 and the ellipse centre xc, yc. Obtain the first point centred at origin as (0, 𝑟𝑦 )
1
2. Calculate the initial value of the decision parameter in region 1 as 𝑝10 = 𝑟2𝑦 − 𝑟2𝑥 𝑟𝑦+ 4 𝑟2𝑥
3. At each 𝑥𝑘 in region 1, starting at k=0, perform the following test : if 𝑝1𝑘 <0, the next point
is [𝑥𝑘+1 , 𝑦𝑘 ] and 𝑝1𝑘+1 = 𝑝1𝑘 + 2𝑟2𝑦 (𝑥𝑘+1 ) + 𝑟2𝑦otherwise, the next point is [𝑥𝑘+1 , 𝑦𝑘−1 ] and
𝑝1𝑘+1 = 𝑝1𝑘 + 2𝑟2𝑦 (𝑥𝑘+1 )𝑟2𝑦 − 2𝑟2𝑥 (𝑦𝑘+1 ) + 𝑟2𝑦 with 2𝑟𝑦2 𝑥𝑘+1 =2𝑟𝑦2 𝑥𝑘 + 2𝑟𝑦2 and 2𝑟𝑥2 (𝑦𝑘+1 ) =
2𝑟𝑥2 𝑦𝑘 - 2𝑟𝑥2 and continue until 2𝑟𝑦2 𝑥𝑘 ≥ 2𝑟𝑥2 𝑦𝑘
4. Calculate the initial value of the decision parameter in region 2 using the last point
1 2
calculated in region 1 at (x0, y0) as 𝑝20 = 𝑟2𝑦 (𝑥0 + 2) + 𝑟2𝑥 (𝑦0 − 1)2 - 𝑟2𝑥 𝑟2𝑦
5. At each 𝑦𝑘 in region 2, starting at k=0, perform the following test : if 𝑝2𝑘 <0, the next point
is (𝑥𝑘 , 𝑦𝑘 − 1) and 𝑝2𝑘+1 = 𝑝2𝑘 - 2𝑟𝑦2 𝑦𝑘+1 + 𝑟𝑥2, otherwise the next point on the ellipse is
(𝑥𝑘 + 1, 𝑦𝑘 − 1)𝑝2𝑘+1 = 𝑝2𝑘 +2𝑟𝑦2 𝑥𝑘+1 − 2𝑟𝑥2 𝑦𝑘+1 + 𝑟𝑥2 using the same incremental
calculations for x and y as in region 1.
6. Determine the symmetry points in the other three quadrants.
7. Move each calculated pixel position (x,y) onto the circular path centred on (xc,yc) and plot
the coordinates x=x+xc, y=y+yc.
8. Repeat steps for region 1 until 2𝑟𝑦2 𝑥 ≥ 2𝑟𝑥2 𝑦

19. EXPLAIN FLOOD FILL WITH ALGORITHM.


Ans: Sometimes we want to fill in (or recolor) an area that is not defined within a single colour
boundary. We can paint such areas by replacing a specified interior colour instead of searching for
a boundary color value. This approach is called a flood-fill algorithm. We start from a specified
interior point (x, y) and reassign all pixel values that are currently set to a given interior color with
the desired fill color. If the area we want to paint has more than one interior color, we can first
reassign pixel values so that all interior points have the same color. Using either a 4-connected
or8-connected approach, we then step through pixel positions until all interior points have been
repainted. The following procedure flood fills a 4-onnected region recursively, starting from the
input position
void floodFill4(int x, int y, int fillColor, int oldColor)
{
if(getpixel(x,y)==oldColor)
{
setColor(fillColor);
floodFill4 (x+1, y, fillColor, oldColor);
floodFill4 (x-1, y, fillColor, oldColor);
floodFill4 (x, y+1, fillColor, oldColor);
floodFill4 (x, y-1, fillColor, oldColor);
}
}

20. EXPLAIN BOUNDARY FILL WITH ALGORITHM.


Ans: This method is used to fill the area inside a region with respect to boundary. If the boundary
is specified in a single colour, the fill algorithm proceeds outward pixel by pixel until the boundary
colour is encounters. A boundary-fill procedure accepts input as coordinates of an interior pixel
point (x,y), a fill colour and a boundary colour. Starting from (x,y), the procedure tests the
neighbouring positions to determine whether they are of the boundary colour. This process
continues until all pixels up to the boundary colour for the area have been tested. Both inner and
outer boundaries can be set up to specify an area, and some examples of defining regions for
boundary fill are shown in figures below:
Figure below shows two methods for proceeding to neighbouring pixels from the current test
position. In the first method, four neighbouring points are tested. These are the pixel positions that
are right, left, above, and below the current pixel. Areas filled by this method are called 4-
connected. The second method, is used to fill more complex figures. Here the set of neighbouring
positions to be tested includes the four diagonal pixels. Fill methods using this approach are called
8-connected.

4-Connected area 8-Connected area

The following procedure illustrates a recursive method for filling a 4- connected area with an
intensity specified in parameter fill up to a boundarycolor specified with parameter boundary. We
can extend this procedure to fill an8-connected -ion by including four additional statements to test
diagonal positions, such is (x + 1, y + 1).
void boundaryFill4(int x, int y, int fill, int boundary)
{
int current;
current=getpixel(x,y);
if((couurent!=boundary) && (current !=fill)
{
setColor(fill);
boundaryFill4(x+1, y, fill, boundary);
boundaryFill4(x-1, y, fill, boundary);
boundaryFill4(x, y+1, fill, boundary);
boundaryFill4(x, y-1, fill, boundary);
}
}

You might also like