KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

11

Transcript of KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

Page 1: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37
Page 2: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

������� ��� ������� ��� � ���

�� ��� ��

������ ��� ��� ������������� ���

� ���� ������������ ���� �� ���������� �������������� �� �������� �������� �

�������

New Delhi-1100012010

������� �������

Page 3: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

COMPUTER GRAPHICS, MULTIMEDIA AND ANIMATION, Second Edition (with CD-ROM)Malay K. Pakhira

© 2010 by PHI Learning Private Limited, New Delhi. All rights reserved. No part of this bookmay be reproduced in any form, by mimeograph or any other means, without permissionin writing from the publisher.

The author and publisher make no warranty of any kind, expressed or implied, with regard to C programscontained on the CD-ROM. The author and publisher shall not be liable in any event of incidental orconsequential damages in connection with, or arising out of, the furnishing, performance, or use of theseprograms.

ISBN-978-81-203-4127-2

The export rights of this book are vested solely with the publisher.

Fifth Printing (Second Edition) . . . . . . . . . August 2010

Published by Asoke K. Ghosh, PHI Learning Private Limited, M-97, Connaught Circus,New Delhi-110001 and Printed by Mudrak, 30-A, Patparganj, Delhi-110091.

Page 4: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

��� ������ �� �� �� ��

Page 5: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37
Page 6: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

v

Contents

Preface ......................................................................................................................xiiiPreface to the First Edition .......................................................................................... xv

1. INTRODUCTION ...................................................................................................... 1–71.1 Applications of Computer Graphics .................................................................... 11.2 Operations of Computer Graphics ...................................................................... 31.3 Graphics Software Packages ............................................................................... 41.4 Requirements of a Graphical System ................................................................. 51.5 Graphical User Interfaces ................................................................................... 61.6 Questions ............................................................................................................. 6

2. GRAPHICAL INPUT-OUTPUT DEVICES ............................................................ 8–312.1 Graphical Input Devices ..................................................................................... 8

2.1.1 Common Input Devices .......................................................................... 92.1.2 Other Input Devices ............................................................................. 12

2.2 Graphical Output Devices ................................................................................. 132.3 Raster Scan Video Principles ........................................................................... 13

2.3.1 Raster Scan CRT Monitors .................................................................. 152.3.2 Colour Raster Scan Systems ................................................................ 192.3.3 Plasma Panel Display .......................................................................... 242.3.4 LCD Panels .......................................................................................... 252.3.5 Hard Copy Raster Devices .................................................................. 28

2.4 Random Scan Devices ....................................................................................... 282.4.1 Memory Tube Displays ........................................................................ 292.4.2 Plotters ................................................................................................. 30

2.5 Graphic Accelerators and Graphic Co-processors ............................................. 312.6 Questions ........................................................................................................... 31

3. SCAN CONVERSION ........................................................................................... 33–623.1 Scan Conversion ................................................................................................ 33

3.1.1 Scan Conversion Methods .................................................................... 343.2 Polynomial Method ........................................................................................... 34

3.2.1 Polynomial Method for Line ................................................................ 353.2.2 Polynomial Method for Circles ............................................................ 353.2.3 Scan Conversion of Circles using Polar Coordinates ........................... 36

Page 7: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

vi Contents

3.3 DDA Algorithms ............................................................................................... 373.3.1 DDA for a Line ................................................................................... 373.3.2 DDA for Circle Generation .................................................................. 413.3.3 DDA for Ellipse ................................................................................... 413.3.4 DDA for Parabola ............................................................................... 42

3.4 Bresenham’s Algorithms .................................................................................... 433.4.1 Bresenham’s Line Drawing Algorithm ................................................. 443.4.2 Bresenham’s Circle Algorithm ............................................................. 48

3.5 Midpoint Methods ............................................................................................. 513.5.1 Midpoint Line Algorithm ..................................................................... 513.5.2 Midpoint Circle Algorithm .................................................................. 533.5.3 Midpoint Ellipse Algorithm ................................................................. 56

3.6 Problems of Scan Conversion ........................................................................... 603.7 Questions. .......................................................................................................... 62

4. SCAN CONVERSION OF SOLIDS ....................................................................... 63–774.1 Solid Areas or Polygons ................................................................................... 634.2 Inside-Outside Test ............................................................................................ 63

4.2.1 Odd-Even Method ................................................................................ 644.2.2 Winding Number Method ..................................................................... 65

4.3 Solid Area Filling Algorithms .......................................................................... 664.3.1 Boundary Fill Algorithm ..................................................................... 664.3.2 Flood Fill Algorithm............................................................................ 684.3.3 Scan Line Fill Algorithm ..................................................................... 694.3.4 Scan Line Seed Fill Algorithm ............................................................ 704.3.5 Ordered Edge List Algorithm .............................................................. 71

4.4 Questions ........................................................................................................... 77

