Exam Solution

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Part 1: Introduction to Computer Graphics

1. Computer graphics

- Computer Graphics (CG) is:

An area of computer science and engineering that plays an important role in almost every
application of computer software.
CG’s is the art and science of creating images by:

- Programming the geometry and appearance of the contents of the images,


- Displaying the results of that programming on appropriate devices that support graphical
output and interaction.
- Uses a graphics API’s that supports the necessary modeling and does most of the detailed
work of rendering the scene that is defined through the programming.
2. Memory mapping

The status of each pixel on the screen was stored in a specific memory address in the
computer’s memory (memory mapped display).

- Each pixel is numbered sequentially.


- By writing values to the correct locations in memory the appearance of the screen can be
con
- Find out if a trolled by a programmer.
- A program can pixel is turned on or off.
3. give an example of memory mapping for 5 X 5 resolution color display device?

4. Aspect Ratio

- is 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.
5. Resolution
- Resolution: Is the maximum number of points that can be displayed without overlap on a
CRT monitors. Or it is the number of points per centimeter that can be plotted horizontally
and vertically, although it is often simply stated as the total number of points in each
direction.
6. What is the difference between raster storage image and vector storage
image?

Raster Image:
The images is considered as rectangular arrays of pixels, each pixel have different colors stored
as three numbers, for RGB. In a Monochrome system [black-and-white], each screen point is
either on (a bit value of 1) or off (a bit value of 0), so only one bit per pixel is needed to store
the intensity of screen positions.
Vector Image:
The image is stored as a set of instructions for displaying the.
• Are often used for text, diagrams, mechanical drawings, and other applications where precision
are important and photographic images and complex shading aren’t needed.

7. What are the popular image storage formats?

- Jpeg format. This Lossy format compresses image blocks based on thresholds in the human
visual system. This format works well for natural images.
- Tiff format. This format is most commonly used to hold binary images or lossless
compressed 8- or 16-bit RGB although many other options exist.
- Ppm format. a lossless, uncompressed format is most often used for 8-bit RGB images
although many options exist.
- Png format. This is a set of lossless formats with a good set of open source management
tools.
8. List of common Computer Graphics Areas

• Modeling • Virtual reality


• Rendering • Visualization
• Animation • Image processing
• User interaction • 3D scanning

9. List the operating characteristics for the video display systems based on the
CRT technology?

- A beam of electrons emitted by an electron gun, passes through focusing System and
deflection systems that direct the beam toward specified positions on the phosphor-
coated screen.
- The phosphor-coated screen then emits a small spot of light at each position contacted
by the electron beam.
- The light emitted by the phosphor fades very rapidly, the picture is redrawn by quickly
directing the electron beam back over the same points. This type of display is called a
refresh CRT.

10. What are the different types of Flat-Screens, and what is the difference
between them?

- light-emitting diodes (LEDs) - light-emitting diodes that can be turned on and off
- liquid-crystal displays (LCDs) - polarization of the liquid crystals in the middle panel
- plasma panels - voltages on the grids to energize gases
- Similarities:
- All use a two-dimensional grid to address individual light-emitting elements.
- The two outside plates each contain perpendicular parallel grids of wires .
- Sending electrical signals to a wire in each grid, generates electrical field at the

Intersection of two wires, can control the corresponding element in the middle plate.

11. Describe what is performed by the following functions:

• setpixel(x, y, color) - Sets the pixel at position (x, y) to the given color.
• getpixel(x,y) : Gets the color at the pixel at position (x, y).

12. What can the programmer do in computer graphics?

• Develop appropriate representations for the geometric objects of the images.


• Assemble these objects into an appropriate geometric space.
• Specify how the scene is to be viewed and how it will be displayed on the graphic device.
• Define some animation for the image.
• Design a ways for the user to interact with the scene as it is presented.

13. How can the computer graphics used in solving problems?

• GC can solve a lot of problems:


• Identifying a problem.
• Addressing the problem by building the model.
• Identifying a way to represent the problem geometrically.
• Creating an image from that geometry so that the problem can be seen visually.
• Use the image to understand the problem or the model and to try to understand a possible
solution.

14. How can an application program actually draw something on screen?

15. Describe the Basic Components of computer graphics system?

• A computer graphics system is a computer system; that have all the components of a
general-purpose computer system.
• There are six major elements in our system:

• Input devices
• Central Processing Unit
• Graphics Processing Unit
• Memory
• Frame buffer
• Output devices

16. What are the different types of Flat-Screens, and what is the difference
between them?

- light-emitting diodes (LEDs) - light-emitting diodes that can be turned on and off
- liquid-crystal displays (LCDs) - polarization of the liquid crystals in the middle panel
- plasma panels - voltages on the grids to energize gases
- Similarities:
- All use a two-dimensional grid to address individual light-emitting elements.
- The two outside plates each contain perpendicular parallel grids of wires .
- Sending electrical signals to a wire in each grid, generates electrical field at the

