Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
птта , . л ^ я ш н р я | T H I R D E D I T I O N
C i #*% I •
!#•% л«*у1 W\ I I "в С ^ Ш* I — jy* #*% **% ^ ^ I g"% C"" %ьЖ I I I W*J Werl W ^ » * I ^tmnP I ЧыЛ P ^ r I I I ^ ^ » ta^
with OpenGL Donald Hearn M. Pauline Baker Computer Science Department and Pervasive Technology Lab for Visualization and Interactive Spaces Indiana University—Purdue University
PEARSON
Prentice Hall
Upper Saddle River, NJ 07458
1-1 1-2 1-3 1-4 1-5 1-6 1-7 1-8 1-9
1-10
2-1
Preface
A Survey of Computer Graphics Graphs and Charts Computer-Aided Design Virtual-Reality Environments Data Visualizations Education and Training
Computer Art Entertainment
Image Processing Graphical User Interfaces
Summary References
Overview of Graphics Systems Video Display Devices
Refresh Cathode-Ray Tubes Raster-Scan Displays Random-Scan Displays Color CRT Monitors
Flat-Panel Displays Three-Dimensional Viewing Devices Stereoscopic and Virtual-Reality Systems
xix
2 3
5 10 12 19
23 28
31 32 33 33
34 35 36 39 41 42 44 47
48
2-2 <
2-3
2-4
2-5 2-6 2-7 2-8
i
l
t
2-9
1
i
Raster-Scan Systems
• Video Controller • Raster-Scan Display Processor
Graphics Workstations and Viewing Systems Input Devices
• Keyboards, Button Boxes, and Dials
' Mouse Devices • Trackballs and Spaceballs
• Joysticks • Data Gloves • Digitizers
• Image Scanners • Touch Panels ' Light Pens • Voice Systems
Hard-Copy Devices
Graphics Networks Graphics on the Internet Graphics Software
• Coordinate Representations • Graphics Functions • Software Standards
• Other Graphics Packages Introduction to OpenGL
' Basic OpenGL Syntax
• Related Libraries • Header Files • Display-Window Management
Using GLUT A Complete OpenGL Program
50 50 52
54 57 57 57
59 59 60
60 62 64
65 65 66 68 68
69 69 71 72 73 73 74 74
75
76 77
V i : Contents
2-10 Summary References Exercises
Graphics Output Primitives
81 82 82
84 3-16
3-1
3-2
3-3 3-4 3-5
3-6 3-7 3-8 3-9
3-10
3-11
3-12 3-13
3-14 3-15
Coordinate Reference Frames • Screen Coordinates • Absolute and Relative Coordinate
Specifications Specifying a Two-Dimensional World-Coordinate Reference Frame in OpenGL OpenGL Point Functions OpenGL Line Functions Line-Drawing Algorithms
• Line Equations • DDA Algorithm • Bresenham's Line Algorithm • Displaying Polylines
Parallel Line Algorithms Setting Frame-Buffer Values OpenGL Curve Functions Circle-Generating Algorithms
• Properties of Circles • Midpoint Circle Algorithm
Ellipse-Generating Algorithms • Properties of Ellipses • Midpoint Ellipse Algorithm
Other Curves • Conic Sections • Polynomials and Spline Curves
Parallel Curve Algorithms Pixel Addressing and Object Geometry
• Screen Grid Coordinates • Maintaining Geometric Properties
of Displayed Objects Fill-Area Primitives Polygon Fill Areas
• Polygon Classifications • Identifying Concave Polygons • Splitting Concave Polygons
86 86
87
87 88 91 92 93 94 95 99 99
101 102 103 103 105 109 109 110 117 117 119 119
120 120
121 123 124 124 125 125
3-17 3-18 3-19
3-20 3-21 3-22 3-23
3-24
3-25
... _
Ш mm 4-1 4-2
4-3
Splitting a Convex Polygon into a Set of Triangles 127 Inside-Outside Tests 127 Polygon Tables 129 Plane Equations 131 Front and Back Polygon Faces 132 OpenGL Polygon Fill-Area Functions 134 OpenGL Vertex Arrays 139 Pixel-Array Primitives 142 OpenGL Pixel-Array Functions 143 OpenGL Bitmap Function 143 OpenGL Pixmap Function 145 OpenGL Raster Operations 146 Character Primitives 147 OpenGL Character Functions 149 Picture Partitioning 151 OpenGL Display Lists 151 Creating and Naming an OpenGL Display List 151 Executing OpenGL Display Lists 152 Deleting OpenGL Display Lists 153 OpenGL Display-Window Reshape Function 154 Summary 157 Example Programs 160 References 168 Exercises 168
Attributes of Graphics Primitives OpenGL State Variables Color and Gray Scale RGB Color Components Color Tables Gray Scale Other Color Parameters OpenGL Color Functions The OpenGL RGB and RGBA Color Modes OpenGL Color-Index Mode
172
Contents ix
• OpenGL Color Blending 179 • OpenGL Color Arrays 180 • Other OpenGL Color Functions 182
4-4 Point Attributes 183 4-5 Line Attributes 183
• Line Width 183 • Line Style 185 • Pen and Brush Options 186
4-6 Curve Attributes 187 4-7 OpenGL Point-Attribute Functions 189 4-8 OpenGL Line-Attribute Functions 190
• OpenGL Line-Width Function 190 • OpenGL Line-Style Function 190 • Other OpenGL Line Effects 192
4-9 Fill-Area Attributes 193 • Fill Styles 193 • Color-Blended Fill Regions 194
4-10 General Scan-Line Polygon-Fill Algorithm 196
4-11 Scan-Line Fill of Convex Polygons 200 4-12 Scan-Line Fill for Regions with
Curved Boundaries 201 4-13 Fill Methods for Areas with Irregular
Boundaries • Boundary-Fill Algorithm • Flood-Fill Algorithm
4-14 OpenGL Fill-Area Attribute Functions
• OpenGL Fill-Pattern Function • OpenGL Texture and Interpolation
Patterns • OpenGL Wire-Frame Methods • OpenGL Front-Face Function
4-15 Character Attributes 4-16 OpenGL Character-Attribute
Functions 4-17 Antialiasing
• Supersampling Straight-Line Segments
• Subpixel Weighting Masks • Area Sampling Straight Line
Segments • Filtering Techniques • Pixel Phasing • Compensating for Line-Intensity
Differences 218
• Antialiasing Area Boundaries
4-18 OpenGL Antialiasing Functions
4-19 OpenGL Query Functions 4-20 OpenGL Attribute Groups 4-21 Summary
References Exercises
5-1
5-2
201 201 205
205 206
207 207 210 211
213 214
215 217
217 217 218
5-3 5-4
Geometric Transformations Basic Two-Dimensional Geometric Transformations Two-Dimensional Translation Two-Dimensional Rotation Two-Dimensional Scaling Matrix Representations and Homogeneous Coordinates Homogeneous Coordinates Two-Dimensional Translation Matrix Two-Dimensional Rotation Matrix Two-Dimensional Scaling Matrix Inverse Transformations Two-Dimensional Composite Transformations Composite Two-Dimensional Translations Composite Two-Dimensional Rotations Composite Two-Dimensional Scalings General Two-Dimensional Pivot-Point Rotation General Two-Dimensional Fixed-Point Scaling General Two-Dimensional Scaling Directions Matrix Concatenation Properties General Two-Dimensional Composite Transformations and Computational Efficiency
219
221 222 223 224 226 227
230 232 232 234 236
237 238
239
239
239 240
241
241
241
242
242
243
244 244
245
С
Contents
5-5
5-6
5-7
5-8
5-9
5-10
5-11
5-12 5-13
5-14
5-15
5-16 5-17
5-18
Two-Dimensional Rigid-Body Transformation Constructing Two-Dimensional Rotation Matrices Two-Dimensional Composite-Matrix Programming Example Other Two-Dimensional Transformations Reflection Shear Raster Methods for Geometrie Transformations OpenGL Raster Transformations Transformations Between Two-Dimensional Coordinate Systems Geometrie Transformations in Three-Dimensional Space Three-Dimensional Translation Three-Dimensional Rotation Three-Dimensional Coordinate-Axis Rotations General Three-Dimensional Rotations Quaternion Methods for Three-Dimensional Rotations Three-Dimensional Scaling Composite Three-Dimensional Transformations Other Three-Dimensional Transformations Three-Dimensional Reflections Three-Dimensional Shears Transformations Between Three-Dimensional Coordinate Systems Affine Transformations OpenGL Geometrie-Transformation Functions Basic OpenGL Geometrie Transformations OpenGL Matrix Operations OpenGL Matrix Stacks OpenGL Geometrie-Transformation Programming Examples Summary
247
248
248 "* ^
253 253 6 _ 1
255 6-2
257
258 6-3
259
261 262
263 i
264 6-4
266
272
275
278
281 281 281
282 283
283
284 285 287
288 291
References Exercises
Two-Dimensional Viewing The Two-Dimensional Viewing Pipeline The Clipping Window
Viewing-Coordinate Clipping Window
• World-Coordinate Clipping Window Normalization and Viewport Transformations
• Mapping the Clipping Window into a Normalized Viewport
• Mapping the Clipping Window into a Normalized Square
• Display of Character Strings • Split-Screen Effects and Multiple
Output Devices OpenGL Two-Dimensional Viewing Functions
• OpenGL Projection Mode • GLU Clipping-Window Function • OpenGL Viewport Function • Creating a GLUT Display Window
- Setting the GLUT Display-Window Mode and Color
• GLUT Display-Window Identifier • Deleting a GLUT Display Window • Current GLUT Display Window • Relocating and Resizing a GLUT
Display Window • Managing Multiple GLUT Display
Windows * GLUT Subwindows • Selecting a Display-Window
Screen Cursor Shape • Viewing Graphics Objects in a GLUT
Display Window • Executing the Application Program
' Other GLUT Functions • OpenGL Two-Dimensional Viewing
Program Example
293 293
296
297
299
300 300
301
301
303 305
305
305 306 306 307 307
308 309 309 309
309
310 311
311
311 312
312
313
Contents xi
6-5 6-6 6-7
6-8
6-9 6-10 6-11
В швшя 7-1
7-2
7-3
Clipping Algorithms Two-Dimensional Point Clipping Two-Dimensional Line Clipping
• Cohen-Sutherland Line Clipping • Liang-Barsky Line Clipping • Nichol-Lee-Nichol Line Clipping • Line Clipping Using Nonrectangular
Polygon Clip Windows • Line Clipping Using Nonlinear
Clipping-Window Boundaries Polygon Fill-Area Clipping
• Sutherland-Hodgman Polygon Clipping
• Weiler-Atherton Polygon Clipping • Polygon Clipping Using
Nonrectangular Polygon Clip Windows
• Polygon Clipping Using Nonlinear Clipping-Window Boundaries Curve Clipping Text Clipping Summary References Exercises
1 Three-Dimensional Viewing Overview of Three-Dimensional Viewing Concepts
• Viewing a Three-Dimensional Scene
• Projections • Depth Cueing • Identifying Visible Lines and
Surfaces • Surface Rendering • Exploded and Cutaway Views • Three-Dimensional and Stereoscopic
Viewing The Three-Dimensional Viewing Pipeline Three-Dimensional Viewing-Coordinate Parameters
• The View-Plane Normal Vector
315 315 316 317 322 325
328
329 329
331 335
337
338 338 339 340 342 343
344
345
345 346 346
347 348 348
348
348
351 351
• •
•
7-4
7-5 7-6
•
1-1
7-8
7-9
• The View-Up Vector 352 • The uvn Viewing-Coordinate
Reference Frame 353 Generating Three-Dimensional Viewing Effects 353 Transformation from World to Viewing Coordinates 355 Projection Transformations 356 Orthogonal Projections 357 Axonometrie and Isometric Orthogonal Projections 358 Orthogonal Projection Coordinates 358 Clipping Window and Orthogonal-Projection View Volume 359 Normalization Transformation for an Orthogonal Projection 360 Oblique Parallel Projections 362 Oblique Parallel Projections in Drafting and Design 362 Cavalier and Cabinet Oblique Parallel Projections 364 Oblique Parallel-Projection Vector 364 Clipping Window and Oblique Parallel-Projection View Volume 366 Oblique Parallel-Projection Transformation Matrix 366 Normalization Transformation for an Oblique Parallel Projection 367 Perspective Projections 368 Perspective-Projection Transformation Coordinates 368 Perspective-Projection Equations: Special Cases 369 Vanishing Points for Perspective Projections 370 Perspective-Projection View Volume 371 Perspective-Projection Transformation Matrix 373 Symmetric Perspective-Projection Frustum 374 Oblique Perspective-Projection Frustum 378 Normalized Perspective-Projection Transformation Coordinates 380 The Viewport Transformation and Three-Dimensional Screen Coordinates 382
xii Contents
7-10
7-11
7-12
7-13
OpenGL Three-Dimensional Viewing Functions
• OpenGL Viewing-Transformation Function
• OpenGL Orthogonal-Projection Function
• OpenGL Symmetric Perspective-Projection Function
• OpenGL General Perspective-Projection Function
• OpenGL Viewports and Display Windows
• OpenGL Three-Dimensional Viewing Program Example Three-Dimensional Clipping Algorithms
• Clipping in Three-Dimensional Homogeneous Coordinates
• Three-Dimensional Region Codes • Three-Dimensional Point and Line
Clipping • Three-Dimensional Polygon
Clipping • Three-Dimensional Curve Clipping • Arbitrary Clipping Planes
OpenGL Optional Clipping Planes
Summary References Exercises
383
383
384
386
386
387
387
389
389 390
391
394
395 395 397
398 400
400
8-3 8-4
Three-Dimensional Object Representations Polyhedra OpenGL Polyhedron Functions OpenGL Polygon Fill-Area Functions GLUT Regular-Polyhedron Functions Example GLUT Polyhedron Program Curved Surfaces Quadric Surfaces Sphere Ellipsoid Torus
402
8-5
8-6
8-9
8-10
404 404 404
404
406 408 408
408 408 409
8-11 8-12
8-13 8-14
Superquadrics 410 Superellipse 410 Superellipsoid 411 OpenGL Quadric-Surface and Cubic-Surface Functions 411 GLUT Quadric-Surface Functions 412 GLUT Cubic-Surface Teapot Function 413 GLU Quadric-Surface Functions 414 Example Program Using GLUT and GLU Quadric-Surface Functions 416 Blobby Objects 418 Spline Representations 420 Interpolation and Approximation Splines 420 Parametric Continuity Conditions 421 Geometric Continuity Conditions 422 Spline Specifications 423 Spline Surfaces 424 Trimming Spline Surfaces 424 Cubic-Spline Interpolation Methods 425 Natural Cubic Splines 426 Hermite Interpolation 426 Cardinal Splines 429 Kochanek-Bartels Splines 431 Bezier Spline Curves 432 Bezier Curve Equations 433 Example Bezier Curve-Generating Program 435 Properties of Bezier Curves 437 Design Techniques Using Bezier Curves 438 Cubic Bezier Curves 439 Bezier Surfaces 441 B-Spline Curves 442 B-Spline Curve Equations 442 Uniform Periodic B-Spline Curves 444 Cubic Periodic B-Spline Curves 447 Open Uniform B-Spline Curves 448 Nonuniform B-Spline Curves 451 B-Spline Surfaces 452 Beta Splines 452 Beta-Spline Continuity Conditions 452
Contents Л i 11
• Cubic Periodic Beta-Spline Matrix Representation 453
3-15 Rational Splines 454 3-16 Conversion Between Spline
Representations 3-17 Displaying Spline Curves and
Surfaces • Horner's Rule • Forward-Difference Calculations • Subdivision Methods
3-18 OpenGL Approximation-Spline Functions 461
• OpenGL Bezier-Spline Curve Functions 462
• OpenGL Bezier-Spline Surface Functions
• GLU B-Spline Curve Functions • GLU B-Spline Surface Functions • GLU Surface-Trimming Functions
3-19 Sweep Representations 3-20 Constructive Solid-Geometry
Methods 3-21 Octrees 3-22 BSP Trees 3-23 Fractal-Geometry Methods
Fractal Generation Procedures Classification of Fractals Fractal Dimension Geometric Construction of Deterministic Self-Similar Fractals 484 Geometric Construction of Statistically Self-Similar Fractals 487 Affine Fractal-Construction Methods 489 Random Midpoint-Displacement Methods 490 Controlling Terrain Topography 493 Self-Squaring Fractals 495 Self-Inverse Fractals 506
8-24 ' Shape Grammars and Other Procedural Methods 507
8-25 Particle Systems 510 8-26 Physically Based Modeling 511 8-27 Visualization of Data Sets 514
• Visual Representations for Scalar Fields 514
• Visual Representations for Vector Fields 517
• Visual Representations for Tensor Fields 519
456
457 457 458 459
8-28
• Visual Representations for Multivariate Data Fields Summary References Exercises
520 521 524 525
465 467 469 471 473
474 476 479 479 481 481 482
9-2 9-3 9-4 9-5 9-6
9-7 9-8 9-9
9-10 9-11
Q.19
Visible-Surface Detection Methods 528
9-1 Classification of Visible-Surface Detection Algorithms 529 Back-Face Detection 530 Depth-Buffer Method 531 A-Buffer Method 534 Scan-Line Method 535 Depth-Sorting Method 537 BSP-Tree Method 540 Area-Subdivision Method 541 Octree Methods 543 Ray-Casting Method 544 Comparison of Visibility-Detection Methods 545 Curved Surfaces 545
• Curved-Surface Representations 546 • Surface Contour Plots 546
9-13 Wire-Frame Visibility Methods 547 • Wire-Frame Surface-Visibility
Algorithms 547 • Wire-Frame Depth-Cueing
Algorithm 548 9-14 OpenGL Visibility-Detection
Functions 549 • OpenGL Polygon-Culling Functions 549 • OpenGL Depth-Buffer Functions 549 • OpenGL Wire-Frame
Surf ace-Visibility Methods 551 • OpenGL Depth-Cueing Function 552
9-15 Summary 552 References 553 Exercises 554
Contents
ИЕ n f
10-1
1
10-2 10-3
10-4
10-5 10-6 10-7 10-8
10-9
1 Illumination Models and Surface-Rendering Methods Light Sources
• Point Light Sources > Infinitely Distant Light Sources ' Radial Intensity Attenuation • Directional Light Sources and
Spotlight Effects • Angular Intensity Attenuation • Extended Light Sources and the Warn
Model Surface Lighting Effects Basic Illumination Models
• Ambient Light Diffuse Reflection Specular Reflection and the Phong Model
' Combined Diffuse and Specular Reflections
• Diffuse and Specular Reflections from Multiple Light Sources Surface Light Emissions Basic Illumination Model with Intensity Attenuation and Spotlights RGB Color Considerations Other Color Representations
• Luminance Transparent Surfaces
' Translucent Materials • Light Refraction
Basic Transparency Model Atmospheric Effects Shadows Camera Parameters Displaying Light Intensities
• Distributing System Intensity Levels • Gamma Correction and Video
Lookup Tables • Displaying Continuous-Tone Images
Halftone Patterns and Dithering Techniques
• Halftone Approximations • Dithering Techniques
556 558 558 559 559
560 561
562 563 563 563 564
567
571
571 571
573 573 575 575 576 576 577 578 579 580 581 581 581
582 584
585 585 588
10-10
10-11
10-12
10-13 10-14 10-15 10-16
10-17 4
1
1
* 10-18 10-19 10-20
*
i
<
Polygon-Rendering Methods • Constant-Intensity Surface
Rendering • Gouraud Surface Rendering
Phong Surface Rendering • Fast Phong Surface Rendering
Ray-Tracing Methods • Basic Ray-Tracing Algorithm • Ray-Surface Intersection
Calculations • Ray-Sphere Intersections • Ray-Polyhedron Intersections • Reducing Object-Intersection
Calculations * Space-Subdivision Methods • Simulating Camera Focusing Effects • Antialiased Ray Tracing
Distributed Ray Tracing Radiosity Lighting Model
• Radiant-Energy Terms The Basic Radiosity Model
• Progressive Refinement Radiosity О J
Method Environment Mapping Photon Mapping Г Г О
Adding Surface Detail Modeling Surface Detail with Polygons Texture Mapping
• Linear Texture Patterns Surface Texture Patterns Volume Texture Patterns
• Texture Reduction Patterns Procedural Texturing Methods Bump Mapping Frame Mapping OpenGL Illumination and Surface-Rendering Functions
• OpenGL Point Light-Source Function • Specifying an OpenGL Light-Source
Position and Type Specifying OpenGL Light-Source Colors Specifying Radial-Intensity Attenuation Coefficients for an OpenGL Light Source
591
591 592 595 595 597 597
601 602 603
604 605 607 610 612 615 616 616
620 623 624 625
627 628 628 629 632 633 633 634 637
637 637
638
639
639
Contents A4
10-21
10-22
11-1 11-2
OpenGL Directional Light Sources (Spotlights) 640 OpenGL Global Lighting Parameters 641 OpenGL Surface-Property Function 642 OpenGL Illumination Model 643 OpenGL Atmospheric Effects 644 OpenGL Transparency Functions 645 OpenGL Surface-Rendering Functions 646 OpenGL Halftoning Operations 647 OpenGL Texture Functions 648 OpenGL Line-Texture Functions 648 OpenGL Surface-Texture Functions 651 OpenGL Volume-Texture Functions 653 OpenGL Color Options for Texture Patterns 653 OpenGL Texture-Mapping Options 654 OpenGL Texture Wrapping 655 Copying OpenGL Texture Patterns from the Frame Buffer 655 OpenGL Texture-Coordinate Arrays 655 Naming OpenGL Texture Patterns 656 OpenGL Texture Subpatterns 657 OpenGL Texture Reduction Patterns 657 OpenGL Texture Borders 658 OpenGL Proxy Textures 659 Automatic Texturing of Quadric Surfaces 659 Homogeneous Texture Coordinates 659 Additional OpenGL Texture Options 660 Summary 660 References 664 Exercises 665
Interactive Input Methods and Graphical User Interfaces 668 Graphical Input Data Logical Classification of Input Devices
• Locator Devices • Stroke Devices • String Devices
669
669
670
670
670
• Valuator Devices 671 • Choice Devices 671 • Pick Devices 672
11-3 Input Functions for Graphical Data 673 • Input Modes 674 • Echo Feedback 674 • Callback Functions 674
11-4 Interactive Picture-Construction Techniques 675
• Basic Positioning Methods 675 • Dragging 675 • Constraints 675 • Grids 676 • Rubber-Band Methods 676 • Gravity Field 677 • Interactive Painting and Drawing
Methods " 678 11-5 Virtual-Reality Environments 679 11-6 OpenGL Interactive Input-Device
Functions 679 GLUT Mouse Functions 680 GLUT Keyboard Functions 684 GLUT Tablet Functions 689 GLUT Spaceball Functions 689 GLUT Button-Box Function 690 GLUT Dials Function 690 OpenGL Picking Operations 690
11-7 OpenGL Menu Functions 696 Creating a GLUT Menu 696 Creating and Managing Multiple GLUT Menus 699 Creating GLUT Submenus 700 Modifying GLUT Menus 703
11-8 Designing a Graphical User Interface 703 The User Dialogue 703 Windows and Icons 704 Accommodating Multiple Skill Levels 704 Consistency 705 Minimizing Memorization 705 Backup and Error Handling 705 Feedback 705
11-9 Summary 706 References 709 Exercises 709
xvi Contents
12-1
12-2
12-3
12-4 12-5
12-6
12-7
12-8 12-9
12-10
Color Models and Color Applications Properties of Light The Electromagnetic Spectrum Psychological Characteristics of Color Color Models Primary Colors Intuitive Color Concepts Standard Primaries and the Chromaticity Diagram The XYZ Color Model Normalized XYZ Values The CIE Chromaticity Diagram Color Gamuts Complementary Colors Dominant Wavelength Purity The RGB Color Model The YIQ and Related Color Models The YIQ Parameters
Transformations Between RGB and YIQ Color Spaces The YUV YCrCb Systems The CMY and CMYK Color Models The CMY Parameters Transformations Between CMY and RGB Color Spaces The HSV Color Model The HSV Parameters Selecting Shades, Tints, and Tones Transformations Between HSV and RGB Color Spaces The HLS Color Model Color Selection and Applications Summary References Exercises
712 713 713
715 716 716 716
717 717 718 718 719 719 719 720 720 722 722
722 723 723 723
724 724 724 726
726 728 728 730 731 731
• •
13-2 13-3 13-4
13-5 13-6
• •
13-7 • • •
13-8 13-9
13-10 13-11
•"* E 1 14-1
• •
14-2 14-3
• •
• 14-4
14-5
Double Buffering Generating Animations Using Raster Operations Design of Animation Sequences Traditional Animation Techniques General Computer-Animation Functions Computer-Animation Languages Key-Frame Systems Morphing Simulating Accelerations Motion Specifications Direct Motion Specification Goal-Directed Systems Kinematics and Dynamics Articulated Figure Animation Periodic Motions OpenGL Animation Procedures Summary References Exercises
Hierarchical Modeling Basic Modeling Concepts
О .Г
System Representations Symbol Hierarchies J
Modeling Packages General Hierarchical Modeling Methods Local Coordinates Modeling Transformations
О
Creating Hierarchical Structures Hierarchical Modeling Using OpenGL Display Lists
Г Г J
Summary References Exercises
734
735 735 737
737 738 739 739 742 745 745 745 746 747 748 749 752 754 754
756 757
757 759 760
762 763 763 763
765 765 766 766
13-1
Computer Animation 732 Raster Methods for Computer Animation 734
Graphics File Formats 15-1 Image-File Configurations 15-2 Color-Reduction Methods
768 769 770
Contents XVII
Uniform Color Reduction Popularity Color Reduction Median-Cut Color Reduction
15-3 File-Compression Techniques
Run-Length Encoding LZW Encoding Other Pattern-Recognition Compression Methods Huffman Encoding Arithmetic Encoding Discrete Cosine Transform
15-4 Composition of the Major File Formats JPEG: Joint Photographic Experts Group CGM: Computer-Graphics Metafile Format TIFF: Tag Image-File Format PNG: Portable Network-Graphics... Format XBM: X Window System Bitmap Format & XPM: X Window System Pixmap Format Adobe Photoshop Format
MacPaint: Macintosh Paint Format PICT: Picture Data Format BMP: Bitmap Format PCX: PC Paintbrush File Format TGA: Truevision Graphics-Adapter Format
• GIF: Graphics Interchange Format 15-5 Summary
References Exercises
Mathematics for Computer Graphics
A-l Coordinate Reference Frames • Two-Dimensional Cartesian Screen
Coordinates • Standard Two-Dimensional
Cartesian Reference Frames • Polar Coordinates in the xy Plane
770 771 771
771 772 772
773 773 776
776
778
779
780 781
781
781 782
782 782 782 783
783
783 783 784 784
o~i a / 787
787
788
788
A-2
A-3 A-4
A-5
A-6
A-7
A-8
A-9 A-10
Standard Three-Dimensional Cartesian Reference Frames Three-Dimensional Cartesian Screen Coordinates Three-Dimensional Curvilinear-Coordinate Systems
• Solid Angle
Points and Vectors Point Properties Vector Properties Vector Addition and Scalar Multiplication
• Scalar Product of Two Vectors • Vector Product of Two Vectors
Tensors Basis Vectors and the Metric Tensor
• Determining Basis Vectors for a Coordinate Space
• Orthonormal Basis • Metric Tensor
Matrices • Scalar Multiplication and Matrix
Addition • Matrix Multiplication
• Matrix Transpose • Determinant of a Matrix • Matrix Inverse
Complex Numbers • Basic Complex Arithmetic
• Imaginary Unit • Complex Conjugate and Modulus of
a Complex Number • Complex Division • Polar-Coordinate Representation for
a Complex Number Quaternions Nonparametric Representations Parametric Representations
Rate-of-Change Operators • Gradient Operator • Directional Derivative • General Form of the Gradient
Operator • Laplace Operator
• Divergence Operator • Curl Operator
789
790
790 791 792 792 792
794 794
795 796 796
796 797
798 799
800 800 801 801 802 802
803 803
804 804
805 805 807 807
808 809 809
810 810
810 811
xviii Contents
Rate-of-Change Integral Transformation Theorems Stokes's Theorem Green's Theorem for a Plane Surface Divergence Theorem
Green's Transformation Equations Area and Centroid of a Polygon Area of a Polygon Centroid of a Polygon Calculating Properties of Polyhedra Numerical Methods
Solving Sets of Linear Equations Finding Roots of Nonlinear Equations
811
811 812
813 814 814 814
815 817
817 817
819
• Evaluating Integrals 820 • Solving Ordinary Differential
Equations 822 • Solving Partial Differential Equations 824
• Least-Squares Curve-Fitting Methods for Data Sets 825 Bibliography 827 Subject Index 839 OpenGL Function Index 856
• Core Library Functions 856 • GLU Functions 857 • GLUT Functions 857