5 2-D GEOMETRICAL TRANSFORMATIONS ..................................................... 78–1045.1 Some Basic Transformations ............................................................................. 78

5.1.1 Translation ........................................................................................... 795.1.2 Scaling .................................................................................................. 805.1.3 Rotation ............................................................................................... 815.1.4 Transformation of Points and Objects ................................................. 82

5.2 Homogeneous Coordinate System ..................................................................... 835.2.1 Transformations in Homogeneous Notation ......................................... 835.2.2 Inverse of Basic Transformations ......................................................... 845.2.3 Scaling about a Reference Point ......................................................... 865.2.4 Rotation about an Arbitrary Point ..................................................... 89

5.3 Other Transformations ...................................................................................... 935.3.1 Reflection ............................................................................................. 935.3.2 Reflection about any Arbitrary Line ................................................... 955.3.3 Shearing ................................................................................................ 96

5.4 Combined Transformation ................................................................................. 995.4.1 Computational Efficiency ..................................................................... 995.4.2 Visual Reality .................................................................................... 100

Page 8: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

Contents vii

5.5 Inverse of Combined Transformations ............................................................ 1025.6 Questions ......................................................................................................... 103

6. DISPLAY FILES AND SEGMENTS .................................................................. 105–1166.1 Display File. .................................................................................................... 1056.2 Segments. ........................................................................................................ 107

6.2.1 Segment Table .................................................................................... 1076.2.2 Creation of a Segment ....................................................................... 1086.2.3 Deleting a Segment ............................................................................ 1106.2.4 Temporary Segments .......................................................................... 1116.2.5 Setting Transformation Parameters ................................................... 111

6.3 Algorithms for Segment Table and Display File ............................................ 1116.4 Questions. ........................................................................................................ 116

7. 3-D GEOMETRICAL TRANSFORMATIONS ................................................... 117–1317.1 Basic 3-D Transformations .............................................................................. 117

7.1.1 3-D Translation .................................................................................. 1177.1.2 3-D Scaling ......................................................................................... 1187.1.3 3-D Rotation ...................................................................................... 1197.1.4 Rotation about an Arbitrary Axis in Space ..................................... 122

7.2 Other 3-D Transformations ............................................................................. 1277.2.1 3-D Reflection .................................................................................... 1277.2.2 Reflection about any Arbitrary Plane ............................................... 1287.2.3 3-D Shearing ...................................................................................... 130

7.3 Questions. ........................................................................................................ 130

8. PROJECTION .................................................................................................... 132–1558.1 Parallel Projection .......................................................................................... 133

8.1.1 Orthographic Projection .................................................................... 1338.1.2 Axonometric Projection ..................................................................... 1358.1.3 Oblique Projection ............................................................................. 140

8.2 Perspective Projection .................................................................................... 1428.2.1 Standard Perspective Projection ........................................................ 1428.2.2 Vanishing Points ................................................................................ 1458.2.3 General Perspective Projection .......................................................... 1488.2.4 Vanishing Points for General Perspective Projection ....................... 151

8.3 Image Formation Inside a Camera ................................................................. 1528.4 Questions. ........................................................................................................ 154

9. 2-D VIEWING AND CLIPPING ....................................................................... 156–1829.1 Windows and Viewports .................................................................................. 1569.2 Viewing Transformation .................................................................................. 157

9.2.1 Viewing Transformation Matrix ......................................................... 1589.3 Clipping of Lines in 2-D ................................................................................. 160

9.3.1 Cohen–Sutherland Clipping Algorithm............................................... 1609.3.2 Midpoint Subdivision Method ............................................................ 162

Page 9: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

viii Contents

9.4 Concepts of Parametric Clipping .................................................................... 1649.4.1 Liang–Barsky Clipping Algorithm ..................................................... 166

9.5 Generalized 2-D Line Clipping ....................................................................... 1689.5.1 Cyrus–Beck Clipping Algorithm ........................................................ 168

9.6 Polygon Clipping ............................................................................................ 1749.6.1 Sutherland–Hodgman Polygon Clipping ............................................ 175

9.7 Clipping against Concave Windows ................................................................ 1789.8 Questions. ........................................................................................................ 180

10. 3-D VIEWING AND CLIPPING ....................................................................... 183–19710.1 Viewing Transformation Matrix in 3-D .......................................................... 18310.2 Clipping of Lines in 3-D ................................................................................. 186

10.2.1 Cohen–Sutherland Clipping Algorithm in 3-D ................................... 18610.3 Clipping in Homogeneous Coordinates ........................................................... 18810.4 Clipping Using Normalized Windows ............................................................. 188

10.4.1 Liang–Barsky 3-D Clipping Algorithm .............................................. 19010.5 View Volumes and General Normalization Transformation ........................... 19310.6 Questions. ........................................................................................................ 196