Intersection of two wires, can control the corresponding element in the middle plate.
17. Consider three different raster systems with resolutions of 640 by 480, 1280 by
1024, and 2560 by 2048. What size frame buffer (in bytes) is needed for each of
these systems to store 12 bits per pixel? How much storage is required for each
system if 24 bits per pixel are to be stored?

Frame-buffer size for each of the systems is


640 × 480 × 12 bits ÷ 8 bits per byte = 450 KB
1280 × 1024 × 12 bits ÷ 8 bits per byte = 1920 KB
2560 × 2048 × 12 bits ÷ 8 bits per byte = 7680 KB
For 24 bits of storage per pixel, each of the above values is doubled.
900 KB & 3840 KB & 15360 KB

18. How long does it take to load a 640-by-480 frame buffer with 12 bits per pixel, if
105 bits can be transferred per second?

Let X the time that will be taken to load a 640-by-480 frame buffer with 12 bits per pixel.
Number of bits = 640 * 480 * 12 = 3686400 bits
1 sec X 105 bits
X sec(s) X 3686400 bits
Then X = 3686400/105 = 36.864 second

19. How much time is spent in scanning across each row of pixels during screen refresh
on a raster system with a resolution of 1280 by 1024 and refresh rate of 60 frames
per second?

The time required for scanning one frame is 1/60 = 0.01666


One frame has 1024
The time of scanning on row = 0.01666 / 1024 = 1.627 * 10-5 sec

20. Suppose we have a video monitor with a display area with 12 inches width and 9.6
inches high. If the resolution is 1280 X 1024 and the aspect ratio is 1, what are the
width and the height of each point on the screen?

21. How long would it take to load a 640-by-480 frame buffer with 12 bits per
pixel, if 105 bits can be transferred per second? How long would it take to load
a 24-bit-per-pixel frame buffer with a resolution of 1280 by 1024 using this
same transfer rate?

Total number of bits for the frame = 640 x 480 x 12 bits = 3686400 bits
The time needed to load the frame buffer = 3686400 / 105 sec = 36.864 sec
Total number of bits for the frame = 1280 x 1024 x 24 bits = 31457280 bits
The time needed to load the frame buffer = 31457280 / 105 sec = 314.5728 sec

22. Suppose an RGB raster system is to be designed using an 8-inch by 10-inch


screen with a resolution of 100 pixels per inch in each direction. If we want to
store 6 bits per pixel in the frame buffer, how much storage bytes do we need
for the frame buffer?

Part 2: Graphics Primitives


23. For the brute force line drawing algorithm:

 Analyze the Basic concept of drawing a line using the brute force algorithm?

y = mx + c
where m is the gradient of the line:
∆y yfrom − yto
m= =
∆x xfrom − xto
and c is its intercept of the y-axis
c = yfrom − m xfrom

 Write pseudo code for applying the algorithm.


24. What are the main disadvantages of the Brute Force Algorithm and how can
you solve it?

 Gaps start to appear in the line. Why has this happened? Looking at some
values for x and y soon reveals that when m>1, the values for y increase by an
amount greater than the increments of x that we are using (i.e. >1). And it can
be solved as the following


 It requires floating point arithmetic which is slow when compared with using
integer only arithmetic. And it can be solved using Bresenhams algorithm

25. Write the algorithm of the line drawing algorithm using Bresenham’s
algorithm.

Bresenham's Line-Drawing Algorithm for |m| < 1

1. Input the two line endpoints and store the left endpoint in (x0 , y0 )
2. Load (x0 , y0 ) into the frame buffer; that is, plot the first point.
3. Calculate constants Δx, Δy, 2Δy, and 2Δy − 2Δx, and obtain the starting value for the
decision parameter as p0 = 2∆y − ∆x
4. At each xk along the line, starting at k = 0, perform the following test:

If pk < 0 , the next point to plot is (xk+1 , yk ) and


pk+1 = pk + 2∆y
Otherwise, the next point to plot is (xk+1 , yk+1 ) and
pk+1 = pk + 2∆y − 2∆x

5. Repeat step 4 Δx times.


26. Digitize a line with end points (20, 10) and (30, 18).

27. Write the algorithm of the line drawing algorithm using Digital Differential
Analyzer (DDA).

28. Using the DDA algorithm digitize a line with end points (10,15) and (15,30).
29. The process of drawing circle using Brute force method can be enhanced by
taking greater advantage of the symmetry in a circle.

Write the complete algorithm used to apply this enhancement.

30. Derive the homogenous matrices to represent the following transformation

Translation - Rotation about the origin – Scaling


31. Discuss the difference between the rotation about the origin and the rotation
about a local point.

1. Use the Bresenhams algorithm to digitize the line in point (b).


2. Digitize a line with end points (20, 10) and (30, 18) using:

a. Bresenhams line drawing Algorithm.


b. DDA line drawing Algorithm.

3. Using the Brute orce algorithm to digitize a line with end points (20, 10) and
(26, 14).

You might also like