0% found this document useful (0 votes)
2K views80 pages

COMPUTER GRAPHICS-Skyward

Computer Graphics text book as per nep

Uploaded by

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

COMPUTER GRAPHICS-Skyward

Computer Graphics text book as per nep

Uploaded by

Sanjay Dilip
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 80
COMPUTER GRAPHICS ‘As per the New NEP Syilabus for BCA 5° Semester Course of Bengaluns City University and Bangalore University Authored By Dr, Aruna Devi. C MCA, M.Phil, Ph.D Associate Professor and HOD -BCA, Department of Computer Applications Dayananda Sagar College of Arts, Science and Commerce Bengaluru Skyward Publishers #157, 7h Cros, ea Man Rood, Choma Bengelore-18, Phone: 080-26602595 / 43706620, ‘Mab: 9611195999 Ema skywaregaherd@amelicon Website: wineakyrworepubliherscois [A Text Book of “Computer Grphies™ ~ As_per the New NEP Syllabus for 3 Semester BCA Course of Bengalur City University & Bangalore University by Aruna Devi C. © Author Copy Right: No part ofthis book may be reproduced, stored in a retrieval system, or transmitted, in any {form or by any means, without che previous permission ofthe copyright holders. Every effort has been Imade ta avoid errors or omissions in this publication. In spite of this, some errors might have crept in Any mistake, error oF diserepancy noted may be brought to our notice which shell be taken care in the next edition. The publisher shall not verify the originality, authenticity, ownership, non-infringement of ‘the daca, content, and information. The Authors are the sole ownersof the copyrights ofthe Work. Ieshall be Authors sole responsibility to ensure the lawfulnes of the content and publisher isnot responsible for ‘any copyright issues. cis notified chat publisher will not be responsible for any damage or los of action ‘anyone ofany kind, In any manner, there from all disputes ae subject to Bengaluru Jurisdiction only Disclaimer: Skyward Publishers has exercised due care and caution in collecting all the data before publishing the book. In spite of this, if any omission, inaccuracy or printing error occurs with regards to the data contained in this book, Skyward Publishers will not be held responsible or liable. Skyward Publishers will be grateful for your suggestions which will be of great help for other readers. ISBN : 978 95.95085.95-5, Price = 1501. Pablishedby: Skyward Publishers 1157, Teh Cross, 3rd Main Read, Chamarsjpes, Bengsluru-t8. Phone: 080-26603535 / 000-43706620, Mob: 9611185999 E-mal skyward publishers@gmailcom Wiebste: wwwiskywardpublishers.coin This text book has been written for Computer Science Cours. This text bod is orgonized in such a way that ‘covers the concept of Computer Graphics. ‘As Computer Graphics remains one of the most exciting and rapidly growing in computer fel. Ie is known, commonly used in various applications. In this book students can get abasic understanding of graphics and learn how images are drawn using programming language. This book helpsthe students to earn all the topes fromone text book where covers theall the concep. ‘Chapter 1 deals with Introduction to Computer Graphics then the applications of Computer geaphles and also about various display devices, Chapter 2 deals with the concept of displaying the 2D objects using algorithms and their ateibutes. Chapter 3 deals with two dimensional transformaticns: Chapter 4 deals with viewing ‘ransformation and the concept of clipping used to clip an object. Chapter S deals with 3D coordinate system and their transformations with different display techniques. Chapter 6 deals with segments concepts, Chapter’? eals with ineractive picture construction techniques. Chapter 8 deals withthe diferent graphical Input devies. Applications, Dayananda Sagar College of Arts, Sclence and Commerce, for rndering all help an co-operation necessary for completion of this hook. | wish to express my special thanks to Mr, Srikanth and Skyward Publishers tam for providing this opportunity Your valuable suggestions and comments for further improvernent of the book can be sent to arunatO4@gma Dr. Aruna Devi C Cais ‘Total: 48 Hes Application of computer graphics; Graphic sofware; Video display devices: Raster scan and random scan displays; CRT functioning - Factors affecting CRT; Raster scan system; Color CRT monitors - Display processor with raster system: Raster co-ordinate system Color mapping Instruction set and raster system applications: Line dravving methads-Diceet, DDA and Bresenhams, line attributes, Circle draw Dieet and midpoint circle drawing ~ ellipse drawing-Bresenhams ellipse algorithn-Area filligscantine ares filing and character attributes Geometric transformation; Translation; Rotation; Scaling: = Composite transformation ~ Raster methods for representations; Homogeneous co-ordinates geometric transformations: Reflection and shear matrix Window and viewport; Clipping process - Point clipping, Line elippng, Text clipping, Line clipping techniques -Cohen Sutherland line clipping algorithm, Midpoint subdivision algorithm; Area clipping Sutherland and Hodgman polygon clipping algorithm, Window to view port transformation 3D-Coordinate system; 2D-Display techniques; parallel projections, Perspective projections, Orthogonal projections: 3D-Transformations; Translation, Scaling, Rotation, Reflection: polygon surfaces, polygon tables; Octrees; Hidden surface removal: Depth bulfer anid scan line anethod Introduction to segments, Functions for segmenting, display file, segment attributes, display file compilation, Input Devices: Keyboard, Mouse, Joystick, Touch panels, Track ball, Light pen, Graphic tablets. Positioning techniques, Grid, Consteaints, Dynamic manipulation, Gravity field, Rubber bond, Dragging, Selection technique, Menu, Pointing and selection by naming. Tablet; Data glove; Digitizers Voice systems, 12 13 1a 15 16 7 19 a9 120 hat La 13 14 115 116 uu? 18 CONTENTS Incoduetion LA History of Computer Graphies Applications of Computer Graphics Computer Graphics Classifications Graphics Software How interactive graphics display iors Video Display Devices 1.6.1 Raster Sean Display 1.62. Random Sean Display Cathode Ray Tube (CRT) 1.74 CRT Functioning 1.7.2 Factors afecting CRT Color CRT Monitors 18.1 Beam-Penewation Method 182 Shadow-hesk Method Display Processors 19. RacterSean Systeme 419.2. Random-Sean Systems Color Mapping Instruction St (ther Display Technologies 12 Direct lew Storage Tube (OVST) 1.12.2 Plat Pano Display 1.123 Plasma Pane! 1.12.4 Liquid Crystal Display Outpt Primitives Pointsand Lines Line Drawing Algorihns| LISA. DDA Line Drawing Algorithms L182 Bresenham's Line Algorithn Cirle Generating Algorthan AGL DDA Circle Drawing Algoritho, 1.162 Srosonham's ise Algorthm 1163 Midpoint Gale Algor: lipse Generating Algorithm ‘Ateribates of Output primitces Lit as 16 naa rg Ly iat 121 122 fers Las 125 125 126 123 129 130 1a 136 137 138 naa 12 16 1 bine Atunbates > a4 Surface Rendering 38 se ava ing 2.47 ype and cutaway Views an LAKE Unwaeter Atbates 158°Thiee Dimensional and Stereescopic Views 38 19 Romow Questions 20-Trasiomation, Windowing an 5.35 Diflreace between Poll Perspective Projection 30 ‘34 Three Dimensional Transformation 39 5441 Translation 38 21 Goomet Transformation 5.42 Rotation san 2 Transat 34 3Scaling 23 Pts 344° Reflection as 4 Seating Polygon Surfaces ate 25 ther fassormation atrees a7 281 Retletion 7 curvesand Surfaces 321 252. Shear 7.1 Bester Curves an 2.6 Mate representation and Homogeneous Coordinates 38 ikdden Surface Removal 325 27 Composite Transformation 2.1 Back ace Detection / Removal 326 28 Genera Pivot Point Rotation 1382 Depth Butler Method 327 29. General Fised Point Sealing 29 ScanLine Method 330 2 Raster Method for Teansformaton 3:10 Review Questions 331 211 Viewing Tansformation 7, Hail np bone deans —SSSSCSCS*C~C~“~S~CS*~ Liquid Seystal Diply > Bresenhans Line Algom {> Brosentims inte Ageia, Review Questions 12 1.1 Intraduction Computer Graphies isa picture that is generated by 2 eon ter Graph of producing picture or images using a computer: This include eadeling ~ creation, manipulation, and storage of geometric objects and rendering ~ converting a scene to an image, ot the pracess of transformation sbaclingilursination, and animation ofthe ntage Computer iagery is fou sion, in newspapers, for example in weather reports, oF ia all kinds of meaics! investigation and surgical procedures, The development af camputer graphics has ‘made computers easier to interact with,and better for understanding and interpreting man} lay, we tind computer g business, industry, government, art, entertainment, advertising, education, and taining, rely in the iphies used rout 1.1.1. History of Computer Graphics ‘+ In tho 1950's, the first computer driven display was use! to g te simple pictures. This display used Cathode Ray Tube (CRT). Using dark and light characters, a pieture can be reproduced, 1950: Ben Laposky created the first graphicimages,an Oscilloscope, generated by an electronic (analog) machine. The image was produced by manipulating electronic beams and recording them onto high-speed fil, etd Interactive graphics. One of the worst problems w paecessibility of machines, 1960; William Fetter coins the computer graphics to deseribe new design methods: + Inthe eaely 1970's, outp 1960's, beginnings of modern inceraccive graphics, output ave vector graphics and the cost and Xe startusing raster displays graphiescapabilty was tl falely eunky. + ln the 1990's output are built-in raster graphics, bitmap image snd pixel, Personal computers costs decrease drastically; trackball and mouse becosne tke stanlarl ineractive devices. + i the 1996", since the introduction of MGA and SVGA, personal computer could easily display photo-realistic images and movies. 3D image renderings are become the main advances and kt stimulated cinematic graphics applications 1.2 Applications of Computer Graphics ‘Some of the main applications of computer graphic are given below 1. Computer-aided design 2, Presentation Graphies 3. Computer Art 4. Entertainment 5, Educational and Training 6. Informatian Visualization 7. Image Processing 8. Information graphies 9, Viral Real Computer 1d Design (CAD) is a4 Is useful In various designing fields such as architecture, mechanical and cle siveraf, spacecraft, compoters, textes and many more This isa type of software, which enables users to create rapid and precise drawings and rough sketch ans of iain product pe of computer based soo! usec for drafting aad designing, CAD cal, automobiles, Ta design the applications, objects are rst displayed In 1 -ame display allows the designers to quickly soe the effects of interactive ad wire frameoualine so that the averall shape sand internal features of objects ean be soen. [F Figure 1.1 Wire-frame Model of a Teayot we packages for CAD applications ty enviconment, i, different view of abjects lly provide she designer with muti window In the mechanical fel, it s used for designing various machirery and tools that are useful fr manufacturing purposes, ln the field of electronics, itis used in ma nulacturing process phaaning, digital circutt desi in the feld of architecture, itis used for designing all types of buildings. t enables them to design buildings in 2D and 3D models to give almost areal replica ofthe original work Architects use interactive graphies methods to layout floor pla, that show the positioning of rooms, doors, windows, stars, shelves and other bullding feat res, {48 seul Wt engineering processes in conceptust design, and laying out and analyzing ‘components in manufacturing methods. [2 resostasonGrphicr | Presentation graphics, used to produce illustrations for reports or to generate 35-mm slides or transparencies for use with projectors. It is used to summarize finsncal, statistial, mathematical, ifle, data for research reports and ather types of reports. ‘Typical examples of presentation graphies are bar eharts, line graphs surface graphs, ple charts, and other displ ‘sshowing relationships between multiple parameter sure 1.2 gives examples of two-ditwensional graphics combined with geographical information. This illustration shows bar charts combined onto one graph and a pie chart with three sections. Similar sgraphs and charts can he displaved in three dimensions to provide additional information, F Sibtory unm res a % A My 22% s : ( ¢ & s c\ é 26% Grade 36% Figure 1.2 Two Dimensional Bar Chart and Pie Chart Computer graphies methods are widely used in both fine art and commercial art applications “Artists use a variety of computer methods, including special-purpose hardware, artist's paintbrush programs specially developed software, symbolic mathematics packages. CAD, desktop publishing Software, and animation packages that provide facilites for designing object shapes and specifying ‘object motions. ‘Apaintbrush program that allows artists to “paint” pictures onthe sereen of a video monitor ‘Actually, the picture is usally painted electronically on graphics tablet (digitizer) using & stylus, ‘which ean sirmatate different brosh strokes, brush widths, and colors Fine artists use a variety of other computer technologies to produce images. ‘The artist uses a combination of three-dimensional modeling packages, texture mapping, drawing programs and CAD software “Animations are also used frequerty in advertising, and television commercials are produced frame Trame of the motion is rendered and saved as an image file. The motion of ‘oving abject positions slightly from thelr positions in the previous jmation requires 24 frames for each second by frame, where each ceach frame is simulated by m frames. Phew the frames are transfected to film. Film 2 inthe animation sequence. To playback the animation on. video monitor, 30 frames per second are required. Morphing is another application where one object is transformed into another, This method has been used in TV commercials for example, To turn an oll can into automobile engine, an automobile Into ati Computer graphics methods are used regularly in many movies, TV sees for generating some graphics scene. Some times the graphies object are combined with the acters and live scenes Musi videos use graphics in several ways. Graphics objects can be combined with the live action, or graphics and image processing techniques can be used to produce a transform: fr object into another (morphing). Animation is used frequently in advert commercials [os educationstand Training | Computer graphics techniques is used in education and training. Computer generated models af physical, financial, and economic systems ae often use operation ofthe system. Some examples of simulators used ate «+ Flightsimulator + Automobile driving simulator i television Which can help trainees to understand the + Space Shuttle simulator + Military Tanker simulator For training, special systems are designed, Like the simulators for practice sessions or training of le capt seat errant operas ed ieee prsom Soe simulators have no video sereens, For example: > Aight simulator with only a control pane! for instrument flying, Bu: most simulators provide ‘graphics sereens for visual operation, > Automobile-driving simulator is the simulator usod to investigate the behavior of drivers in critical situations. The drivers’ reactions are then used asa basis for optimizing vehicle design to maximize traffic safe. Ens Information visualization is the interdisciplinary study of “the visual collections of non-numerical information, such 2s files presentation of large-scale lines of code insofware systems, library and bibliographic databases, networks of relations on the internet leis increasingly applied as a critical component in scientific research, digital libraries, data mining, financial data analysis, market studies, manufacturing production control, and drug discovery pee Figure:1.3 Graphic representation ofa minute fraction of the WWW, demonstrating hypertinks Information visualization presumes that “visual representations and interaction techniques take advantage of the human eye's broad bandwidth pathway into the mind to allow users to see, explore, and understand large amounts of information at once. Information visualization focused on the _reation of approaches for conveying abstract information in intuitive ways. Basten Compater graphics ancl image processing are fundamentally different operations. Computer graphics is used to ereate a picture. Image processing on the other hand applies techniques to modify or Interpret existing pletures ‘Two principal applications of image pravessing ate + Improving pietare quality + Machine pereeptioa of visual information, as used in robotics, Inimage processing methods, we first digitize a photograph or other picture into an image fil. Then dligtal methods caw he applied to searrange picture parts, to enhance colar separations, orto improve the quality of sha raphe Systems snd Outpus Patines 17> nageproces: papies re typienllyerminet 1 Mutical oplicatlonsalsomakeestensiveuseu nd cnmnpe ngtechniquestorpictursenhancements Medicine. or example, uses ese techniques to model ane sik’ pica! fonctions, to design aruticial limbs, and to plan and practice surgery: iy Information gzaphies or infographics are graphic visual represenictions of information, data or Imowledze These graphics present comple information quickly andl clear, such as 1 signs, maps, fournaliem, technical vriting ond eccation, With an information zr, eon mathemon process inlarmation, puter scientists, ans, and siatistieians develop and communicate cone: sig a single symbol ta {in newspapers infographics are commonty used 10 show the weather a well as maps Pig. 14 and site plans for newsworthy events, and graphs for statistica me Figure 1.4 A Subway Map ‘Traffic signs au other public signs rely heavily un information graphics, such as stylized human Figures, icons aad emblems to represeat concepts such as yield caution, and the direetion of tafe Public places such as wansie terminals usually have some sort of integrated “signage system” with standardized icons and stylized maps. ag Virtual reatity (VR) is a term that applies to computer-simutated environments that can simulate Places inthe reat world, as wells in imaginary worlds, Most curveat virtual realty environmentsare brimarily visual expertences, displayed ethor on a computer screen or through special stereoscupie displays, but some simulations include additional sensory information, such as sound through speakers or headphones, The simulated environment can be similar tothe real world-—for example, in simulations for pilot Figure 1.5 Classic Virtual Reality HMD with Glove 1.3 Computer Graphics Classifications “The computer grapbies can he eategorized into different variety of ways. These are the following: object (dimenstonality). Type of interaction, + Role ofthe picture. + Relationship herween objects and their pictures saphically a8 abstract or real ‘The picture poet can be represent pe of Object: The ation gan bo 2-D ad 3D type. ‘+ 2D type af object ean be lin gray seale image. > 3-0 type of object can be line drawing (or wireframe), line drawing with various efects, shading color image with varions effects ‘action: It determines te user's degree of contr over the object and its image. + Type oftate Ia ee and stuart desging where the wer tare lack ei the de raster painting, animation, and artwork t applications the drawing is just a representation ofthe object being, + Role of the Picture: wend, For example dr prodict How ever in CAD sosigned or analyzed Grophice Sytam ond Ovinut Pitives + Reiaiiouship betwees Objects and their Picture: his category arises fromm the logical a ‘een abjects an ther pictures. Fv exampk, the user may deal with c {plotting}, oF with sequence af related pictures, or with a collection, pplleations) pe 1.4 Graphics Software in computer graphics, graphics software is a program or collection of programs that enable a person tomanipulate visual Images ana computer {objects (asin CAD ‘There ae two general classifications for graphics software, + General programming packages + Special purpose application packages. spbles era 7 nackages are used in high-level programming Ianguage, stich as Cor FORTRAN. They use a set of yraphies functions to generate picture comparents like Straight lines, polygons, cirles and ather figures, Application grophies packages are designed for nonprogrammers, so that users can generate displays without worrying about how graphics operation works. Example, artist's palating programs and CAD. Some of sraphics sofware: ¥ Photoshop ¥ tilustrater ¥ Corel DRAW Y Microsoft Paint ¥ Pieasa and many more ¥ Paint Shop Pro v The cimP ¥ Digital Image Suite ‘Graphics software is used in many facets of life and business. Some of the common things people use sraphics software for editing and sharing digital photos, creating logos, drawing and modifying clip art creating digital finer, creating Web graphics, designing advertisementsand product packaging, {ouching up scanned photos, and drawing maps orather diagrams. 1.5 How Interactive graphics display works ve graphics display cunsists of throe compen: + Frame Butler or digital memory. + Display Controller or video controler, ‘Television Monitor + Frame Buffer {nthe frame buffer the displayed Image fs stored as.a mexrix of intensity values, + Display Controller: A special purpose processor, called display controller is used to cantol the operation of the display device. The display controller is used! to passes the contents ofthe frame buffer to the “Tre computor Grapes ue image must be passed order to maintain a stead In the frame buffer tive image's stored asa pattern of binary a rectangular array of pixels. piel find white image, we can represent 1 repeatedly to the monitor 30 or ma picture on the screen sal murders which represent is the smallest addressable portion of an image. na black lack pixel as 1's ad white pixel as 0's in the frame busfer: [ Ear | [ [ 1 I | * [ TEE alee | 1 ‘Seccele ‘ 14 3 roo) mates) = ae) a Pas. 7), i L os 6 7 8 9 — Figure 1.6 Grid of Pixels, Frame buffer is the portion of vi ideo card memory that holds the information necessary © Stones Systems ond Output nie > aes aes Te pshbhebRREAHERt eb RER EEE nee |staatestefeste Figure 1.8 Frame Buffer of a Rectangle foaa00900 9901 9600] Igacooon tr rat0n0 Inooorrtt 0000 00 Inout top Gyn001 1 ‘OLOQN19 9000 1000001 19011101 Sean Line Data ie ta eee ioonond9 Orono} 5 say ct Scan Liney Toovonn9 O1Dn000 Taooonno Oionogit s fer determines the resclutien and display a single screen image. The size of the frame bust maximum colors it can display. Frame bufler is a two dimensional table where each row- ‘column stores information about brightness and color values of the corresponding pixel inthe Hiovn000 Hoousie| loo1i7100 over Igonos0t" Yau {00000000 on00%008 screen. Ina frame buffer each pixel can be represented by 1 to 24 bits TEEPE EEE i Becton tb efoystolel Lets) Py p[rewoac] beam (1 m Spor tpoy ers] sole ; Dols] apololt|ijolo ¥ \ f spar a aa a ole {Beton Gun ti ape Taye sfottppol eel ofoTa Oo} oft] af of elalolfefo ‘i estt tele] ef aloe olelipstefet elelele i nae Single Bit Plane CRT Raster Figure 1.7 Display Device with Single Bit Plane Frame Buffer TV Monitor Figure (.9 The frame Buffer Display. ‘The display controller reads the byte of data from the frame buffer and converts its 0's and 1's into corresponding video signal. Theo the signal i transferved to the TV monitor, producing a black ant ‘white pattern on the screen, Suppose we wish to change the displayed picture. We just need to modify the frame hulfer’s contents torepresent the new pattern of pisels, Two problems in drawing curved and straight lines on a graphic display are: ¥ Choice of witich pixe should be black and which pisel is white ¥ Slantinglinesandl curvesin theimagewill be far from smooth and will instead show unpleasant staircase” effec. ‘The first problem is solved by using a procedure, or algorithm, that computes which pixel should be black from the equation af the linear curve {important in displaying pictures. Any display based on the CRT must be reeshed at feast 60 simesa second. ‘The Image must be transmitted to the display point by point. The longer It takes to transmit each clement of the picture the fewer elements can be transmitted and the less information can be displayed, {s transmitted, it will begin flickering, Picwures can be made to Grow, Shrink, Stl the entire ima Rotate by applying the transformations, based'en mathematical techniques: coordinate geometry, Lrigonametry,and matrix methods. Tocreate pictures directly on the display screen, a number of different input devices-light pen, tablet, and mouse have been invented to make this kind oF interaction mote convenient. 1.6 Video Display Devices 1.6.1 Raster Scan Display 6 Phics monitor using a CRT is the raster scan display, based on television technology. hethed ‘© The electron beam is swept across the screen, one row ata time and from top to bottom. As the sam intensity is turned on and off dependent on ation defining the picture to be created. Fig, 1.10 lectron earn moves across each row, th ‘© Picture definition is stored in a memory area called the refresh bufer or frame buffer. This "memory area holds the set of intensity values for all the screen points, Stored intensity values are then retrieved from the refresh buffer and “painted” on the screen one row (scaa line) at ‘2 Each screen pointis relerred to asa pie! or pel. Intensity range for pisel positions depends on the capability ofthe raster system. ‘© Abit value of 1 Indicates that the electron beam isto be turn on at that position, and a value of (O ndicates that the beam intensity isto be of A system with 24 bits per pixel and a screen resolution of 1024 by 1024 requires 3 megabytes ‘of storage forthe frame buffer: On a black-and-white system with one bit per pixel the frame buffer is called a bitmap. For systems wich multiple bits per plxel, the frame butfer Is often referred tos a pixmap. Figure 1.10 Raster Scan Display Refreshing on rasterscan displays is carried out atthe rate of 60 to 80 frames per second, refresh rates are described in units of cycles per second, or Hertz (Hz), where cycle corresponds to une frame. -Atthe end ofach sean line, the electron beam returns tothe leftside ofthe screen to begin displaying the next scan line, The return to the left of the screen, after refreshing each scan tne, i called the Inorizontal retrace ofthe electron beam. Similarly when the electron lam returns to the tup left comer of the screen to bogin the next fram fe cafod vertral retrace SCAN LINE, Horizontal retrac Vertical retrace Figure 1.11 Interlacing Sean Lines on a Raster-scax Display Ti4 Computer Guapice First all points on the even mumbr sean tne isplayed, thew all points along the ocd-numbered ice ane displayed, Invraster-sean systems eacia frame is clisplayed in two passes isi an dateriaced rajresk procedure. The first pass, the beam sweeps across every other scau line frum top to bottom. The seconel pass the vertical retrace, the beam sweeps out the remaining scan lines, interlacing technique the entire screen is scanned in half the time, it would take to siwep avis all the Tines, at once, froma tap to bottom; itis effective method for reducing iekering. ee *+ Decreasing memory costs have made rastersysiems popular + High degree realism is achieved in picture with the akt a advanced shading and hidden surface 1m and Output Pinitves to splay aspect pcre the system ess trough te StF commands in the dss Sara scorn ae ne icon hor brn ro Sane aee tune ofa laure 30t0 60 ines exh second When a pal stot be snatch erences dled to aed tes ate rater than ames pr second Fue cahngof test oflines oud bore othe phosphor Fandorrssanayeteme ore dsigne forlne drawing apeMlonsan canna aly reais sheet been process + Produce smoothie drawings. 1 technigue + Computer monitors and Ts use this method. J (P| Disadvantages of Raster-scan Display ‘The lnes produced are zigagas the plated values are discrote + Resolution is low 1.6.2 Random Scan Display ‘ma random scan display, a CRT has the electron beam directed only to the parts of the screen where a picture is to be drawn, Random sean monitors draw a picture one line at a time are veferted to a8 sector display (or stroke-wrting or calligraphic displays) Fig 4.12 Dicture definition is now stored as a see of lin ds asthe refresh display file or refresh buffer, sawing commands in an area af memory referred to Figure 1.12 Random Scan Systeu Disadvantages of Random Sean Display + Goatien | + Difficale to display realistic scenes Difference between Raster Scan and Random Sean Display ‘i z cae tiiey ae aes Tia Raster scan display the electron beam is| In Random scan display the electron beam [ieee Sa alae eee nee ce Raster Sean Random Sean | Picture definition is stored ina memory area | Picture definition is stored in a memory area eae ara ar) fa il: cad vk ute oeurcs ere sre at felisucactrimensyetues raise | drawing ommands points. ‘Raster displays have less resolution. Random displays have high resolutions since eee the picture definition is stored as a set of j line drawirg commands and not as a set of | intensity values "the lines produced are zig zagas the plotted | Smooth lines are produced as the electron surface technique. = ————___ Decreasing memory ests have made raster | Random scan systens ae generally costes] 1-7 Cathode Ray Tube (CRT) ‘cathode ray tube (CRT) is a vacuum tube in which images are prosuced when an eetvon beam strikes a phosphor-coated surface Phe electron gun generatesa beam of electrons, which passes through foc hat direct the beam toward specified pusitions on the phosphior-coated sere a detection system The phosphor then emits a small spot of ligh each rt al poof ight a each posit contacted y the election beams the ihtemited hy the pesphor des very apy Some mtho snes fr matining the screen pictur, One wy a eth to redraw the picture repeatedly by quickly directing the elect : hisype o dsp seal a ees GT beain back over the same points, 7.1 CRT Functioning cathode ray tube consists of several hasie components: > Heating Metal (Filment) > cathode > Contvol Grid ‘hen electricity is supplied, the filament heats up and a stream or “ray” of electrons pours off the lement into the vacuum, lectron beam touches the screen. : ‘ ae Focusing Electron Cathode “Anode Beam Path — aS Sp oe =e ae) Heating Filament Control Accelerating Gria cet Figure 1.13 Operation ofan Electron Gun tensity of the electron beam Is contrlled by setting voltage levels on the control grid + Abigh negative voltage applied to the control grid will shutoff the beam, 2 Systems end Oui = A smaller negative voltage on the contral grid decreases the nunher af electrons passing through +The brightness of the picture Is controlled by the control grid Focusing System The electron beam fs forced to converge into a small spot on the phosphor coated screen, Otherwise the electron will repel each other: Focusing is done with the help ofa focasing structure containing metal plates t different potentials ‘Acceleration Anode Treconsists of tivo metal plates mounted perpendicular to the beam axis with holes at their centers through which the beam pas. Its maintained at sufficient high relative 2otential to accelerate the beam to necessary veloc Deflection System Deflection system is to change direction. It deflects information rapidly so that it can display elearly fan sereen without flickering. ‘The deflection system contains a set of colls mounted at the neck of the ube. There are two sets of, deflecting plates: horizontal and vertica “The horizontal deflection plates controls the vertical deNecvion. The vertical deflection plates controls horizontal deflection. Vertical ——~\, Phosphor - Deflection \-- Coated Focusing Plates \ Gand base Stem = — ay le = lectron et Beam onnector Electron Hopyontal Pins Gum Deflection Plates Figure 1.14 Electrostatic Deflection of the Electron Beam in a CRT Phosphor ‘The phosphors used in graphic display are chosen for color and persisten-. | The properties are: <8 _ Computer rapier ¥ The persistence whick isthe time i takes tv exit at intensity * fom the sereen to decay to 1/10"of is ¥ Color should be wii he background, Y High efficiency in terms of electric energy converted to ight. ¥ Resistance to burning under prolonged execution especially for application whese dask colored information pears on ‘Tolmprove performance many different phosphors have heen proces, using various compounds of «alelum, cadhnium, and zine together with traces of rare eacth 1.7.2 Factors Affecting CRT ‘The important factor Is the quality ofthe image in computer graphics. The Quality of mage depends bon the following + Resolution + Porsistence, + Addressabilty. + Aspect Ratio, Resolution + Resolution isthe number of pointes ner inch or centimeter that ean be plotted hor vertical tally & + Its nothing but the clarity and sharpness ofthe pleture, + The smaller the spot size, the higher the resolution. + The higher the resolution, the better is dhe graphics system. + High quality resolution is 1280 « 1024 640 x 480 ty Figure 1.15 Screen with 640 » 480 Resolution Size Resolution 13-inch 640% 490 ib ‘300% 600 W7einch 1024 «768, 2tnch 1024768 Table Grovhies Sistem and Ovinus Primitive 19 Persistence Persistence isdefined as the timeilt takes to emit ight from the sereen to decay to 1/10" of ts originat ‘tensity fow long small spots contine to emit tight after the beam Is moved + Lower persistence requites high refresh rate & its good foranimation, + High persistence is useful for displaying highly complex state plewure. + Graphics monitors are usually constructed with 10 to 60 microseconds. adressability © Addressability is a measure ofthe spacing hetween the centers af vertical and hortzantal lines + The picture on a screen consists of intensified points. + The smallest addressable point on the sereen is called pivel ar picture element. + ingraphies mode there are B00%600 pisels ‘Aspect Ratio Aspect ratio gives the ratio between vertical points and horizontal raints necessary to produce equal length ines in both ditections on the screen, Aspoct ratio = 4 means: vertical line with 3 points is equal in length to horizontal line of 4 points 1.8 Color CRT Monitors CRT monitors display colour picture by using combination af phosphors that emit diferent colored light. Cotour CRT monitors use two techniques: © Bean-Penetration method + Shadow-Mask method, 1.8.1 Beam-Penetration Method ‘The beam penetration method for displaying color pictures has been used im random-scan systems. ‘There are tw layers of phosphor; they wre vod ylissplaas ‘the inside ofthe CRT screen. The multilayered phosphor in which a hyer of red phosphor is deposited ‘ochind the initial Ieyer of green phosphor Penetration of Electron beam ‘The color depends on how far the electron beam penetrates into the phosphor layers. + A beam of slow electrons excites only the outer red layer to prchice a red colour + Abeam of very fastolectron penetrates through the red iayerand excites the inner green layer to produce green colour: At intermediate beam speed a combination of re different colours, orange and yellow. i and green light is emitted to shave wo Ciao Computer Graphics [Dlfpicnes tages of Bean * on Method + Probiom with tis method is the need to change the Dea in orderto switch colours canbe displayed «+ only 4 colours are possible. Li + quatry of picture is not god when red touther techniques. {18.2 Shadow-Mask Method ‘Shadow-Mask method are commonly used in raster scan systems, example Colour TV. ‘They produce a much wider range of colours than the Beam Penetration method. A shadow-mask CCRT has three phosphor color dots at each pil postion. One phosphor dot emits a rad light, another emits a green light, and the third emits a blue light. This type of CRT has three electcon guns, one for teach-color dot, and a shadow-mask ged just bohind the phasphor-coated screen. Electron Guns Magnified Phosphor-Dot Triangle Figure 1.16 Shadow mask CRT Armetal shadow mask pierced with small holes, xl behind the phosphor coated sereen. The three ‘electron 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 2 small color spot on the screen. The phosphor dots in the triangles are arranged so that ‘ach electron beam can activate onl its corresponding color dat when it passes through the shadow mask. Different colours are displayed by varying the intensity levels ofthe three electron beams. By turning off the red and green guns, we get only the colour blue. Other combinations of beam intensities produce a small ight spot for each phe position. Crophic Syste ord Output “The color we see depends on the amount of excitation ofthe red, green, and blue phuspnors «© Auwhite (orgray) is produced! by all three dots with equal intensity, + Yellow is proguced with the green and red dots only. + Magenta is produced with the blue and red dots + Cyan is produced when hlue and green are activated equally. tn some low-cost systems, the electron beam can only be set to on or off and it can produce eight alors. More sophisticated systems ean set intermediate intensity levels for the electron produce several million diferent colors. (ee ——— 1.9 Display Processors isan interpreter or pice of hantiare that convert asplay processor cole int pcre. There are ‘so types of display processor + Raster-Scan Display Processor, + Random-Scan Display Processor —— 1.9.1 Raster-Scan Systems Interactive raster graphics systems typically employ several processing units. In ation ro the central processing unlt or CPU, a special-purpose processor, called the video controlier or display controller, is used to control the operation ofthe display device. Organization of Simple Raster System video conirober ‘alter Figure 1.17 Architecture of Raster System with a Display Processor [A Major Task of the Display Processor: « Digitizing a picture definition inan application program into a set of pivel-Intensty values for storage inthe frame butfer «+ Digitizing means simply capturing an analog signal in digital form. + This digitization process is called scan conversion. Comput ee eee + The functions generate various line styles, displaying color a ind performing transformietfons ond manipulations on displayed objects + A fixed area of the systein memory is reserved forthe frame bulla the video controller is given direct access to the frame-bulfer memory. + Frame-buffer locations and the corresponding screen postions are roferenced in Cartesian coordinates + Display processors are typically designed 0 inter input devices, such asa 1.9.2. Random-Scan Systems ‘The organization ofa simple randomy-scan system (sometimes cilled vector sean system). + An application program is input and stored tn the systein memory package. ‘+ Graphics commands in the application program are display file stored in the system memory, ong with a graphics anslated by the graphics package inte x + This display file is then aceessed by the display processor to refresh the screen, «© The display processor Is referred as Display processor unit or graphics controller which goes ehzough ach comesand nthe display fle during every refesh ce I — cu | | sem | Disa L se | ancy a l oe v0 Devices Figure 1.18 Architeviure vf w Simpie Ramon Scan System 1.10 Color Mapping A color model is an abstract mathematical model describing the way colors can be represented as tuples of numbers, typically as three or four values or calor components, A color model is a specification ofa 3-D coordinate system, ‘The different typeof color models + RGB color model + CMY color model. + Yigeulor model RGR CH of ‘he RGB color modelis composed of the primary BA colors Red, Green, an Hite. This system defines ! the color model that Is used in mst color CRT blue} (0,01) ‘monitors and color raster graphics. The RG snoxlel uses the Cartesian coordinate system. This movel is called additive, and the colors interest is cube shown in Fig, 1.19 "RGB Color Model. (RGB values are normalized to 0-1), in Which RGB values are at three corners; cyan, magenta, and yellow are the three other corners, bblac is a& their origin; and white isa the corner facthest from the origi. The primary colors can bbe added to produce the secondary colors Figure 119 RGB Color Model For example - magenta is red plus blue, cyan is green plus blue, and yellow is red plus gréen. The combination of red, green, and blue at full intensities makes white ed fellow Gan Green Blue cyan Magenta (cw meaet Figure 1.20 Primary and Secondary Colors for RGBand CMY Modets. ‘The importance ofthe RGB color model i that i relates very closely to the way that the human eye (2) RGB Model perceives color RGB Is a basle ealor model for computer graphics recause color displays use red green, and blue to create the desired colo. “The CMY color model Fig. 1.21 tsa subset of the RGB color model and is primarily used! in color print production, CMY color model stands for ‘an, magenta, and yellow. The CMY eolor space i subtractive, meaning that cyan, magenta yellow, and blacc pigments or inks are applied tw a white surface to subtract some color from ‘white surface to create the final color, nd Oust Prine. 1.12 Other Display Technologies In gosros ine-trawing display hased on ERT has some disadvant + High cost +The tendency to ticker sehen the display picture is omptes. ‘These two problems led to the development of inherent image storage capability. The most widely used display devices are + Direct View storage Tube (D¥ST] + Liquid Ceystal Displays (LCDs) + Phasina Parl For example - Cyan is white minus red, magenta is white minus green, and yellow is white minus blue, SERIE “Thisis the color model used by the US. Commercial Color Television Broadcasting, [Lisa recodli GB for transunission efficiency and for downward compatibility for black & white television. ‘The YUV color space is “derived from the RGD space. It comprises the luntinance (¥) ad two color «lifference (U, V) components. The luminance can be computed as a weighted sum of red, green and blue components; the color difference, or chromiinaace, components are formed by subtracting Tuminance from blue and from red, Figure 1.21 CMY Color Model 1.11 Instruction Set In onter to provide a flicker-free display, the display processor must execute Ks program 30 to 60 times per second because there Is ao pixmap (pixmap Is for multiple-bit-per-pixel system). Since pixel map refers tothe contents ofthe refresh bufer and tothe buffer memory itself ‘The display processing unit (DPU}, or graphics controller has aa dnstruction set and instruction adress register, which goes through the classic instruction fetch, decode, and execute evcle found inany computer ‘The program executed by the DPU isin main memory which i shared by the general CPU and DPUL he application program and graphics subroutine package alsa reside in main memory and executed on the general CPU. ‘The graphics package creates a display program of DPU instructions and tells the DPU where to start the program. Tre DPU then asynchronously executes the display progeam until i is told to stop by the graphics package. A JUMP instruction at the end of the display program transfers control back to its start, so that the dlisplay continues tobe refreshed without CPU Intervention, 1.12.1 Direct View Storage Tube (OVST) [ERY uses the method of reresh the sereen for the image o seman visible in case of DST i uses tl hnothod! to maintaining a seraen image Isto store the picuare kofarmation inside the CRE “Two electron guns are used ina DYST: + ‘The Primary Gun ~is used to store the picture pattern + Flood Gun - maintains the piture display Advantages of Direct View Storage Tube (DYST) 1 ereshing is needed ery compos pletnes cane spayed 3 ory gh esnhtanns wrist Hicker errr {Gil Disadvantayes of Direct View Storaze Tube (DYST) = They ordinary do lisp coho au tha selected part ot pine canna bere mustbe erseda + Tociminate a pieture section, thee picture redrawn, 1.12.2 Flat Ponel Display Hat Panel aisplays have rectuceu vowune, weight, anil power requirements compared to a CRT. The feature of flat-panel displays is that they are ‘hunner than CRTS as they can be wall mounted Examples are small TV monitors, caleelators, pocket video games, laptop computers, and armrest viewing of movies on airlines, as advertisement boards in elovators. Flat-panel displays a categories a: + Bmissive displays + Noo-emissive displays Figure 1.22 flat sereen TV's G 28 Computer Graphics The emissve dspiays.ave devices that convert electrical energy in light. Plasma Panels one example. The Non-emissive disploys use optical ettee graphs patterns. Exannple i lquid-erystat device. eee 1.12.3 Plasma Panel A plasma display panel (PDP) Isa type of flat panet display common to large TV displays. They are called “plasma” displays hecause the pixels rely on plasma cells sto convert sunlight o light fram Some ather source into iter _>- Magnesium ose Coming Pret rt Pate ise i Fates x Figure 1.23 Plasma Panel Display Te has milions such 25 neo! emit ight. y cells in between two panels of glass, The cells hold a misture of noble gases The gas inthe cells is electrically turned into plasina which then excites phosphors to [tow Piasia Disptays Work? The xenon, neon, and Klint gas i w plasma television fs contained In hundreds of thousands af Uy cols positioned between cwo pats of lass Long alectrodor ae also put together between the glass plate front | and behing the celts. The address electrodes sit beh the cll, along the rear glas plate. The transparent | display electrodes, which ae surrounded hy an insulating heletric material and covered by a magnesium | oxide protective layer, are motnted in front ofthe cl, along the front slass plate As the pas ons rach tothe lectrodes and collide, photons are emitted | |na monocirome plasma panel, the ionizing state can be maintained by applying low-level volage between alte horizontal and vertical electrodes even after the joniing voltage s removed To erase a cel ll wage ‘5 removed froma pal ofelctraes, This ype of panel has inherent memory and docs aot use phosphors, in color panels the back of each els coated with a phospho: The ultraviolet photons emitted bythe plasma fscite these phosphors to give of colored light very piso is made up of three separate sulpisel cells, each with ferent colored phosphors. One subpixet has eed light phosphor one subpine has a green light phosphor and one sutpielhasa blu light phosphor ‘These colorsbend together to create the overall color ofthe piel te sameas shadow mask CRT or color LCD, Brightness is controled by pulse-width modulation Plasma csplays use the some phosphors 3s CRTs which accounts forthe ext production when viewing television or computer video Images. Charscteriatios of Phsina Panel "Plasma deplays are bight having a wide range of cokars 7 Thyhoes veya lnieancr'arroon cle comparctthelter othe mdlaninne |e menace Dayna dls ue a mach power per squnre meter a CHT vse, {72 | advantages of Plasma Pane! 1 Peer eee + Slim profile + Wider viewing angles than those of LCD; images do not suffer frm degradation at hi Leos es ~ Soscbict lagers ska | Geneaty nnn come ie esha | + stscetibe ween glare in bright ooms. + Heavier than LD deo the requirement ofa gl cron tooth pases + tze more lc on average tan an LCD dr 1.12.4 Liquid Grystel Display A liquid crystal display (L£0) is a thin, at eletrone vival dispiay that use the ight modlating Dropertes of gud eystals. Liquid Crystal do not emi light dre. They are used ina wie range ofapplications including: computer monitors, television, instrament panel arf rack dislare, inches signage, etc. They are more compact, lightweight, portable, less eyensive, mote reiable, ‘on tho eyes nd easier Polarize Glass suistrate with IT0 electrodes. Liquid crystals Layer Glass suostrate with common electrode Film (IT0) with horizontal ridges to line up with the horizontal iter 5. Horizontal iter flm 0 block/allow through igh 6, Reflective surface to send light back to Figure 1.24 Schematic diagram of Liquid Crystal Display teach pivet of an LCD typieally consists of a layer ent Los, vn ie patarizing filters, the axes of perpendicular to each other: With no actual liquid erystal between the ‘hes; light passing through the first oud ie blocked by the second (crossed) soluvTaer The surfaces of the electrodes that are we liquid crystal material are ad ign the quid erystal molecules fee yorticwiar direction. Before applying an jmerecligs Pol the orientation of the liguld erystal nel ‘eteratined by the alignment at the + oF olustrodes, Figure 1.25 Sub Pixels of Color LCD dual pixel is divided into three cols, or subpisel, which are coloured red, green, snd blue, respectively, by additional filters, Each subpixel can be controlled independently to yleld thousands or millions of possible colours for each pixel. CRT monitors employ a similar wher stretores vfa phosphors, although the electron beam employed in CRTS do nat hit exact of LCD displays: 4@ Passivesmatrix LOD. © Active-matrix LCD, and packet calculators, dedicated cireut supplies an elzetvie LCD's witha small aummber of segments such as thase used in digital have invidual electrical contacts For each segment. An extern charge to control each segment, This display structure is unwleldy for more than a few display. elements. Each row or column ofthe display has a single electrical circuit. The pixels are addressed a tine ly row and column addresses. This type of display ts called passive-matrix addressed Decause the pixel must retain its state between refreshes without the benefit of a steady electrical ‘Another method for constructing LCD's is to place a transistr at each pixel location, using thin-film ‘wansistor technology, The transistors are used to control the voltage at the pisel locations and to ange {rem gradually feaking out ofthe liquid-crystal cells. These devices are called active reve Difference between CRT and LCD Monitors + CRs are bigand bulky while LED's are thin and light, + CRs consume more power compared to LCD's + A byproduct ofthe power consumption, CRTs also get much hotter compared to LCD's + LCD'S have a greater response time than CRIs Grophice Systems end Output Primitives 1.29" + LcD's ave considerably move expensive than CRTs «chs ean suffer ream deal pivels while CRS do not 1.13 Gutput Primitives A picture i completely specified by the set of intensities for the pixel gasitions in the disp se out of many h ‘ostrct a useful picture on a point plotting display we must bul the pic of pls Lines and curves must he dravn with closely spaced pisels, Polat plotting diet ot use 1m of point coordinates by the computer But the Hickering was butfrs instead where fed with a str Graphics programming packages provide functions to describe a scene fy terms of basic goon structures, referred to as output primitives, Points and straight line segments are the si geometric components of pictures. Additional output primitives that exn be usec! to constrict a pleture include etcles and other conic sections, quadlrie surfaces, spline curves ar olor areas, and character strings. ———_——= 1.14 Points and Lines Pint plotting is a single coordinate position. in a CRT monitor, for example, the electron beat turned onto illuminate the sereen phosphor atthe selected location. Line drawing is hy calculating intermediate positions along the line path between two specified endpoint positions. An outpat device is then directed to fill n these positions between the endpoints, straight line canbe drawn For analog devices, such a¢.a veetor pen plotter ora random-scan display, smoothly from one endpoint to the other Digital devices display a streight Iie szmnent discrete points between the two endpoints, Diserete coordinate pasitiens sions, caleulated from the equation ofthe line =—rral ene For a raster video display, the line color (Intensity) is loaded into the Fame buller at the corresponding piel coorlinates. Reading from the frame bller, the vieo controler then the sereen pixels. A computed line position of (10.48, 2081) for example, would be eo | piel position (20,21) Thus rounding of coordinate values to integers causes ines a twit asta step oppearance "the joggies) | Gee eee lisplayed [Po red t Sean fine no. an column number, To Joat an intensity value | frame butfer at a position corresponding to column x long sean line y 4s kuown us sean conversion line ‘The procedure is setPixel(s,y, intensity) getPisel(sy) 4.15 Line Drawing Algorithms ‘Straight line segments are uses in computer generated pictures. G eral requirement to dravea lines + Lines should appear stenight + Lines should terminate accurately. + Lines should have constant density. + Line donsity should he independent of Une length and angle. + Lines should be drawn rapidly. ‘The Cartesian slope intercept equation fora straight line is fem x0] om Where mistheslope of theline bas the y intercept The ewo endpoints are represented as x,.y,) and (3,9, Slope ofthe fine m is Ye / ee fa @ mh yyintercept 8 b=y,-m.s, ee @ Figure 1.27 Line path between two endpoints For any given x interval dx along a line, we compute the corresponding y interval By y= max 0 Thereforedx= AY (5) These equations form the basis for determining deflection voltages in analog devices + For ines with slope |m |< 1, Axcan be et propartional to 2 small horizontal deflection voltage and the corresponding vertical deflection is then set proportional to Ay as calculated fram Eg. Grophiestystems and Output Primitives LID + Forlines with slope | m |> 1, ay can be set proportional toa small vertical i with the corresponding horizaual deflection voltage set proportional to 3s. cate Eqs sn vokage sted trom + Por lines with m= 1, ay= dy-and the horizontal and vertical defections vol + In each case, a smooth line with slope m is generated between the specified endpoints. equal t Heat las iat ate Figure 1.28 Straight line segments with five sampling positions 1.15.1 DDA Line Drawing Algorithm The digital differential analyzer (ODA) isa scan-conversion line algorithm based on calculating either By or Ax using equation 4 and 6 Steps: ‘We sample the line at unit intervals in one coordinate and determine cosresponding integer values nearest to the line path forthe other coordinate. Consider first a line with positive slope as shown in Fig. 1.27. feat unitx intervals (Ax = 1) and co (6) Slope Less than 1 Figure 1.29 Line with Negative Stepe ‘where 'K’takes integer values starting from 1 for the frst point, and increases by t until the final encipoint is reached. And ‘m’ can be any real number between O and 1 + Ifthe positive sto and compute each successive x vale 3 0 32._Computer ropes Seep 2 ‘Phese Equations 6 and 7 are hased on the slow assumption that lines are to be processed: : een fom the left endyoint to the right endpoint. IF i : this processing is reversed, so that the starting | endpoint isa the right, then ether we have axe-1 withy,y-mand 8) of dys-1 sithy, yes, © & = : tpivel{cound(s) roundly), 15 Advantages of DDA Line Drawing Graphics Systems and OutpuPenitivas 1.33 Y See Dl iesavanages of DDA Line Drovwing eee Tape 2 ood points (My ¥) and Oy ‘calculate a= 8, = 4, amd BY 9, = Yy is! position “The accumulation of round oF eror Is successive addition a the Aoating point ancements fs sed find the ttakelocof time 1 compute the pixel pesiton Step 3: Obtain the munber of eps by uEing the condition [= oom] weer) > absty) then steps = abs(6x) else sens» abs) — ~ 7 Tf at et taal ee nee . a " DDA Line drawing for a line with endpoints (20, 10) and (28, 20) + du/staps ad ySne = 4y/stens so [asa > abstey) 4 seep 5: Plot the sterting point Gx 1) y, | abs (8) > abs(10) fatse | step 6: forbs 2 ko steps Am inccanents of 2 10-10 | ehonsteps=abs(iy) steps = 30 [sep 7) oot the next posot by generating 3 98 Iie assent eenee ey eta 4 ine [ yincsdysttoat)swps, ovine = 10 /40=1 Step 8: for Loop - ser 9: __ Stor 7 att ae? | 20) T ox) oe io 1 Err Er eee eereeeeceee| 7 ios ui ; I po | as 1 weld Ueda int vat 9,80 RARE HD are i 9) ‘ oT j fs ek OP) = or BEEBE 7 fontaine, yy Ae FO é 28 Th ase (sade sa0500) @ 268 sepeobst; ce EZ) 7 1 Coert ase stapesanston: (“~_s “I Candie ae tiiee sincsurs teat) steps; yinesdy {803880085 uipixen{cound(x) round), 2) 5 keatenes Kea) Figare 1:31 DDA Line Drawing Algorithms 134.) Computer Grephies 1.15.2 Bresenham’s Line Algorithm An accurate and efficient raster line-generating algorithm, developed by Bresenlham, scan converts lines using only incremental integer calculations. It entirely implements with integer avthmete, Integer arithmeticismuch faster than loating point. Thisalgorithm doesnotrequireany multiplication or division. 4. ~\ specitea [@lO t Une ath 3 O<[mj 1 step 3: fapent steps T and Bote yo8 * As in the circle Alg, the next positions Pee ‘long the eliptial path i seleced by, a i tuatuting the decision parameter tthe hs tnidpoine With the decision parameter, Mee [Srengz ans = Sune ise pci ie ving pr, noes cae and P,,, we get the decision parameter at Region 1 and Region 2 ml * Decision parameter at Region 1 Figure 1.44 Midpoint between Pixel Sampling Position xk+ 1. calculate frst point a5 Gy. 7) = > 5) seep 2: For repon2y compute initio decsoonparnetr volun 2 Puegeneng ene step 8: AS GOV, posi in eegon 4 wth K= 6, tase the volun of oh, <6 the eye point on hu lie 18 O46 3) a pace DST 82 Siluoray is poo the nent point along the sige $5 (+ 26 = 2) a8 Phase Pht IK, BI, apres eh eae Be Ay BY BI 2 seep 4: uterine symetry pots ip he we 2 trate nts then Seep $1 gett step 3 20 # WADE 25,298 20,7 Suge; fortgion 2, eletate the inal valve ofthe decision piratceresing the 2st (+8) e227 it exch y, position in region 2, fest the value of 92. 1 pd, ca 8 the next point along the eitipse As (=, + 2, ~ 2) and eee eee eer point (x .¥—) of region 1 a5 [Ps otnerwise ## p2, > @, the next point along the ellipse ss (% » Y= 1) and Pays pte r= 20 2d increnont using sare 28 eegton 28x=Osincrement 2%, =72 2Py, nerement-2, ADB unt 28x 3 Region 1 The intial point for region 4 (3.95) = (0,6) gwen pise, Buttcaps, > Round caps, GrophiesSyems and Outpt Pintivos TaP > Prjtng squares > -ngobaned by ajting he nd psn oh conponn paral issn 7 Aa femcrtncscaplyeethoqare end shat are prendre te path, > Round cape Tits obtained by aig» ld secre each but 5 proetiog square Cape: iss bated by extending te ibe anda Bucs that are Tradone on aoftetine with eon te spelen GGG @ ® © Figure 1.4 Thick tines drawn with (a) Butt Caps (b) Rowne Caps (¢} Projection Square Caps Tine Clon, ‘When a system provides color options, a parameter giving the arent color indexis included inthe listof system-attribute values. ‘The ine color value in PHIGS with the function ‘setPolylineColourindex(lo red color choices, are ass [Non-negative integer values corresponds t9 allows ned to the line color parameter Ic. setLinetype (2); setLinewidehSealeactor (2) stPalyineColourindex (5): 1182 Are Filing Séan~Line Algorithm orate ig: Sean ie ing grt wad for ilng pogo aes Ts proce ons he owing % For each scan-line locate the intersection of the scan-line with the edges. ¢ Sontelntrsecon polit Fo eet 5 Cenrtemehue poston long the curvent canbe between Pl erection FE) Competer Grapher points @ Figure 1.45 (2) Interior pixels alonga scan line passing through a polygonarea (b) Example : The polygon is filled for this particular sean line from told andx=18 t024 Draw the interior intersection points pair wise. (a-), (ed) Problem with corners. Same paint counted twice oF not? From fig. 45 a, b, cand dare intersected by 2 line segments each, ‘Some scan line intersecting polygon vertex needs special handling. When a scan-line passes ‘through a vertex, it intersects two polygon edges at that point and hence adds two polats to the ist of interseetions for the scan line. tn fig 1.46, scan line y' intersects the polygon at an ‘ecen number of edges where as scan-line y intersects fve polygon edges we, odd number of ‘edges. Since scan-tine y" generates even number of ncersections, they can be paired to identify correcily the interior pixel spans. olution: 0 determine the correct interior point + Make a clockwise or counter-clockwise traversal on edges, ‘+ Check ify is monotonically increasing or decreasing. + Ifdirection changes, double intersection, otherwise single intersection. fore: Sean iney | Graphics Sysloms and Duipt Primates C189 4 Calculation can be performed by making use of Coherence properties of an image to be displayed. Properties of one part ofa scene are related withthe other in a way that can ft be used to reduce procescing ofthe other 4+ To determine edges intersections, incremental co-ordinate calculation san be performed using the fac that the Slope of the edge is constant from scan Tie to the next EAgd Filing Atirbates Fill an area with a solid color or a patterned fill and chotces forthe particular colors and pattems ‘hese fil options can be applied to polygon regions or to areas defined with curved boundaries. In addition, areas can be painted using various brush styles, colors, and transparency parameters Fill styles: ‘Areas are displayed with three basic fi + Hollow with a color border. «+ Filled with a solid color + Filled with a specified pattern or design, ‘+ Abasic fil style is selected In & PHIGS program with the function setinteriorSiyletts) stylest Values for the fill-style parameter fs include hollow, solid, and pattern &> & Hollow sali Patemed o o @ Figure 1.47 Polygon All styles. Another value for fill sryle is hatch, which is used to ll an area with, selected hatehi parallel lines or crossed lines. Ml CBR Diagonal Ceoss-Hlatch Fill, ing patterns: Diagonal Hatch Fill Figure 1.48 Polygon fill using Hatch Patterns. ples Hollow areas are displayed using only the boundary outline, with the interior color the same as the background colot. A sold fill is displayed in a single color up ta and including the borders of the region, The color for a solid interior or fora hollow area outline is chosen with setinteriorColorindex(fe) i ‘where ill color parameter fe is setto the desired color code, Solid fil aFa region can be accomplished ‘with the scarcline procedures. Other fill options include specifications for the edge type, edge width, and edge color ofa region: ‘These attributes are set independently of the fil style or fill colot, and they provide for the same options as the line-atribute parameters (line type, line width, and line color) That is, we can display area edges dotted or dashed fat or thin, and in any available color regardless of how we have filled the interior. 1.18.3 Cheracter Attributes ‘The appearance of displayed characters is controlled by attributes such + Font (typeface) # Syle # Color # Orientation © Path + Spacing “Attributes can be set both for entire character strings (text) and for individual characters defined as marker symbols lect atrribites. 1 There area many text options that i available to graphics programmers ¢ Fontand siyte + Thetexe can beset with afont (or typeface) suchas New York, Courier Helvetica, London, ‘Times New Roman, + The characters can be set with a font style such as underline, boldface, italics and in ‘outline or shadow styles. A font and associated style (selected in a pmeram hy sttin font parameter tin the function + sae oiaer/nigny | * Alignment: 7 san imegee cade for setTextFone(it) 6 Color settings for displayed text setTexiColorindex(te) where text color parameter ‘tc specifies an allowable color code (6 We can adjust text size by scaling the overall dimensions (height and width) of characters or by scaling only the character width, setCharacterHeight(ch) Graphics Syste end Outpt Primitives C¥51 shmoter lar Figure 1.49 Character Body Parameter ‘ch’ is assigned a real value greater than 0 to set the coordinate height of capital letters. ‘The distance between the bottom line and the top line of the character bod Is the same for all characters in a particular size and typeface, but the body wide may vary. 6 Character’ height Is defined as the distance between the baseline and the cap line of characters. Kerned characters are such as f and J typically extend beyond the character-bedy limits. Height 1 Height 2 Height 3 Figure 1.50 The effect of diferent character height. {4 The width of text can be set with the function ‘set CharacterexpansionFactor(cw) where the character-width parameter width 05 ‘eis sett positive rel value that scales the hody wlth of characters. width 1.0 width 2.0 Figure LS1 The effect of different character width. 4 Spacing between characters is controlled separately with setCharacterSpacing(es) where the character-spacing parameter ‘cs’ can he assigned any real value. ‘The value assigned to cs determines the spacing between characters bodies. Nogative values for cs overlap Spaci character bodies, 0.9 4 Positive values insert space i to spread out the displayed SPACINg O.5 ! characters. 6 The value 0 to es causes text to be displayed with no space between character bodies. Spacing 1.0 Figure 152 Mheffect of diferentcharacer / spacing 4 The erientation for a displayed character strings St acording tothe direction ofthe character up vector: &, rs Figure 1.53 (2) Direction ofup Vector (©) Controt Orientation of Display Text ‘where the text-path parameter ‘ty’ can be assigned the value: right, lef up, of textdisplayed with these four options are shown in fig 154(b). setCharacterUpVector(upvect) Parameter ‘upvect’in this Function is assigned ‘wo values that specify the x and y vector components. For example, with upvect = (1, 1), the direction ofthe up vector is 45 degree and text would be displayed as shovra in Fig, 153, 4 To arrange character strings vertically or horizontally setTextPath(tp) or down. Examples HORIZONTAL TEXT nies sing Figure 1.54 (a) Text path, vertical and horizontal (©) Text display with four text path options, & Alignment tiributes are set with setTextalignment(h, ¥) \where parameters andy’ control horizontal and vertical alignment. Horizontal alignment is set by assigning ha value of ef, centre, or right. Vertical alignment is set by assigning va value of top, cap. half base or botwom, - Top Cap ‘Top Tr Cap z STRING Half : Half }~ Base 7 1 Bottom : Left Center Right - is Base Bottom Left Right Geater © Figure 1.55 Aligament attribute values for horizontal and vertical strings. 6 Marker attribute is « marker symbol for a single character that can 3e displayed in different colors and in diferent sizes, \We selects particular character tobe the marier symbol with ‘where marker type parameter ‘mt’ is set to an integer code. Typical codes for marker type are the integers 1 through 5, specifying, respectively, a dot (}, vertical cross(+), as asterisk(*), a circle (o), ‘anda diagonal erassfs. Displayed marker types are centered on the marker coordinates, ‘We set the marker size with setMarkersizescalePactor(ins) Where parameter marker size ‘ms’ assigned a positive number, Values greater than 1 produce character enlargement; values less than 1 reduce the marker size. Marker colors specified with setPolymarkerColorindex(me) where parameter ‘me’ assigns a color code. Shear & Matrixrepresentation and Homogeneous Coordinates | 2 6 Composite Transformation == a © General Pivot Point Rotation General Fised Point Scaling Raster Method for Transformation mace? . "© Window-to-viewpor® Coordinate transformation 4 Cipping Operstions © oint Clip $ Line Clipping > Cohen Sutherland Line Clipping 2%. Midpoint SubatisionAlgritht ‘Area Clppingor Polygon Clipping > Sutherland Hodgeman Paljgen Clipping TemtChipping © Curve Clipping | 2-# Beerler Gipping | Roview Questions 20Tronsformatin Windowieg ond Clipping “Za > 2.1 Geometric Transformation ‘transformations are one of the primary concepts used in computer graphics for altering or ianipulating the object. Animation is produced by moving the “camera” or the objects ina scene ‘along animation paths. Many applications use the Geometric Transformations to change the j position, orientation, and size of object. ‘The basic geometric transformation are: + Translation + Rotation + Seating Other transformation are: + Reflection + Shear In order to transform an object, we transform the points that define it For example: ++ Polygon: Its vertices. + Circle: Its center and, perhaps, its radius Seana ie a 2.2 Translation ‘translation is applied to an objectby repositioning it alonga straight-line path from one coordinate location to another We translate (oF move) points toa new position by addinga trans 4, and , tothe original coordinate position (x,y) t0a new position (,y") Fig 2 yet k=xet, mmesiie) ‘The transiation distance palr (t,t, is called a translation vector or shift veetor. ‘The translation equation (1) can be expressed asa single matrix equation bv using column vectors. Petit “~ a Figure 2.1 Translating point from position P to position P” with translation vector T. nerarange win enon GOA, 6 oar ENT NET] ew he ne coor te pesitions with the aquaon: fan yor } ‘New Points | Forces) x" 21045 =15, 2 58) [retns) rates, yosaces Gsm | For (18,10) x! =15¢5=20, y'=10+3=13--> (20,13) ‘The new coordinate points are: (20,10) (30, 10), (25,5) : | Figure 2.2 Moving a Polygon trom Position (a) to Position (b) “Translation isa rigid-body transformation that moves objects without deformation. Thats, every paint on the objec translated by the same amount, : ton vector tothe coordinate position of each vex and | esneringto potgonasig the now scr ene ene | Techange the position ofa circle or ellipse we translate the center coordinates and redraw the figure inthe | ev location, i Bvereise 1. Example: Consider a polygon with 4 Coordinate Points (0, 0) (4, 0), (2, 3), (2,1) with a translation distance (t,t as (0,1). Find the new coordinate positions forthe palygon. 2. sample: Consider a triangle with 3 Coordinate Points (20, 0), (60, 0} (40, 100) with s translation distance (, §,) 25 (300, 10).Find the new coordinate positions fr the polygon. HAD computer Grapes ——— 2.3 Rotation ‘A.twordimensional rotation is applied to an object by repositioning it along a circular path in the xy piane, To rotate an object we need to specify a rotation angle 0 and the position (x,,] of the rotation ‘point (or pivot point) about which the objects tobe rotated ‘To rotate a line or polygon, we must rotate each ofits vertices with the same angle 6 Positive values for the rotation angle define counterclockwise rotations about the pivot point and negative values rotate objects in the clockwise direction. “The transformation equations for rotation of a point position P when the pivot point is at the coordinate origin. Inte fig,2.3,ris the constant distance ofthe point P from the origin, angle @ isthe original angular position ofthe point , and @ is the rotation angle. ing standard trigonometric identities, we can express the transformed coordinates in terms of angles 8nd ® as x ercos(+0) = reos bcos 0-rsin® sind ylersin (+9) = reas sind rrsin®cos0 @&y) nl) ‘The original coordinates of the point in polar ‘coordinates are: x=reos®, yersin® Figure 2.3 Rotation a point from position (x,y) to (x7) with angle 8. Sulstitute equation (4) into (3), The transformation equation for rotating a point at position (x,y) ‘with an angle 0 about the origin: oO) ‘With the column vector representation, the rotation equation in the matrix form: [x] _[eose -sine) fx Ly] [sine coso I] 6 Rotations are rgi¢-body transformations that move objects without deformation. 20-Transformaton Wisdowing end Clipping © 23> Astraight lines rotated by applyingthe rotation equations to each ofthe ineendpoints and redraw. the line berween the new endpoint. Polygons are rotated with the rotation angle for each vertex and regenerating the polygon using the new vertices. Curved lines are rotated by repositioning the defining points and redrawing the curves. {Anellipse can be rotated about its center coordinates by rotating the maja and minor axes. dogree. Now find the new coordinate positions with the equation: | x'=xcos0 -ysino | vexsino+y cose | New Coordinate Points For (0,0) x'=0* cos 15-0 sin 15 07 sin 15 +0" cos 15 (00) | For (40) x'=4*c08 15-0" sin 15 | 4 sin 15+0° cos 15 (206,104) | For (2,3) x'=2* cos 15 -3* sin 15 yi 2*sin 15 +3 eos 15 3(116,3, For (2,1) x'=2*cos 15-1 sin 15 y= 2 sin 15-+1* cos 15 (1.67, 1.48) ‘The new coordinate points ate: (0,0), (3.86, 1.04), (1-16, 342), (1.67, 148) | o Figure 2.4 Rotating Polygon with @= 15 degree moo Secereee. 1. Example: Consider a triangle with 3 Coordinate Points (20,0), (60,0), (40, 00) with rotation angle 0 = 485 degree. Find the new coordinate positions forthe triangle

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy