Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Unit 1 notes of data structures, Summaries of Data Structures and Algorithms

An overview of computer graphics, including output primitives, graphics systems, and display devices. It also discusses the applications of computer graphics, such as computer-aided design, presentation graphics, and computer art. the operation of cathode ray tube (CRT) monitors and the two ways of displaying objects on the screen: raster scan and random scan. It also describes the beam-penetration method and shadow-mask method for producing color displays with a CRT. Finally, the document introduces flat panel displays as a potential replacement for CRT monitors.

Typology: Summaries

2022/2023

Available from 02/03/2023

Gvskumar
Gvskumar 🇮🇳

1 document

1 / 40

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Output Primitives: Survey of computer graphics Overview of graphics systems Line drawing
algorithm Circle drawing algorithm Curve drawing algorithm - Attributes of output primitives
Anti-aliasing
Basics of Computer Graphics
Computer Graphics involves creation, display, manipulation and storage of pictures and
experimental data/models or images for proper visualization using a computer. Such models
come from diverse and expanding set of fields including physical, biological, mathematical,
artistic, and conceptual/abstract structures.Typical graphics system comprises of a host computer
with support of fast processor, large memory, frame buffer and
•Display devices (color monitors),
Input devices (mouse, keyboard, joystick, touch screen, trackball)
Output devices (LCD panels, laser printers, color printers. Plotters etc.)
•Interfacing devices such as, video I/O, TV interface etc.
Application of Computer Graphics
1. Computer Aided Design (CAD) :
It is used in the design of Buildings, Automobiles, Aircraft, Watercraft, Spacecraft, Computers, Textiles
and many more products
For some design applications, objects are first displayed in a wireframe outline which shows the overall shape
and internal features of objects
Circuits and Networks for communications, water supply or other utilities are constructed
The shapes used in a design represent the different network or circuit components
Real time animations using wireframe displays on a video monitor are useful for testing performance of a
vehicle or system
Realistic displays are generated for advertising of automobiles and other vehicles using special lighting effects
and background scenes
Architects use interactive graphics methods to layout floor plans such as positioning of rooms, windows,
stairs, shelves and other building features
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

Partial preview of the text

Download Unit 1 notes of data structures and more Summaries Data Structures and Algorithms in PDF only on Docsity!

Output Primitives: Survey of computer graphics – Overview of graphics systems – Line drawing algorithm – Circle drawing algorithm – Curve drawing algorithm - Attributes of output primitives

  • Anti-aliasing

Basics of Computer Graphics

Computer Graphics involves creation, display, manipulation and storage of pictures and experimental data/models or images for proper visualization using a computer. Such models come from diverse and expanding set of fields including physical, biological, mathematical, artistic, and conceptual/abstract structures.Typical graphics system comprises of a host computer with support of fast processor, large memory, frame buffer and •Display devices (color monitors),

  • Input devices (mouse, keyboard, joystick, touch screen, trackball)
  • Output devices (LCD panels, laser printers, color printers. Plotters etc.) •Interfacing devices such as, video I/O, TV interface etc.

Application of Computer Graphics

1. Computer Aided Design (CAD) :

  • It is used in the design of Buildings, Automobiles, Aircraft, Watercraft, Spacecraft, Computers, Textiles and many more products
  • For some design applications, objects are first displayed in a wireframe outline which shows the overall shape and internal features of objects
  • Circuits and Networks for communications, water supply or other utilities are constructed
  • The shapes used in a design represent the different network or circuit components
  • Real time animations using wireframe displays on a video monitor are useful for testing performance of a vehicle or system
  • Realistic displays are generated for advertising of automobiles and other vehicles using special lighting effects and background scenes
  • Architects use interactive graphics methods to layout floor plans such as positioning of rooms, windows, stairs, shelves and other building features

Fig 1.1 Example for Wireframe drawing

