INTERACTIVE COMPUTER GRAPHICS Data Structures, Algorithms, Languages Wolfgang K. Glloi Technical University of Berlin and University of Minnesota Tochnisths BodischBle Dnrmstadt FACHEEKE1CH 1NFORMATIK BIBLIOTHEK Inventar-Nr.: Sachgebiete: Standortt PRENTICE-HALL, INC., Englewood Cliffs, New Jersey 07632
Contents Preface far Acknowledgements For Illustrations xll PARTI: DATA STRUCTURES AND ALGORITHMS 1 1 Introduction 3 1.1 What is computer graphics? 3 1.2 The motivation for interactive computer graphics 7 i/1.3 Model of interactive graphics systems 8 )/ 1.4 The display file 12 vl.5 The necessity of a dual representation of graphic objects 14 1.6 The problem of picture transformations 15 1.7 Taxonomy of display systems 21 1.8 Stand-alone versus satellite systems 23 Exercises 24 2 Data Structures, Data Bases, and List Handling 26 2.1 Formal definition of data structures 26 2.1.1 A data structure definition 26 2.1.2 Definitions of relations and their properties 27 2.1.3 Linear lists 30 2.1.4 Tree structures 31 2.1.5 Generalized list structures 35 2.1.6 Associative structures 36
vi Contents 2.2 Representation of data structures in a computer 39 2.2.1 Sequential or linked memory allocation 39 2.2.2 Representation of arrays 44 2.2.3 Representation of trees 44 2.2.4 Representation of generalized lists (hierarchical structures) 49 2.2.5 Representation of associative structures 52 2.3 Data models and data base organization 58 2.3.1 Objectives of data base management systems 58 2.3.2 Conceptual data models 59 2.4 List handling 61 2.4.1 Implementation of linear lists 61 2.4.2 List construction and manipulation 65 2.4.3 Searching and sorting of lists 68 2.4.4 Hash coding 73 Exercises 74 3 Picture Structure and Picture Transformations 77 3.1 Picture structure 77 3.2 Domain transformations 84 3.3 Geometric transformations 92 3.3.1 Rotation 93 3.3.2 Translation 96 3.3.3 Scaling 97 3.4 The perspective representation of three-dimensional objects 97 3.5 The "4x4-matrix" for rotation, scaling, translation, and perspective 102 3.6 A standard transformation system 107 Exercises 112 4 Interpolation and Approximation of Curves and Surfaces 119 4.1 Introductory remarks 119 4.2 Classical methods: Lagrange and Hermite interpolation 123 4.3 Interpolation with 5-splines 129 4.4 Bezier approximation of curves 134 4.5 General principles of surface construction 140 Exercises 148 5 Rendering of Surfaces and Solids 151 5.1 The hidden-surface problem 151 5.2 The set of transition functions {PM,IS,CT,DT,VT} 156 5.2.1 The projective mapping PM 156 5.2.2 The function class IS 156 5.2.3 The containment test CT 159 5.2.4 The depth test DT 160 5.2.5 The visibility test VT 164
Contents vii 5.3 Description of four hidden-surface algorithms 165 5.3.1 General remarks 165 5.3.2 Appel's method of quantitative invisibility 166 5.3.3 Encarnacao's priority method 168 5.3.4 Watkins'scan-line algorithm 172 5.3.5 Encarnacao's scan-grid algorithm 175 5.4 Comparison 179 5.5 Sorting 184 Exercises 185 PART II LANGUAGES AND THEIR INTERPRETERS 187 6 Interaction Handling 189 6.1 Interactive input devices 189 6.1.1 Lightpen 190 6.1.2 Joystick, control ball, and "mouse" 194 6.1.3 Tablet 196 6.1.4 Keyboards 197 6.1.5 Lightpen vs. cursor control devices 197 6.1.6 A pen track procedure 198 6.2 Device independence 200 6.3 Attention handling 201 6.3.1 The role of interrupts in display systems 201 6.3.2 Attention queue and task scheduler 202 6.3.3 The finite state model of an interactive program 205 Exercises 207 7 The Display Processor 211 7.1 The display console 211 7.1.1 Typical CRT specifications 212 7.1.2 Input devices 213 7.2 The display generator 215 7.2.1 Position generator and dot generator 215 7.2.2 Character generator 215 7.2.3 Vector generator 220 7.2.4 Time'requirements 226 7.3 The display controller 227 7.3.1 Typical display processor instruction set 227 7.3.2 Instruction formats 233 7.3.3 The controller 236 7.3.4 Analog scissoring 237 7.4 High-performance display systems 239» 7.5 Low-cost displays 245 7.5.1 Storage tube displays and plasma displays 245 7.5.2 TV raster displays for text and simple graphics 246 7.5.3 TV raster graphic display systems 252 Exercises 256
viii Contents 8 Display File and Picture File Organization 261 8.1 Data base and display file revisited 261 8.2 Display file without subpicture calls 262 8.3 Display file with subpicture calls 265 8.4 Display file and picture file 267 Exercises 272 9 Language Concepts for Interactive Computer Graphics 276 9.1 High-level graphic programming languages 276 9.1.1 An example 276 9.1.2 Language extensions vs. subroutine packages 277 9.1.3 The "prefabricated-structure" vs. the "building-block" concept 281 9.2 High-level graphic languages: two cases in point 282 9.2.1 LEAP-an ALGOL 60 extension based on the prefabricated-structure concept 282 9.2.2 EX. GRAF-a FORTRAN extension based on the building-block concept 287 9.3 L 4 -an intermediate language for device-independence and intra system communication 288 10 Hlgn-Level Language Implementation of Display Programming Systems 293 10.1 Tasks of a graphical programming package 294 10.2 Language structures 295 10.3 Interaction handling routines 298 10.4 GRIP (Graphic Procedures for Instructional Purposes) 302 10.5 The instant of object creation 308 10.6 Command languages 309 10.7 Implementation the GRIP philosophy in existing high-level languages 310 10.7.1 FORTRAN 310 10.7.2 ALGOL 60 311 10.7.3 PASCAL 311 10.7.4 PL/1 311 10.7.5 APL 312 Exercises 314 BIBLIOGRAPHY 320 Appendix: Implementation of the GRIP Concept 330 Index 351 A.I General considerations 330 A.2 Terminal graphics software 334 A.2.1 Data flow in the terminal 334 \ A.2.2 Display file overview and L 4 interpreter data structures 335 * A.2.3 L 4 interpreter 341 A.3 High-level graphic programming packages 346 A.3.1 Introduction 346 A.3.2 FORTRAN Graphics Package (GRAP) 346 A.3.3 APL Graphics Package (APL-G) 349