11. CURVE DESIGN ................................................................................................ 198–23711.1 Classical Techniques for Designing Curves and Object Surfaces ................... 19811.2 Modern Curve Representations ....................................................................... 20211.3 Mathematics of Parametric Curves ................................................................ 203

11.3.1 Advantages of Parametric Curves ..................................................... 20411.3.2 Parametric Continuity Conditions ..................................................... 20511.3.3 Geometric Continuity Conditions ....................................................... 206

11.4 Lagrange Interpolation Curves ....................................................................... 20711.5 Parametric Spline Curves ............................................................................... 209

11.5.1 Natural Cubic Spline Curves .............................................................. 21111.5.2 Hermite Cubic Spline ......................................................................... 212

11.6 Bézier Curve .................................................................................................... 21411.6.1 Derivation of Cubic Bézier Functions ................................................ 21611.6.2 Drawing Piecewise Continuous Bézier Curves ................................... 21911.6.3 Properties of Bézier Curves ............................................................... 22011.6.4 Rendering Bézier Curves .................................................................... 22011.6.5 Subdividing Bézier Curves .................................................................. 22111.6.6 Invariance of Bézier Curves ............................................................... 221

11.7 B-Spline Curves ............................................................................................... 22111.7.1 Properties of B-spline Curves ............................................................. 22311.7.2 Finding Knot Vectors ......................................................................... 22311.7.3 Calculating Basis Functions ............................................................... 22611.7.4 Alternative Derivation of Uniform Cubic B-splines .......................... 229

11.8 Bézier Surfaces ................................................................................................ 23111.9 Fractal Models ................................................................................................ 232

11.9.1 Fractats .............................................................................................. 23311.9.2 Different Types of Fractals ................................................................ 233

Page 10: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

Contents ix

11.9.3 Fractal Generation Procedure ............................................................ 23411.9.4 Fractal Geometry and Dimension ...................................................... 23411.9.5 Construction of Fractals ..................................................................... 234

11.10 Questions. ........................................................................................................ 236

12. HIDDEN SURFACE ELIMINATION ................................................................. 238–25212.1 Back Face Removal Algorithm ...................................................................... 238

12.1.1 Back Faces Using Dot Product .......................................................... 23812.1.2 Computing Surface Normals .............................................................. 24012.1.3 Insufficiency of Object Space Methods .............................................. 243

12.2 The Z-Buffer Algorithm .................................................................................. 24512.2.1 Incrementally Calculating Depth ....................................................... 248

12.3 Warnock’s Algorithm ...................................................................................... 24912.4 Painter’s Algorithm ........................................................................................ 25012.5 BSP Tree Method............................................................................................ 25112.6 Questions. ........................................................................................................ 252

13. LIGHT, SHADES AND COLOURS ................................................................... 253–29313.1 Modelling Illumination ................................................................................... 253

13.1.1 Illumination Due to Ambient Light .................................................. 25413.1.2 Illumination Due to Point Source ..................................................... 25413.1.3 Specularly Reflected Light ................................................................. 256

13.2 Shading. ........................................................................................................... 25613.2.1 Constant Shading ............................................................................... 25713.2.2 Gourad Shading .................................................................................. 25813.2.3 Phong Shading ................................................................................... 26113.2.4 Determining Surface Normals ............................................................ 263

13.3 Shadow. ........................................................................................................... 26813.4 Assigning Intensity Levels to Grey Shades .................................................... 268

13.4.1 Gamma Correction and Lookup Tables ............................................. 27013.4.2 Creating Grey Shades for Bi-level Displays ...................................... 272

13.5 Concept of Colours ......................................................................................... 27513.5.1 Colour Models for Images .................................................................. 27613.5.2 Classiffication of Colour Models ........................................................ 27713.5.3 Additive vs Subtractive Colour Models ............................................. 280

13.6 CIE Colour Standard ...................................................................................... 28113.6.1 XYZ Colour Model ............................................................................ 28213.6.2 RGB Colour Model ............................................................................ 28313.6.3 CMY Colour Model ........................................................................... 28413.6.4 YIQ Colour Model ............................................................................. 28413.6.5 HSV Colour Model ............................................................................. 28513.6.6 HSI Colour Model .............................................................................. 28813.6.7 YCbCr Colour Model .......................................................................... 28913.6.8 YUV Colour Model ............................................................................ 29013.6.9 CIE L*a*b Model ............................................................................... 292

13.7 Questions. ........................................................................................................ 292

Page 11: KopyKitab · vi Contents 3.3 DDA Algorithms..... 37 3.3.1 DDA for a Line ..... 37

Computer Graphics,Multimedia AndAnimation

Publisher : PHI Learning ISBN : 9788120341272 Author : PAKHIRA, MALAYK.

Type the URL : http://www.kopykitab.com/product/7481

Get this eBook

25%OFF