2. Presentation Graphics Presentation Graphics is used to produce illustrations for reports, Slides or transparencies for use with projectors. It is used to summarize Financial, Statistical, Mathematical, Scientific as well as Economic Data. For example,Barcharts, Line Graphs, Surface Graphs, Pie charts and other displays shows relationships between multiple parameters. **Fig 1.2 Example for Presentation Graphics

  1. Computer Art** Computer Graphics are used in both fine art and commercial art applications. Artists use a variety of computer methods including special purpose hardware, artists paint brush programs, specially developed software,symbolic mathematical packages, CAD software, Desktop publishing software and Animation packages that provide facilities for designing object shapes and specifying object motions Eg) LOGOs , TV advertising, Combining Text and Graphics, Morphing, etc. Fig 1.3 Example for Computer Art

Fig 1.5 Example for Data Analysis

7. Image Processing Image processing is applied to modify / interpret existing pictures such as photographs and TV scans. Applications of Image Processing:

  1. Improving picture quality
  2. M/C perception of visual information as used in robotics In order to apply image-processing methods: Digitize a photograph or picture into an image file Apply techniques to enhance color separation or improve the quality of shading e.g., Analyze satellite photos, Photos of earth, Galaxy, etc. Medical Image processing uses Ultrasonics which converts High frequency sound waves to process data and Medical scanners **Fig 1.6 Example for Image Processing
  3. Graphical User Interface** Uses Window manager which allows a user to display multiple window areas. It can be activated by an icon. Fig 1.6 Example for Graphical User Interface

Video Display devices Cathode Ray Tube (CRT) The primary output device in a graphical system is the video monitor. The main element of a video monitor is the Cathode Ray Tube, shown in the following illustration (Fig. 1.1). The operation of CRT is very simple:  The electron gun emits a beam of electrons (cathode rays), when the filament is heated.  Intensity of the electron beam is controlled by setting voltage levels on the control grid.  The electron beam passes through focusing and deflection systems that direct it towards specified positions on the phosphor-coated screen. The focusing system is needed to force he electron beam to converge into a small spot as it strikes the phosphor screen, else the bam would spread out as it approaches the screen.  When the beam hits the screen, the phosphor emits a small spot of light at each position contacted by the electron beam.  It redraws the picture by directing the electron beam back over the same screen points quickly. This is called refreshing, hence the CRT is called as Refresh CRT.  The difference between the kinds of phosphors is their persistence- how long they continue to emit light after the CRT beam is removed.

called vector display, stroke-writing display, or calligraphic display. Picture definition is stored as a set of line-drawing commands in an area of memory referred to as the refresh display file. 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 the line-drawing commands are 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. Fig 1.3 shows random scan method. Fig 1.3: Random scan display Color CRT Monitor A CRT monitor displays color picture by using a combination of phosphor that emit different- colored light. By combining the emitted light from the different phosphor, a range of colors can be generated. The two basic techniques for producing color displays with a CRT are the beam- penetration method and the shadow-mask method. Beam-penetration method The beam-penetration method for displaying color pictures has been used with random-scan monitors. Two layers of phosphor, usually red and green, are coated onto the inside of the CRT screen, and the displayed color depends on how far the electron beam penetrates into the phosphor layers. A beam of slow electrons excites only the outer red layer. A beam of very fast electron penetrates through the red layer and excites the inner green layer. At intermediate beam speeds, combinations of red and green light are emitted to show two additional colors, orange and yellow.

The speed of the electrons, and hence the screen color at any point, is controlled by the beam- acceleration voltage. Beam penetration has been aninexpensive way to produce color in random- scan monitor, but only four colors are possible, and the quality of picture is not as good as with other methods. Shadow Mask Method Shadow-mask,(Fig 1.4) methods are commonly used in raster-scan system (including color TV) because they produce a much wider range of colors than the beam penetration method. A shadow- mask CRT has three phosphor color dots at each pixel position. One phosphor dot emits a red light, another emits a green light, and the third emits a blue light. This type ofCRT has three electron guns, one for each color dot, and a shadow-mask grid just behind the phosphor-coated screen. Figure illustrates the delta-delta shadow-mask method, commonly used in color CRT system. The three beams are deflected and focused as a group onto the shadow mask, which contains a series of holes aligned with the phosphor-dot patterns. When the three beams pass through a hole in the shadow mask, they activate a dot triangle, which appears as a small color spot on the screen. The phosphor dots in the triangles are arranged so that each electron beam can activate only its corresponding color dot when it passes through the shadow mask. Another configuration for the three electron guns is an in-line arrangement in which the three electron guns, and the corresponding redgreen-blue color dots on the screen, are aligned along one scan line instead of in a triangular pattern. This in-line arrangement of electron guns is easier to keep in alignment and is commonly used in high-resolution color CRTs.

The primary gun produces high speed electrons which strike on the storage grid to draw the picture pattern. As electron beam strikes on the storage grid with high speed, it knocks out electrons from the storage grid keeping the net positive charge. The knocked out electrons are attracted towards the collector. The net positive charge on the storage grid is nothing but the picture pattern. The continuous low speed electrons from flood gun pass through the control grid and are attracted to the positive charged areas of the storage grid. The low speed electrons then penetrate the storage grid and strike the phosphor coating without affecting the positive charge pattern on the storage grid. During this process the collector just behind the storage grid smooth’s out the flow of flood electrons. Advantages:  Refreshing of CRT is not required.  Because no refreshing is required, very complex pictures can be displayed at very high resolution without flicker.  It has flat screen. Disadvantages:  They do not display colors and are available with single level of line intensity.  Erasing requires removal of charge on the storage grid Thus erasing and redrawing process takes several seconds.  Selective or part erasing of screen is not possible.  Erasing of screen produces unpleasant flash over the entire screen surface which prevents its use of dynamics graphics applications.  It has poor contrast as a result of the comparatively low accelerating potential applied to the flood electrons.  The Performance of DVST is somewhat inferior to the refresh CRT. Flat Panel Displays Although most graphics monitors are still constructed with CRTs, other technologies are emerging that may soon replace CRT monitors. The term Flat panel displays refers to aclass of video devices that have reduced volume, weight and power requirements compared to a CRT. The

important feature of flat panel display is that they are thinner than the CRTs. Since we can even write on some flat-panel displays, they will soon be available as pocket notepads. Current uses for flat-panel displays include small TV monitors, calculators, pocket video games, laptop computers, armrest viewing of movies on airlines, as advertisement boards in elevators, and as graphics displays in applications requiring rugged, portable monitors. There are 2 types: Emissive and Non Emissive displays. Emissive Displays: They covert electrical energy into light energy. E.g. Plasma panels, Thin Film Electroluminescent displays, LEDs. Non Emissive Displays: They use optical effects to convert sunlight or light from some other source into graphics patterns. E.g. LCD (Liquid Crystal Display)

Plasma panels , also called gas-discharge displays, are constructed by filling the region between

two glass plates with a mixture of gases that usually includes 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 (Fig 1.6 below). 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 a 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. Alternating

  • current methods are used to provide faster application of the firing voltages, and thus brighter displays. Separation between pixels is provided by the electric field of the conductors. Figure below shows a high definition plasma panel. One disadvantage of plasma panels has been that they were strictly monochromatic devices, but systems have been developed that are now capable of displaying color 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 sulfide doped with manganese,instead of a gas (see Fig 1.7 below). 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 color and gray scale displays are hard to achieve. Fig 1.7 Basic design of a thin-film electroluminescent display device

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. As in scan-line refreshing of a CRT, 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.

Liquid Crystal Display (LCD) are commonly used in small systems, such as calculators

(see figure below) and portable, laptop computers. These nonemissive devices produce a picture by passing polarized light from the surroundings or from an internal light source through a liquid- Crystal material that can be aligned to either block or transmit the light. The term liquid crystal refers to the fact that these compounds have a crystalline arrangement of molecules, yet they flow like a liquid. Flat-panel displays commonly use nematic (threadlike) liquid-crystal compounds that tend to keep the long axes of the rodshaped molecules aligned. A flat-panel display can then be constructed with a nematic liquid crystal. Two glass plates, each containing a light polarizer at

