Figure 3.12: A tri-stimulus colour represented as a pure colour and white Note that the pure colour is not a coherentwavelength as in the CIE diagram. The saturation is the proportion ofpure colour. As in the RGB system colours may be adjusted by changingany of the three values. However, with the HSI system the three variableseach correspond to properties of colour we can easily understand, andthus they are easier to use to adjust colour palettes and balance colourimages. 3.4 DIRECT VIEW STORAGE TUBE DVST terminals also use the random scan approach to generate the image on the CRT screen. The term \"storage tube\" refers to the ability of the screen to retain the image which has been projected against it, thus avoiding the need to rewrite the image constantly. Direct View Storage Tube (DVST) resembles CRT as it uses electron gun to draw picture and phosphor coated screen to display it. The phosphor used in this is of high persistence. DVST does not use refresh buffer or frame buffer to store picture definition. Picture definition is stored in inside CRT in form positive charged distribution. Because of this reason DVST is knows as Storage Type CRT. In DVST no refreshing is required as result picture drawn on DVST will be seen for several minutes before fading. Various Components of DVST Electron Guns Two electron guns are used in DVST : Primary Gun and Flood Gun. Primary gun is used to store picture pattern. Flood gun is used to maintain picture display on phosphor coated screen. Phosphor Coated Screen In DVST the inner surface of CRT is coated with phosphor crystals is of high persistence that emit light when beam of electrons strike them. 51 CU IDOL SELF LEARNING MATERIAL (SLM)
Storage Mesh It is thin and high quality wire that is coated with dielectric and is located just behind phosphor coated screen. Primary gun deposits pattern of positive charge on this grid and it is transferred to phosphor coated screen by continuous flood of electrons produced by flood gun. Thus Storage Mesh stores picture to be displayed in form of positive charge distribution. Collector This grid is located just behind storage mesh and purpose of this negatively charged grid is to smooth out flow of flood electrons. Working principle of DVST Direct View Storage Tube (DVST) resembles CRT as it uses electron gun to draw picture and phosphor coated screen to display it. The phosphor used in this is of high persistence. DVST does not use refresh buffer or frame buffer to store picture definition. Less time consuming. No refreshing is required because we do not work pixel by pixel. Complex pictures can be shown at very high resolution. In DVST similar with CRT electron gun and phosphor coated method is used. But in this no electron beam is used to directly writing pictures on screen, but instead of this we can used Storage mesh wire grid is used it is just located behind phosphor coated screen. There is also another grid located just behind storage mesh is called Collector and this purpose is to smooth out flow of flood electrons. The flood gun produce large number of electrons, this negatively charged grid reduces speed of these electrons. Then electrons pass through collector at low velocity and attracted by positive charged portions of storage mesh and strike at portions of phosphor coated screen to display picture. Some electrons get repelled by other portions of mesh that are negatively charged. Since the collector has slowly down electrons, in this way they not able to produce sharpened images. So to reduce this problem, screen itself is maintained at a high positive potential by means of voltage applied to thin aluminium coating between tube face and phosphor. 52 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 3.13 Direct View Storage Tube Advantages of DVST For picture display it does not require refreshing. Display complex pictures at high resolution without any flicker. No use of frame buffer or refresh buffer. Disadvantages of DVST Not used for dynamic graphic such as animation. These systems do not display colours. To erase selected part of an image, entire screen needs to be erased and modified pictures needs to be redrawn. Function of Guns Two guns are used in DVST 1. Primary guns: It is used to store the picture pattern. 2. Flood gun or Secondary gun: It is used to maintain picture display. 3.5 FLAT PANEL DISPLAY The term flat-panel display refers to a class of video devices that have reduced volume, weight and power requirements compared to a CRT. They are of2 types. i. Emissive Displays(plasma, LED’s, Thin electroluminescent displays) ii. Non Emissive Displays(LCD) 53 CU IDOL SELF LEARNING MATERIAL (SLM)
The emissive displays (or emitters) are devices that convert electrical energy into light. Plasma panels, thin-film electroluminescent displays, and Light-emitting diodes are examples of emissive displays. Flat CRTs have also been devised, in which electron beams arts accelerated parallel to the screen, then deflected 90' to the screen. But flat CRTs have not proved to be as successful as other emissive devices.. Non emissive displays (or non- emitters) use optical effects to convert sunlight or light from some other source into graphics patterns. The most important example of a non-emissive flat-panel display is a liquid-crystal device. Figure 3.14: Classifications of Flat panel display The Flat-Panel display refers to a class of video devices that have reduced volume, weight and power requirement compare to CRT. Examples Small T.V. monitor, calculator, pocket video games, laptop computers, an advertisement board in elevator. Emissive Display The emissive displays are devices that convert electrical energy into light. Examples are Plasma Panel, thin film electroluminescent display and LED (Light Emitting Diodes). Non-Emissive Display The Non-Emissive displays use optical effects to convert sunlight or light from some other source into graphics patterns. Examples are LCD (Liquid Crystal Device). Plasma Panel Display Plasma-Panels are also called as Gas-Discharge Display. It consists of an array of small lights. Lights are fluorescent in nature. 54 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 3.15: State of cell in plasma panel display The essential components of the plasma-panel display are: 1. Cathode: It consists of fine wires. It delivers negative voltage to gas cells. The voltage is released along with the negative axis. 2. Anode: It also consists of line wires. It delivers positive voltage. The voltage is supplied along positive axis. 3. Fluorescent cells: It consists of small pockets of gas liquids when the voltage is applied to this liquid (neon gas) it emits light. 4. Glass Plates: These plates act as capacitors. The voltage will be applied, the cell will glow continuously. The gas will slow when there is a significant voltage difference between horizontal and vertical wires. The voltage level is kept between 90 volts to 120 volts. Plasma level does not require refreshing. Erasing is done by reducing the voltage to 90 volts. Each cell of plasma has two states, so cell is said to be stable. Displayable point in plasma panel is made by the crossing of the horizontal and vertical grid. The resolution of the plasma panel can be up to 512 * 512 pixels. Advantages 1. High Resolution 2. Large screen size is also possible. 3. Less Volume 4. Less weight 55 CU IDOL SELF LEARNING MATERIAL (SLM)
5. Flicker Free Display Disadvantages 1. Poor Resolution 2. Wiring requirement anode and the cathode is complex. 3. Its addressing is also complex. LED (Light Emitting Diode) In an LED, a matrix of diodes is organized to form the pixel positions in the display and picture definition is stored in a refresh buffer. Data is read from the refresh buffer and converted to voltage levels that are applied to the diodes to produce the light pattern in the display. LCD (Liquid Crystal Display) LCD stands for Liquid Crystal Display. It is a flat panel display technology, mainly used in TVs and computer monitors, nowadays it is used for mobile phones also. ... In LCD it has backlights that provide light to each pixel. Each pixel has a red, green, and blue (RGB) sub- pixel that can be turned on or off Liquid Crystal Displays are the devices that produce a picture by passing polarized light from the surroundings or from an internal light source through a liquid-crystal material that transmits the light.LCD uses the liquid-crystal material between two glass plates; each plate is the right angle to each other between plates liquid is filled. One glass plate consists of rows of conductors arranged in vertical direction. Another glass plate is consisting of a row of conductors arranged in horizontal direction. The pixel position is determined by the intersection of the vertical & horizontal conductor. This position is an active part of the screen. Liquid crystal display is temperature dependent. It is between zero to seventy degree Celsius. It is flat and requires very little power to operate. Figure 3.16: LCD on state 56 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 3.17: LCD off state Advantages 1. Low power consumption. 2. Small Size 3. Low Cost Disadvantages 1. LCDs are temperature-dependent (0-70°C) 2. LCDs do not emit light; as a result, the image has very little contrast. 3. LCDs have no color capability. 4. The resolution is not as good as that of a CRT. Liquid-crystal display (LCD) is a popular type of technology used in electronic displays. As the name suggests, it's characterized by the use of liquid-filled crystals to produce images. Because liquid crystals have light-modulating properties, LCDs are particularly effective for this purpose LCD (Liquid Crystal Display) is a type of flat panel display which uses liquid crystals in its primary form of operation. LCDs consume much less power than LED and gas-display displays because they work on the principle of blocking light rather than emitting it. Look-Up Table Image representation is essentially the description of pixel colors. There are three primary colors: R (red), G (green) and B (blue). Each primary color can take on intensity levels produces a variety of colors. Using direct coding, we may allocate 3 bits for each pixel, with one bit for each primary color. The 3-bit representation allows each primary to vary 57 CU IDOL SELF LEARNING MATERIAL (SLM)
independently between two intensity levels: 0 (off) or 1 (on). Hence each pixel can take on one of the eight colors. A widely accepted industry standard uses 3 bytes, or 24 bytes, per pixel, with one byte for each primary color. The way, we allow each primary color to have 256 different intensity levels. Thus a pixel can take on a color from 256 x 256 x 256 or 16.7 million possible choices. The 24-bit format is commonly referred to as the actual color representation. Lookup Table approach reduces the storage requirement. In this approach pixel values do not code colors directly. Alternatively, they are addresses or indices into a table of color values. The color of a particular pixel is determined by the color value in the table entry that the value of the pixel references. Figure shows a look-up table with 256 entries. The entries have addresses 0 through 255. Each entry contains a 24-bit RGB color value. Pixel values are now 1-byte. The color of a pixel whose value is i, where 0 <i<255, is persistence by the color value in the table entry whose address is i. It reduces the storage requirement of a 1000 x 1000 image to one million bytes plus 768 bytes for the color values in the look-up table. Table 3.2: Look up table Functions of lookup table A lookup table is an array of data that maps input values to output values, thereby approximating a mathematical function. Given a set of input values, a lookup operation retrieves the corresponding output values from the table. It can be used to translate encoded information into a user-friendly description, to validate input values by matching them to a list of valid items, or to translate a shorthand entry into something more detailed. A lookup action retrieves values from a related table. 58 CU IDOL SELF LEARNING MATERIAL (SLM)
In computer science, a lookup table is an array that replaces runtime computation with a simpler array indexing operation. The savings in processing time can be significant, because retrieving a value from memory is often faster than carrying out an \"expensive\" computation or input/output operation. Figure 3.18: Look up table 3.6 GRAPHICS MONITORS Monitors which are capable of showing and supporting Graphics mode along with the Text modes. iii). Graphic monitors who can display pictures on its screen, of course it acts like an output device. The monitors which support the following Graphic applications are said to be Graphic Monitors. A monitor capable of displaying graphics. That is, any monitor that supports a graphics mode in addition to text modes. Nearly all modern monitors are graphics monitors. Most graphics monitors today operate as raster scan displays High-definition graphics monitor used in applications such as air traffic control, simulation, medical imaging, and CAD. A multi-screen system called the Media Wall, provides a large \"wall-sized display area. This system is designed for applications that require large area displays in brightly lighted environments, such as at trade shows, conventions, retail stores, museums, or passenger terminals. 59 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 3.19: Graphic monitor The name itself giving some idea that, Monitor which can display “Graphics”. Generally most of the Monitors support Text modes.So monitors which are capable of showing and supporting Graphics mode along with the Text modes. Graphic monitors who can display pictures on its screen, of course it acts like an output device. The monitors which support the following Graphic applications are said to be Graphic Monitors. The Graphics Applications include, 1. Animation Software’s 2. CAD Software’s 3. Drawing programs 4. Paint Application programs 5. Presentation Graphics Software’s (Excel likewise, creating pie and bar charts) 6. Desktop publishing (MS Office, Share points, Document managements) Following are the requirements for graphics monitors. i. a. High Resolution ii. b. High interacting capabilities like monitors with touch sensing system iii. c. High speed processors Some examples of graphics monitors are i. Dual display monitors ii. Large screen monitors(combination of small screen monitors 60 CU IDOL SELF LEARNING MATERIAL (SLM)
3.7 WORKSTATIONS Workstation refers to a group of input and output devices connected to a single computer or multiple computers for a particular task. • Graphics workstation may be group of only interactive graphical input devices or only output devices or a combination of both connected to computer. The main features of work stations are listed below. i. Workstation is also a computer which varies generally with other General Computers ii. Because these Workstations need good operating power of computer. They must be able to support high power i.e. it must sustain good graphic capabilities. iii. These kind of computers comes with the following specifications. Unlike normal general computers they consists of, 1. Minimum of 64 Megabytes of RAM 2. Very good Resolution Graphics screen 3. High and Large Screen 4. GUI Graphical User Interface (which helps programs easier to use of the Computer’s Graphics) 5. Very good Mass storage Device like Disk Drive 6. Built-in Network Support and many factors iv. We may also notice that, some of the workstations do not have any disk drives in it. So these kind of disk drives are called as Diskless workstation. v. Workstations took place of and they lie between Personal computer (General Computers) and minicomputers as far as Computing power is concerned. vi. These can be used as both types such as stand system (which only consists of one) and Local area network. So basically in this LAN kind, workstations are typically connected together one and other. Operating Systems for Workstations The most generally used common operating systems are, Unix UNIX is a multitasking operating system. Unix Operating System are to be written in High level programming language, which we can simply say C language. This Unix Operating System is with very flexible and so most commonly used in Workstations. Windows NT 61 CU IDOL SELF LEARNING MATERIAL (SLM)
Windows NT is also referred as Windows New Technology. It is also a most commonly used Operating system for workstations. This Windows NT highly supports multitasking works and Windows NT has its other versions are such as Windows NT Server and Windows NT Workstation. 3.8 SUMMARY Direct View Storage Tube (DVST). It is similar to random scan but persistent, has no flicker. It can be incrementally updated but not selectively erased and used in analogue storage oscilloscopes. DVST achieves good resolution and possess two electron guns. It has primary gun - for storing the charge(intensity values of present image) in storage grid. It has flood gun to retain the image in the screen. It contains the picture pattern which is to be displayed. In general, innovative activity has tended to follow investment in manufacturing in the FPD industry, but some important innovation continues to occur that is not necessarily located close to manufacturing. Scientists and engineers in East Asia have an important advantage over U.S. scientists and engineers because of the location of manufacturing there; nevertheless, some U.S. firms have remained key participants in the industry and their scientists and engineers have been able to contribute in very important ways to innovation in the industry. Without firms like IBM, Corning, Applied Materials, and Photon Dynamics, the FPD industry would not have been able to solve important scientific and technological problems. While the main benefit to date from innovative activity in this industry has probably been captured mainly by firms and workers in Japan, Korea, and Taiwan, a not insubstantial number of beneficiaries can be found in the United States as well. The nearly 400 workers employed by Corning in its fusion glass facility in Harrodsburg, Kentucky, are an example. A key lesson to be drawn is that U.S. supplier firms that are willing to establish service centres abroad and to work collaboratively with foreign firms wherever the latter are located can remain internationally competitive even in industries where manufacturing is primarily located abroad. Such willingness to collaborate does not necessarily imply the offshoring of formerly U.S.-based R&D, as the cases of Corning, AKT, and Photon Dynamics illustrate. On the contrary, the willingness to collaborate ensures that some important innovative activity will continue to occur in the United States, Any government policies that prevent firms from doing this are likely to be highly counterproductive. U.S. firms have many strengths that derive from the emphasis on government sponsorship of basic research, relatively strict enforcement of competition and intellectual property 62 CU IDOL SELF LEARNING MATERIAL (SLM)
laws, the availability of venture capital for start-ups, and a generally favourable climate for entrepreneurship. If the United States wants to participate in dynamic, globalized industries like the FPD industry, it has to keep its economic nationalists on a short leash. Colour representations in computer systems sometimes use four components to represent each colour. The first three are R G and B and the fourth or alpha value is simply an attenuation of the intensity. This does not add anything further to the representation, but allows greater flexibility in representing colours and can avoid truncation errors at low intensities. It can also be used for providing special features such as masking certain parts of an image. 3.9 KEYWORDS Persistence: Persistence is defined as the time it takes the emitted light from the screen to decay to one-tenth of its original intensity •Resolution: 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, although it is often simply stated as the total number of points in each direction. •Aspect Ratio: This number 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. Bitmap - Frame buffer which holds the intensity values for black and white system. (1 bit per pixel for storing pixel intensity value) Pixmap - Frame buffer which holds the intensity values for colour system. (24 bits/pixel for storing pixel intensity value) 3.10 LEARNING ACTIVITY 1. Create a survey about the recreation happened while using colour CRT monitors in your locality. ___________________________________________________________________________ ___________________________________________________________________________ 2. Create a session about flat panel display used in your area. 63 CU IDOL SELF LEARNING MATERIAL (SLM)
___________________________________________________________________________ ___________________________________________________________________________ 3.11 UNIT END QUESTIONS A. Descriptive Questions Short Questions 1. What is the full form of CRT? 2. What are the two basic techniques for producing colour displays with a CRT? 3. What is beam penetration method 4. Define shadow mask method? 5. What is delta-delta method? Long Questions 1. Explain colour CRT monitor. 2. What do you mean by workstation? 3. Describe about flat panel display. 4. Explain graphic monitors. 5. Explain direct view storage tube. B. Multiple Choice Questions 1. Which can be true regarding Graphics? a. Simulation b. Drawing c. Movies, photographs d. All of these 2. What are the components of Interactive computer graphics? a. Monitor b. Display controller c. Frame buffer d. All of these 3. What is a pixel mask? 64 a. A string containing only 0's CU IDOL SELF LEARNING MATERIAL (SLM)
b. A string containing only 1's c. A string containing two 0's d. A string containing both 1's and 0's 4. Which kind of image does the higher number of pixels gives us? a. Better b. Worst c. Smaller d. None of these 5. Which is the primarily used output device? a. Video monitor b. Scanner c. Speaker d. Printer Answers 1-d,2-d, 3-d, 4-a, 5- 3.12 REFERENCES References Brody. T. P (1996). The birth and early childhood of active matrix, a personal memoir. Journal of the Society* for Information Display (April):1 17. Castellano, J. A. (2005). Litluid GoLd: The Story of Liquid Crystal Displays and rhe Creation of an Industry. Hackensack, N.J.: World Scientific. Hutchison, M. M. (1998). The Political Economy of Jaltanese Monetary Poiic_ri Cambridge: MIT Press. Textbooks Johnstone, B. (i999). We Were Buning: Jaltanese Entrepreneurs and the Forging oJ the Electonic Age. Boulder, CO: Basic Books. Lenway. S. A., T. Murtha, and J. A. Hart, (2000). Techno nationalism and cooperation in a globalizing industry: The case of flat panel displays. ln Coping unitGlobalization, A. Prakash and J. A. Hart, eds. New York: 65 CU IDOL SELF LEARNING MATERIAL (SLM)
Routledge. Kamiya, H., K. Tajima, K. Toriunri, K. Terada, H. Inoue. T. Yokone. N. Shimizu, T. Kobayashi, S. Odahara, G. Hougham, C. Cai, J. H. Glownia, R. J. von Gutfeld, R. John. and S.-C. Alan Lien.(June 2001). Development of one drop fill technology forAM-LCDs. Websites http://money.cnn .cornJ 2005 I | 2/ 02lmarkets/spotlighVspotli ght_glw/. http://findarticles.com/p/articles http://www.glassonweb.com/news/index/4187/. https://www.tutorialandexample.com/display-devices-in-computer-graphics/ 66 CU IDOL SELF LEARNING MATERIAL (SLM)
UNIT - 4 TWO-DIMENSIONAL GRAPHICS PRIMITIVES PART I STRUCTURE 4.0 Learning Objectives 4.1 Introduction 4.2 Points and Lines 4.3 Point Plotting Techniques 4.4 Coordinate System 4.5 Increment Method 4.6 Summary 4.7 Keywords 4.8 Learning Activity 4.9 Unit End Questions 4.10 Reference 4.0 LEARNING OBJECTIVES After studying this unit, you will be able to: Explain about two dimensional graphic primitives. Illustrate about points and lines. Explain about point plotting techniques. Describe about co-ordinate system and increment method. 4.1 INTRODUCTION In vector computer graphics, CAD systems, and geographic information systems, geometric primitive (or prim) is the simplest (i.e. 'atomic' or irreducible) geometric shape that the system can handle (draw, store). Sometimes the subroutines that draw the corresponding objects are called \"geometric primitives\" as well. The most \"primitive\" primitives are point and straight line segment, which were all that early vector graphics systems had. In constructive solid geometry, primitives are simple geometric shapes such as a cube, cylinder, sphere, cone, pyramid, torus. 67 CU IDOL SELF LEARNING MATERIAL (SLM)
Modern 2D computer graphics systems may operate with primitives which are lines (segments of straight lines, circles and more complicated curves), as well as shapes (boxes, arbitrary polygons, circles). A common set of two-dimensional primitives includes lines, points, and polygons, although some people prefer to consider triangles primitives, because every polygon can be constructed from triangles. All other graphic elements are built up from these primitives. In three dimensions, triangles or polygons positioned in three-dimensional space can be used as primitives to model more complex 3D forms. In some cases, curves (such as Bézier curves, circles, etc.) may be considered primitives; in other cases, curves are complex forms created from many straight, primitive shapes. A shape of any of these dimensions greater than zero consists of an infinite number of distinct points. Because digital systems are finite, only a sample set of the points in a shape can be stored. Thus, vector data structures typically represent geometric primitives using a strategic sample, organized in structures that facilitate the software interpolating the remainder of the shape at the time of analysis or display, using the algorithms of Computational geometry.[2] A Point is a single coordinate in a Cartesian coordinate system. Some data models allow for Multipoint features consisting of several disconnected points. A Polygonal chain or Polyline is an ordered list of points (termed vertices in this context). The software is expected to interpolate the intervening shape of the line between adjacent points in the list as a parametric curve, most commonly a straight line, but other types of curves are frequently available, including circular arcs, cubic splines, and Bézier curves. Some of these curves require additional points to be defined that are not on the line itself, but are used for parametric control. A Polygon is a polyline that closes at its endpoints, representing the boundary of a two-dimensional region. The software is expected to use this boundary to partition 2- dimensional space into an interior and exterior. Some data models allow for a single feature to consist of multiple polylines, which could collectively connect to form a single closed boundary, could represent a set of disjoint regions (e.g., the state of Hawaii), or could represent a region with holes (e.g., a lake with an island). A 3D torus prim created in Second Life, an example of a parametric shape A Parametric shape is a standardized two-dimensional or three-dimensional shape defined by a minimal set of parameters, such as an ellipse defined by two points at its foci, or three points at its centre, vertex, and co-vertex. A Polyhedron or Polygon mesh is a set of polygon faces in three-dimensional space that are connected at their edges to completely enclose a volumetric region. In some applications, closure may not be required or may be implied, such as modelling terrain. The software is expected to use this surface to partition 3-dimensional space 68 CU IDOL SELF LEARNING MATERIAL (SLM)
into aninterior and exterior. A triangle mesh is a subtype of polyhedron in which all faces must be triangles, the only polygon that will always be planar, including the Triangulated irregular network (TIN) commonly used in GIS. 4.2 POINTS AND LINES Point plotting is accomplished by converting a single coordinate position furnished by an application program into appropriate operations for the output device. With a CRT monitor, for example, the electron beam is turned on to illuminate the screen phosphor at the selected location Line drawing is accomplished by calculating intermediate positions along the line path between two specified end points positions. An output device is then directed to fill in these positions between the end points Digital devices display a straight line segment by plotting discrete points between the two end points. Discrete coordinate positions along the line path are calculated from the equation of the line. For a raster video display, the line colour (intensity) is then loaded into the frame buffer at the corresponding pixel coordinates. Reading from the frame buffer, the video controller then plots “the screen pixels”. Pixel positions are referenced according to scan-line number and column number (pixel position across a scan line). Scan lines are numbered consecutively from 0, starting at the bottom of the screen; and pixel columns are numbered from 0, left to right across each scan line Figure 4.1: Pixel Positions reference by scan line number and column number To load an intensity value into the frame buffer at a position corresponding to column x along scan line y, setpixel (x, y) To retrieve the current frame buffer intensity setting for a specified location we use a low level function getpixel (x, y 4.3 POINT PLOTTING TECHNIQUES Point plotting techniques have become essential in programming frame buffer displays, where the intensity of each dot must be separately computed. These are based on the Cartesian coordinate system. Points are addressed by their x and y coordinates. The value of x increases from left to right and that of y from bottom to top. 69 CU IDOL SELF LEARNING MATERIAL (SLM)
Points are plotted in response to the digital signals from the computer. This depends on coordinate precision and resolution of the display screen. With 10 bits of x and y coordinate precision, 1024 x 1024 array of positions, are possible where a dot can be displayed (10 bit binary number = 210 = 1024 distinct values). Resolution is the number of visible dots that can be displayed in a given area of the screen. It is usually expressed in terms of dots per inch (dpi). Display screens generally measure about 10 inches square with 100 dpi. The value of 1024 is popular as it makes full use of 10 bit integer coordinates. Displays of different types 4096 x 4096 (12 bit), 256 x 256 (8 bit) are also available. Incremental methods are a form of iterative computation, in which each iterative step is simplified by maintaining a small value of state, or memory about the progress of computation. These methods are useful in generating lines on point plotting displays and also simplify both scan conversion and shading of computer generated pictures of solid objects. For example to draw a line, incremental techniques generate the intermediate points that lie on the line in between start and end points. Straight-line segments are used in computer-generated pictures (like block diagrams, bar charts, graphs, drawings, architectural plans, etc.). Besides curves can be approximated quite effectively by sequences of short straight-line segments. A good line-drawing algorithm should fulfil the following requirements: 1. Lines should appear straight 2. Lines should terminate accurately. 3. Lines should have constant density. 4. Line density should be independent of length and angle. 5. Lines should be drawn rapidly. The vector generation (i.e., the process of turning on the pixels for a line segment) algorithms, which step along the line to determine the pixels, which should be turned on, are sometimes called “Digital Differential Analysers” (DDAs). The DDA generates lines from ordinary differential equations. It works on the principle of incrementing x and y by small steps proportional to the first derivatives of x and y. [A digital differential analyser is a mechanical device for integrating differential equations while simultaneously incrementing the values of x and y in small steps proportional to dx and dy.] In the real world of limited precision displays, a line must be generated within the available addressable points. This can be done by rounding to the nearest integer after each incremental step. Thus a point can be displayed at the resultant x and y. The following line generating methods are all incremental. Each method basically generates two sets of signals that are used to step the x and y coordinates of the point that traces out the line. 70 CU IDOL SELF LEARNING MATERIAL (SLM)
4.4 COORDINATE SYSTEM To define positions of points in space one requires a coordinate system. It is way of determining the position of a point by defining a set of numbers called as coordinates. There are different coordinate systems for representing an object in 2D or 3D. Cartesian Coordinate System It is also known as rectangular coordinate system and can be of two or three dimensions. A point in Cartesian coordinate system can be defined by specifying two numbers, called as x – coordinate and the y – coordinate of that point. Figure 4.2: Cartesian coordinate system In the above figure, there are two points (2, 3) and (3, 2) are specified in Cartesian coordinate system. Polar Coordinate System In polar coordinate system, the position of a point is defined by specifying the distance (radius) from a fixed point called as origin and the angle between the line joining the point and the origin and the polar axis (horizontal line passing through the origin). Figure 4.3: Polar coordinate system - A point (r, θ) in polar coordinates. 71 CU IDOL SELF LEARNING MATERIAL (SLM)
4.5 INCREMENT METHOD DDA is an incremental scan conversion method to determine points on screen to draw a line where the Start and End coordinates of the Line segment are provided. DDA calculates the length of the line segment with respect to the difference between either X coordinates or Y coordinates, whichever is greater. Bresenham's Algorithm is faster than DDA Algorithm in line because it involves only addition & subtraction in its calculation and uses only integer arithmetic. DDA Algorithm is not accurate and efficient as Bresenham's Line Algorithm. 4.6 SUMMARY Digital devices display a straight line segment by plotting discrete points between the two end points. Discrete coordinate positions along the line path are calculated from the equation of the line. For a raster video display, the line colour (intensity) is then loaded into the frame buffer at the corresponding pixel coordinates. Reading from the frame buffer, the video controller then plots “the screen pixels”. Pixel positions are referenced according to scan-line number and column number. Points are plotted in response to the digital signals from the computer. This depends on coordinate precision and resolution of the display screen. With 10 bits of x and y coordinate precision, 1024 x 1024 array of positions, are possible where a dot can be displayed (10 bit binary number = 210 = 1024 distinct values). Straight-line segments are used in computer-generated pictures (like block diagrams, bar charts, graphs, drawings, architectural plans, etc.). Besides curves can be approximated quite effectively by sequences of short straight-line segments. Incremental methods are a form of iterative computation, in which each iterative step is simplified by maintaining a small value of state, or memory about the progress of computation. These methods are useful in generating lines on point plotting displays and also simplify both scan conversion and shading of computer generated pictures of solid objects. The vector generation (i.e., the process of turning on the pixels for a line segment) algorithms, which step along the line to determine the pixels, which should be turned on, are sometimes called“Digital Differential Analysers” (DDAs).The DDA generates lines from ordinary differential equations. It works on the principle of incrementing x and y by small steps proportional to the first derivatives of x and y. In the real world of limited precision displays, a line must be generated within the available addressable points. This can be done by rounding to the nearest integer after each incremental step. Thus a point can be displayed at the resultant x and y. 72 CU IDOL SELF LEARNING MATERIAL (SLM)
Cartesian co-ordinate system is also known as rectangular coordinate system and can be of two or three dimensions. A point in Cartesian coordinate system can be defined by specifying two numbers, called as x – coordinate and the y – coordinate of that point. In polar coordinate system, the position of a point is defined by specifying the distance (radius) from a fixed point called as origin and the angle between the line joining the point and the origin and the polar axis. Bresenham's Algorithm is faster than DDA Algorithm in line because it involves only addition & subtraction in its calculation and uses only integer arithmetic. 4. DDA Algorithm is not accurate and efficient as Bresenham's Line Algorithm. 4.7 KEYWORDS LED - A light-emitting diode is a semiconductor light source that emits light when current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form of photons. DVST- Direct View Storage Tube. An early graphics screen that maintained an image without refreshing. Cartesian co-ordinates - A Cartesian coordinate system in a plane is a coordinate system that specifies each point uniquely by a pair of numerical coordinates, which are the signed distances to the point from two fixed perpendicular oriented lines, measured in the same unit of length. Lines - In geometry, the notion of line or straight line was introduced by ancient mathematicians to represent straight objects with negligible width and depth. Lines are an idealization of such objects, which are often described in terms of two points or referred to using a single letter. Points - A point is a primitive notion that models an exact location in the space, and has no length, width, or thickness. In modern mathematics, a point refers more generally to an element of some set called a space. 4.8 LEARNING ACTIVITY 1. Create a session about Cartesian co-ordinate system. ___________________________________________________________________________ ___________________________________________________________________________ 2. Create a survey about the importance of point plotting techniques. 73 CU IDOL SELF LEARNING MATERIAL (SLM)
___________________________________________________________________________ ___________________________________________________________________________ 4.9 UNIT END QUESTIONS A. Descriptive Questions Short Questions 1. Define the term point. 2. What do you mean by points? 3. What is meant by co-ordinates? 4. What are the various requirement of line-drawing algorithm? 5. What are polar co-ordinates? Long Questions 1. Explain incremental method. 2. Explain co-ordinate systems in computer graphics. 3. Explain the various point plot techniques. 4. Explain the requirements for a good line-drawing algorithm. 5. Explain cartesian co-ordinates system. B. Multiple Choice Questions 1. What can cartesian coordinate system be? a. Left-handed b. Right-handed c. Both lefthanded and righthanded d. None of the above 2. Which are the majority of systems that assign 1 bit in the memory map to one pixel on the display? a. Monochromatic b. Dichromatic c. Polychromatic d. Tri-chromatic 3. How may bits be each byte composed of? 74 CU IDOL SELF LEARNING MATERIAL (SLM)
a. 2 b. 4 c. 8 d. 16 4. Which keyboard do most display terminals provide the users with? a. Alphabetic b. Numeric c. Alphanumeric d. All of these 5. What are two types of graphical interaction? a. Partitioning and positioning b. Partitioned and painting c. Positioning and pointing d. None of the above Answers 1-c, 2-a, 3-c, 4-c, 5-c 4.10 REFERENCES References Brody. T. P (1996). The birth and early childhood of active matrix, a personal memoir. Journal of the Society* for Information Display (April):1 17. Castellano, J. A. (2005). Litluid GoLd: The Story of Liquid Crystal Displays and rhe Creation of an Industry. Hackensack, N.J.: World Scientific. Hutchison, M. M. (1998). The Political Economy of Jaltanese Monetary Poiic_ri Cambridge: MIT Press. Textbooks Johnstone, B. (i999). We Were Buning: Jaltanese Entrepreneurs and the Forging oJ the Electonic Age. Boulder, CO: Basic Books. Lenway. S. A., T. Murtha, and J. A. Hart, (2000). Techno nationalism and cooperation in a globalizing industry: The case of flat panel displays. ln Coping unitGlobalization, A. Prakash and J. A. Hart, eds. New York: 75 CU IDOL SELF LEARNING MATERIAL (SLM)
Routledge. Kamiya, H., K. Tajima, K. Toriunri, K. Terada, H. Inoue. T. Yokone. N. Shimizu, T. Kobayashi, S. Odahara, G. Hougham, C. Cai, J. H. Glownia, R. J. von Gutfeld, R. John. and S.-C. Alan Lien.(June 2001). Development of one drop fill technology forAM-LCDs. Websites http://www.faadooengineers.com/online-study/post/cse/computer-graphics/6/point- plotting http://www.faadooengineers.com/online-study/post/cse/computer-graphics/6/the- incremental-dda-algorithm http://vlabs.iitb.ac.in/vlabs-dev/labs/cglab/experiments/dda-algorithm-pvg/theory.html 76 CU IDOL SELF LEARNING MATERIAL (SLM)
UNIT - 5 TWO-DIMENSIONAL GRAPHICS PRIMITIVES PART II STRUCTURE 5.0 Learning Objectives 5.1 Introduction 5.2 Line Drawing Algorithm: DDA 5.3 Bresenham’s Line Drawing 5.4 Bresenham‘s Circle Drawing Algorithm: Using Polar Co-Ordinates. 5.5 Midpoint Circle Drawing Algorithms 5.6 Summary 5.7 Keywords 5.8 Learning Activity 5.9 Unit End Questions 5.10 References 5.0 LEARNING OBJECTIVES After studying this unit, you will be able to: Explain about line drawing algorithm – DDA. Explain about Bresenham’s line drawing algorithm. Illustrate about Bresenham’s line drawing algorithm. Illustrate the concept of midpoint circle drawing algorithm. 5.1 INTRODUCTION 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. In the following three algorithms, we refer the one point of line as X0, Y0 and the second point of line as X1, Y1. DDA Algorithm Bresenham’s Line Generation Mid-Point Algorithm The Cartesian slope-intercept equation for a straight line is 77 CU IDOL SELF LEARNING MATERIAL (SLM)
y = m . x + b (1) Where m as slope of the line and b as the y intercept Given that the two endpoints of a line segment are specified at positions (x1,y1) and (x2,y2) as in figure we can determine the values for the slope m and y intercept b with the following calculations Figure 5.1: Line Path between endpoint positions (x1,y1) and (x2,y2) m = ∆y / ∆x = y2-y1 / x2 - x1 (2) b= y1 - m . x1 (3) For any given x interval ∆x along a line, we can compute the corresponding y interval ∆ y ∆y= m ∆x (4) We can obtain the x interval ∆x corresponding to a specified ∆y as ∆ x = ∆ y/m (5) For lines with slope magnitudes |m| < 1, ∆x can be set proportional to a small horizontal deflection voltage and the corresponding vertical deflection is then set proportional to ∆y as calculated from Eq (4). For lines whose slopes have magnitudes |m | >1 , ∆y can be set proportional to a small vertical deflection voltage with the corresponding horizontal deflection voltage set proportional to ∆x, calculated from Eq (5) For lines with m = 1, ∆x = ∆y and the horizontal and vertical deflections voltage are equal. 78 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 5.2: Straight line Segment with five sampling positions along the x axis between x1 and x2. 5.2 LINE DRAWING ALGORITHM: DDA The digital differential analyser (DDA) is a scan-conversion line algorithm based on calculation either ∆y or ∆x The line at unit intervals in one coordinate and determine corresponding integer values nearest the line path for the other coordinate. A line with positive slop, if the slope is less than or equal to 1, at unit x intervals (∆x=1) and compute each successive y values as yk+1 = yk + m (6) Subscript k takes integer values starting from 1 for the first point and increases by 1 until the final endpoint is reached. m can be any real number between 0 and 1 and, the calculated y values must be rounded to the nearest integer. For lines with a positive slope greater than 1 we reverse the roles of x and y, (∆y=1) and calculate each succeeding x value as xk+1 = xk + (1/m) (7) Equation (6) and (7) are based on the assumption that lines are to be processed from the left endpoint to the right endpoint. If this processing is reversed, ∆x=-1 that the starting endpoint is at the right yk+1 = yk – m (8) When the slope is greater than 1 and ∆y = -1 with xk+1 = xk-1(1/m) (9) If the absolute value of the slope is less than 1 and the start endpoint is at the left, we set ∆x = 1 and calculate y values with Eq. (6) 79 CU IDOL SELF LEARNING MATERIAL (SLM)
When the start endpoint is at the right (for the same slope), we set ∆x = -1 and obtain y positions from Eq. (8). Similarly, when the absolute value of a negative slope is greater than 1, we use ∆y = -1 and Eq. (9) or we use ∆y = 1 and Eq. (7). Algorithm #define ROUND(a)((int)(a+0.5)) void lineDDA (int xa, int ya, int xb, int yb) { int dx = xb - xa, dy = yb - ya, steps, k; float xIncrement, yIncrement, x = xa, y = ya; if (abs (dx) > abs (dy) steps = abs (dx) ; else steps = abs dy); xIncrement = dx / (float) steps; yIncrement = dy / (float) steps setpixel (ROUND(x), ROUND(y) ) : for (k=0; k<steps;k++) { x+=xIncrement; y+=yIncrement; setpixel (ROUND(x), ROUND9y)); } } Algorithm Description Step 1 : Accept Input as two endpoint pixel positions Step 2: Horizontal and vertical differences between the endpoint positions are assigned to parameters dx and dy (Calculate dx=xb-xa and dy=yb-ya). Step 3: The difference with the greater magnitude determines the value of parameter steps. Step 4 : Starting with pixel position (xa, ya), determine the offset needed at each step to generate the next pixel position along the line path. Step 5: loop the following process for steps number of times a. Use a unit of increment or decrement in the x and y direction b. If xa is less than xb the values of increment in the x and y directions are 1 and m 80 CU IDOL SELF LEARNING MATERIAL (SLM)
c. If xa is greater than xb then the decrements -1 and – m are used. Example : Consider the line from (0,0) to (4,6) 1. xa=0, ya =0 and xb=4 yb=6 2. dx=xb-xa = 4-0 = 4 and dy=yb-ya=6-0= 6 3. x=0 and y=0 4. 4 > 6 (false) so, steps=6 5. Calculate xIncrement = dx/steps = 4 / 6 = 0.66 and yIncrement = dy/steps =6/6=1 6. Setpixel(x,y) = Setpixel(0,0) (Starting Pixel Position) 7. Iterate the calculation for xIncrement and yIncrement for steps(6) number of times 8. Tabulation of each iteration Figure 5.3: Plotting of points 81 Advantages of DDA Algorithm 1. It is the simplest algorithm CU IDOL SELF LEARNING MATERIAL (SLM)
2. It is a is a faster method for calculating pixel positions Disadvantages of DDA Algorithm 1. Floating point arithmetic in DDA algorithm is still time-consuming 2. End point accuracy is poor 5.3 BRESENHAM’SLINE DRAWING An accurate and efficient raster line generating algorithm developed by Bresenham, that uses only incremental integer calculations. In addition, Bresenham’s line algorithm can be adapted to display circles and other curves. 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 unit x intervals. Starting from the left endpoint (x0,y0) of a given line, we step to each successive column (x position) and plot the pixel whose scan-line y value is closest to the line path. To determine the pixel (xk,yk) is to be displayed, next to decide which pixel to plot the column xk+1=xk+1.(xk+1,yk) and .(xk+1,yk+1). At sampling position xk+1, we label vertical pixel separations from the mathematical line path as d1 and d2. The y coordinate on the mathematical line at pixel column position xk+1 is calculated as y =m(xk+1)+b (1) Then d1 = y-yk = m(xk+1)+b-yk d2 = (yk+1)-y = yk+1-m(xk+1)-b To determine which of the two pixel is closest to the line path, efficient test that is based on the difference between the two pixel separations d1- d2 = 2m(xk+1)-2yk+2b-1 (2) A decision parameter Pk for the kth step in the line algorithm can be obtained by rearranging equation (2). By substituting m=∆y/∆x where ∆x and ∆y are the vertical and horizontal separations of the endpoint positions and defining the decision parameter as pk = ∆x (d1- d2) = 2∆y xk.-2∆x. yk + c (3) The sign of pk is the same as the sign of d1- d2,since ∆x>0 Parameter C is constant and has the value 2∆y + ∆x(2b-1) which is independent of the pixel position and will be eliminated in the recursive calculations for Pk. 82 CU IDOL SELF LEARNING MATERIAL (SLM)
If the pixel at yk is “closer” to the line path than the pixel at yk+1 (d1< d2) than decision parameter Pk is negative. In this case, plot the lower pixel, otherwise plot the upper pixel. Coordinate changes along the line occur in unit steps in either the x or y directions. To obtain the values of successive decision parameters using incremental integer calculations. At steps k+1, the decision parameter is evaluated from equation (3) as Pk+1 = 2∆y xk+1-2∆x. yk+1 +c Subtracting the equation (3) from the preceding equation Pk+1 - Pk = 2∆y (xk+1 - xk) -2∆x(yk+1 - yk) But xk+1= xk+1 so that Pk+1 = Pk+ 2∆y-2∆x(yk+1 - yk) (4) Where the term yk+1-yk is either 0 or 1 depending on the sign of parameter Pk This recursive calculation of decision parameter is performed at each integer x position, starting at the left coordinate endpoint of the line. The first parameter P0 is evaluated from equation at the starting pixel position (x0,y0) and with m evaluated as ∆y/∆x P0 = 2∆y-∆x (5) Bresenham’s line drawing for a line with a positive slope less than 1 in the following outline of the algorithm. The constants 2∆y and 2∆y-2∆x are calculated once for each line to be scan converted. Bresenham’s line Drawing Algorithm for |m| < 1 1. Input the two line endpoints and store the left end point in (x0,y0) 2. Load (x0,y0) into frame buffer, i.e. Plot the first point. 3. Calculate the constants ∆x, ∆y, 2∆y 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. Perform step4 ∆x times. Implementation of Bresenham Line drawing Algorithm void lineBres (int xa,int ya,int xb, int yb) 83 CU IDOL SELF LEARNING MATERIAL (SLM)
{ 84 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 > x b ) { x = xb; y = yb; xEnd = xa; } Else { x = xa; y = ya; xEnd = xb; } setPixel(x,y); while(x<xEnd) { x++; if (p<0) p+=twoDy; else { y++; p+=twoDyDx; } setPixel(x,y); CU IDOL SELF LEARNING MATERIAL (SLM)
} } Example : Consider the line with endpoints (20,10) to (30,18) The line has the slope m= (18-10)/(30-20)=8/10=0.8 ∆x = 10 ∆y=8 The initial decision parameter has the value p0 = 2Δy- Δx = 6 and the increments for calculating successive decision parameters are 2Δy=16 2Δy-2 Δx= -4 We plot the initial point (x0,y0) = (20,10) and determine successive pixel positions along the line path from the decision parameter as Figure 5.4: Tabulation and result of Bresenham’s line algorithm 85 CU IDOL SELF LEARNING MATERIAL (SLM)
Advantages Algorithm is Fast Uses only integer calculations Disadvantages It is meant only for basic line drawing. 5.4 BRESENHAM‘S CIRCLE DRAWING ALGORITHM: USING POLAR CO-ORDINATES. Drawing a circle on the screen is a little complex than drawing a line. There are two popular algorithms for generating a circle: Bresenham’s Algorithm and Midpoint Circle Algorithm. These algorithms are based on the idea of determining the subsequent pointsrequired to draw the circle. Let us discuss the algorithms in detail. The equation of circle is X2 + Y2 = r2, where r is radius. Figure 5.5: Bresenham’s circle drawing Algorithm We cannot display a continuous arc on the raster display. Instead, we have to choose the nearest pixel position to complete the arc. From the following illustration, you can see that we have put the pixel at (X, Y) location and now need to decide where to put the next pixel: at N (X+1, Y) or at S (X+1, Y-1). 86 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 5.6: Plotting of pixels This can be decided by the decision parameter d. If d <= 0, then N(X+1, Y) is to be chosen as next pixel. If d > 0, then S(X+1, Y-1) is to be chosen as the next pixel. Algorithm Step 1: Get the coordinates of the centre of the circle and radius, and store them in x, y, and R respectively. Set P=0 and Q=R. Step 2: Set decision parameter D = 3 – 2R. Step 3: Repeat through step-8 while X < Y. Step 4: Call Draw Circle (X, Y, P, Q). Step 5: Increment the value of P. Step 6: If D < 0 then D = D + 4x + 6. Step 7: Else Set Y = Y + 1, D = D + 4(X-Y) + 10. Step 8: Call Draw Circle (X, Y, P, Q). 87 CU IDOL SELF LEARNING MATERIAL (SLM)
Draw Circle Method(X, Y, P, Q). Call Putpixel (X + P, Y + Q). Call Putpixel (X - P, Y + Q). Call Putpixel (X + P, Y - Q). Call Putpixel (X - P, Y - Q) Call Putpixel (X + Q, Y + X). Call Putpixel (X - Q, Y + X). Call Putpixel (X + Q, Y - X). Call Putpixel (X - Q, Y - X). 5.5 MIDPOINT CIRCLE DRAWING ALGORITHMS Step 1: Input radius r and circle centre (xc, yc) and obtain the first point on the circumference of the circle cantered on the origin as (xθ, yθ) = (θ, r) Step 2: Calculate the initial value of decision parameter as P0 = 5/4 – r (See the following description for simplification of this equation.) f(x, y) = x2 + y2 – r2 = θ f(xi – ½ + e, yi + 1) = (xi – ½ + e)2 + yi + 1)2 – r2 = (xi – ½ )2 + (yi + 1)2 – r2+ 2(xi – ½) e + e2 = f(xi – ½ , yi + 1) + 2(xi – ½) e + e2 = θ 88 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 5.7: Plotting of equations 89 CU IDOL SELF LEARNING MATERIAL (SLM)
Step 3: At each XK position starting at K=0, perform the following test: Step 4: Determine the symmetry points in other seven octants. Step 5: Move each calculate pixel position (X, Y) onto the circular path cantered on (XC, YC) and plot the coordinate values. Step 6: Repeat step-3 through 5 until X >= Y 5.6 SUMMARY To draw a line, you need two points between which you can draw a line. In the following three algorithms, we refer the one point of line as X0, Y0 and the second point of line as X1, Y1. For lines whose slopes have magnitudes |m | >1 , ∆y can be set proportional to a small vertical deflection voltage with the corresponding horizontal deflection voltage set proportional to ∆x, calculated from Eq (5) For lines with m = 1, ∆x = ∆y and the horizontal and vertical deflections voltage are equal. In addition, Bresenham’s line algorithm can be adapted to display circles and other curves. 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 unit x intervals. Starting from the left endpoint (x0,y0) of a given line, we step to each successive column (x position) and plot the pixel whose scan-line y value is closest to the line path. DDA stands for Digital Differential Analyzer. It is an incremental method of scan conversion of line. In this method calculation is performed at each step but by using results of previous steps. 90 CU IDOL SELF LEARNING MATERIAL (SLM)
Bresenham's line algorithm is a line drawing algorithm that determines the points of an n-dimensional raster that should be selected in order to form a close approximation to a straight line between two points. In computer graphics, a line drawing algorithm is an algorithm for approximating a line segment on discrete graphical media, such as pixel-based displays and printers. On such media, line drawing requires an approximation (in nontrivial cases). Basic algorithms rasterize lines in one colour. Bresenham's Circle Drawing Algorithm is a circle drawing algorithm that selects the nearest pixel position to complete the arc. The unique part of this algorithm is that is uses only integer arithmetic which makes it, significantly, faster than other algorithms using floating point arithmetic in classical processors. In computer graphics, the midpoint circle algorithm is an algorithm used to determine the points needed for rasterizing a circle. Bresenham's circle algorithm is derived from the midpoint circle algorithm. The algorithm can be generalized to conic sections. The algorithm is related to work by Pitteway and Van Aken. Midpoint Circle Drawing Algorithms - In computer graphics, the midpoint circle algorithm is an algorithm used to determine the points needed for rasterizing a circle. Bresenham's circle algorithm is derived from the midpoint circle algorithm. The algorithm can be generalized to conic sections. The algorithm is related to work by Pitteway and Van Aken. This is an algorithm which is used to calculate the entire perimeter points of a circle in a first octant so that the points of the other octant can be taken easily as they are mirror points; this is due to circle property as it is symmetric about its centre. For this purpose decision parameter is used. It uses the circle function (fcircle(x, y) = x2 + y2 - r2) evaluated at the midpoint between these two pixels. If di < 0, this midpoint is inside the circle and the pixel on the scan line yi is closer to the circle boundary. The midpoint circle drawing algorithm helps us to calculate the complete perimeter points of a circle for the first octant. ... In the algorithm, we will use the 8-way symmetry property. In this algorithm, we define the unit interval and consider the nearest point of the circle boundary in each step. 5.7 KEYWORDS Polar Co-ordinates - The coordinates of a point are a pair of numbers that define its exact location on a two-dimensional plane. Recall that the coordinate plane has two axes at right angles to each other, called the x and y axis. The coordinates of a given point represent how far along each axis the point is located. 91 CU IDOL SELF LEARNING MATERIAL (SLM)
Pixel - The pixel (a word invented from \"picture element\") is the basic unit of programmable colour on a computer display or in a computer image. Think of it as a logical - rather than a physical - unit. A Graphics Interchange Format file, for example, contains a bitmap of an image. Resolution - In computers, resolution is the number of pixels (individual points of colour) contained on a display monitor, expressed in terms of the number of pixels on the horizontal axis and the number on the vertical axis. The sharpness of the image on a display depends on the resolution and the size of the monitor. Algorithm - In mathematics and computer science, an algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of specific problems or to perform a computation. Slope - The slope of a line is the ratio of the amount that y increases as x increases some amount. Slope tells you how steep a line is, or how much y increases as x increases. The slope is constant (the same) anywhere on the line. 5.8 LEARNING ACTIVITY 1. Create a survey about the significance of DDA algorithm. ___________________________________________________________________________ __________________________________________________________________________ 2. Create a session about the importance of Bresenham’s line drawing methods. ___________________________________________________________________________ ___________________________________________________________________________ 5.9 UNIT END QUESTIONS A. Descriptive Questions Short Questions 1. What are advantages of DDA algorithm? 2. Write two advantage of Bresenham’s line drawing 3. What are the disadvantages of DDA Algorithm? 4. Write two disadvantage of Bresenham’s line drawing 5. Define two dimensional graphic. Long Questions 1. Explain about line drawing algorithm – DDA. 92 CU IDOL SELF LEARNING MATERIAL (SLM)
2. Explain about Bresenham’s line drawing algorithm. 3. Illustrate about Bresenham’s line drawing algorithm. 4. Illustrate the concept of midpoint circle drawing algorithm. 5. Explain two dimensional graphic primitives. B. Multiple Choice Questions 1. Which is true with respect to the Bresenham's line drawing algorithm? a. It overcomes the drawbacks of DDA line drawing algorithm b. The DDA algorithm was proposed to overcome the limitations of Bresenham's line drawing algorithm c. Both a. and b. d. None of these 2. Why is the complexity of Bresenham's line drawing algorithm less than that of DDA line drawing algorithm? a. It uses floating point operations over integer addition and subtraction b. It considers only selected ranged inputs c. It uses integer addition and subtraction over floating point operations d. None of these 3. Which property is followed by the Bresenham's algorithm? a. It is an incremental method b. It chooses points randomly c. It uses floating point operations d. All of these 4. Which is true with respect to the Bresenham's algorithm? a. It produces smooth polygons b. The results of this algorithm are 100 percent accurate. c. Due to integer operations, it's complexity gets reduced d. All of these 5. What is the formula for calculating the slope 'm' of a line? 93 a. m = dx / dy b. m = dy / dx CU IDOL SELF LEARNING MATERIAL (SLM)
c. y = mx + c d. None of these Answers 1-a, 2-c, 3-a, 4-c, 5-b 5.10 REFERENCES References Computer Graphics Principles and Practice, J.D. Foley, A Van Dam, S. K. Feiner and R. L. Phillips, Addision Wesley. Principles of Interactive Computer Graphics, William M. Newman, Robert F. Sproull, Tata McGraw-Hill. Introduction to Computer Graphics, J.D. Foley, A. Van Dam, S. K. Feiner, J.F. Hughes and R.L. Phillips, Addision Wesley Textbooks Donald Hearn, M P. Baker Computer Graphics PHI. David F. Rogers Procedural elements of Computer Graphics Tata McGraw Hill. Rajesh K. Maurya Computer Graphics Wiley – India Websites https://www.javatpoint.com/computer-graphics-dda-algorithm. https://www.geeksforgeeks.org/mid-point-circle-drawing-algorithm/ https://www.gatevidyalay.com/mid-point-circle-drawing-algorithm/ 94 CU IDOL SELF LEARNING MATERIAL (SLM)
UNIT -6 TWO-DIMENSIONAL GRAPHICS PRIMITIVES PART III STRUCTURE 6.0 Learning Objectives 6.1 Introduction 6.2 Filled Area Algorithm: Scan Line 6.3 Polygon Filling Algorithms 6.4 Boundary Filled Algorithms 6.5 Summary 6.6 Keywords 6.7 Learning Activity 6.8 Unit End Questions 6.9 References 6.0 LEARNING OBJECTIVES After studying this unit, you will be able to: Describe the concept of two dimensional graphics primitives. Illustrate the concept of filled area algorithm scan line. Explain the concept of polygon filling algorithm. Explain the concept of boundary filled algorithms. 6.1 INTRODUCTION A useful construct for describing components of a picture is an area that is filled with some solid colour or pattern.A picture component of this type is typically referred to as a fill area or a filled area.Any fill-area shape is possible, graphics libraries generally do not support specifications for arbitrary fill shapes. In graphics, primitives are basic elements, such as lines, curves, and polygons, which can be combined to create more complex graphical images.To creative any drawing in the computer these primitives form a part of the software and the type of display to store these in the form of data is important. 95 CU IDOL SELF LEARNING MATERIAL (SLM)
In vector computer graphics, CAD systems, and geographic information systems, geometric primitive (or prim) is the simplest (i.e. 'atomic' or irreducible) geometric shape that the system can handle (draw, store). Sometimes the subroutines that draw the corresponding objects are called \"geometric primitives\" as well. The most \"primitive\" primitives are point and straight line segment, which were all that early vector graphics systems had. In constructive solid geometry, primitives are simple geometric shapes such as a cube, cylinder, sphere, cone, pyramid, torus. Modern 2D computer graphics systems may operate with primitives which are lines (segments of straight lines, circles and more complicated curves), as well as shapes (boxes, arbitrary polygons, circles). A common set of two-dimensional primitives includes lines, points, and polygons, although some people prefer to consider triangles primitives, because every polygon can be constructed from triangles. All other graphic elements are built up from these primitives. In three dimensions, triangles or polygons positioned in three-dimensional space can be used as primitives to model more complex 3D forms. In some cases, curves (such as Bézier curves, circles, etc.) may be considered primitives; in other cases, curves are complex forms created from many straight, primitive shapes. There are two types of 2D Computer graphic, bitmap and vector. A bitmap is a picture made up of lots of tiny dots called pixels and can be edited in Adobe Photoshop. Vector is when the picture is joined on vector paths and shapes are used to create objects. 2D graphics are widely used in animation and video games, providing a realistic, but flat, view of movement on the screen. Animation connects with people on a deep emotional level, evoking instant feelings of nostalgia, humour, and excitement. People simply love seeing animated graphics - so if your company can use them effectively to convey information, customers will pay attention and enjoy the experience. This might leave you wondering: What kind of animation should we use? 2D graphics and 3D graphics are two popular forms - but which is most effective? Here’s a closer look. Defining 2D vs. 3D 2D and 3D Graphics are quite different from one another, in both their creation and their end result. On the most basic level, 2D graphics have height and width, and 3D graphics add a layer of depth which provides an element of realism.People are most familiar with 2D graphics in traditional cartoons. 2D graphics are widely used in animation and video games, providing a realistic, but flat, view of movement on the screen.3D graphics provide realistic depth that allows the viewer to see into spaces, notice the movement of light and shadows, and gain a fuller understanding of what’s being shown. 3D motion graphics work with the brain’s natural tendency to explore what we see and enrich our understanding of the world. How Companies Use 2D and 3D Graphics? 96 CU IDOL SELF LEARNING MATERIAL (SLM)
Companies use motion graphics to educate, entertain, and connect with people on a deeper level. Animation enhances messages, making them much more memorable than simply reading text. Here’s a short list of ways a company can use animated graphics: Title slates, charts, and captions for promotional messages and commercials Animated logos that twist, flip, bounce, or flutter Characters that serve as a mascot for the business Educational and instructional graphics, including training videos Diagrams that show proper assembly Animations that demonstrate a procedure or process Virtual tours and walk-throughs Internal tours that show things otherwise hidden from the human eye Effectiveness of Graphics There’s no question that motion graphics help people learn and remember information. In fact, many people would rather see a video than interact with your brand in any other way. People remember animations 21 days longer than static images and text. 72% of people would rather watch a video about a brand than read text about it. 85% of people wish companies would share more videos, rather than create other types of content. Research has also shown that 3D experiences make people feel more emotional than 2D graphics. When people were shown holographic and virtual reality images during an experiment, they reacted by exclaiming, moving their hands, and even crying. While both 2D and 3D graphics can connect with people on some level, richly-detailed 3D graphics are more effective at communicating complex information and inspiring genuine feelings. They illuminate abstract ideas, providing a much richer experience that feels real. 6.2 FILLED AREA ALGORITHM: SCAN LINE A scan-line fill of a region is performed by first determining the intersection positions of the boundaries of the fill region with the screen scan lines.Then the fill colours are applied to each section of a scan line that lies within the interior of the fill region. The simplest area to fill is a polygon because each scanline intersection point with a polygon boundary is obtained by solving a pair of simultaneous linear equations, where the equation for the scan line is simply y = constant. Scan Line Algorithm 97 CU IDOL SELF LEARNING MATERIAL (SLM)
In scanline filling algorithm, we take the intersection of each scanline with the edges of the polygon. Steps 1. Read n 2. Read (xi,yi) for all i=1,2,3……n 3. Read edges and store it in the array E which will be sorted accordingly to y axies. 4. Xmin=a; xmax=b; ymin=c; ymax=d 5. Take intersection 6. Take the scanline y=c and scan from x=a to x=b 7. Find the intersecting edges of E with y=c by comparing the y coordinate of the end points with y=c 8. Activate those edges 9. Scan through the line y=c and compute the next x position by applying the formulation 10. Xk+1= xk +1/m 11. Check whether the point (Xk+1, Yk) is inside or outside the polygon, by inside outside procedure. If the point (Xk+1, Yk) is inside, paint it. 12. Repeat the procedure from Yc to Yd i.e. y=c to y=d. Here, all the pixels inside the polygon can be painted without leaving any of the neighboring pixels. If the point of intersection of an edge and the scanline is a vertex, we shorten one of the edges. So that it will be contributed to the intersection is 1. If the endpoint of the two edges are on one side of the scan line and the contribution will be 2 if the other points are on the opposite side of the scanline. The scan line filling algorithm can be applied for the curve closed boundary as follows. 1. Determine the pixels position along the curve boundary by using any of the incrementing methods 98 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 6.1: Scan line 2. Filling the pixels by scanning through a scanline which spans between the boundary points. If the shape to be filled is regular geometrical figure like circle, ellipses etc. use symmetric property of geometrical figure to reduce boundary point calculations. 6.3 POLYGON FILLING ALGORITHMS Polygon is an ordered list of vertices as shown in the following figure. For filling polygons with particular colours, you need to determine the pixels falling on the border of the polygon and those which fall inside the polygon. In this chapter, we will see how we can fill polygons using different techniques. Figure 6.2: Polygon Seed Fill To fill a polygon we start with a seed and point the neighboring points till the boundary of the polygon is reached. 99 CU IDOL SELF LEARNING MATERIAL (SLM)
Figure 6.3: Neighbouring Pixels If boundary pixels are not reaching pixels are illuminated one by one and the process is continuing until the boundary points are reached. Here, at every step we need check the boundary. Hence, this algorithm is called “boundary fill algorithm”. To find the neighboring pixels we can use either a 4connected or 8 connected region filling algorithm. The algorithm is recursive one and can be given as follows: Here, we specify the parameters, fore-color by F and back color by B Seed pixel (x,y) Seed_Fill ( x, y, F, B)// 4 connected approach {/ /Seed= getpixel (x,y); If (getpixel(x,y)!= B && getpixel(x,y)!= F) { putpixel (x,y,F); Seed_Fill (x-1, y, F, B); Seed_Fill (x+1, y, F, B); Seed_Fill (x, y-1, F, B); Seed_Fill (x, y+1, F, B); }} getpixel (): is a procedure which gives the color of the specified pixel. 100 CU IDOL SELF LEARNING MATERIAL (SLM)
Search
Read the Text Version
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144
- 145
- 146
- 147
- 148
- 149
- 150
- 151
- 152
- 153
- 154
- 155
- 156
- 157
- 158
- 159
- 160
- 161
- 162
- 163
- 164
- 165
- 166
- 167
- 168
- 169
- 170
- 171
- 172
- 173
- 174
- 175
- 176
- 177
- 178
- 179
- 180
- 181
- 182
- 183
- 184
- 185
- 186
- 187
- 188
- 189
- 190
- 191
- 192
- 193
- 194
- 195
- 196
- 197
- 198
- 199
- 200
- 201
- 202
- 203
- 204
- 205
- 206
- 207
- 208
- 209
- 210
- 211
- 212
- 213
- 214
- 215
- 216
- 217
- 218
- 219
- 220
- 221
- 222