right angles to the-other plate, sandwich the liquid-crystal material. Rows of horizontal transparent conductors are built into oneglass plate, and columns of vertical conductors are put into the other plate. The intersection of two conductors defines a pixel position. Normally, the molecules are aligned as shown in the "on state". Polarized light passing through the material is twisted so that it will pass through the opposite polarizer. The light is then reflected back to the viewer. To turn off the pixel, we apply a voltage to the two intersecting conductors to align the molecules so that the light is not .twisted. This type of flat-panel device is referred to as a passive-matrix LCD. Picture definitions are stored in a refresh buffer, and the screen is refreshed at the rate of 60 frames per second, as in the emissive devices. Back lighting is also commonly applied using solidstate electronic devices, so that the system is not completely dependent on outside light sources. Colors can be displayed by using different materials or dyes and by placing a triad of color pixels at each screen location. Another method for constructing LCDs is to place a transistor at each pixel location, using thin-film transistor technology. The transistors are used to control the voltage at pixel locations and to prevent charge from gradually leaking out of the liquid- crystal cells. These devices are called active-matrix displays. Fig 1.8 shows a hand calculator with LCD display Fig 1.8 Hand calculator with a LCD screen

 Voice Systems HARD-COPY DEVICES  Printers  Plotters Line Drawing Algorithms A line connects two points. It is a basic element in graphics. To draw a line, you need two points between which you can draw a line. The DDA is a scan conversion line algorithm based on calculating either dy or dx. A line issampled 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

Yk+1 =Yk + m

Subscript k takes integer values starting from 0, for the 1st point and increases by until end point 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

X k+1 = X k + 1/m

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. Digital Differential Analyzer (DDA) line drawing algorithm Digital Differential Analyzer (DDA) algorithm is the simple line generation algorithm which is explained step by step here.

 Get the input of two end points (X0, Y0) and (X1, Y1).  Calculate the difference between two end points.  Based on the calculated difference, 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 coordinate.  Calculate the increment in x coordinate and y coordinate.  Put the pixel by successfully incrementing x and y coordinates accordingly and complete the drawing of the line. Algorithm: Advantages:  It is the simplest algorithm and it does not require special skills for implementation.  It is a faster method for calculating pixel positions than the direct use of equation y=mx + b. It eliminates the multiplication in the equation by making use of raster characteristics, so that appropriate increments are applied in the x or y direction to find the pixel positions along the line path. Disadvantages:  Floating point arithmetic in DDA algorithm is still time-consuming.  The algorithm is orientation dependent. Hence end point accuracy is poor.

Fig 1.11 Bresenham’s line drawing algorithm

Algorithm _procedurelineBresenham(xa, ya, xb, yb : integer) var dx,dy,x, y, xend, p : integer; begin dx=abs(xa-xb); dy=abs(ya-yb); p=2dy-dx; if(xa>xb) then begin x=xb;y=yb;xend=xa; end else begin x=xa; y=ya;xend=xb; end; putpixel(x,y,4); while(x<=xend) do begin x=x+1; if (p<0) then p=p+2dy; else begin y=y+1; p=p+2(dy-dx); end; putpixel(x,y,4); end end_* Difference between DDA Line Drawing Algorithm and Bresenhams Line Drawing Algorithm Table 1 .Difference between DDA and Bresenhams Algorithm Digital Differential Analyzer Line Drawing Algorithm Bresenham’s Line Drawing Algorithm Arithmetic DDA algorithm uses floating points i.e. Real Arithmetic. Bresenham’s algorithm uses fixed points i.e. Integer Arithmetic Operations DDA algorithm uses multiplication and division in its operations. Bresenham’s algorithm uses only subtraction and addition in its operations.