THE UNIVERSITY OF MICHIGAN SYSTEMS ENGINEERING LABORATORY Department of Electrical Engineering College of Engineering SEL Technical Report No. 51 OPTIMUM IMPLEMENTATION OF TOPOLOGICAL STRUCTURES FOR INTERACTIVE COMPUTER DISPLAYS by James H. Jackson under the direction of Professor Keki B. Irani January 1971 under contract with: ROME AIR DEVELOPMENT CENTER Research and Technology Division Griffiss Air Force Base, New York Contract No. F30602-69-C-0214 and ADVANCED RESEARCH PROJECTS AGENCY Department of Defense Washington, D. C. Contract No. DA-49-083 OSA-3050

I

PREFACE This research could not have been completed without the support of the Advanced Research Projects Agency and Rome Air Development Center, or without the assistance of many people. The author is indebted to the Advanced Research Projects Agency, contract number DA-49-083 OSA-3050, for the opportunity to implement computer graphics programs during preliminary phases of this research, and for financial support at that time. He is also indebted to Rome Air Development Center, contract number F30602-69-C-0214, for financial support during the latter part of the research. The author is most grateful for the assistance of his doctoral committee. He is particularly indebted to Professor Irani, for his detailed reading of the manuscript and many helpful suggestions. The author's association with Professor Irani during preliminary related research is also greatly appreciated. Professor Westervelt has been a source of encouragement and guidance during the early phases of this research, which has proved to be most helpful. The reviews of the work by Professor Galler and Professor Herzog are also sincerely appreciated. The final manuscript was typed by Miss Joyce Doneth, Mrs. Carolyn Heile, and the author's wife, Carole. Earlier versions ii

of the manuscript were typed by Miss Sharon Bauerle and Mrs. Joanne Aichler. Finally, the author is indebted to his wife for her continued encouragement and support throughout this period of research. iii

TABLE OF CONTENTS Page PREFACE ix LIST OF TABLES xi LIST OF FIGURES xii LIST OF APPENDICES xv NOTATION xvi Chapter 1 INTRODUCTION 1 1.1 Brief History of Topological Structures and Display Equipment 1 1. 2 Types of Implementation 6 1,3 Types of Structure 7 1.4 Objectives 8 2 THE TOPOLOGICAL STRUCTURE 9 2. 1 Topology 15 2.1.1 Definition of Topology 17 2.1. 2 Dependent Representation of Entities 20 2.1. 2.1 Structural Equivalence 23 2.1. 2. 2 Entities as Transformed Subpictures 30 2 1. 2. 2.1 Representation of Coordinate Transformations 32 2 1. 2. 2. 2 Generation of Entities from Subpictures 35 iv

Chapter Page 2. lo 2, 3 Classification of Entities 44 2.1.3 Representation of Topology 49 2. 2 Coordinate Transformations 56 2. 2.1 A Structure Which Enforces No Constraints 59 2. 2.2 A Structure Which Enforces Concatenation Constraints 61 2. 2. 2.1 Ordering of Entities 61 2. 2. 2o 2 Concatenation of Subpictures 63. 2. 2. 2. 1 Coordinate Systems for Concatenation 67 2. 2. 2. 2. 2 Transformations Performed by Drawing a Subpicture 68 2. 2. 2. 2. 3 Concatenations as Coordinate Transformations 72 2. 2. 2.3 Values of F Determined by Concatenation 78 2. 2. 2.4 Description of the Structure 79 2.2. 2. 5 Examples of the Structure 80 2. 2.3 Applicability of Structures 86 2,3 Conclusion 89 v

Chapter Page 3 COST 92 3.1 Storage Requirement 93 3o1.1 Overhead Storage 95 3.1. 2 Storage Per Element of B 99 3.1.3 Storage Per Element of E/D 107 3.1.4 Examples 111 30 2 Computer Time Required to Generate a Picture 117 3. 2 1 An Algorithm for Generating the Picture 117 3o 2. 2 Time Required to Perform Algorithm 3.1 125 3. 2. 2o 1 Initialization 125 3. 2 2. 2 Identifying Entities from the Structure 126 3.. 22.3 Displaying Entities in E 137 3. 2. 2.4 Restoring from the Push-Down Stack 139 3. 2. 2 5 Summary 141 3.3 Average Response Time 142 3.3.1 Definition of Basic Operations 144 3.3.2 Time Required to Perform Basic Operations 148 3.3. 2 1 Time Required to Modify the Structure 152 3 3. 2. 1 Creating and Destroying Elements of E/D 152 vi

Chapter Page 3.3.2.1.2 Creating Elements of B 153 3. 2. 1.3 Destroying Elements of B 159 3.3.2.1.4 Modifying Elements of B in the Structure {B,E/D,,y} 163 3.3. 2. 2 Time Required to Interrogate the Structure 164 3.3.2.2.1 Identifying P(D[e]) for a Given Class D[e] 164 3.3 22. 22 Identifying Values of i' 170 3.3. 2. 2.3 Identifying the Last Element of B Needed to Form a Subpicture 171 3.3. 2.2.4 Retrieving G(D[e] ) 1 from D[e] EE/DO 172 3.3.2.2.5 Identifying Values of ju 173 3.3.2.2.6 Identifying the First Component of an Element of B 174 vii

Chapter Page 33. 2.2.7 Identifying the Second Component of an Element of B 175 3.3.2.2.8 Retrieving Values of F' and y 177 3.4 Conclusion 178 4 DESIGN DECISIONS 179 4o1 Definition of a Set of Design Decisions 179 40 2 Effect of Design Decisions on Storage 186 4, 2.1 An Algorithm for Computing Sizes of Storage Blocks 187 4. 2. 2 Storage of Items Common to All Blocks 195 4, 2.3 Storage of Items Which Describe an Element of B 197 4. 2 4 Storage of Items Which Describe an Element of E/D 199 4.3 Effect of Design Decisions on Picture Generation Time 202 4.3.1 Time During Which the Computer is Devoted to Picture Generation 202 4.3. 2 Time Which Elapses While the Picture is Generated 210 4. 4 Effect of Design Decisions on Response Time 213 4.4,1 Operations Which Modify the Structure 214 viii

Chapter Page 4.4. 2 Operations Which Interrogate the Structure 218 4. 5 Constraints 223 4.6 Conclusion 226 5 APPLICATIONS 228 5o1 Methods of Implementation 229 5 o1.1 Storage Formats 230 5.1. 2 Elementary Instruction Sequences 231 5. 2 Time Required to Perform Algorithms 3. 2 and 3. 5 238 5. 2.1 Time Required to Compute G(D[e] )1 239 5. 2. 2 Time Required to Perform Algorithm 3. 5 244 5.3 Optimum Implementations for Specific Applications 246 5.3.1 A Text Editing Program 246 5.3.1.1 Estimation of Parameters 247 5.3.1. 2 Results of Analysis 260 5.3.2 A Graph Theory Program 267 5.3. 2.1 Estimation of Parameters 269 5.3.2.2 Results of Analysis 283 5.4 Conclusion 289 6 CONCLUSIONS 291 6.1 General Design Principles 291 6.2 Limitations 293 6.3 Strengths and Weaknesses 293 BIBLIOGRAPHY 351 ix

LIST OF TABLES Page 2.1 Paths Which Represent Entities in Figure 2 10 55 4.1 Design Decisions 180 5o 1 Storage Requirements for DEC 339 232 5. 2 Elementary DEC 339 Instruction Sequences 234 5. 3 Structure Size Parameters for Text Editor 250 5o 4 Storage Parameters for Text Editor 251 5. 5 Time Parameters for Text Editor 253 5. 6 Values of the Function n for Text Editor 261 5. 7 Structure Size Parameters for Graph Theory Program 271 5. 8 Storage Parameters for Graph Theory Program 272 5. 9 Time Parameters for Graph Theory Program 274 5 10 Values of the Function n for Graph Theory Program 278 A.1 Device Codes 305 A. 2 Text Statements 309 A. 3 Text Statements for Graph Theory Program 319 B. 1 Notation for Parameters 336 x

LIST OF FIGURES Page 1.1 Interactive Computer Display Program as Described by W. R. Sutherland 2 2.1 A Picture and a Representation of Its Topology 11 2o 2 Examples of Pictures for Which the Topology of Each Picture Facilitates Response to Control Language Inputs 13 2.3 Graphs of the Relations C and A for Picture in Figure 2.1 21 2.4 An Electrical Circuit Diagram and the Representation of Its Connectivity by the Relation A 22 2. 5 Examples of the Subsets E, E,E, E.',E 25 2o 6 An Example of Two Equivalent Structures 31 2.7 Some Simple Coordinate Transformation Matrices 36 2.8 Subpictures Used to Generate Picture in Figure 2.1 37 2.9 Coordinate Systems for Entities in Figure 2.3 41 2.10 Graphical Representation of B 53 2.11 An Ambiguous Topological Structure 58 2.12 Examples of Pictures for Which a Concatenation Facility is Useful 64 2.13 Shaw's Binary Concatenation Operators 66 xi

Page 2.14 Example Transformation Matrices G(D[e] ) 69 2.15 Concatenation of Two Subpictures 73 2.16 Other Concatenations of Subpictures in Figure 2.15 74 2.17 Applications of the Concatenation Facility 81 2.18 A Topological Structure for an Editor Program 83 2.19 Concatenations of Text Characters 85 2. 20 Isolation of Coordinate Transformations in the Structure {B E/DL, 7y} 88 2. 21 Alternative Representations of Concatenation 90 3,1 A Storage Allocation Scheme 96 3. 2 Data Blocks for a List Structure Representation of {B,E/D,, y} 112 3.3 Representation of Two Angles by a List Structure 113 3. 4 Modification of the List Structure Blocks in Figure 3, 2 116 3o 5 A Relation A With Values of 4 Indicated 129 3.6 Part of a Structure {B,E/D, i,y} 134 3. 7 Example of Picture Distortion Due to Lack of Synchronization 155 4.1 Packing of Items Into Storage Blocks 191 5 1 Topological Structures for Text Editing 248 xii

Page 5.2 Estimation of Ttf and Ttg for Text Editor 258 5.3 Text Editor Cost for n= 20 264 5. 4 Text Editor Cost for n = 35 265 5. 5 Topological Structures for Graph Theory 268 5.6 Graph Theory Program Cost for ne = 100 and = 100 285 5. 7 Graph Theory Program Cost for n = 80 and V = 100 286 5.8 Graph Theory Program Cost for n^/n = 5/4 and ~= 100 287 A.1 Block Formats for Elements of E/D 297 A. 2 Block Formats for Elements p(e,e')EB 298 A. 3 Representation of State Diagrams 303 A. 4 Example Tracking Pattern Characters 306 A. 5 State Diagram for Graph Theory Program 318 B.1 Flow Chart for the SOLVE Command 332 B. 2 PAR Subroutine for Text Editor 334 B. 3 Listing of Parameters for DEC 339 344 xiii

LIST OF APPENDICES Appendix Page A AN IMPLEMENTATION OF THE STRUCTURE {B,E/D,, 7y} 295 A.1 Implementation of the Structure 295 A. 2 The Display Language 301 A. 2.1 The State Diagram 302 A. 2. 2 Specification of Operations Associated with a State 307 A. 2.3 An Example of an Application Program 316 A. 3 Operation of the Program 323 Ao 4 Suggested Improvements 327 B PROGRAMS USED FOR ANALYSIS 329 B. 1 Enumeration 329 B. 2 Printing 346 B. 3 Application of Constraints 347 B.4 Plotting 349 xiv

NOTATION The following list summarizes the symbols which occur frequently in the text. Symbols used to describe a topological structure: Symbol Meaning Page Function which maps subpictures into entities 35 y Function which maps elements of B into sequences of coordinate transformation matrices 75 6,6' Entity ordering functions 62 p Function which maps elements of A into elements of B 54 X Entire picture entity 18,u4 ~ Function which generally maps each element of a set p({e} x S(e)) into the previous element in this set 79 A'z Function which generally maps each element of a set p({e}x S(e)) into the next element in this set 101 Function which maps each entity into the number of times that it is displayed while the picture is generated once 127 xv

Symbol Meaning Page A Intransitive topology relation 19 B Set of instances 49 C Transitive topology Relation 17 D Relation which describes which entities may be represented as transformations of a common subpicture 44 Do Relation which describes which primitive entities are transformations of a common subpicture 45 E Set of entities 17 E10 Set of primitive entities 23 F Function which maps elements of A into coordinate transformation matrices 42 F' Function which maps elements of B into coordinate transformation matrices 59 G Function which maps elements of E /D into coordinate transformation matrices 68 H Function which maps entities into coordinate transformation matrices 38 xvi

Symbol Meaning Page P Function which maps each element D[e] e E/D into the set of elements of B whose second component is D[e] 102 S' Function which maps each entity into the smallest set of other entities of which it is composed 127 T Relation which describes which entities have equivalent structures 23 Parameters to be estimated: a Ratio of elapsed memory access time for picture generation to actual memory access time 212 f (2.i),f g(i) Frequencies of Operation 2i 214 Gbf Gbg Times required for the computer to identify the second component of an element of B during the picture generation process 206, 207 Gcf Gcg Times required for the computer to convert subpictures for entities in E0 into display processor format 208 xvii

Symbol Meaning Page GhfGmf Times required for the computer to effectively multiply matrices while generating a picture from the structure {B,E/D,F'} 204, 205 Ghf Gmf Times during which the computer is suspended while the display processor effectively multiplies matrices while generating a picture from the structure {B,E/D,F'} 204, 205 Ghg Gmg Times required for the computer hg' mg to effectively multiply matrices while generating a picture from the structure {B,E/D,gt,y} when references to second components of elements of B are stored 205, 206 G' G m Times during which the computer hg' mg is suspended while the display processor effectively multiplies matrices while generating a picture from the structure {B,E/D,/, y} 205, 206 Gh "G m Times required for the computer to hg mg effectively multiply matrices while generating a picture from the structure {B, E/D, L, y} when references to second components of elements of B are not stored 205, 206 xviii

Symbol Meaning Page Gs Time required for the computer to save a reference to an element of B on a push-down stack and to restore this reference 203 G' Time during which the computer is suspended while the display processor saves a reference to an element of B on a push-down stack and restores this reference 203 G " Time required for the computer to save a value of H on a push-down stack and to restore this value 204 G(>"' Time during which the computer is suspended while the display processor saves a value of H on a push-down stack and restores this value 204 Gtf'Gtg Times during which the computer is suspended while entities in E0 are transferred to the display processor 209 Gtf Gtg Times during which the computer is suspended while subpictures in 3(E0) are transferred to the display processor 209, 210 xix

Symbols Meaning Page qbf qbg Cardinalities of B 184 qdfqdg Cardinalities of E/D 184 dOf' dOg Cardinalities of E0/D0 184 qsfIqsgp eeE-{xp(e) 184 qOf'sOgI (e) 184 eE E0 r Time required to copy the contents of one location into another 153 rd Average time required to destroy a storage block 153 r Average time required to g create a storage block 153 R,R' Average times required to determine the form of a value of y 222 Rf,Rf' Average times required to retrieve a value of F' from the structure {B, E/DF'} 222 xx

Symbol Meaning Page R Rg Average times required to g' g retrieve a value of G for a class in E0/DO from the structure {B,E/D, g, y} 221, 222 R. Average time required to store a display processor jump command 215 R Average time required to store a pointer 215 Rf, Rsg Average times required to perform Algorithm 3. 5 when the computer performs Algorithm 3.1 and references to second components of elements of B are stored 219, 220 R sfRsg' Average times required to perform sf sg Algorithm 3. 5 when the computer performs Algorithm 3,1 and references to second components of elements of B are not stored 220 R "R Rs' Average times required to perform sf sg Algorithm 3. 5 when the display processor performs Algorithm 3.1 220 xxi

Symbol Meaning Page sO Overhead storage associated with creating and destroying a storage block 104 Sf, Sag Average storage occupied by a subpicture for a class in E0/DO when the computer forms entities in E 200 Sf' S' Average storage occupied by a subpicture for a class in E0/Do when the display processor forms entities in E0 200 S Average storage required to represent a value of y when the computer performs Algorithm 3.1 199 S' Average storage required to represent a value of y when the display processor performs Algorithm 3o1 199 Sa Storage per element D [e] e E/D-E0/D0 which is occupied by information which causes the display processor to compute G(D[e] )-1 201 xxii

Symbol Meaning Page Sf Average storage per element of B required to represent a value of F' when the computer performs Algorithm 3.1 198 S' Average storage per element of B required to represent a value of F' when the display processor performs Algorithm 3.1 198 S Average storage per element D[e] E EE/DO required to represent G(D[e] ) when the computer performs Algorithm 3.1 201 S' Average storage per element Die] E E0/Do required to represent G(D[e] ) 1 when the display processor performs Algorithm 3.1 201 Sh Storage occupied by a display processor halt command 202 S. Storage occupied by a display processor jump command 198 S Storage occupied by a pointer 197 P Sr Storage occupied by a display processor subroutine return command 202 xxiii

Symbol Meaning Pae Ss Storage occupied by a display processor subroutine call command 198 St Storage required to designate block type when the computer performs Algorithm 3.1 196 St Storage required to designate block type when the display processor performs Algorithm 3l1 196 Tb Time required to determine whether a block represents an element of B, E/D-E /DO, or E0/D 175 Tc Time required to compare two pointers 166 Tdf Tdg Total times required to plot entities in E0 210 T. Time required to execute a display processor jump command 207 T.' Time required for the computer to interpret a display processor jump command as a pointer 171 T Time required to extract a pointer from a known position in the structure 166 xxiv

Symbol Meaning Page Ts Time required to execute a display processor subroutine call command 208 T' Time required for the computer to interpret a display processor subroutine call command as a pointer 176 Ttf Ttg Total times (in addition to memory access time) required for the display processor to perform coordinate transformations while the picture is generated once 211 Other frequently used symbols: g Total time during which the computer is devoted to the picture generation process while the picture is generated once 141 i. The ith basic operation 144 r Cost 142 s Total storage occupied by the structure 94 tf Time which elapses while the picture is generated once 150 ui The ith design decision 180 xxV

Chapter 1 INTRODUCTION The objective of this research is to describe the topological structure of an interactive computer display picture and to compare the time which is required to operate on various implementations of this structure in response to user inputs. The scope of the work may be clarified with the aid of Figure 1.1, which represents a simplified form of the general interactive computer display program as described by W. R. Sutherland [70 ]. In this figure, the rectangles represent sections of the program, the circles represent sets of data, and the directed paths represent flow of information. Each input which affects the picture is an element of a one-dimensional control language, which consists of sequences of light pen motions, push button hits, etc. In response to these inputs, the control language interpreter modifies the structure of the picture which is being displayed. The resultant structure is then further modified by a constraint program which compensates for the coarseness of the control language inputs, and it is interpreted by the picture generator to produce a new picture. (Typically, it is also interpreted to control an analysis program.) This paper is concerned with the topological structure which is interpreted to generate the picture, the picture generator, and the picture which is produced. lo 1 Brief History of Topological Structures and Display Equipment The need for representing the structure of a picture, in addition to its appearance, was originally demonstrated by I. E. Sutherland's 1

2 Z.. Control topo Picture Languag Interpreter tructur Constraint Program ~Problem. Analysis Su. rto Program Of.,Datan Figure 1.1 Interactive Computer Display Program as Described by W. R. Sutherland

3 SKETCHPAD [67, 68],which is generally considered to be the first major effort to support an interactive computer display [63 p. 58]. This program was designed to produce two-dimensional line drawings in response to push button and light pen inputs. Since all operations were purely graphical in nature, SKETCHPAD did not include the analysis program shown in Figure 1.1. However, it did include a facility for displaying multiple copies of a subpicture, as well as a program which enforced geometric constraints. The topology of the picture * as well as information which described constraints, was stored in the form of a list structure. This structure facilitated both the display of multiple copies of a subpicture and the identification of those other subpictures which would be modified whenever a subpicture was either referenced by a demonstrative control language input or modified by the enforcement of a constraint. Soon after SKETCHPAD was implemented, interest developed in improving communication between man and machine through the use of interactive computer displays. The first efforts concentrated on the establishment of more sophisticated hardware, as exemplified by the SCHOOLER display [ 4 ], Graphic-1 at Bell Telephone Laboratories [47 ], and DAC-I at General Motors [ 15 ]. Not much thought was given to the structure of pictures to be displayed by this equipment, although considerable thought was given to the type of software capabilities which were desirable from the user's point of view [2,15, 29,47 ]. *Throughout this paper, the word "topology" is used for historical reasons. This word is not to be interpreted in a mathematical context.

4 Because time-sharing systems were becoming available, the new hardware included a programmable display processor which either had its own buffer memory or shared the memory of a small general purpose computer in order to refresh its picture. However, this equipment required the support of a large computer (e. g., time-sharing facility) for analysis programs and, possibly, some or all of the programs which operated on the topological structure of the picture. After some preliminary experimentation with the new type of equipment, a software system which provided for the representation of the topology of a picture on this equipment was developed at Bell Telephone Laboratories for use with GRAPHIC-2 [ 12 ]. Each primitive subpicture (i.e., each subpicture which was composed of not more than one part) was represented by a display processor program which was called a "leaf", and these leaves were referenced by pointers in a list structure which described other subpictures in terms of those represented by leaves. Coordinates were also stored in the list structure such that the coordinates at which each copy of each primitive subpicture should be displayed could be obtained by summing these coordinates along a path through the structure. The display processor was driven interpretively from the list structure by the associated general purpose computer, which computed the coordinates of each copy of each primitive subpicture from the structure, and then allowed the display processor to execute the corresponding leaf, starting at the computed coordinates.

5 The structures used by SKETCHPAD and GRAPHIC-2 were similar in that they both described picture topologies. However, pictures were generated from these two structures in quite different fashions. SKETCHPAD interpreted a list structure to produce a table of the coordinates of points to be plotted on the display screen. Then the program generated the picture to be displayed by transferring the coordinates of each point represented in the table to the display processor. Consequently, the SKETCHPAD picture generator was essentially a program0 However, in GRAPHIC-2, the general-purpose computer program interpreted the list structure only to compute a pair of coordinates at which a primitive subpicture was to be displayed and to locate a display processor program (leaf) for that subpicture. The display processor itself then executed the leaf and produced the subpicture at the computed coordinates. Consequently, the GRAPHIC-2 picture generator was partly a program and partly display processor hardware A third form of a topological structure was implemented previously by the author [ 26 ] o This structure was implemented entirely as a display processor program. Consequently, the picture generator for this structure was entirely display processor hardware. Recent effort in the design of display processors has yielded devices which interpret 3-dimensional data and plot perspective projections of this data on 2-dimensional screens. Examples of such

6 devices are the Adage Graphics Terminal [ 71 ] and the Evans and Sutherland LDS-1 [ 18 ]. The latter of these devices is sufficiently versatile to generate a picture from a topological structure without the aid of a general-purpose computer program. 1.2 Types of Implementation As evidenced by the above examples, the picture generator may be either a program, a combination of a program and display processor hardware, or entirely display processor hardware. No one of these schemes has a clear advantage over the others for all applications. A software point-plotting picture generator, such as the one which was employed by SKETCHPAD, can be implemented with even the most primitive display processor hardware. However, this scheme requires storage both for the structure of the picture and for a display buffer. Furthermore, unless the picture is produced on a storage tube or some similar device, much computation time is consumed merely maintaining a static picture. Less computation time is required for this process if a scheme such as that used in GRAPHIC-2 is employed. Furthermore, no storage is required for a display buffer. However, this scheme requires that a data channel be available to send information to the display processor and that the display processor include a display generator which is capable of producing some basic geometric forms, such as vectors, which may be displayed relative to given coordinates. Unlike the software point-plotting technique, this technique often limits

7 the flexibility with which copies of a subpicture may be displayed. For example, a single leaf could not be executed so that copies of its corresponding subpicture would be displayed at various angles of rotation in GRAPHIC-2. Even more limitations are imposed if the display processor hardware itself is to be used as the picture generator. In particular, the words which appear in the topological structure must be executable display processor commands. Furthermore, if this procedure is used and demonstrative control language inputs are to be identified, the display processor must contain a subroutining facility which saves return addresses on a push-down stack which may be examined by the general-purpose computer. However, this procedure has the advantage over the others that no computation time is required to maintain a static picture. 1 3 Types of Structure Except for the constraints represented in the SKETCHPAD list structure, each of the structures in the three examples given above describes only the topology of the picture and drawing information for primitive subpictures. This type of structure is common, for it has also been applied to other display systems, e. g., SKETCHPAD m [ 28 ], DIM [ 5 ], and PLAN-PGS [11 ]. However, certain other forms of information appear to be suitabe for inclusion in the structure, as they simplify certain operations on the picture. In particular, A. C. Shaw[61, 62] has developed a formal description of picture parsing which provides some insight into the type of information which

8 might be included. Although this description was developed primarily for pattern recognition purposes, the facility which it provides for representing concatenation of subpictures is often a useful part of a structure from which a picture is to be generated. 1.4 Objectives In the following chapter, the information which defines a topological structure is discussed. An original contribution of this chapter is a means of representing coordinate transformations such that subpictures are effectively concatenated in a manner similar to that described by Shaw. To demonstrate the feasibility of this method, a program which employs a topological structure in which coordinate transformations are represented in this way was written by the author and is described in Appendix A. In Chapter 3, the average time which is required to operate on an implementation of the structure is parameterized as a cost function. The discussion in this chapter illustrates the major decisions which affect the choice of implementation. This cost function is then expressed as a function of these decisions in Chapter 4 and is applied to several applications in Chapter 5. The set of programs which were used to study these applications is described in Appendix B. Finally, suggestions for future extensions to this effort are discussed in Chapter 6.

Chapter 2 THE TOPOLOGICAL STRUCTURE In order to compare various implementations of topological structures, the information which is contained in these structures must be defined. Generally, a topological structure will be considered to describe both a topology of picture parts and the coordinate transformations which are necessary to display these picture parts, In this chapter, a topological structure which has been used widely in previous interactive computer graphics programs (e.g., SKETCHPAD [67,68], SKETCHPAD III [ 28 ], GRAPHIC-2 [12 ], DIM[ 5 ], PLAN-PGS [11 ], PENCIL [ 74 ) is described. This structure provides for the independent modification of picture parts which are not topologically related, A second structure which has been developed by the author is then described, This latter structure provides for the enforcement of concatenation constraints among picture parts as a consequence of refreshing the picture. The usefulness of representing the topology of the picture was originally demonstrated by SKETCHPAD [67, 68]. As mentioned in the previous chapter, one use of this information was to permit the display of multiple copies of a subpicture. The ability to display multiple copies of a subpicture eliminated the necessity to store individual copies of identical subpictures. Consequently, since the storage required for topology information was small relative to that required to 9

10 store copies of subpictures, the representation of the topology of the picture in memory resulted in a reduced total storage requirement. Furthermore, all picture parts which were represented as copies of a common subpicture could be modified simultaneously by modifying the subpicture. Multiple copies of a subpicture may be displayed by interpreting a topological structure which uses copies of this subpicture as parts of a larger subpicture which is displayed. This procedure may be illustrated with the aid of Figure 2. 1. Figure 2. la represents a picture to be displayed and Figure 2. lb shows a representation of the topology of this picture. In Figure 2. lb, each directed line indicates that a copy of the subpicture to which it points is used as part of the subpicture at its tail. For this example, the picture consists of a trapezoid and two rows of objects, each of which consists of two squares and a triangle. The subpictures which are represented are the trapezoid, the square, the triangle, the row, and the entire picture. Only three of these subpictures are used to generate polygons in the picture: the trapezoid, the square, and the triangle. However, seven polygons appear in the picture because four copies of the square are displayed and two copies of the triangle are displayed. In order to use a copy of a subpicture as part of a larger subpicture, some information about how the smaller subpicture is to appear in the larger subpicture is needed. In SKETCHPAD, this

11 /E\ a. Picture Picture Trapezoid Row Square Triangle b. Representation of Topology Figure 2. 1 A Picture and a Representation of Its Topology

12 information was represented by four variables: x and y coordinates, a rotation angle, and a scale factor. (The values actually stored were the x and y coordinates and the products of the scale factor by the sign and cosine of the angle of rotation.) These four variables represented a transformation of coordinates to be applied to each point in the smaller picture when it was displayed. A set of values for these four variables, together with a subpicture, was called an instance. A subpicture could then be defined in terms of smaller subpictures as a collection of instances. For the example in Figure 2.1, there are two instances of the square, one instance of the trapezoid, one instance of the triangle, and two instances of the row. Each of these instances is represented as a directed line in Figure 2. lb. The number of instances of a subpicture is not necessarily the number of times that that subpicture appears in the overall picture. In this example, there are four squares in the picture, yet there are only two instances of the square. Likewise, the variables which help define an instance are not measured relative to the overall picture. In this example, the coordinates of the two instances of the square and the instance of the triangle are measured relative to the coordinates of each row. As mentioned above, the topology of the picture is also used to identify those other subpictures which are modified whenever a subpicture is referenced by a demonstrative control language input (i. e.,

13 Resistor 1. 0 Port Parameter Body a. A Resistor from an Electrical Network Program Machine Part Quadrant b. A Machine Part from a Drafting Program Figure 2. 2 Examples of Pictures for Which the Topology of Each Picture Facilitates Response to Control Language Inputs

14 an input which consists of identifying a picture part by pointing to it with a light pen, stylus, etc.)9 Some of the applications of the topology of the picture to this problem may be illustrated with the aid of Figure 2. 2. Figure 2, 2a shows a resistor symbol as it might appear in a circuit analysis program. The symbol is considered to be composed of two ports, i.e., attachment points for connections to other elements, a parameter value, and a body. In the picture, each port appears as a small circle, the parameter value appears as the number lo0, and the body appears as the rest of the symbol. For purposes of illustration, assume that a program is running which allows the user to point at the symbol with a light pen and either (1) change the value of the parameter to a value which has just been inputted on some other device, or (2) move the symbol with the light pen if no parameter value has been inputted. In either case, the light pen may reference any one of several primitive subpictures: the port, the parameter, or the body of the symbol. The resistor subpicture is identified as the subpicture which consists of a set of instances of primitive subpictures and which was being displayed at the time of the light pen hit. In the former case, the parameter subpicture to be replaced is identified as the primitive subpicture which is part of the resistor subpicture and which represents a parameter. (Whether or not a subpicture represents a parameter is determined from information external to the topology, e.g., from an ordering imposed on the parts of the resistor subpicture.) In the latter case,

15 the coordinates associated with the instance of the resistor subpicture which was referenced with the light pen are modified in order to move the symbolo Figure 2.2b represents a picture which maintains symmetry about the origin of the two axes shown. The program is assumed to be capable of modifying only the quadrant subpicture in response to control language inputs. The machine part subpicture is displayed as four instances of this quadrant subpicture at angles 0, 17/2, r, and 37r/2. Not only does the topological structure provide the information necessary to identify what other changes should be made to the picture when a quadrant is modified, but it guarantees that the other quadrants will be correspondingly modified without intervention by the program. 2 1 Topology In order to discuss the topology of a picture and the representation of this topology for interactive computer display applications, the following definition is needed: Definition 2. 1 * An entity is either a part of the displayed picture which is interpreted as a unit by the program or the entire displayed picture. The displayed picture is the picture which is transferred to the display processor, regardless of whether or not all of it is visible to the user. For example, the clipping divider [64 ] developed by Evans and Sutherland Corporation may be used to select only part of the displayed picture to be plotted on a display screen.

16 The entities in the picture shown in Figure 2.1 are the four squares, the two triangles, the trapezoid, the two rows, and the entire picture. Generally, entities are chosen so that they have a semantic meaning to the user. For example, the user who observes the picture in Figure 2. la immediately recognizes the seven polygons. The fact that six of these polygons are arranged to form two rows may not be so obvious to him. However, if he is interacting with the program, he will generally recognize that the rows are entities by observing responses to his inputs. For example, he may generate inputs which cause each row to be moved as a unit. With the term "entity" defined, the terms "subpicture" and'instance" may be clarified by the following definitions: Definition 2.2 A subpicture is a picture to which a coordinate transformation may be applied to produce an entity. Definition 2.3 An instance is a part of a subpicture which is obtained by applying a coordinate transformation to a smaller subpicture. Five subpictures are involved in Figure 2.1: a square, a triangle, a trapezoid, a row, and the entire picture. The row subpicture consists of two instances of the square subpicture and one instance of the

17 triangle subpicture, and the entire picture subpicture consists of two instances of the row subpicture and one instance of the trapezoid subpicture. The entire picture entity will be considered to be the same as the entire picture subpicture, i.e., the coordinate transformation which is applied to the entire picture subpicture in order to produce the entire picture entity is the identity transformation. 2.1.1 Definition of Topology The topology of the picture may be described by a relation C which identifies which entities are parts of other entities. if E is the (finite) set of all entities which are represented in the picture, C may be defined on E as follows: C = {(e, e')I (e, e') e E x E and e' is a part of e}. (2.1) The word "part" is interpreted to mean "something less than the whole" (which is not null), and the partitioning of each entity into its component parts is a function of the application of the graphics program. Because a part of an entity is strictly less than the entire entity, C is irreflexive, i. e., e E (e,e) i C. (2.2) Furthermore, since a part of a part of an entity is itself a part of that entity, C is also transitive, i. e., (e,e') E C and (e, e") C —==>(e,e" ) c C. (2.3)

18 A third property of C may be specified by considering the entity X e E, which represents the entire picture. Since all entities are parts of this picture, X is related to every other element e e E by C, or ee E and e # => (X, e) e C. (2.4) A further property of C may be derived from the fact that C is both irreflexive and transitive. However, before this property can be stated the following definition and theorem must be stated: Definition 2. 4 A directed cycle of length n (n > 1) which is formed by a relation Y on the set X is a sequence (x1, x2,.,xn) e X such that (xi, xi+) e Y for i=l, 2,..., n-1 and (Xn, X1) e Y. Theorem 2. 1 A transitive and irreflexive relation forms no directed cycles. Proof Assume that Y is a transitive and irreflexive relation on a set X which forms the directed cycle (x1, x2,..., Xn) C Xn. Then (xi, xi+ ) e Y for i=l, 2,..., n-1, and (xn, Xl) Y. (xn, Xk) is shown to be an element of Y for k=1, 2,..., n by induction as follows: Basis: k=l. (x n, x) E Y from the definition of a directed cycle.

19 Induction step: Assume that (Xn,Xi) E Y for some i < n-1. Since i < n-l, (xi,x +) E Yo Since Y is transitive, (x,x.) e Y and (xi,xi+l) E Y => (Xnxi+1) e Y. In particular, (xn,xn) e Y. However, (xn,x ) n Y because Y is irreflexive. 3 Since C is both irreflexive and transitive, C forms no directed cycles. Although the relation C properly describes the topology of the picture, it is generally a rather large set, and, consequently, storage of its elements in a general-purpose computer may not be practical. However, by taking advantage of the fact that C is transitive and forms no directed cycles, a relation A c C, which generally has fewer elements than C, may be defined such that C may be easily generated from A. The relation A is defined as follows: A = {(e,e') I(e,e') C and; e" E E such that (e,e") e C and (e",e') C}. (2.5) C is then the transitive closure of A, i.e., C may be generated from A by adding to A those elements which are necessary to make it transitive. The definition of A given above is useful only because C forms no directed cycles. If C did form a directed cycle, the elements associated with the directed cycle could not be generated from A. For example, assume that C was transitive and consisted only of those elements necessary to form the directed cycle (e1l,e2, e3), i. e.,

20 C = (el, e), (e2 e2), (e3, e3), (el, e3)' (e3, e2), (e2, el), (el e2) (e2, e3), (e3, e1) }. (2.6) For this relation, A = 0, and the transitive closure of A is 0. Graphs of the relations C and A for the example picture shown in Figure 2.1 are shown in Figure 2.3. The graph of A commonly assumes the form of a tree, as it does in this example. This occurs whenever each entity in the picture is not considered to be a part of two or more entities which are not themselves related by C. However, the facility to represent a relation A whose graph does not assume the form of a tree is sometimes quite useful. In particular, the connectivity of a network diagram (i.e., a diagram in which element symbols are to be associated with each other via connections, such as electrical circuit diagrams flow charts, bridge truss diagrams, etc.) may be represented through the use of this facility. For example, Figure 2. 4 shows an electrical circuit diagram and the graph of a relation A for this diagram. Each port of each element in the network is represented by a connection which is considered to be a part of that element. (An unconnected port is considered to be connected to itself.) Two ports are connected to each other if and only if they are represented by the same connection. 2. lo 2 Dependent Representation of Entities Even if A, rather than C, is stored, some information may be stored redundantly. In particular, entities which are described as

21 C: \ e3 // i \ e7 / e4 e5 e6 A: _/ e5 el e2 e3 e7 e8 e9 Trapezoid: e5 Squares: e, e2,e7, e8 Triangles: e3,e9 Rows: e4, e6 Figure 2. 3 Graphs of the Relations C and A for Picture in Figure 2. 1

22 Elements: e1, e2, e3 Resistor symbol: e4 Transistor symbol: e5 Capacitor symbol: e6 Connections: e,, eQ, e10 Figure 2.4 An Electrical Circuit Diagram and the Representation of Its Connectivity by the Relation A

23 collections of other entities by similar structures and which differ only by a transformation of coordinates need not be stored independently. 2. 1. 2.1 Structural Equivalence An equivalence relation T C E x E will be defined to classify those entities which have similar structures. In order to define the relation T, the function S: E -> $ (E) is first defined, where p(E) is the power set of E, i.e., f (E) = {X XC E}. (2.7) S is defined as follows: S(e) ={e'(e,e) e A} (2.8) This function maps each entity into the set of its immediate successors under the relation A. S may now be applied to define the subsets E E,E2'o o f E as follows: E0= {el(e) =' i-i i-1 =i = {ee I U Ej and S(e) c U E}, i=, 2,... j=o j=o J A finite number of these subsets are to represent a partitioning of the set E. For this to be true, there must exist an integer m such that E is the union of EO.E1,E,,... Em andEi n E. = k for i # j and 0 < i, j < m. From the definition of E0, E1, E2,.. the latter condition is clearly satisfied for all nonnegative integers m. The former condition is verified by the following theorem:

24 Theorem 2. 2 m There exists an integer m > 0 such that E = U E1. i=0 Proof Since E is a finite set and the subsets E0, E1 EE2,... are defined to be disjoint, the integer m exists if it can be shown that i-1 i-i E # U E > Ei for i=l, 2,.... Assumethat UE. j=0 i- 1 j=0 J for some integer i > 1. Then, X E E - U E.. Since i-1 j=0 X ~ U E. and (X, e) E C for all e E E, there exists at least one element j=0 J e E E 1 such that (X, e) E C. Consequently, there exists an element e'e Ei such that (e', e) e A, i. e., Ei ~. I As a result of this theorem, the only E'Is which will be considered further are E0,E1,...,Em For both the example in Figures 2.1 and 2.3 and the example in Figure 2.4, m = 2. The subsets E,E,and E2 for these two examples are depicted in Figure 2.5. The equivalence classes of the relation T are formed by partitioning the subsets EO,E1,E 2,..,E. For the example in Figure 2. 5a, the equivalence classes of T are simply the subsets EO,E1, and E2. However, for the example in Figure 2.5b, the equivalence classes of T are EO,E2, and two sets which are formed by partitioning E1.

25 / "5 e1 e2 e3 e_ e 9 ee / a. Example from Figures 2. 1 and 2.3 x ^e3 e2. ~tV "V < 0: TO e_ e b. Example from Figure 2.4 Figure 2. 5 Examples of the Subsets E, E1, Eo,, *., Em

26 As a further step toward defining the relation T, the relations T cE x Ei are defined for i = 0, 1,2,...,m as follows: TO E0X E (2.11) Ti = {(e,e') I(e,e') E x E and there exists a one-one and onto function a: S(e) -> S(e') such that i-i e" S(e) > (e", c(e")) U T}, i=1,2,..,m. (212) T is then defined to be the union of these relations, i. e., m T = L Ti. (2.13) i=O As mentioned above, T is required to be an equivalence relation. In order to show that T is an equivalence relation, the relations T, T1,T2,... m T are first shown to be equivalence relations by the following theorem: Theorem 2.3 TO,T, T2,..., Tm are equivalence relations. Proof TOT1,T2,... Tm must be shown to be reflexive, symmetric, and transitive. 1. TO, T1, T2,.., Tm are shown to be reflexive by induction as follows:

27 Basis: e E E0 -> (e,e) E E0x E0== (e,e) e TO => TO is reflexive. Induction step: Assume that T0, T1, T2,.., Ti are reflexive. Let e e Ei+l and a: S(e) -> S(e) be the identity function. Then, i i S(e) c U Ej, and, since T. is reflexive for j < i, e' e S(e) -> e' U E i j=0 i i j=0 (e',e') e U T. (e',o(e')) e U T. Consequently, (e,e) e Ti+ j=0 o j=0 ] and Ti+l is reflexive. 2. To, T1, T2,..., Tm are shown to be symmetric by induction as follows: Basis: (e,e') e T ==> (e,e') e E0x E0==> (e',e) e E0X E0 (e', e) E T > —> T is symmetric. Induction step: Assume that TO, T1, T2,..., Ti are symmetric. Let (e, e') e Ti+l. Then, there exists a one-one and onto function i a: S(e) -> S(e') such that e" c S(e) ==> (e a(e")) E U T. 1 i j=o J (a (a(e")), a(e")) e U T.. Since Tj is symmetric for j < i, j=0 J - j-0 -1 i ei' S(e) -=> a(e" S(e') => (a(e"), a- (a(e"))) U T.. j=0 3 Consequently, there exists the one-one and onto function -1 i a S(e) -> S(e) such that et" e S(e') — > (e"', a (e") e U T.. j=0 Then (e', e) e Ti+l and Ti+l is symmetric. 3. TO, T1, T2'... Tm are shown to be transitive by induction as follows:

28 Basis: (e,e') e T0 and (e, e") E T — =>(e, e") E x E -> (e', e") e T ==> T0 is transitive. Induction step: Assume that To T1, T,..., Ti are transitive. Let (e, e') E Ti+l and (e'e") e Ti+. Then, there exists a one-one and onto function a: S(e) -> S(e') such that e"' e S(e) -=> i (e"', ce"')) e U T, and there exists a one-one and onto function j=0 t': S(e') -> S(e") such that e"' e S(e) -> a(e"') e S(e') -=> i (a(e"'), ao'((et'))) E U T.. Since T. is transitive for j < i, j=0 J there exists the one-one and onto function a' a: S(e) -> S(e") such i that e"' e S(e) -> (e", a' o(e"')) e U T.. Consequently, j= 0 (e, e") E T i+ and Ti+1 is transitive. | A union of equivalence relations is not necessarily itself an equivalence relation. For example, consider the two equivalence relations Y = {(x, x2), (x2, x), (X1 x1), (x2, 2)} and Y2= (xl, x3), (x3,x1), (x, xl), (x3,x3)}. Y U Y2 is not an equivalence relation, for it is not transitive, i. e., (x2,x) E Y1U Y2 and (xlx3) E Y YU Y but (x2,x3), Yu Y2.

29 Consequently, Theorem 2. 3 is not sufficient to establish that T is an equivalence relation. However, T may be shown to be an equivalence relation by considering both this theorem and Theorem 2. 4 below. Theorem 2. 4 If Yi c Xi x Xi i=0, 1, 2,.., n, are equivalence relations n and X. i X. = f for i Z j, then U Y. is an equivalence ~1 J ~i=O 1 relation. Proof n U Yi must be shown to be reflexive, symmetric, and i=0 transitive. n 1. Since Yi is reflexive for i=O, 1, 2,..., n, x e U Xi > i=O there exists an integer k such that x e Xk — > (x, x) e Yk => n n (x,x) e U Yi. Consequently, U Y. is reflexive. i=O i=O n 2. Since Yi is symmetric for i=O, 1, 2,..., n, (x, x) e U Y i=O => there exists an integer k such that (x, x') e Yk => (x', x) e Yk n n -> (x',x)e U Yi. Consequently, U Y is symmetric. i=O n i=O n 3. Assume that (x,x') e U Yi and (x',x") e U Yi. Then, i=O i=O there exists an integer j such that (x, x') e Y., and there exists an integer k such that (x', x") E Yk. (x, x') e Yj and (x', x") e Yk > x' e X.j X,. Since Xj IXk = P for j / k, j = k. Consequently, n n (xx") ~ Yk C U Yi, and U Yi is transitive. i=0 i=0

30 From Theorem 2. 3, T0, T1, T2,..., Tm are equivalence relations. Furthermore, Ti c Ei x Ei for i=O, 1, 2,..., m, and Ei Ej = for i # j from the definition of Ei. Consequently, from Theorem 2. 4, T is an equivalence relation. Since TO is defined to be E0 xE E0 E is always an equivalence class of T. Furthermore, since e e E and e X =-> (X, e) e C, Em = {X}. Since Em contains only one element, Em is always an equivalence class of T. For the example in Figure 2. 5a, E1 is readily seen to be an equivalence class of T. However, for the example in Figure 2. 5b, E1 is the union of two equivalence classes of T: {e2} and {el, e3}. For these two examples, the two subgraphs of the relation A, one of which includes only the entity e and those entities e" such that (e, es)e C and the other of which includes only the entity e' and those entities e"' such that (e', e"') E C, are isomorphic wherever (e, e') T. This condition is not true in general. In fact, there may not even exist a homomorphism between two such subgraphs, as illustrated by the example shown in Figure 2. 6. In this example, (el, e2) e T, but there exists no homomorphism from one of the corresponding subgraphs to the other. 2. 1. 2. 2 Entities as Transformed Subpictures Although two entities which are related by T are structurally equivalent, they may appear as entirely different images in the picture. For example, the entities el and e3 in Figure 2. 4 have

31 /2 i / \ \ ~ ~ | / \ / \/ [/ \ k\ \/ / \\ I Subgraph associated with el Subgraph associated with e Figure 2.6 An Example of Two Equivalent Structures

32 equivalent structures,but one appears as a resistor in the picture, whereas the other appears as a capacitor. Such entities must be represented independently in storage. However, as mentioned above, if the two entities differ only by a transformation of coordinates, they need not be stored independently. In particular, the two entities may be displayed as copies of the same subpicture to which different coordinate transformations are applied. Two such entities are the two rows of polygons in Figure 2. 1, which differ only by a translation of coordinates. An equivalence relation D c T may be defined to relate those entities which need not be stored independently. Before the relation D can be defined, however, a means of representing coordinate transformations must be described. 2. 1. 2.2. 1 Representation of Coordinate Transformations Coordinate transformations may be represented conveniently if the coordinates of each point in the picture are represented as homogeneous coordinates [ 56 ]. This representation of coordinates has been used previously in computer graphics programs, particularly those which provided for the manipulation of threedimensional drawings [28, 57]. A point (x1, x2,..., Xn) in n-dimensional space may be represented by the homogeneous coordinates (Y1, y2,. * * Yn+_) in (n+l)dimensional space, where yi = Yn+lxi for i=1, 2,..., n.

33 Thus, (xl,x2,..,Xn,l) is one possible representation of the point (x1,x2, o.,xn) The coordinates yl,Y2, o.,yn may be interpreted as direction numbers~for a line in n-dimensional space which intersects the origin, where Yn 1 describes the distance of a point on this line from the origin. Note that a point at infinity is described by choosing yn 1= 0, whereas a point at the origin is described by choosing yi = 0, i= 1,2,..,n, and n+l A 0o A transformation may then be applied to these homogeneous coordinates to yield the homogeneous coordinates (y,y2' * * *,.,y') Then the transformed coordinates (x',2',..,x') in n-dimensional space may be obtained according to the rule xi =yi'/y'for i= 1,2,.n. Generally, a user of a computer display cannot comprehend pictures which are drawn in more than three dimensions. Consequently, no more than three dimensions will be considered further. Although most interactive computer display pictures are currently produced on two-dimensional screens, a three-dimensional picture may be represented in any one of several forms, such as: a set of three orthographic views [ 28], a halftone perspective projection [60, 77], a pair of stereoscopic perspective projections [65 ], or a hologram [23,37]. A transformation of the coordinates of a point expressed with respect to the coordinate system W into the coordinates of this point expressed with repect to the coordinate system W' may be represented by the matric equation v' =vH, (2.14)

34 where v' is a vector which describes the homogeneous coordinates of the point with respect to W' v is a vector which describes the homogeneous coordinates of the point with respect to W, and H is a 4 x 4 matrix which describes the coordinate transformation. For example, a transformation of the coordinates of a point expressed with respect to W into coordinates expressed with respect to a coordinate system W' whose origin has the coordinates (- Ax, -Ay, -Az) in W, whose axes are parallel to the respective axes of W, and whose units of measurement are b times as large as those of W may be expressed as follows: [wx'wy' wz' w] = [xyzl] 0 0 0 0 1 0 0 0 0 1 0 Ax Ay Az b From this equation, x + Ax A ~ b y + Ay y- b and z + Az = b- The transformation used in this example is actually a sequence of two simpler transformations. The coordinates of the point are first incremented, and then they are scaled. The transformation matrix H for

35 this example, then, is the product of two other transformation matrices which represent the simpler transformations. In this case, 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 H = 0 0 1 0 0 0 1 0 Ax Ay Az 1 0 0 0 b A table of some simple transformation matrices is given in Figure 2. 7. 2o 1o 2o 2. 2 Generation of Entities from Subpictures In order to describe the generation of entities from subpictures, the function (: E ->Q is defined, where Q is a set of subpictures. P(e) is the subpicture to which a coordinate transformation is to be applied to produce the entity e. Clearly, ((e) is not unique, for the subpicture which is obtained by applying any non-singular coordinate transformation to 3(e) could also be used to generate e. However, in the interest of conserving storage, the values of 3 are usually chosen such that as many of them as possible are the same, Suitable choices for the values of 3 for the picture represented in Figures 2 1 and 2.3 are shown in Figure 2.8. The coordinate system with respect to which each subpicture is drawn is also indicated in the figure. Any transformation which is applied to a subpicture to produce an entity is applied to coordinates expressed with respect to this coordinate system.

36 1 0 0 0 Translate. The origin of the new coordinate system is the point 0 1 0 0 (-Ax, -y,-Az) in the original coordinate system. The respec0 0 1 0 tive axes of the two coordinate systems are parallel. Ax Ay Az 1 1 0 0 0 Rotate. The origin of the new coordinate system is the origin O cos a sin a 0 of the original coordinate system. The x axes of the two coordinate O -sin a cos ac 0 systems are parallel. The angle between the y or z axes of the two 0 0 0 1 coordinate systems is a. 1 0 0 0 Magnify all coordinates by the factor 1/a. 0 1 0 0 O 0 1 0 0 0 0 a a 0 0 0 Magnify the x coordinate by the the factor a. O 1 0 0 O 0 1 0 O0 0 1 1 0 0 0 Form perspective projection on plane z = 0, such that the point of 0 1 0 0 observation is z = -d. 0 0 0 1 O o o i^0 0 0 0 1 Figure 2. 7 Some Simple Coordinate Transformation Matrices

37 3(el)=3(e2)=e(e7)==(e8) 3(e3)=3(e9) 3(e5) ID IA /(e4)=1g(e6) E A III Li A Figure 2.8 Subpictures Used to Generate Picture in Figure 2. 1

38 The coordinate transformations which are applied to subpictures to generate entities will be restricted to be non-singular, and will be described by the function H: E -> M, where M is the set of nonsingular 4 x 4 matrices. The only common transformation which is excluded by this restriction is perspective projection. However, the non-singular matrix 1 0 0 0 0 1 0 0 o 0 1 1/d 0 0 0 1 rather than the last matrix shown in Figure 2o 7, may be used to represent prespective projection if only x and y coordinates are plotted. H(e) is then a matrix which represents the coordinate transformation which maps 3(e) into e. Since X is considered to be equal to (3(X) (Section 2.1 above), H(X) is defined to be the identity matrix. The range of the function H is generally restricted by the way in which the topological structure is implemented. For example, if a picture is described in only two dimensions (in the plane z = 0), every value of the function H must assume the following form:

39 h11 h12 0 0 h21 h22 0 0 0 0 h33 0 h41 h42 ~ h44 (This matrix is assumed to be non-singular, i.e. h33 0, h44 A 0, and h22hll h21h12.) Since all elements which are not on the main diagonal and which are in the third column are zero, the transformation which this matrix represents maps every point in the z = 0 plane into a point in that plane. The fact that the off-diagonal elements in the third row are zeros insures that the transformed x and y coordinates do not depend on the value of z. The zeros in the last column insure that no perspective projection is performed. As a further example, a structure which describes a three-dimensional picture, but which does not describe rotation or perspective projection, requires that every value of H assume the following form, where none of the values hllh22'h33 or h44 is zero h11 0 0 0 0 h22 0 0 0 0 h33 0 h41 h42 h43 h44

40 With these restrictions, the only transformations which can be performed are: (1) scaling of individual coordinates (via hll h22' and h33), (2) uniform scaling of all coordinates (via h44), and (3) translation (via h41, h42, and h43) Values of H may be illustrated by considering a coordinate system to be associated with each entity. The coordinate system which is associated with an entity e is the coordinate system with respect to which 3(e) is drawn to produce e. H(e) represents the transformation which maps coordinates expressed with respect to this coordinate system into coordinates expressed with respect to the coordinate system for X. For example, the coordinate systems which are associated with the entities represented in Figure 2.3 are shown in Figure 2.9. The values of the function H which yield the entities shown in this figure are the following: 1 0 0 0 1 0 00 H(e1) 0 1 0H(e 0 1 10 H(e1) =, H(e2) = 0 0 1 2 0 0 1 0 Xl +Y 0 X2+X4 yl+Y4 0 1 2+4 2+Y4 0 1 - 0 010 1 0O 00 0 i 0 0 0 0 00 H(e3) =, H(e4) = 0 0 1 0 0 0 1 0 X3 3S40t+x4 Y+y4 0 1 x 4 0 1

41 x3 xx 1 Y2 <c X2,2', - rx4.h i A -x 6 Is 5 _ Figure 2.9 Coordinate Systems for Entities in Figure 2. 3 5^ — r e-> 6.___ __ _ ____ ^ ---- __ ____ ^ ^~~ L~~r -T ^~Y Y6 1 \________ LL6

42 0 1 0 0 0 1 0 0 H(e5) = H(e) = x6 Y6 1 Lx5 Y5 01 1 0 00 1 0 00 0 1 00 0 1 00 H(e7) =H) = i1 0 7) 0 0 10 0 0 10 X1+X5 1+Y5 0 1 LX2+X5 Y2+Y5 0 1I 1 0 0 o 0 1 00 and H(e) = x3+X5 y3+Y5 0 1 To facilitate classification of those entities which may be represented as transformations of a common subpicture, the function F: A -> M is defined such that F(e,e') is a matrix which represents the transformation which maps the coordinates of points which define e' with respect to its associated coordinate system into coordinates expressed with respect to the coordinate system for e. H(e') may then be expressed as follows: H(e') =F(e,e')H(e). (2.15)

43 Since H(e) is non-singular, the following expression for F(e,e') is obtained by postmultiplying each side of this equation by H(e): F(e,e') =H(e')H(e). (2.16) Using this equation, the following values of F for the picture shown in Figure 2. 9 may be calculated: 1 0 0 0 0 1 0 1 F(k, e,) = H(e4)= 0 0 1 0 x4 y4 0 1 1 0 0 0 F(X, e) = H(e) 1 0 0 and 0 0 1 0 X6 Y6 0 1_ 1 0 0 01 F(X,e6) =H(e6) = 0- O x5 Y5 0 1 Furthermore, since 3(e4) = 3(e6),

44 1 0 0 0 0 I 0 0 F(e4, e) = F(e, e7) = 00100 1 X1 Y1 0 1 1 0 0 0 F(e4, e2)= F(e6, e8) =, and LX2 Y2 0 1 1 0 00 0 1 0 0 F(e4 e3) = F(e6 e4) = 0 0 1 0 x3 y 0 1 2. 1. 2.3 Classification of Entities As has been mentioned above, a relation D c T is to be defined to describe which entities need not be stored independently. This relation is defined in terms of the functions,, F, and S as follows: m D= U Di (2.17) i=0 where

45 Do= {(e,e') (e, e') E E0 E and P(e) = P(e')} (2.18) and D = {(e,e') (e,e') e Eix E. and there exists a one-one and onto function a: S (e) -> S (e') i-1 such that e" e S (e) -= (e", a(e")) e U D. j=O0 and F(e, e") = F(e', oe")))}, i=1, 2..., m. (2.19) In defining this relation, the function j3 has been explicitly used only in the definition of D0. Since all entities in E0 have equivalent topologies, their relationship to other entities need not be considered in order to define D0. However, this relationship must be considered in order to define D; for i=l, 2,..., m. Not only must the entities e and e' which are related by Di have equivalent topologies and differ only by a transformation of coordinates, but each matrix in the image of {e} x S (e) under F must correspond to a matrix in the image of {e'} x S (e') under F as indicated. Since the intended purpose of the relation D is to partition E into sets of entities which need not be represented independently, D must be an equivalence relation. In order to show that D is an equivalence relation, D0, D1, D2,..., Dm are first shown to be equivalence relations by the following theorem:

46 Theorem 2. 5 Do, D1, D2,.., D are equivalence relations. Proof DO, D1, D,..., Dm must be shown to be reflexive, symmetric, and transitive. 1. DO, D1, D2,.., Dm are shown to be reflexive by induction as follows: Basis: e E E0 -=> (e) = /(e) => (e, e) E DO -> DO is reflexive. Induction step: Assume that D0, D1, D2,..., Di are reflexive. Let e e EE+1 and a: S(e) -> S(e) be the identity function. Then, S(e) c U E., and, since D. is reflexive for j < i, e' e S(e) > j=0 JJ i i i el' E >(e', e)e U D.. > (e', a(e)) e U D.. Furthermore, j=0 j=0 j=0 F(e, e') = F(e, a(e')). Consequently, (e, e') E Di+1 and Di+1 is reflexive. 2. Do, D1, D2,..., Dm are shown to be symmetric by induction as follows: Basis: (e, e') E D — > /(e) = 3(e') -> 3(e') = 3(e) -> (e',e) e D0. Induction step: Assume that DO, D1, D2,..., Di are symmetric. Let (e, e') e D.. Then, there exists a one-one and onto function 1~~~~+1~~~~ i a: S(e)->S(e') such that e" e S(e) — => (e", c(e")) e U D. and j=O 3 F(e, e") = F(e', a(e")). Since Dj is symmetric for j < i, J

47 i e" e S(e) > a (e") E S(e') => (a(e"), e") E U D => j=O -1 i (a(e"), a (a(e"))) E U D.. Consequently, there exists the one-one j=O J and onto function a1: S(e')->S(e) such that e"' E S(e') => -1 -1 (e"', a (e"')) E U D. and F(e', e"') = F(e, a (e"')). Then j=O J (e', e) e Di+1 and Di+l is symmetric. 3. D0, D1, D2,..., Dm are shown to be transitive by induction as follows: Basis: (e, e') e DO and (e', e") e DO — > 3(e) = 3(e') = 3(e") -> (e, e") E D0. Induction step: Assume that D0, D1, D2,..., Di are transitive. Let (e, e') e Di+1 and (e', e") e Di+l. Then, there exists a one-one and onto function a: S(e) — > S(e') such that e"' e S(e) s> i (e"', a(e'"")) e U Dj and F(e, e"') = F(e', a(e"')), and there exists j=0 a one-one and onto function a': S(e') -> S(e") such that e"' e S(e) -> i a(e"') E S(e') => (o(e"'), a'(a(e"'))) e U D. and F(e', a(e"')) j=O J F(e"t, a'(a(e"'))). Since D. is transitive for j < i, there exists the one-one and onto function a' a: S(e) -> S(e") such that e"' e S(e) => i (e"', a' a(e"') E U D. and F(e,et"') = F(e", at' (e"')). Consequently, j=0 3 (e, e") e Di+1 and Di+1 is transitive. I

48 From the definition of Di, Di c Ei x Ei for i=O, 1, 2,..., m. Furthermore, as mentioned in Section 2. 3. 1 above, E. i Ej = q for i # j. 1 Consequently, from Theorems 2. 4 and 2. 5, D = U D. is an i=O equivalence relation. D then defines the quotient set E/D, where each element of E/D is a set of entities which may be represented as transformations of a common subpicture. However, in the above discussion, only a static picture has been considered, i. e., the fact that an interactive display picture is continually being modified was ignored. In particular, reference has been made to values of F which are equal in in the definitions of D1, D2,..., Dm. Whereas these definitions do yield a relation D which properly classifies entities for a static picture, they may not yield a relation D which allows the picture to be easily modified. For example, the picture shown in Figures 2. 1 and 2. 3 has been assumed to contain two rows (e4 and e6) of polygons which differ only in their positions. The definition of D given above may be applied to show that {e4, e6} E E/D. However, if the square eI is moved, but the square e7 is not moved, F(e4, e1) no longer equals F(e6, e7) and {e4, e6} j E/D. Consequently, the set E/D must be modified if the picture is modified in this way. However, if F(e, e') = F(ett, et") is interpreted to mean "F(e, e') = F(et', e"') as long as both e and e" exist, " the necessity to modify E/D when a value of F is changed is avoided. For example, if the program is capable of moving square e1 independently from square e7, {e4, e6}

49 is never an element of E/D, since F(e4, el) is not considered to be equal to F(e6, e7). Because of this practical consideration, equality of values of F should be interpreted in this way in the above definition of D1, D2,..., Dm and proof of Theorem 2. 5, as well as in Step 5 of Algorithm 2. 1 below. 2. 1. 3 Representation of Topology In order to represent the entities in each equivalence class of D as transformations of a common subpicture, a set B of triples is defined to represent the instances which describe larger subpictures in terms of smaller subpictures. This set is defined as follows: B = {(D[e],D[e'], 1(e, e')) (e, e') e A}, (2.20) where tr: A -> {0, 1, 2,.. } is a naming function for elements of A. Each element (D[e], D[el], r7(e, e')) represents an instance of 3(e') which is used to form P(e). The purpose of the function 71 is to distinguish different instances of 3(e') which are used to form 3(e), where e' e S(e). For example, the triples (D[e4], D[el], 7(e4, el)) and (D[e4], D[e2], z7(e4, e2)) in the picture represented by Figures 2. 1 and 2. 3 represent different instances of the square subpicture. These triples must be distinguished by the function 71, since {el, e2} c E0 and 1(e1) = 3(e2) -> D[e1] = D[e2]. However, (D[e6], D[e7], 7i(e6, e7)) is to be the same as (D[e4], D[el],?7(e4, el)), because 3(e4) = 1(e6), /3(el) = 3(e7), and these two triples represent the same instance. For this to be true, r/(e4, el) must be equal to

50 77(e6, e7). Consequently, 77 does not associate a unique name with each element of A, and values of this function must be assigned systematically. A suitable algorithm for assigning values to this function is the following: Algorithm 2. 1 Procedure for assigning values to 7, given A, F, and E/D. (1) Let X = E/D. (2) If X = p, terminate. Otherwise, select an equivalence class D[e] E E/D and remove this class from X. Select an element e' c D[e] and let Y = D[e] - {e'}. Assign an order to the elements of S(e'), and let 7(e', ei) = i-l, where e. is the i-th element of S(e'). (3) If Y = q, proceed with Step 2. Otherwise, select an element e" e Y and remove this element from Y. Let Z = S(e"). (4) If Z = p, proceed with Step 3. Otherwise, select an element e"' e Z and remove this element from Z. (5) Determine the element ei E S(e') such that F(e', ei) F(e", e"') as long as both e' and e" exist. Let 7(e", e"') = i-1 and proceed with Step 4. | This algorithm assigns the same value of 17 to both (e, e") e A and (e', e"') E A wherever D[e] = D[e'], D[e"] = D[e"'], and F(e, e") = F(e', e"') as long as both e and e' exist, whereas it assigns a different value of 77 to (e, e") E A and (e', e") e A wherever D[e] = D[e']

51 and either D[e'"] D[e"'] or F(e, e") may be modified to differ from F(e', e"'). The application of this algorithm to the picture described by Figures 2. 1 and 2. 3 is indicated below. The number of each step is shown, together with the values which are computed by performing it. (1) X= {{e1, e2,e7, e8},{e3, e9}{e4 e6},{e}, {}} (2) X={{e3, e9}, {e4, e6, {e5}, {X}} e = e1, Y = {e2,e7, e8} S(el) = 0. No values of r, defined. (3) e'= e2, Y = {e7,e8} Z =b (3) e'=e7, Y={e8} Z = f (3) e'=e8, Y = (2) X= {{e4,e6}, {e5}, {X}} e=e3, Y={e9} S(e3) = c. No values of n defined. (3) e' = e9, Y = (2) X = {{e5}, {X}} e=e4, Y={e6} S(e4) = {e, e2, e3}. Let 77(e4, el) = 0, 27(e4, e2) = 1, 17(e4, e3) = 2.

52 (3) e"=e6, Y = Z= {e7, e8, e9} (4) e1'"e7, Z = {e8,e9} (4) e =e8, Z={e9} (5) 7 (e6, e7) = 1 (4) e"- e8, Z= {e9} (5) 7(e6, e8) = 1 (4) e = e9, Z = (5) t1(e6, e9) = 2 (2) X ={{X}} = e5, Y = S(e5) = 4. No values of r7 defined. (2) X = e = X, Y = (X) = {e4, e5, e6}. Let 71(X, e4) = 0, r(X, e5) = 1, n(X, e6) = 2 The set B may be represented by a multigraph in which each element (D[e], D[e'], 7(e, e')) is represented by a directed line from D[e] to D[e'] which is labeled 77(e, e'). For example, this graph for the picture described by Figures 2. 1 and 2. 3 with the values of 7 assigned as shown above is shown in Figure 2. 10. This representation of B will be used in subsequent figures. Each entity e X may be identified by a set of sequences of elements of B which correspond to (X, e) E C. In order to simplify notation when describing this set, the function p: A-> B is defined

53 {X} / /7 f e/ 0/ /I \2 {el, e2, e7, eg {e3' e9 Figure 2. 10 Graphical Representation of B

54 such that p(e, e) = (D[e],D4e],, (e, e')). (2.21) Thus, p(e, e') is an instance of i(e') which is used to form 3(e). Note that, since p may map many elements of A into a single element of B, p(e, e') does not contain sufficient information to determine e or e'. The following definition is then given to describe certain sequences of elements of B: Definition 2. 5 A path of length n from entity e1 to entity en+ is a sequence (p(el, e2), p(e2, e3),.p(en,e )) Bn Clearly, there exists at least one path from e to e' if and only if (e, e') e C. However, if there exist several distinct entities n e1 e2..., en such that e' e n S(ei), there may exist several paths 1= 1 from e to e'. For example, in the circuit diagram shown in Figure 2. 4, e10 e S(e2)f( S(e3). There are two paths from X to e10: (p(X, e2), p(e2, e10)) and (p(X, e3), p(e3, e10)). Since there are no other paths from X to e10, the set of paths which identifies e10 is then the set of these two paths. Usually, however, every set of paths which identifies an entity consists of only one element. For example, the path which represents each entity in the picture which is represented by the set B in Figure 2. 10 is shown in Table 2. 1.

55 Entity Path e1 (({X}, {e4, e6}, 0), ({e4e6}, {,el, e2, e7, e8},0)) e2 (({X}, {e4, e6}, 0), ({e4, e6}, {el, e2, e7, e8}, 1)) e3 (({X}, {e4, e6},0), ({e4, e6},{el, e2,e7, e 8}, 1)) e4 (({X}, {e4, e6}, 0)) e5 (({X}, { e5}, 1)) e6 (({x}, {e4, e6}, 2)) e7 ((X} {, e e6}, 2), ({e4,e6}, {e1, e2, e7,e8}, 1)) eg (({X}, e4 6}, 2), ({e4, e6}, {e1, e2, e e8}, 1)) e9 (({X}, {e4,e6},2), ({e4, e6}, {e3, e4, 2)) Table 2.1 Paths Which Represent Entities in Figure 2. 10

56 2. 2 Coordinate Transformations In order that the generation of a picture from the topological structure be possible, there must exist a procedure for computing H(e) and t3(e) for every e e E. H(X) is known to be the identity matrix and, therefore, need not be computed. For every class D[e] such that e e E0, 3(e) must be specified explicitly as information external to the structure. However, the values H(e) for e e E - Em and /3(e) for e e E - E0 must be computed from information in the structure and the image of En under 3. For this computation to be possible, the structure must include both the set B and coordinate transformation matrices from which values of F may be computed. Then, by multiplying the values of F which are associated with the components of any path (p(e!, e2), p(e2, e3),..., p(en, en+l)), the transformation matrix F(en, en+).. F(e2, e3) F(el, e2) = (H(enl)H(en))... (H(e)(ee2) )(H(e2)H(el1) = H(en )H(e) (2.22) is obtained. In particular, this transformation matrix for a path from X to an entity e XA is H(e) H(X) = H(e). The subpicture 3(e) for e e E - E is produced by superimposing the images obtained by applying the transformation represented by H(e') H(e)1 to 1(e') for

57 each entity e' such that there exists a path from e to e'. Since, for all entities e" E E - E0. j(e") is described as a superimposition of the images obtained by transforming other subpictures, the only images which are needed to generate 3(e) are those which are used to generate entities in Eo. Since H(X) represents the identity transformation, the picture X is displayed by generating 3(X), i. e., by superimposing the images obtained by applying H(e) to 3(e) for each entity e e E. The representation of the relation A by the set B may be ambiguous in some cases if there are distinct entities e, e', and e" such that e e S(e') () S(e"). For example, Figure 2. 11 depicts a relation A and the corresponding set B for which this ambiguity might occur. For this example, the fact that there are two paths from X to e may generally be recognized by observing that the transformation matrices associated with the two paths (p(X, e'), p(e', e)) and (p(X, e"), p(e", e)) are equal, i.e. F(e', e) F(X, e') = F(et", e)F(X, e") = H(e). However, if the entity e1 coincides with e, the transformation matrix F(X, e5)F(e5, e4)F(e4, el) which is associated with the path (p(X, e5),p(e5, e4), p(e4, e1)) is also equal to H(e). In this event, this path may be interpreted to be a third path from X to e, rather than a path from X to el, when the set B and values of H are examined. D[e] then appears to contain only the one entity e e S(e4) F(h S(e') n S(e"). Since individual entities in an equivalence class of D can differ only in their values of the function H, this ambiguity cannot be resolved in general. Care must be exercised when designing an

58 A: e?t ell A / \e /e\ eI e2 e6 e e7 B: {X} o ]'Sl </ \2 O 0 1 1 O 1 / {e4},- }I {e2} {el,e} Figure 2. 11 An Ambiguous Topological Structure

59 application program, then, to insure that this ambiguity does not occur. For example, an application program which manipulates the structure shown in Figure 2. 11 might be constrained never to move an entity in an equivalence class of D so that it coincides with another member of the same class. If, however, the application requires that movement of entities not be constrained, a constraint which is consistent with the semantics of the application might be placed on the lengths of the paths from X to all entities e such that e S(e') n S(e") for distinct entities e' and e". For example, such paths might be required to have length two in Figure 2. 11. The entity e1 may then be recognized as being different from e because the path from X to e1 has length three. 2.2.. 1 A Structure Which Enforces No Constraints As mentioned above, each coordinate transformation matrix H(e) is a product of values of F. Since all values of F which are associated with a single element of B are the same, all values of F which are needed to compute H are values of F': B -> M, where F'(p(e, e')) = F(e, e'). (2.23) Thus, for any path (p(X, el), p(e1, e2),..., p(en, e)) from X to e # X, H(e) = F'(p(en, e))... F'(p(e1, e2)) F'(X, e1)). Since the picture X may be produced by generating all entities in Eo, the set {B, E/D, F'} represents a topological structure which, together with values of j3 for entities in E0, describes the picture X.

60 Whenever an entity e is modified in this structure, the only entities e' which are modified without some action by a constraint program are those for which either (e', e) e C or (e, e') e C. For example, if the row e4 in Figure 2. 1 is moved, the picture X is modified because (X, e4) e C. Similarly, the squares e1 and e2 and the triangle e3 are moved because (e4, e1) e C, (e4, e2) e C, and (e4, e3) e C. The entities e5, e6, e7, e8 and e9 are not modified, however, for they are not related to e4 by C. Various implementations of this topological structure have been widely used in previous interactive graphics programs, e g. SKETCHPAD [67,68], SKETCHPAD III [ 28], GRAPHIC-2 [12], DIM [5 ], and PLAN-PGS [11 ]. This structure lends itself to independent modification of entities which are not related by C. However, as mentioned in Chapter 1, a constraint program is usually included as part of the interactive graphics program to refine the structure after it has been modified in response to a control language input. Some of the constraints which are enforced by this program cause entities which are not related by C to be modified in dependent fashion. For example, when a character is removed from a line of text which is displayed, other characters in the line may be adjusted so that no gap is left in the line. When a connection is drawn in a network diagram, network element symbols which are not related to this connection by C may be moved so that the diagram maintains an aesthetically pleasing appearance. In a picture of a

61 mechanical system, many parts may move when a specified part is moved in order to simulate mechanical constraints. If coordinate transformations are represented in the structure so that they depend on other parts of the structure, some constraints may be enforced as a consequence of refreshing the picture. One structure in which coordinate transformations are represented in this way is described below. 2.2. 2 A Structure Which Enforces Concatenation Constraints If coordinate transformations are represented so that they depend on portions of the structure, the subpictures which are used to generate entities in each set S(e) may be concatenated to form the subpicture?(e). Then, whenever one of these entities is modified, other entities are automatically modified in order to enforce the concatenation constraint. For concatenation of subpictures to have meaning, however, the entities in each set S(e) must be ordered. 2. 2. 2. 1 Ordering of Entities If the picture is generated from the structure by a sequential process, the elements of S(e) for each entity e e E are assigned an order for purposes of generating the picture. If this order can be controlled and examined by the program, it may aid the interpretation of the structure as well as permit subpictures to be concatenated. For example, this ordering is useful in conjunction with the network

62 shown in Figure 2. 4. In order to interpret a demonstrative input on this network, the program might need to determine whether the item referencea was an element symbol or a connection symbol. This is easily accomplished if an element symbol is known to be the first entity in every set S(e) such that e represents a circuit element, i. e., e e S(X). Furthermore, although the capacitor and resistor elements are bilateral elements, an analysis program would need to determine which ports of the transistor correspond to the emitter, base, and collector of the transistor. This information could easily be represented in the structure by the order in which the ports of each transistor element are displayed. In order to describe this ordering of entities, the functions 6:A -> E and 6':A -> E are defined as follows: e', if e' is the first entity in S(e), or 5(e, e')= (2.24) e" such that e" immediately precedes e' in S(e), I otherwise e', if e' is the last entity in S(e), or 6'(e, e') = (2.25) e" such that e" immediately follows e' in S(e), otherwise These functions are used below to describe the coordinate transformation matrices which are involved in concatenating subpictures.

63 Before these matrices can be defined, however, concatenation of subpictures must be described. 2o 2o 2.2 Concantenation of Subpictures Two simple examples of pictures for which the facility to concatenate subpictures is useful are shown in Figure 2.12. Each example is represented in this figure by a representative drawing and a diagram of the associated set B. The elements of B are arranged from left to right in each diagram in the order in which they are used to generate each picture. Figure 2. 12a represents a parallelogram if the four lines which form the picture are constrained to be concatenated to each other at their end points and the only coordinate transformations which are represented in the structure are translations. Figure 2. 12b represents an assembly of levers in which point Q is to be positioned by rotating lever e1 about point O. If lever e1 is rotated about point O and lever e2 is to remain stationary with respect to lever e1, lever e2 must also rotate through the same angle about point P and must be translated so that it remains attached to lever e1. The constraints which are needed for these examples may easily be enforced by representing concatenations of subpictures within the topological structure. Before a means of representing such concatenations is discussed, however, some relevant ideas developed by A. C. Shaw [61,62] are discussed.

64 e 2 0/ ) 3 eI {e, e3} {e2, e4} a. A Parallelogram {A P le 2 / \1 0 1 Q {el} {e2} b. An Assembly of Levers Figure 2. 12 Examples of Pictures for Which a Concatenation Facility is Useful

65 Shaw was concerned with developing a picture parsing method which was well suited to the analysis, rather than the generation, of pictures, although his procedure could be applied to either process. Each subpicture was considered to have two distinguished points, called a head and a tail, at which it could be concatenated to other subpictures. Four binary operators were defined to describe the concatenation of subpictures at these points. To facilitate discussion of the concatenation operators, each subpicture was represented abstractly by a directed line from its tail to its head, Each operator could then be represented graphically as a concatenation of two directed line segments. The four operators are represented in this way in Figure 2. 13, and they are interpreted as follows: x + y Concatenate the head of x to the tail of y. x - y Concatenate the head of x to the head of y. x x y Concatenate the tail of x to the tail of y. x * y Concatenate the head of x to the head of y and the tail of x to the tail of y. In each case, the result which was formed by concatenating x and y was considered to have a tail which was the tail of x and a head which was the head of y. The result of each concatenation operation could then be used as an operand for further concatenation operations.

66 head y tail -x x + y tail x head x- y y/ head y tail x xx y x tail I head x * y Figure 2.13 Shaw's Binary Concatenation Operators

67 2. 2. 2 2. 1 Coordinate Systems for Concatenation By using this basic concept of concatenation of subpictures, a topological structure which enforces concatenation constraints may be defined. Natural choices for the head and tail of each subpicture which is represented in this structure are the points at which the drawing of that subpicture is terminated and begun, respectively, However, at the time that an entity e is to be produced, not just the coordinates of a point are known, but the coordinate system with respect to which P(e) is to be drawn in order to produce the entity is known. This coordinate system is the coordinate system which was associated with e in Section 2. 1o 2. 2. 2 above, and will be called the tail system of e when discussing concatenation of subpictureso H(e) represents the coordinate transformation which maps coordinates expressed with respect to this coordinate system into coordinates expressed with respect to the tail system of X. The process of drawing the subpicture 3(e) to produce e is considered to perform a coordinate transformation which maps coordinates expressed with respect to a second coordinate system into coordinates expressed with respect to the tail system of e. This second coordinate system will be called the head system of e. With these coordinate systems defined, concatenation operations similar to those defined by Shaw may be incorporated into the structure. However, since the relative positions of the head and tail of each operand

68 of Shaw's I*" operator must be equal, this operator cannot be applied to arbitrarily selected subpictures and will not be considered further. 22. 2.22.2 Transformations Performed by Drawing a Subpicture In order to describe these operations, a function G: E/D->M is defined such that G(D [e]) is the matrix which represents the coordinate transformation which maps coordinates expressed with respect to the head system of each entity in D[e] into coordinates expressed with respect to its tail system. Thus, the matrix G(D[e] )H(e) maps coordinates expressed with respect to the head system of e into coordinates expressed with respect to the tail system of Xo For simplicity, G(D[e] )H(e) will be said to describe the head system of e with respect to the tail system of X. Similarly, H(e) will be said to describe the tail system of e with respect to the tail system of X, and G(D[ e] ) will be said to describe the head system of e with respect to its tail system. By associating coordinate transformations with each step of a procedure for drawing 3(e), one way in which G(D[e]) may be determined by this procedure may be illustrated. Figure 2, 14 depicts a two-dimensional subpicture 3(e) which consists of two straight lines, together with two procedures for drawing this subpicture. For this example, the following two types of steps are applied to draw the subpicture:

69 W w 3 /1/ b<W2 / b W 2 16/~ ---— a - ----- Define W2 by drawing vector (a, 0) with respect to W1. Define W3 by drawing vector (0,b) with respect to W2. 1 o o o 1 o o o i o o o I10 0 0 0 0 0 1 0 00 010 0 0 1 0 0 0 1 0 WO b O 1 | a O O 1 0a b O0 W,W4 W2 Define W2 by drawing vector (a, 0) with respect to W1. Define W4 by performing rotate-and-scale step with respect to W2. with a = 7/2 and a =a/b. Define W5 by drawing vector (a, 0) with respect to W4. 1 0 0 0 0 1 0 0 0'0 1 0 0 G(D[e] )= 0 1 ~ ~10 0 0 0 1 0 -1 0 0 G(D[e]): O 0 1 O 1 O 0 1 0 a 0 0 1 O Oa/bJLa OO a2/b a 0 a/b Figure 2.14 Example Transformation Matrices G(D[e])

70 (1) A vector with components x and y is drawn relative to a given coordinate system. The coordinate transformation which is associated with this step is described by the matrix 1 0 0 0 0 1 0 0 O 0 1 0 Lx y 0 1 (2) A rotate-and-scale step is performed relative to a given coordinate system in order to define a new coordinate system. This step contributes no visible parts to the subpicture. The coordinate transformation which is associated with this step is described by the matrix cos a sin d. 0 0 -sin a cos a 0 0 0 0 1 0 0 0 0 a (In this matrix, a may be interpreted as an angle of rotation, whereas a may be interpreted as a scale factor.)

71 In the first procedure indicated, a vector with components (a, 0) is drawn with respect to the coordinate system W1. The coordinate transformation which is associated with this step describes the coordinate system W2 with respect to W1. A second vector with components (0,b) is then drawn with respect to W2. The transformation which is associated with this step describes W3 with respect to W2. When this subpicture is drawn to produce an entity, the tail system of this entity is W1, whereas the head system of this entity is W3. In the second procedure indicated, two vectors with components (a, 0) are drawn. However, before the second vector is drawn, a rotate-and-scale step is performed to define the coordinate system W4. The second vector is then drawn with respect to this coordinate system so that it becomes a vector with components (0,b) with respect to W2. Note that each of these procedures yields a different matrix G(D[e]), although the subpicture which is produced by each procedure is otherwise the same.

72 22. 2. 2. 3 Concatenations as Coordinate Transformations Two subpictures 3(el) and 3(e2) may be concatenated as shown in Figure 2. 15. In this figure, the concatenation is performed by considering the tail system of e2 to be the head system of el, i. e., the coordinate system with respect to which 3(e2) is drawn to produce e2 is the head system of e. Because the head system of e is defined by generating e1, the concatenation operation shown in this figure is the one which is performed whenever e1 and e2 are generated in sequence. However, this is not the only concatenation operation which can easily be performed. These two subpictures may be concatenated in three other ways if a procedure is developed which allows either the head system or tail system of e1 to be either the head system or tail system of e2. These operations are shown in Figure 2. 16. A method for performing these operations is described below. In order to perform the concatenation operations shown in Figure 2. 16, inverses of matrices which are values of G are considered. (Since G maps E/D into M, and M was defined to be a set of nonsingular matrices, these inverses always exist.) By selectively performing the coordinate transformations which are represented by G(D[el])-1 and G(D[e2])1 between the time that the generation of el is completed and the generation of e2 is begun, g(el) and 3(e2) may be concatenated as shown in either Figure 2. 15 or 2. 16.

73 Coordinate system with respect to which 3(e) is defined k + — ICoordinate system with respect to which p(e) is defined i(e1) f(e2) a. Subpictures to be Concatenated Head System of e2 ~ Head system of el it^~~~~~ I ~= Tail system of e2 Tail system of el b. Concatenated Subpictures Figure 2. 15 Concatenation of Two Subpictures

74 a. Head System of eI = Head System of e2 b. Tail System of e1 = Tail System of e2 c. Tail System of e1 = Head System of e2 Figure 2. 16 Other Concatenations of Subpictures in Figure 2. 15

75 In order to describe the use of these matrices, the functions G':B -> M and G":B — > M are defined such that G'(p(e, e')) and G"(p(e, e')) may each assume only the values I and G(D[e']) 1. If 6 (e, e') A e' and G'(p(e, e')) = I, the tail system of e' is selected to be either the head system or tail system of 6(e, e'), whereas, if G'(p(e, e')) = G(D[e']) 1, the head system of e' is selected. Similarly, if 6'(e, e') A e' and G"(p(e, e')) = I, the head system of e' is selected to be either the head system or tail system of 6'(e, e'), whereas, if G"(p(e, e')) = G(D[e'])-, the tail system of e' is selected. Thus, values of G' and G" specify the uses of the head systems and tail systems of the various entities. The interpretation of G' and G" may be illustrated by considering Figures 2. 15 and 2. 16. In these figures, all possible concatenations of 3(ei) and 3(e2) are shown. The values of G' and G" which specify these concatenations are the following, where it is assumed that {e1, e2} S(e) and 6(e, e2) = e: Figure 2. 15 Figure 2. 16a Figure 2. 16b Figure 2. 16c G"(el) I I G(D[e]) G(D[el])G'(e2) I G(De2]) I G(e])1 The values of G' and G" have been chosen to be coordinate transformation matrices so that the selection of head systems and tail systems may be described as transformations of coordinates. In order to discuss this interpretation, the function y:B -> M is defined as follows:

76 y(p(e, e')) = (G'(p(e, e')), G(D[e']), G"(p(e, e'))). (2.26) Each sequence y(p(e, e')) represents the sequence of coordinate transformations to be performed whenever an element of D[e'] is generated as a part of an element of D[e]. The transformation which is represented by G(D[e']) is performed when N(e') is drawn with respect to the tail system of an entity in D[e']. The transformation matrices G' (p(e, e')) and G"(p(e, e')), however, either are computed by some other means or are stored explicitly in the structure. To interpret the sequence y(p(e,e')), consider an entity e' which is about to be produced as a part of e, and assume that 6(e,e') e' and 6'(e,e') e'e Depending on the value of G"(p(e, (e,e'))), the last coordinate system which was defined is either the tail system or the head system of 6(e,e'). The tail system of e' is then that coordinate system which is described relative to this coordinate system by G'(p(e,e'))o If G'(p(e,e')) =I, the tail system of e' is clearly either the head system or tail system of 6(e,e')o However, if G'(p(e,e')) =G(D[e)1), the tail system of e' is generally a different coordinate system. Now consider the head system of e'. The process of drawing 3(e') describes the head system of e' with respect to the tail system of e'. Consequently, the head system of e' is described with respect to the head system or tail system of 6(e, e') by the matrix G(D[e']) G'(p(e, e')).

77 Thus, if G'(p(e, e')) = G(D[e'])-, G(D[e']) G'(p(e, e')) = I, and the head system of e' is either the head system or tail system of 6(e, e'). Either the head system or tail system of e' is then selected to be the coordinate system which is passed on to 6'(e, e'). If G"(p(e, e')) = I, the head system of e' is selected, since it is the last coordinate system which was computed. However, if G"(p(e, e')) = G(D[e'])-, the tail system of e' is selected. In the above discussion, G'(p(e, e')) has been interpreted only for 6(e, e') e e', and Gt"(p(e, e')) has been interpreted only for 6'(e, e') e e'. Each of these matrices has a similar interpretation for 6(e, e') = e' or 6'(e, e') = e' If 6(e, e') = e', the tail system of e, rather than either the head system or tail system of 6(e, e'), is selected to be the head system or tail system of e' according to G'(p(e, e')). Similarly, if 6'(e, e') = e', the head system of e is selected to be the head system or tail system of e' according to G"(p(e, e')). The matrix G(D[e]) for e e E - E0 is then the product of matrices which are components of sequences y(p(e, e')). In particular, if S(e) = {el, e2,..., en, 6(e, el) = el, and 6(e, e l) ei for i=1,2,...,n- 1, G(D[e]) = G"(p(e, en))G(D[en])G'(p(e, en)).. G"(p(e, e2))G(D[e2])G'(p(e, e2))G"(p(e, el))G(D[el])G'(p(e, el)). (2.27)

78 2. 2. 2. 3 Values of F Determined by Concatenation With the functions G' and G" defined, the matrix F(e, e') may be computed for each (e, e') e A as follows: G'(p(e, e')), if 6(e, e') = e', or F(e, e')= (2.28) G'(p(e, e'))G"(p(e, 6(e, e')))G(D[6 (e, e')]F(e, 6(e, e')), otherwise. In order to interpret this equation, the process of drawing j(e) to produce e is considered. This process begins with the tail system of e computed. The tail system of e1 is then described with respect to this tail system by G'(p(e, el)), where e1 is the first entity in S(e). Since G'(p(e, el)) describes the tail system of e1 with respect to the tail system of e, F(e, e1) = G'(p(e, e1)). To compute F(e, e2), where 6(e, e2) = el, the other transformations which are performed before the generation of e, is begun must be considered. These transformations are represented by the matrices G(D[e1]) and G"(p(e, el)), respectively. Furthermore, the additional transformation which is represented by G'(p(e, e2)) must be performed to produce the tail system of e2. The tail system of e2 is then de_ scribed with respect to the tail system-ef el by the transformation matrix G(p(e, e2)) G"(p(e, el)) G(D[el]), i.e., F(e, e2) = G'(p(e, e2)) G"(p(e, el)) G(D[e1]) F(e, e1). The matrices F(e, ei) are computed in similar manner for other entities e. e S(e). 1

79 2. 2. 2. 4 Description of the Structure Since values of F may be computed in this way, a topological structure which represents concatenations of subpictures may be described. As indicated above, the functions y and 6 are needed to compute F. However, if the topology of the picture is to be represented by the set B, the set E and the relation A are not explicitly represented, and the function 6: A -> E is not useful. For this reason, the function L: B -> B U E/D is defined as follows: (D[e], if 6(e,e') = e', or M(p(e, e')) = (2.29) p(e, 6(e, e')), otherwise. All information which is necessary to compute F may be obtained from the functions u and y. If 6(e, e) = e', the first component G'(p(e, e')) of y(p(e, e')) is the matrix F(e, e'). The fact that 6 (e, e') = e' is detected by noting that g(p(e, e')) belongs to E/D, rather than B. If 6 (e, e') # e', components of both y(p(e, e')) and y(Ij(p(e, e'))), as well as the matrix F(e, 6(e, e')),are used to compute F(e, e'). (If F(e,e') is computed after F(e,6(e,e')) is computed, F(e, 6 (e, e')) is known when it is needed.) A topological structure which represents concatenation of subpictures is then described by the set {B, E/D, j, y}.

80 2. 2. 2. 5 Examples of the Structure Figure 2. 17 shows a structure of this form for each of the example pictures in Figure 2. 12. In this figure, the values of y are given explicitly, and the function p, is represented by assigning values of r7 such that 7t(e, e') = r7(e, e") + 1 wherever gp(p(e, e")) = p(e, e'). The structure shown in Figure 2. 17a guarantees that the picture is a parallelogram as long as the subpictures /3(el) = /3(e3) and /3(e2) = 3(e4) are each straight lines which may be concatenated at their end points. Since the only coordinate transformations which are represented in this structure are translations, all entities which are formed from one of these subpictures must be parallel lines of equal length. The only additional requirement needed to insure that the figure is a parallelogram, then, is that G({(}) be the identity matrix, i. e., that the figure be a closed polygon. Clearly, G(}) = G({ e e4}) G({e,e3}) G({ e2, e4})G({e1 e3}). Since both G({ e1, e3} ) and G({e2 e4}) represent translations, the transformations which they represent are commutative, and G({X}) = G({e2, e4}) GG({ e,4})G({e1, e}) G({e, e3}) = I. For purposes of discussion, assume that the levers in the system represented in Figure 2. 17b are to be modified by modifying the subpictures /3(el) and 3(e2). The structure insures that the tail system of e2 is equal to the head system of e1. Consequently, if e is rotateiby replacing /(el) with a rotated form of 3(el), i. e., if /(el) is modified so that G(D[ el]) becomes

81 {X4 0 1 1 e0 a. Paralllogramini 3 20 12 {/ / }\ \ r o1000 0e \N. e47 = 0 0 1 ~ 0O el e3} {e2 e42} X2 Y2 1 y(p(, el)) = (I, G({el,e3),I) y;(p(, e2)) = (I, G({e2, e4}), I) (p(X, e3) = (G ({ell, e 3}), G(e e}, e3})-1).,(p(X, e4)) = (G({e2, e4})-i, G({eZ, e4}), G({e2, e4})-) a. Parallelogram in Figure 2.12a f I f 0 0 00 Fgr 2.\0 1 0 0 {e Ap pliaton G(ofteCne at i F= o O 1 0.~:ei}):X1 0 0 1 00 1 Lx2 Y2 0 1 y<(p(;, el))= (I, G({el}), 1);Wy(X e2)) = (I, G({ e2}), I) b. Lever System in Figure 2.12b Figure 2.17 Applications of the Concatenation Facility

82 1 0 0 0 cos a sin a 0 0 0 1 0 0 -sin a cos a 0 0 0 00 10 0 1 0 1 Y 0 1 0 0 0 1 where a is the angle of rotation, e2 is translated so that it remains concatenated to el, and it is rotated through the angle a. However, if 3(e2) is replaced with a rotated form of j(e2), e2 is rotated about the origin of its tail system,and e1 is not modified. In practice, topological structures which represent concatenations of subpictures are more complex than those shown in Figure. 17. For example, consider a program which provides for the editing of text via an interactive computer display. A page of text is to be displayed on a two-dimensional display so that the user can insert and delete both characters and lines. A topological structure which represents concatenation is useful here because, as an item is inserted, the text must be adjusted to provide room for the insertion. Furthermore, as text is deleted, the remaining text must be adjusted to close the gaps which are created by this process. A suitable form of the topological structure for use with this program is indicated in Figure 2.18. The picture is composed of e0 and the n lines of text el, e2,..., en. The entity e0 is an invisible entity whose purpose is to establish a tail system for e which is different from the coordinate system with respect to which the picture is drawn. For example, the picture may be drawn with respect to a coordinate system whose origin is at the center

83 { } { el" e2''' n 21' \n (p(e ei'))= (I,G({ei}), G({ei') \) y(p(e,e')) = (i, G(le']), I) for (e, e') # (ei, ei'), i=l,2,.., n Figure 2. 18 A Topological Structure for an Editor Program

84 of the screen. However, it is usually desirable to begin a page of text in the upper left hand corner of the screen. Each line ei, i=l, 2,..., n, is composed of a vertical displacement ei and a string of characters e!. Each line is considered to have these two parts so that the position of subsequent lines will not be affected by the number of characters which it contains. This independence of the number of characters in a line is achieved by ignoring the head system of each character set e!, i. e., by choosing y(p(ei, e!)) to be (I, G({e }), G({e'l})1). The concatenations which are involved in describing a page of text are illustrated in Figure 2.19. Each character has a tail system at its lower left hand corner and a head system at its lower right hand corner, as illustrated for the character "E" in the word "SOME" in the figure. Several of the character subpictures which are concatenated to each other form a character string which has a tail system at its lower left hand corner and a head system at its lower right hand corner. An example of such a string is the string "SOME" which is denoted el in Figure 2.18. A line of text is formed by concatenating the subpicture for a text string to an invisible subpicture so that the head system of the line is the tail system of the text string and the tail system of the line is positioned above this head system. In Figure 2.19, the line e1 is formed by concatenating the invisible subpicture x(ei ) to the subpicture i(ei ) in this way. Finally, the page of text is formed by concatenating

85 Tail system of e Tail system of e' Head system of e1 Tail system of "E" Head system of "E" = Tail system of el. = Tail system of e2 Head system of = Head system of el = Tail system of ei "M" = 1Head system of e = Head system of e, Head system of e" Figure 2. 19 Concatenations of Text Characters

86 subpictures for the lines of text. The purpose of this structure is to facilitate the insertion and deletion of text. The character e may be inserted into the line e. after the character e' by creating the element p(ei, e) E B such that t(p(e, e)) = p(e!, e'). If this is done, all characters to the right of e' in line e. are shifted right one character width to provide room for the new character. Similarly, a character e may be deleted by destroying the element p(ei', e). If this is done, all characters to the right of e in the line ei are shifted left one character width to close the gap in the line. A line of text may be inserted below the line ei on the page by inserting it after line ei in the structure. All lines which are below ei are then moved down to provide room for the new line. Similarly, if a line is deleted, all lines which were below it are moved up on the page to close the gap left between lines. 2. 2. 3 Applicability of Structures Although the structure {B, E/D, A, y} provides for concatenation of subpictures, it does exhibit some disadvantages when compared to the structure {B, E/D, F}. In particular, invisible entities are often needed to introduce coordinate transformations into the structure. Examples of these invisible entities are the entities e0 and e', e',.., e" in Figure 2. 18. The purpose of e0 is to translate the origini of the page to the upper left hand corner of the screen, whereas the purpose of each entity e', i=1, 2,..., n, is to translate

87 each line of text so that it is displayed below the previous line. Additional entities to those which are necessary to define the picture may also be needed to suppress the effect of certain values of the function G. For example, the entities el, e2',.., enT in Figure 2. 18 serve this purpose. Since y(p(ei ei)) (I, G(D[eip]), G(D[ei]) 1) for i=l, 2,..., n, G(D[ei']) does not affect the position of any entities in the picture. Each of these entities which contributes only coordinate transformation information to the structure and which is not otherwise needed to define the picture will be termed an artificial entity. The artificial entities which may be needed in a structure B, E/D, p y} in order to represent a coordinate transformation in the corresponding structure {B, E/D, F'} are depicted in Figure 2. 20. This figure shows the representation of p(e, e') which is needed for each entity which is to be modified independently of those other entities which are not related to it by C. The entities in D[e1] are invisible entities which introduce F(e, e') into the structure, whereas the entities in D[e2] are needed to suppress the effect of G(D[e']). If the structure shown in Figure 2. 20 requires more storage or time to interpret than the element p(e,e') e B and the matrix F'(p(e,e') in the structure {B, E/D, F'}, the structure {B, E/D, F'} may be more suitable than the structure {B, E/D, L,, y} for those applications in which entities are not frequently concatenated.

88 D[e] e2] D[e ] D[e'] G(D[el]) = F(e,e') G'(p(e2,e')) = I (p(e, e2)) = (I, G(D[e2]), G(D[e2]) y(p(e2, el)) = (I, G(D[el]), I) Figure 2. 20 Isolation of Coordinate Transformations in the Structure {B, E/D,,, y}

89 Although the structure {B, E/D, g, y} is inferior to the structure {B, E/D, F'} for some applications, it is often more suitable for those applications which involve frequent concatenations of subpictures. Concatenation of subpictures can be represented by the structure {B, E/D, F'}. However, this type of representation requires that some artificial entities be defined, and it requires more computation to modify. These two methods are compared in Figure 2. 21. In this figure, the subpicture P3(e0) is represented as a concatenation of the subpictures 3(el), j3(e2),..., 3(en). 2n elements of E/D and 2n-1 elements of B are required to represent 3(e0) in this way if the structure is described {B, E/D, F'} whereas only n+l elements of E/D and n elements of B are required if the structure is described by rB, E/D,,y}. Furthermore, if one of the subpictures 3(ei), i=l, 2,..., n, is modified such that G(D[ei]) is changed, new transformation matrices F(eg, ei)F(e0, eil -) and F(e0, e l)F(e0, ei) must be computed if the former structure is used, whereas no new matrix need be computed if the latter structure is used. These considerations justify the use of the structure {B, E/D, p, 7} for some applications. 2 3 Conclusion Two structures which represent the topology of a picture have been described. In either structure, each entity is represented by a coordinate transformation and the subpicture to which this transformation is to be applied to produce the entity. By considering entities,

90 {B, E/D,F}: De] D[ eo ] \ ei] 0/ D[e2] D[el] 0 De2] D[ enl] 0 1D[ aid \D e n] Aen-1] F'(p(e, e ) = G'(p(e, el)) FI(p(ei, el )) = G'(p(e, ei+))G"(p(e0, ei))G(D[eL]), i=l, 2,.., n-2 F'(ei,ei) = I, i=1,2,...,n-1 F n(p(e-, en))= G'(p(eO, e))G"(p(eo, e_ ))G(D[e I) n-l n en) = en) {B, E/D, y}: eO] Die1] De2] eI n-en-] D[el] D[e2] D[en_l] D[en] Figure 2. 21 Alternative Representations of Concatenation

91 rather than subpictures, as a basis for defining these structures, a method of representing multiple uses of a particular picture part, as well as multiple occurrences of a subpicture, has been described. The two structures differ in that coordinate transformations are represented in one to facilitate independent modification of entities which are not topologically related, whereas these transformations are represented in the other to enforce concatenation constraints. These structures will be used as a basis for comparing various implementations of topological structures in succeeding chapters.

Chapter 3 COST By using the development given in Chapter 2, a cost function which is a measure of the performance of an implementation of the topological structure may be defined. The objective of this chapter is to define such a cost function. Equations which express this cost function in terms of major design decisions (e.g., whether to use the display processor or a computer program as the picture generator, whether to use the structure {B,E/D,F'} or {B,E/D, L,y}, etc.) are derived in Chapter 4. These equations may be applied to determine the optimum implementation of the topological structure for a given hardware configuration and a given application. The cost of an implementation of the structure will be considered to be the average time which is required to modify and interpret the structure in response to a control language input. For simplicity, the computer which controls the display processor will be assumed to be dedicated to the use of that display processor. Consequently, this response time is not affected by the activities of other users. The discussion will be restricted to display processors whose picture must be continually refreshed. Furthermore, in order to avoid momentary losses of the picture, the process of refreshing the picture will be assumed to have priority over the process of responding to control language inputs. Display processors whose 92

93 picture need not be continually refreshed will not be considered because the response time for these devices is independent of the picture generation process and is generally insignificant when compared to the time which is required for this process. Certain constraints are imposed on the set of possible implementations by the hardware configuration. One of these is a limitation on the amount of storage which is available to represent the structure. Since the computer is assumed to be dedicated to the use of the display processor, this storage is the total storage in the computer minus that which is occupied by the program. A second constraint is a limitation on the amount of time which is available to produce a picture from the structure. This time is the smallest time interval which produces objectionable flicker (typically about 1/30 sec.) In order to describe these constraints, as well as the cost of an implementation of the structure, both the storage which is required by the structure and the time which is arrested from the computer whenever the picture is generated must be described. These items are described in Sections 3.1 and 3.2 below. This discussion is followed in Section 3 3 by a discussion of the cost. 3.1 Storage Requirement As has been discussed in Chapter 2, the topological structure may be represented by either of the sets {B,E/D,F'} or {B,E/D,p,y}.

94 Since the domain of each of the functions F', pl, and yis B, each of these functions may be represented by storing one of its values as part of the representation of each element of B. If this is done, the storage which is required to represent either of the sets {B,E/D,F'} or {B,E/D,g,y} is that necessary to represent the elements of B and E/D. In addition to the information which is needed to describe the structure, the set of subpictures which are associated with the elements of E/D must be stored so that a picture may be produced. Each of these subpictures may be stored as part of the representation of the class in E/D with which it is associated. For e e E, /3(e) must be represented as plotting information, whereas, for e e E - EO, 3(e) may be represented by a reference to the set.p({e}xS(e)) CB. Because subpictures are represented in these two different ways, the storage requirement for classes in E /Do will be expressed separately from that for classes in E/D - E0/D0. The total storage s which is required to represent the topological structure at any given time is then = B I + [Eo/Do ISd + IE/D-E /DO sd' (3.1) where Sb is the average storage which is required to represent an b element of B, Sd is the average storage which is required to represent a class in Eo/Do, and

95 sd is the storage which is required to represent a class in E/D - E0/D. The average storage per element of B and the average storage per element of EO/DO appear in this equation because the various elements of B generally require different amounts of storage and the various elements of EO/DO generally require different amounts of storage. However, sd does not represent an average because each element of E/D - EO/DO generally requires the same amount of storage. The storage which is required to represent the elements of each of these sets is discussed below, following a discussion of the overhead storage which is common to all elements. 301o 1 Overhead Storage Since the purpose of the topological structure is to facilitate modification of the picture, the sets B and E/D are modified frequently during the execution of the program. Consequently, blocks of storage which are required to represent elements of these sets must be created (i. e., obtained from a free storage pool) and destroyed (i.e.,returned to the free storage pool) frequently. In order to manage storage in this way, some overhead storage is generally associated with each block. For example, a simplified form of a dynamic storage allocation technique which has been described by Knuth [ 30 pp.435-442] is depicted in Figure 3.1. In addition to those locations which are needed to represent data, each block which is created by

96 In use-d7 i1 Y to next (flag=O)f free data block a. Storage Blocks Block to be ___ destroyed I..=... b. A Storage Block To Be Destroyed Figure 3 l A Storage Allocation Scheme

97 this method must have a control word at each end of the block (Figure 3. la). Each of these control words contains a pointer to the other end of the block and a flag to indicate whether or not the block is being used. Furthermore, each free block is linked to another free block by a pointer which occupies the first location which is used for data when this block is created. These pointers are arranged so that the free blocks may be examined sequentially. In order to create a block of length n, the string of free storage blocks is scanned to find a block of length m > n. If m > n, but m < n+2, the block is removed from the free storage string and created. If m > n+2, the block is subdivided into two blocks, one of length n and one of length m-n. The block of length n is then created, and the block of length m-n is substituted for the original block of length m in the free storage string. (A block of length m < n+2 is not subdivided because a free storage block of length m-n cannot be formedo) The pointer in the first control word of each free block which is examined is used to determine the length of the block for this operation. This length is one more than the value of this pointer minus the address of the location in which it appears. Full use of the control words is made when a block is destroyed (Figure 3.1 b)o In order to insure that the free storage blocks are as large as possible, each block must be concatenated to any free blocks which are adjacent to it when it is destroyed. Whether or

98 not either of the two blocks which are adjacent to the block to be destroyed is free is determined by examining the flag in the last word of the block which precedes the block to be destroyed and the flag in the first word of the block which follows the block to be destroyed. If one of these flags is a 1, the pointer in the word in which it appears is used to locate the other control word in the same block. This control word, together with a control word in the block which is being destroyed, is then modified to concatenate the two blocks, The overhead storage which is required to hold the control information for creating and destroying storage blocks is generally constant per block. If the amount of storage which is required by any element of BUE/D is assumed not to vary between the time that that element is created and the time that it is destroyed, each of these elements requires only one block of storage o Consequently, this overhead storage is generally constant for all elements of BUE/D. Additional overhead storage may be needed in each block to hold information which indicates whether that block represents an element of B, an element of E/D - EO/D0, or an element of EO/D0. The topological structure can be implemented in either of two ways: as a list structure, or as a display processor program. Whenever a list structure is used, the program which generates the picture, as well as programs which interpret the structure in order to respond to control language inputs, must determine the type of element that each block represents in order to interpret it properly.

99 However, if the topological structure is implemented as a display processor program, the display processor merely executes this program and does not need to interpret the meaning of each storage block. Although programs which operate on this structure do need this information, the format of each storage block usually may be examined to determine which type of element the block represents, For example, the program which is described in Appendix A determines which type of element a particular block represents by examining its first word. If this word contains a push jump command, the block represents an element of B, whereas, if it contains a jump command, the block represents an element of E/D - E0/Do. If this word contains neither a push jump command or a jump command, the block represents an element of E0/Do 3.1o2 Storage Per Element of B In order to describe the storage which is required to represent an element of B, the information which might be stored to represent an element of B is considered. Each element p (e,e') e B was defined to be a triple of the form (D[ e],D[e'], r(e,e')). The purpose of the function r7 was to distinguish distinct elements (D[e],D[e'],7(e,e')) and (D[e] D[e,"],(e,e")) for which D[e'] =D[e"]. If each element of B is stored in a random-access memory, the address of each element of B is unique and distinguishes it from other elements of B. Consequently, the function r7 need not be storedo Since each element of

100 E/D is generally a component of more than one element of B, the elements of E/D are stored independently of the elements of B. Then, references to the classes D[e] and D[e'] either must be stored as part of the representation of p(e, e') or must be computable from other information in the structure. As has been mentioned at the beginning of Section 3, 1, a value of either the function Ft or the function y must be stored as part of the representation of each element of B to permit computation of coordinate transformations when the picture is generated. Which of these values is stored is determined by the design decision u3, which will be discussed in Chapter 4. For the structure {B,E/D,F'}, the matrix F'(p(e,e')) must be stored as part of the representation of p(e,e')o For the structure {B,E/D,pi,y}, the sequence (p(e,e')) must be stored as part of the representation of p(e, e') Although the function u seems to be needed to describe this latter structure, in fact the values of /i need not be stored. Since each element i (p(e,e')) e BUE/D is encountered during the picture generation process before p(e,e') is encountered, the information which the function A contributes to the picture generation process may be retained until needed. In particular, since /u(p(e,e')) is examined before p(e,e') is examined during the generation of the picture, the matrix G"(p(e,5(e,e')))G(D[ 6(e,e')]) F(e, 6(e,e')) which is computed (as described in Section 2.2.2 3) when the entity 6(e,e') is displayed may be retained until p(e,e') is examinedo Then, this matrix may be premultiplied by G'(p(e,e')) to produce F(e,e').

101 However, a reference to i(p(e,e')) may be included in the representation of p(e,e') to facilitate interrogation of the structure for ordering information. Even if coordinate transformations are represented by values of F' this ordering information may be useful. For example, the ports of the transistor shown in Figure 2.4 may be ordered so that each of them can be identified as either the collector, base, or emitter of the transistor. The design decision u8, to be discussed in Chapter 4, specifies whether or not references to values of M are stored. If values of i are not stored in the blocks which represent elements of B, some other indication of ordering must be stored in these blocksso that these elements may be scanned to generate a picture. The function g: B -> B UE/D has been defined in Chapter 2 such that u (p(e,e') denotes the element of p({e} x S(e)) immediately before p(e,e') which is needed to form 3(e) (unless p(e,e') is the first element of p({e} x S(e)) which is needed to form j(e)). However, in order to determine the element of p({e} x S(e)) immediately after p(e, e') which is needed to form 3(e), the structure must be searched if the function Mi is the only indication of ordering which is stored. For this reason, a reference to a value of the function /': B -> B UE/D is generally stored in each block which represents an element of B, where D[e], if 6'(e,e') =e', or u'(p(e,e') = (3.2) p(e,'(e,e')), otherwise

102 Then, if /'(p(e,e')) e E/D, p(e,e') is the last element of p({e}xS(e)) which is needed to form 3(e), whereas, if,'(p(e,e')) e B, il(p(e,e')) is the element of p({f} x S(e))immediately after p(e,e') which is needed to form 3(e)o In order to either respond to a control language input or to enforce a constraint, elements of the set P(D[e]) ={p(e',e") Ie"e D[e] and (e',e") A} (3.3) must often be determined for a class D[e] e For example, if a class D[e'] is to be substituted for a class D[e], the second component of each element of P(D[e]) must be modified. (Recall that p(e',e") (D[e'], D[e"], r(e',e")).) As a second example, the elements of P(D[e]) must be destroyed in order to remove a connection e from the network diagram shown in Figure 2. 4 In order to facilitate operations on the structure such as these, a reference to each element of P(D[e]) may be stored in the structureo However, because elements of B are frequently added to and removed from each set P(D[e]), these references are generally not stored as part of the representation of D[e]. Instead, the elements of each set P(D[e]) are generally linked together in a ring withthe class D[e] References to adjacent elements in this ring must then be stored as part of the representation of each element of P(D[e]). Whether or not these elements are linked together in a ring is determined by the design decision u10, which will be discussed in Chapter 4.

103 Thus, the items which may be stored to represent p(e,e') E B are the following: (1) A reference to the class D[e], (2) A reference to the class D[e'] (3) A reference to i(p(e,e')), (4) A reference to l'(p(e,e')), (5) Either the matrix F'(p(e,e')) or the sequence y:p(e,e')), and (6) References to adjacent elements in the ring which links the elements of P(D[e]) with D[e'] o However, not all of these items need be stored in order to represent an element of B, since some of them may be computed from those which are stored. The second example shown in Section 3o 1 4 below illustrates the omission of some of these items. In addition to the overhead storage and the storage which is needed to describe an element of B, some storage which contains no useful information may be needed to represent an element of B. If two or more of the items which describe an element of B each do not occupy an integer number of storage locations, they may share a common storage location. The remaining storage in that location may then be unusable because either it is not large enough to hold another item or there are no other items to be stored.

104 The average storage sb is the sum of the overhead storage, the average storage which is required to describe an element of B, and this unusable storage. This sum may be expressed as follows: Sb =s+s+s +Se+se+s l+sl S + s + s (3.4) b 0 t p e e IL +s fsy wb, where sO is the overhead storage which is associated with creating and destroying a storage block, so is the overhead storage which is needed to indicate that the storage block represents an element of B, s is the storage which is required in each block which p represents an element of B to reference adjacent blocks in the ring which represents a set P(D[e]), se is the storage which is required to reference the first component of an element of B, s' is the storage which is required to reference the second e component of an element of B, s is the storage which is required to reference a value of ji, s' is the storage which is required to reference a value of i'. Sf is the average storage which is required to represent a value of F', s is the average storage which is required to represent a value of y, and

105 s is the average storage which is unusable in each block wb which represents an element of B. In practice, several of the terms in this equation are zero. For example, if the structure is {B,E/D,F'}, s =0, whereas, if the 7 structure is {B,E/D,j,y}, sf =09 Furthermore, regardless of which structure is used, the terms sps e and s are zero if each set P(D[e]), first components of elements of B, and values of 1 are determined by searching the structure. As indicated by the fact that s. represents an average amount of storage, various amounts of storage may be required to represent values of the function F' In particular, various amounts of storage are required if default values are assumed for those elements of each matrix which are not specified. For example, consider a two-dimensional display system which uses coordinate transformations which are represented by matrices of the form cos 0 sin 0 0 - sin e cos 0O 0 0 1 0 Ax Ay 0 a This matrix represents a coordinate transformation which maps coordinates expressed with respect to a coordinate system W into coordinates expresses with respect to a coordinate system W' whose origin is the point (-Ax, -Ay) in W, whose x and y axes form the angle & with the respective axes of W, and whose units of measurement are a times as large as those of Wo The matrix may be stored as the

106 four-tuple (x, Ay, 0, ). If the default value of each matrix element is assumed to be the corresponding element of the identity matrix, not all components of this four-tuple need be stored. If a = 1, the three-tuple (Ax, Ay, 0) is sufficient to represent the matrix, and if both ca 1 and 0 =0, the pair (Ax, Ay) is sufficient. If a = 1, 0 =0, and Ax = Ay =0, the matrix is the identity matrix and need not be stored at all. Similarly, various amounts of storage may be required to represent values of the function y. Each sequence y(p(e,e')) assumes one -i -1 of fourforms: (I,G(D[e]),I), (I,G(D[e']), G(D[e']) ), (G(D[e']) G(D[e'] ),), or (G(D[e'] ),G(D[e'] ),G(D[e'] ) ) The matrix G(D[e']) is not stored, for the coordinate transformation which it represents is performed when the subpicture 3(e') is drawn. Because there may be many elements of B whose second component is D[e'],G(D[e']) is not stored with y(p(e, e')). The only information which is needed to represent the sequence y(p(e,et)) is then a specification of its form. In some implementations (e. go, the program described in Appendix A), the amount of storage which this specification requires depends on which form y(p(e,e')) assumes. The dependence of the terms in this equation on the design decisions will be discussed in Chapter 4. In that chapter, a method for computing s without actually determining Swb will also be described. fb 8b as edsrbd

107 3.1.3 Storage Per Element of E/D In order to describe the storage which is required to represent a class in E/D, the information which is necessary to represent this class is considered. Since each entity is to be computed from the structure, the entities in each class in E/D need not be stored. However, the subpicture 3(e) must be included in the representation of D[e] so that the entities in D[e] may be generated. For D[e] e E/D - E0/D0, this subpicture may be represented by a reference to the set p({e}x S(e)). However, a reference to I'(p(e,e')) is assumed to be stored in the block which represents each element p(e,et) so that the element of p({e} x S(e)) immediately after p(e,e') which is needed to produce 3(e) can be easily identified. Consequently, a reference to p(e,e') such that,(p(e,e')) =D[e] ( i.e., the first element of p({e} x S(e)) which is needed to form 3(e)) is sufficient to represent this set. For D[e] e E0/D0, however, the subpicture 3(e) must be represented explicitly. In addition to the subpicture j(e), other information may be stored to represent each class D[e]. As has been mentioned above in Section 3. 1 1, the elements of the set P(D[e]) may be linked together in a ring with D[e]. If P(D[e] ) is represented in this way, some storage is required in the block which represents D[e] to reference blocks which are adjacent to it in the ring. The amount of storage which is required for this purpose is sp, the same as that

108 which is required for this purpose in each block which represents an element of B. The matrix G(D[e]) must also be stored as part of the representation of some of the classes D[e] if the structure is {B,E/D,I,y}o If a subpicture 3(e') for which (e,e') e C is modified so that G(D[e']) is modified, G(D[e]) must also be modified. Consequently, if each matrix G(D[e]) is stored with D[e] for D[e] E E/D - EO/D, the computer must modify this matrix whenever it modifies a subpicture on which the matrix depends~ This requirement produces a demand on computer time which defeats the purpose of the structure {B,E/D, L,y}. However, if each matrix G(D[e] )-1 is stored explicitly for D[e] E EQ/DO, but is computed from the structure when the picture is generated for D[e] E E/D - E0/D0, it is effectively modified whenever a subpicture on which it depends is modified. In order to describe the computation of each matrix G(D[e] ) for D[e] e E/D - EO/D0, recall from Equation 2 27 that G(D[e]) =GG"(p(e,en))G(D[en] )G'(p(e,en)).. G"(p(e, e2))G(D[ e2] )G'(p(e, e2))G"(D (e, el)) G (D[ el] )G' (p(e,el)), where S(e)= {el,e2,...,en, 6(e,el)= el, and 6 (e, e+l) ei for i= 1, 2,...,n-l. From this equation,

109 G(D[e]) 1 = G(p(e,el)) G(D[el]) lG" (p(e,el)) lG'(p(e,e2))l1 G(D[e2] ) lG"(p(e,e2))1. G'(p(e,en)) lG(D[en] )lG"(p(e,en)). (3.5) If G(D[e'] )-1 is stored explicitly for all D[e'] E EO/D0, then G(D[e] )-1 for D[e] E ED - E/D may be obtained from the structure by repeated application of this equation. If this is done, and a subpicture on which G(D[e]) depends is modified, G(D[e] ) assumes the correct value with no further adjustment of the structure. If the display processor is used as the picture generator (as determined by the design decision ul, which is described in Chapter 4), some information which is needed only to control the display processor often must be stored in each block which represents an element E/D. In particular, display processor commands which cause the display processor to compute G(D[e])1 for D[e] e E/D - Eo/D0 must be included in the block which represents D[e] in the topological structure.{B,E/D,L, y}. The program which is described in Appendix A was designed to manage a topological structure in which a display processor jump command is used for this purpose. As a second example, the reference to D[e'] which is stored in the block which represents p(e,e') may be implemented as a display processor subroutine call. Display processor commands which return from this subroutine call must then be stored in each block which represents a class in E/Do

110 The average storage sdO which is required to represent an element of EO/D may be expressed as follows: sdO S+ st+ s+ ro+ s Og + wdO (30 6) where srO is the storage per element of Eo/D which is occupied by information whose only purpose is to control the display processor, s is the average storage per element of Eo/D0 which is Po3 required to represent a subpicture as plotting information, s is the average storage per element D[e] e EO/DO which is required to represent the matrix G(D[e] ), and swd0 is the average unusable storage per element of EO/D0. Similarly, the storage sd which is required to represent an element of E/D - E0/Do may be expressed as follows: sd =So+ st+S+ r+ S + swd (3 7) ^V^V' p r wd' (3'7) where s is the storage per element of E/D - E0/D0 which is occupied by information whose only purpose is to control the display processor, sP is the storage per element D[e] E E/D - E0/D0 which is occupied by references to the set p({e} x S(e)), and swd is the unusable storage per element of E/D - EO/D0o Like the terms in Equation 304, some of the terms in Equations 3.6 and 3.7 may be zero for some implementations. For the structure

ll {B,E/D,F'}, s =0. Furthermore, s =0 if each set P(D[e]) is'g'p determined by searching the structure. If the display processor is not used as the picture generator, SrO = s = 0~ Y r0 r The terms in Equations 3. 6 and 3. 7 will be described as functions of the design decisions in Chapter 4. In that chapter, a method for computing sd and sd without actually determining swd or swd will also be described, 3. 1.4 Examples In order to illustrate the storage requirements for elements of B and elements of E/D, a list structure representation of {B,E/D, E, y} is depicted in Figures 3. 2 and 3.3. Figure 3 2 shows the form of the data blocks which represent elements of B and E/D, whereas Figure 3.3 shows the interconnection of these blocks to represent a picture which consists of two angles (el and e2) which share a common side (e3)o In this example, each storage location is considered to be capable of containing two pointers. Consequently, s = se = s = s = 0.5 p e e locations. Because this list structure represents {B,E/D, L,y}, = 0. Each sequence y(p(e,e')) is represented by two bits as follows: 00: y(p(e,e')) (I,G(D[e']),I) 01: y(p(e,e')) = (I,G(D[e'] ),G(D[e'] )1) 10: y(p(e,e')) = (G(D[e'] ) G(D[e'] ),I) 11: y(p(ee')) = (G(D[e'] ) G(D[e'] ),G(D[e'] )-) Consequently, s = 2 bits. Since no other item which is stored to represent an element of B can be packed with these two bits, the

112 L(p (e, e)) - -- I'(p(e e)) D[e]. — - D[e'] y(p(e,e)) ---. next element in ring which represents P(D[ e']) a. A Block Which Represents p(e, e') first element in ring which [7 ZI > _ represents P(D[ e ]) -p(ee') suc p(e,e") such that'i(p(e,e')) that j (p(e,et)) =D[ e] D e b. A Block Which Represents D[ e] cE/D-EO/D0 first element in ring which:~- ----— Z..represents P(D[ e]) ___ _-___ ~ _G(D[e] )-1 ( J h(e) c. A Block Which Represents D[ e] eE0/D0 Figure 3 2 Data Blocks for a List Structure Representation of {B, E/D, a, y}

113 e5 e4 1 I "ll. p(XeJl (el, p(e 2 e' P(el, e Figure 3o3 Reetation of TwO Angles by a stu

114 remainder of the location in which each value of y is stored is unusable, and Swb= 0. 5 locations - 2 bits. For D[e] E E/D - EO/D0, P(e) is represented by pointers to both the first and last elements of p({e}x S(e)). Consequently, s= 1 locationo For D[e]EE0/DO, (e) and G(D[ e] ) are stored explicitly. Since there is no information to store in the high order half of the first word in each block which represents a class D[e], SwdO = wd = 0. 5 locations. For any class D[ e] e E /D0, the storage which is required to represent G(D[e] )1 plus that which is required to represent,3(e) is assumed to be at least 3 locations. Whether a block represents an element of B, E/D - EO/D0, or EO/Do may then be easily determined from the length of the storage block. Each block of length 3 represents an element of B, each block or length 2 represents an element of E/D - E0/DO, and each block of length > 4 represents an element of E0/D0O Because the type of element which a block represents may be determined from its length,.t = 0 Much of the information which is stored in this list structure may be computed from other information in the structure, Consequently, by eliminating these items from the structure, computation time may be traded for storage. The pointers which represent values of M may be eliminated at th the expense of the computation time which is required to sequence through portions of the structure whenever a value of this function is to be determined. Similarly, the pointer to p(e,e')

115 such that MO'(p(e, e')) = D [e] inay be eliminated from each block which represents a class D[e] o The pointer to the block which represents D[e] in each block which represents an element p(e,e') e B may also be determined by searching a portion of the structure0 Consequently, this pointer may also be eliminated. The pointers which link the elements of each set P(D[e]) with D[e] may be eliminated at the expense of the time which is required to search the entire structure for this information, If all of these simplifications are applied to the list structure shown in Figure 3.2, the list structure shown in Figure 30 4 results. For this structure, s',s' sy,sg, and swd are unchanged from their e' I' y g' wd values for the list structure described above. However, s = s = =0'p e g and s= 0. 5 locations. Furthermore, swb = 1 location - 2 bits, and wdO 0 ~wd0V-O Both of the list structures shown in Figures 3.2 and 3. 4 represent the topological structure {B,E/D, I, y}. For many applications, the latter list structure cannot be interpreted as rapidly as the former list structure. However, the former list structure may require more time to modify because more information must be changed when it is modified' In order to choose between alternatives such as these, the cost will be expressed in Chapter 4 as a function of the information which is stored.

116 -_'(p(e,e')) 7(p(ee')) -- > D[ e'] a. A Block Which Represents p(e, e') i..... i,.> p(e, e') such that jl(p(e,e')),]-.....-1 =D[e] b. A Block Which Represents D[ e] e E/D-E0/D0,___^_ I) G(D[ e]) L _f}(e) c. A Block Which Represents D[ e] EE0/D0 Figure 3 4 Modification of the List Structure Blocks in Figure 3, 2

117 3. 2 Computer Time Required to Generate a Picture As has been mentioned in Chapter 2, the picture X is generated by displaying all entities in E0. However, in order to determine entities in E0 from the structure, the picture generator must sequence E0 through the portion of the structure which describes entities in E-EO. As has been mentioned in Chapter 1, either the computer or the display processor may perform this functiono (Which method is used is determined by the design decision ul, which is described in Chapter 4.) If the computer sequences through the structure, it must be devoted to this process for short periods of time during which it cannot perform other functions (such as responding to control language inputs). Even if the display processor sequences through the structure, the computer may be suspended while the display processor accesses its memory. Similarly, once an entity in E0 has been determined from the structure, the computer must be suspended while the entity is transferred to the display processor. In this section, the time during which the computer must be devoted to the process of generating the picture is described. 3.2.1 An Algorithm for Generating the Picture In order to describe the time during which the computer must be devoted to the generation of the picture, the procedure which is used must be considered. A procedure Which is applicable to either of the structures {B,E/D,F'} or {B,E/D,, y} is given by Algorithm 3.1 below, Although other algorithms are possible, the algorithms which have been used in practice differ insignificantly from this one.

118 Consequently, in all subsequent discussion, Algorithm 3.1 will be assumed to describe the procedure which is used to generate the picture. Algorithm 3. Procedure for generating a picture from either of the topological structures {B,E/D,F'} or {B,E/D, g,y}. (1) Let J= H(X) = I, let b be the element of B such that At(b)= {X}, and empty a push-down stack for use in this algorithm. (2) Save b on the push-down stack. Let Xe E/D be the second component of b. If the topological structure is {B,E/D,F'}, let J=F'(b)J; otherwise, let J=G'(b)J. If there exists an element b' EB such that (b')=X, let b=b' and repeat this step. (3) J now equals H(e) for some entity in E. Display this entity by applying J to the subpicture which is associated with X. If the topological structure is {B,E/D,,y}, let J= G(X) J after this entity is displayed. (4) If the push-down stack is empty, terminate. Otherwise, restore b from the push-down stack. If the topological -1 structure is {B,E/D,F'}, let J= F'(b) J; otherwise, let J= G"(b) J. If A'(b) E B, let b= /'(b) and proceed with Step 2. Otherwise, repeat this step. I

119 In order to illustrate this algorithm, the steps which are needed to generate the picture which is shown in Figure 2.1, whose relation A is shown in Figure 2.3, and whose set B is shown in Figure 2.10 are given below. Coordinate transformations are represented by values of F', and the following values of g are assumed: i(p(ke5)) =D[X] = {X}, (p(X, e 4)) = p(X, e5), / (p(X, e6)) = p(X, e4), A!(p(e4, e)) =D[e4] = {e4,e6},!L (p(e4, e2)) =p(e4,el), and (p(e4, e3)) = p(e4,e2) Each step is represented below by its number and the items which are affected by performing it. (1) J=I b= p(X,e5) (2) Stack contains p(X,e5) X= {e5} J =F'(p(X,e5)) =H(e5) (3) Display e5 (4) b =p(X,e5); Stack empty J =I b =p(X, e)

120 (2) Stack contains p(X, e4) X ={e4, e6} J =F'(p(X,e4)) b =p(e4,el) (2) Stack contains p(X,e4),p(e4,el) X ={e,e2 e7 e8} J =F'(p(e4, e))F'(p(X,e4)) =H(e1) (3) Display e (4) b = (e4,el); Stack contains P(X, e4) J = F'(p(, e4)) b =p(e4,e2) (2) Stack contains p(X, e),p(e4,e2) X={el, e2 e, e8}' 2' 7' J =F t(p(e4, e2))F' (p(X, e4)) = H(e2) (3) Display e, (4) b = p(e, e2); Stack contains p(X,e4) J =F't(p(X,e4)) b =p(e4, e3) (2) Stack contains p(X, e),p(e, e3) X ={e3,e4} J =F'(p(e4, e3))F'(p(X,e4)) =H(e3) (3) Display e3 (4) b =p(e4,e3); Stack contains p(X,e4) J =F'(p(, e4))

121 (4) b =p(X,e4); Stack empty J =1 b =p(X, e6) (2) Stack contains p(X, e6) X ={e4,e6} J =F'(p(X,e6)) b =.p(e 6 e7) (2) Stack contains p(X,e6),p(e6, e7) X = e{e,,e e e} J = F(p(e6,e7))F'(p(, e6)) =H(e7) (3) Display e (4) b =p(e, e7); Stack contains p(, e6) J = F'(p(X,e )) b = p(e, e8) (2) Stack contains p(X,e6),p(e6,e8) X ={-e,e2,e7,e 8} J =F'p(ee 8))F'^,)) = ( ) (3) Display e (4) b =p(e6,e8);; Stack contains p(X,e6) J = F'(p(X,e6)) b =p(e6,' e3) (2) Stack contains p(X, e6),p(e6, e9) X= {e3,e9} J = F'(p(e6, eg))F'(p(, e6)) =H(eg)

122 (3) Display e9 (4) b =p(e6, e); Stack contains p(X,e6) J =F'.(p(X, e6)) (4) b =p(A,e6); Stack empty J =I Although each modification of the matrix J has been described as a matrix multiplication in this algorithm, some of these modifications may be performed in other ways. In particular, if the structure is {B,E/D,F'}, letting J= F(b) J in Step 4 merely restores J to the value which it assumed before it was premultiplied by F'(b) in Step 2. In practice, the original value of J is often saved with b on the pushdown stack during Step 2. This value is then retrieved later during Step 4 in lieu of premultiplying J by F'(b). Whether or not these matrices are saved on the push-down stack and later restored from the push-down stack is determined by the design decision us, which is discussed in Chapter 4. For the structure {B,E/D, D, y},letting J =G(X)J in Step 3 of the algorithm may also be accomplished without performing a matrix multiplication. Instead, the process of displaying an entity by applying J to the subpicture which is associated with X is used to modify J. For example, consider a two-dimensional display processor which contains x and y coordinate registers, an angle register, and a scale register. The contents of each of these registerswill be denoted x,y, 0

123 and a, respectively. The values x and y define a position relative to the coordinate system with respect to which the picture is to be generated, whereas 0 and a describe how the x and y registers are to be incremented when drawing vectors. The following display processor commands affect these registers: (1) Rotate by AO: AO is added to the content of the angle register, and the result if left in the angle register. (2) Scale by Aa: Aa is multiplied by the content of the scale register, and the result is left in the scale register. (3) Draw vector with components Ax and Ay: (AxcosO- AysinO)/a is added to the content of the x register and the result is left in the x register, (Ax coso + Ay sin /ya is added to the content of the y register and the result is left in the y register. A vector is drawn from the point whose coordinates were the original contents of the x and y registers to the point whose coordinates are the final contents of these registers. The values x,y, 0, and a are considered to represent the coordinate transformation matrix cos& sino 0 0 -sin0 cosO 0 0 0 0 1 0 ax ay 0 a

124 In order to show how J is effectively premultiplied by G(X) by drawing the subpicture which is associated withX, the effect of each command on this matrix is considered. The rotate command increments the value 0, which is equivalent to performing the matrix multiplication cos A0 sinA0 0 0 cos0 sine O 0 0 cos(0+A0) sin(0+A0) 0 0 -sinAO cosA0 0 0 -sine cosO 0 0 -sin(0+A0) cos(0+A0) 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 ax ay 0 a ax ay Oa The scale command multiplies the value a, which is equivalent to the matrix multiplication 10 0 0 cosO sine 0 0 cosO sine 0 0 0 1 0 0 -sine cos0 0 0 -sinO coso 0 0 O 0 1 0 0 1 0 0 1 0 0 0 0 Aa ax ay 0 a aAax aAoy 0 taAa Finally, the draw vector command increments the x and y registers as described, which is equivalent to the matrix multiplication'1 0 0 O rcosO sinO 0 a] 0 1 0 -sine cosO 0 a 0010 0 0 1 0 Ax Ay 0 1 ax ay 0 a cosO sine 0 0 -sine cosO 0 O0 0 1 a(x+(ASfcose - Aysin0)/a) a(y+(Axcose+Aysine)/c ) 0 a

125 Consequently, the rotate, scale, and draw vector commands effectively premultiply the transformation matrix which is represented in the registers by matrices which represent rotation, scale change, and translation, respectively. In order to perform Step 3 of Algorithm 31o, the x,y, angle,and scale registers are initially loaded with values which represent J. The contents of these registers are then modified by the rotate, scale, and draw vector commands which draw the subpicture which is associated with X. The final values which are contained in these registers then represent the transformation matrix G(X)J. Other matrix multiplications in this algorithm may also be performed in a similar way by the display processor for the structure {B,E/D,F'}. However, if the structure is {B,E/D,g,y}, Algorithm 3. 2, which is described later in Section 3. 2. 2. 2, must be executed in order to perform one of these multiplications. 3. 2, 2 Time Required to Perform Algorithm 3, 1 The time g which is required to perform Algorithm 3.1 is the total time during which the computer is devoted to the process of generating the picture. Note that g does not represent the total time which elapses during this process and does not depend on the plotting rate of the display processor. However, the plotting rate does affect the response time and will be considered later in Section. 3.3. An expression for g is derived below by considering each step of Algorithm 3, 1 in detail, 3. 2, 2. 1 Initialization The first step of the algorithm is performed only once during

126 the generation of the picture, since it represents an initialization, Because J is merely initialized, rather than obtained as the result of a matrix multiplication, the time which is required for this step is not large when compared to the time which is required to perform either Step 2 or Step 4. Furthermore, the time which is required for this step is not large when compared to the total time during which the computer is suspended while an entity in E0 is transferred to the display processor in Step 3. Since the initialization step is performed only once, whereas other steps are generally performed many times, and since the time which it requires is not large relative to the time which is required to perform each other step, the time which is required for initialization is generally insignificant and may be ignored. 3.2.2.2 Identifying Entities From the Structure The purpose of the second step of Algorithm 3.1 is to determine the information which is necessary to display an entity e / XA As was mentioned in Chapter 2, the required information is the matrix H(e) and the subpicture 3(e). This step of the algorithm sets the matrix J to the value H(e) and sets X to D[e] Since the only entities which are to be displayed are those in E, and since the subpicture 3(e) is represented explicitly as part of the representation of D[e] for each e E EO,D[e] is sufficient to describe 3(e) for each e which is displayed. For each entity e e E - EO- f{}, H(e) is computed as a step toward computing H(e') for some entities e' E D0, and D[e] is identified so that the next element of B which is to be examined can be identified.

127 Although all required information about an entity e A X is obtained each time that this step is performed, the number of times that the step is performed may be greater than I I-{X} I. In particular, if there exist distinct entities e,e', and e" such that e E S(e') nS(e"), this step is performed to determine H(e) and D[e] at least twice during the generation of the picture: once when e is encountered as a part of e', and once when e is encountered as part of e". Furthermore, H(e'") and D[e"'] are determined at least twice for each entity e"' such that there exists a path from e to e"'. In order to describe the number of times that Step 2 of the algorithm is performed, the function b: E-> {1,2,... } is defined such that 4W(e) is the number of times that e is displayed by Algorithm 30 1, either explicitly (if e E E0) or as a collection of entities in E0 (if e E E -E0)o Clearly, 4(X)= 1. In order to describe 4(e) for e / X, the function S': E —>$(E) is first defined as follows: S'(e) ={e' (e',e)e A} (3. 8) S'(e) is then the set of all entities e' such that e E S(e'). For each entity e ~ X, e is displayed once each time that each entity e' e S'(e) is displayed. The function,/may then be described as follows: 1, if e =X, or we) = E L e'), otherwise (3. 9) e' S'(e)

128 Figure 3. 5 shows the graph of a relation A, together with values of 4. With the function /defined, the number of times that Step 2 of the algorithm is performed may be expressed. This step is performed once each time that an entity e' e S(e) is identified, where e is an entity which has been identified previously. The number of times that a particular entity e' is identified as being in S(e) is the number of times that e is displayed, i.e., 4(e). The total number of times that Step 2 is performed is then v Z;(e)= (e) eE e' S(e) (e,e') A - E_;(e) e' EE - X.} eES'(e') = Z #e'). (3.10) e' E - X} For the relation A shown in Figure 3. 5, the total number of times that Step 2 is performed is 11 (ei)= 19. i=l By using the function A, the total time which is consumed performing Step 2 of the algorithm may be expressed. The time which is required to perform this step once is g2(e,e') = gs(e,e') + g(p(e,e')) + gm((e,e)) + gb(D [e']). (3 11)

129 4(x) =1 ze(e 4)1l V/(e )=l (e6)= / \~ o y );(e 2 (),, 7 V/(e 0)=3 V(ell)=3 Figure 3.5 A Relation A With Values of 4 Indicated

130 where gs(e,e') is the time which is required to save b =p(e,e') and, possibly, J= H(e) on the push-down stack, gx(p(e,e')) is the time which is required to set X to the second component D e'] of b = p(e, e'), gm(p(e,e')) is the time which is required to premultiply J=H(e) by F'(p(e,e')) or G'(p(e,e')), and gb(D[e']) is the time which is required to let b be the element of B such that /i(b) =X =D[e']. gb(D[ e] )=0 if D[ e'] e E0/D0. The total time which is consumed performing Step 2 of the algorithm is then v (e)g (e,e') = (s+gx+g +gb) e) (3.12) (e,e')E A eE E - {3} Where v (e)g (e,e') g- (ee')EA (3.13) s VI/(e) ee E-{X} is the average time which is required to save information pertiment to an element of A on the push-down stack,..(e)g (p(e, e)) gx= (e,e') A (3.14) C E- (e) eE E-{X}

131 is the average time which is required to determine the second component of an element of B, EZ'V(e) gm((e,e')) - (e,e')e~A (3.15) m Z 4/ (e) e E-{X} is the average time which is required to premultiply J by a value of F' or G', and E (e)gb(D[e'] (e,e')EA (3.16) b V(e) eEE- {X} is the average time which is required to identify the first element of B which describes a subpicture. Saving the matrix J on the push-down stack is useful only for the structure {B,E/D,F'}, since this action avoids a matrix multiplication in Step 4 only for this structure. If this matrix is saved, g5(e,e') may depend on its complexity. For example, in order to reduce the average time which is required for this operation, only the elements of J which differ from the corresponding elements of the identity matrix may be saved. However, if only references to elements of B are saved on the push-down stack, gs(e,e') is generally constant for all (e, e') A.

132 The time g (p(e,e')) which is required to determine the second x component of p(e,e') is generally constant for all p(e,e') E B if the representation of each p(e,e') contains an explicit reference to D[e']. However, if this explicit reference is not included, gx(p(e,e')) may assume different values for various elements p(e,e')E B. For example, if no reference to D[e'] is stored in the block which represents p(e,e'), but the elements of each set P(D[e']) are linked together in a ring with D[e'], the picture generator must sequence through part of this ring to identify D[e']. The time gm(p(e, e')) which is required to premultiply J by F'(p(e,e')) or G'(p(e,e')) may differ for various elements p (e,e')E B. For example, if F'(p(e,e')) is the identity matrix, none of its elements need be storedand the matrix multiplication may be avoided. However,there generally does exist an element p(e",e"') E B such that F'(p(e",e"')) is not the identity matrix, and, consequently, some time is required to premultiply J by F'(p(e",e')). As has been mentioned above, the matrix G(D[e] )1 is stored only for D[e] E E /D0o Consequently, if G'(p(e,e')) =G(D[e']), it must be determined by repeated application of Equation 30 5 for D[e'] / E0/DO0 The time which is required for this process is considered to be included in gm(p(ee')). An algorithm for computing G(D[e'] ) in this way is given below. For each matrix G(D[e'] ) which is determined by this algorithm, the only other matrices G(D[e'] )-1 which are assumed to be known are those for which D[e'] e EE/D0o

133 Algorithm 3 2 Procedure for determining G(D[ e]). (The matrix J in this algorithm is not the matrix J used above in Algorithm 3.1.) (1) Let J = I, let X = D[ e], and empty a push -down stack for use in this algorithm. (2) If there exists an element b'e B such that pu(b') = X, let b=b'. Otherwise, let K= G(X)-1 and proceed with Step 5. (3) If G'(b) / G"(b), proceed with Step 4. Otherwise, save b and J on the push-down stack. Let X be the second component of b and let J = I. Proceed with Step 2. (4) If L'(b) E B, let b= =/'(b) and proceed with Step 3. (5) If the push-down stack is empty, terminate with K=G(D[ e] ). Otherwise, restore b and J from the push-down stack. If G'(b)=I, let J= J K; otherwise, let J= J K-1 Let K= J and proceed with Step 4. In order to illustrate this algorithm, a part of a structure {B,E/D, /L, y} is depicted in Figure 3.6, and the steps of Algorithm 3. 2 which are needed to determine G(D[ e] ) from this structure are shown below. Each step is represented below by its number and the items which are affected by performing it. (1) J=I X =D[ e] (2) b=p(e,el)

134 D[e] 0 1 2 D[ei] D[ e D[ e3] O/ \1 o/ \ 1 o3/ 1 D e[ e[ 4 ] D[ e 7] D[ e D ] D[ e8] D[ e9] i((p(e!, e5)) =p(e e4) g((ee2 e7))=P(e2, e6) g(P(e3, e))=P(e, e8) i(p(e, e4)) = D eel] (p(e2,e6))=D[ e2] g(p(e3,e8))=D[ e3] g(p(e,el)) = D[ e] jL(p(e,e2))=p(e,el) (p(e,e3))=p(el,e2) y(p(e, el)) = (I,G(D[ el] ),I) y(p(el, e4))= (I,G(D[ e4] ),I) y(p(el,e5)) = (G(D[ e5] )-, G(D[ e5] ),G(D[ e5] )-1) y(p(e,e2)) = (G(D[ e2] ), G(D[ e2] ),I) y(p(e,e3)) = (G(D[ e3] )-, G(D[ e3]), G(D[ e3] )-) y(p(e3,e8)) (I,G(D[ e8] ),I) y(p(e3,e)) = (G(D[ e9] )1, G(D[ e9]) G(D[ e9] )-1) Figure 3 6 Part of a Structure {B, E /D,, y}

135 (3) Stack contains p(e,el), I X =D[el] J =I (2) b =p(el,e4) (3) Stack contains p(e,el), I, p(el,e4), I X =D[ e4] J =I (2) K =G(D[e4])1 (5) b =p(el,e4); J =I; Stack contains p(e,el), I i =G(D[e4] )1 K = G(D[ e41) (4) b =p(e, e5) (3) Stack contains p(e,el), I, p(el,e5), G(D[e4] ) X =D[e5] J =I (2) K =G(D[e5])1 (5) b =p(el,e ); J =G(D[e4]); Stack contains p(e,el), I -1 " J -G(D[e4]) G(D[ e]) K =G(D[e4] )- G(D[e5]) (4) b =p(e,e2) (4) b =p(e,e3)

136 (3) Stack contains p(e,e3), G(D[e4]) G(D[e5]) X =D[e3] J =1 (2) b =p(e3,e8) (3) Stack contains p(e,e3), G(D[e4] )-G(D[e5]),p(e3,e), I X =D[e8] J =1 (2) K=G(D[e8])-1 (5) b =p(e3,e8); J =I; Stack contains p(e,e3),G(D[e4] )-G(D[e5]) J =G(D[e8] )1 K =G(D[e8] ) (4) b = (e3,e9) (3) Stack contains p(e,e), G(D[e4) G(D[e] ),p(e3e9),G(D[e])) X =D[ eg] J =1 (2) K=G(D[eg] )1 (5) b =p(e3,eg); J =G(D[e8] )1; Stack contains p(e,e3),G(D[e4] )1 G(D[ es]) J =G(D[e8] )-G(D[eg]) K =G(D[e] )- G(D[e] ) (5) b =p(e,e3); J =G(D[e4] ) 1G(D[e] ); Stack empty J =G(D[ e4] ) G(D[e5] )G(D[eg] )-G(D[e8]) K =G(D[e4] )-G(D[e5] )G(D[ e9] )- G(D[e8])

137 The subset of B UE/D which is examined by this algorithm is difficult to describe for the general application of the topological structure. Consequently, a general expression for the time which is required to perform this algorithm is difficult to derive. However, if the form of the topological structure is known for a particular application, the subset of B UE/D which is examined by the algorithm is much more obvious. For this reason, the time which is required to perform this algorithm is more easily estimated independently for each application of the structure. Examples for which this time is estimated are given in Chapter 5. The time gb(D[e']) which is required to identify the element b e B such that u(b) =D[e'] is determined by whether or not D[e'] e E0/D0o If D[e'] e EO/D0, gb(D[e']) is the time which is required to determine that D[e'] e E0/D0o If D[e'] E EO/D0, g(D[e']) generally is the time which is required to determine that D[e'] V E0/DO and to either examine a pointer or transfer a jump command to the display processor. 3.2.2.3 Displaying Entities in E The time which is required to perform Step 3 of Algorithm 3.1 for the entity e e E0 is g3(e) = gc(e) + gt(e), (3. 17)

138 where g (e) is the time which is required for the computer to produce c the entity e in a form which is acceptable to the display processor, and gt(e) is the time which is required to transfer information which describes e to the display processor. One of the design decisions which will be discussed in Chapter 4 is whether the display processor or the computer is to form each entity e e E0 from H(e) and 3(e). If each entity e E E0 is formed by the display processor, gc(e)= 0, and gt(e) is the time which is required to transfer B(e) to the display processor. For this case, g(e) is generally proportional to the storage which P(e) occupies. However, if e is formed from H(e) and 3(e) by the computer, g (e) > 0, and gt(e) is the time which is required to transfer e to the display processor. For this case, g (e) and gt(e) may not be proportional to the storage which 3(e) occupies. For example, 3(e) may be stored as a mixture of character codes and vectors. Each character code may require more time than a vector to convert into a format which is acceptable to the display processor, and much more information generally must be transferred to the display processor in order to describe ito Furthermore, more character codes than vectors may generally be stored per storage location. The total time which is consumed displaying entities in E0 is then

141 is the average time which is required to restore information relevant to an element of A from the push-down stack, E V^(e) gh(p(e, e') (e e')EA g = (ee) (3. 24) ih= ZC 4'(e) eeE-{X} is the average time which is required to either premultiply J by a value of G" or to invert a value of F' and premultiply J by the resulting matrix, and Z I(e) g (p(e, e')) - (e, e')A (3.25) nn C Z~ 3/_dl i4(e) eEE-{xA} is the average time which is required to examine a value of a', 3,2 2o 5 Summary From Equations 3.12, 3.18, and 3.22, the total time g which is required to perform Algorithm 3 1 is g = 4V(e)g2(e,e') + E (e)g3(e)+ Z 4(e)g4(e,e') (e, e')EA eE EQ (e, e')E A = (s+ gr+ gmgh+ gbgn+ gxi) (e)+ (gc+g t, /(e). ecE- {X} eEE0 (3.26)

142 If there exist no distinct entities e,e', and e" such that e E S(e') (S(e"), 4'(E) = {1}, and Equation 3.26 reduces to the following simpler form: g = (IE -l)(+gs+y r+ g rn+ g) +IEl (gc+gt) (3.27) 3.3 Average Response Time The cost of an implementation of the topological structure is the average time which is required to modify or interpret the structure in response to a control language input. This cost will be denoted by r and may be expressed as follows: r = p(k) k (k'), (3.28) k'EIK k' e K where K is the set of possible control language inputs, p(k') is the probability that the next control language input will be k' and rkk') is the average time which is required to respond to input k'. In further discussion, each response will be assumed to be performed in sequence, i. e, if an input k2 is received while the response to the input kI is in progress, the response to k1 is completed before the response to k2 is begun. If this were not true, the initiation of the response to k2 could interfere with the completion of the response to k1. For example, the first step in responding to k2 might be to destroy a portion of the structure which is needed to complete the response to kl.

143 The response to any control language input will be considered to be a sequence of operations which are performed on the topological structure. Although the response to an input often includes other operations such as communication with another computer, numerical computation, etc., these operations will not be considered when computing r because they are independent of the way in which the topological structure is implemented. The average time rk(k') which is required to respond to the input k' may then be expressed as follows: r-(k') = n(k,)r (), (3.29) A'eL where L is the set of operations which may be performed on the structure n(k?, I') is the average number of times that operation V' must be performed in order to respond to the input k', and r (') is the average time which is required to perform operation t'. From Equations 3 28 and 3o 29, r= Z p(k') Z n(k',')r(r') k'EK'E L = Z Z p(k')n?',')r( ) Q'E L kE K = Z f(')r. (.'), (3.30) P.'cL

144 where f(') = p(k')n(k',') (3.31) k' K is the average number of times that operation 2' is performed in order to respond to a control language input. The set L may be chosen arbitrarily. However, certain basic operations may be applied to perform all modifications and interpretations of the structure. Although these operations may not all be available in some implementations, the operations which are available may be described as sequences of these basic operations. For this reason, L will be considered to be the set of basic operations in all further discussion. 3.3.1 Definition of Basic Operations There are two types of basic operations: (1) those which modify the structure, and (2) those which interrogate the structure. The basic operations which modify the structure are the following: I1: Create an element of E/D. 22: Destroy an element of E/D 23: Create an element p(e,e') E B, given D[e],D[e'], (p(e,e')), and either F'(o(e,e')) or y(p(e,e')). 24: Destroy an element p(e,e') EB. Sequences of these operations may be applied to perform any modification of the topological structure, since this structure is described

145 by B, E/D, and either F' or g and y. However, no attempt has been made to define operations which modify subpictures which are used to generate entities in E, for such operations would affect only the appearance of the picture, but not its structure. The basic operations which interrogate the structure may be grouped into two classes: those which examine elements of E/D, and those which examine elements of B. The operations which examine elements of E/D are the following. For each operation, the class D [e] is assumed to be given. 1: Identify the elements of P(D[e]).': Identify p(e,e') such that (p(e,e')) =D[e] (Applicable only if D[e] / E0/D0. ) f7: Identify p(e,e') such that g'(p(e,e')) =D[e] 7. (Applicable only if D[e]' E0/D. )': Retrieve G(D[e]). (Applicable only to the structure {B,E/D, g, y} for D[e] e E0/D0.) These operations are sufficient to obtain from D[e] all of the information which might be stored to represent it in memory. The operations which examine elements of B are the following. For each operation, the element p(e,e') e B is assumed to be given.

146 9': Identify u(p(e,e')). 110: Identify'(p(e,e')). 2l: Identify D[e]. 212: Identify De']. 13: Determine F'(p(e,e')). (Applicable only to the structure {B,E/D,F'}.) 214: Determine the form of y(p(e,e')) (i.e., whether y(p(e,e')) =(I,G(D[e'],I),(I,G(D[e'] ),G(D[e'] ) ), (G(D[e'] -,G(D[e']),I), or(G(D[e'])-,G(D[e'] ),G(D[e'] )-1). These operations are sufficient to obtain from p(e,e') all of the information which might be stored to represent it in memory. Operations 25 through 14 may then be applied to obtain from the structure all of the information which it represents, except the subpictures which are needed to generate entities in E. Although the operations P1',2' 3, and Q4 are sufficient to modify the structure, they may not be suitable for certain modifications of the structure {B,E/D, g,y}. In particular, if an element p(e,e') eB in this structure is modified by first destroying it (via Q4) and then recreating it in a different form (via 23), some entities may be displayed incorrectly. These entities are incorrectly displayed if p(e,e') is destroyed and not replaced with a new element until after the subpicture 0(e) has again been transformed to produce an entity e"E D[e]. If G(D[e']) I and y(p(e,e')) is either (I,G(De'] ),I) or

147 (G(D[e'] ),G(D[e'] ),G(D[e'] )-1) before p(e,e') is destroyed, subpictures are concatenated incorrectly to form e". Furthermore, the entities which are produced by concatenating subpictures to /(e) may be displayed as incorrect transformations of these subpictures. Not only is this effect undesirable in that it produces an incorrect picture, but it may also cause demonstrative inputs to be interpreted incorrectly, since some entities are momentarily displayed at incorrect coordinates. One common modification of an element of B in the structure {B,E/D, A, y} is the replacement of the second component D[e'] of p(e,e') with a different class D[e"]. In particular, the ability to modify an element of B in this way is needed if entities are to be moved independently, since entities may be moved independently only by substituting one class of artificial entities for another. In order to provide this facility, the following additional basic operation is defined for modifying elements of B in the structure {B,E/D, A, y}. -15: Replace p(e,e') with p(e,e") such that g (p(e,e'))= (p(e,e")), I'(p(e,e'))= 1'?(p(e,e'?), and the form of y(p(e,e")) is the same as that of y(p(e,e')). This operation is equivalent to destroying an element of B (via IQ) and then recreating it in a different form (via Q3). However, since the entire change in the element is accomplished by one operation, the difficulty mentioned above cannot occur.

148 3.3.2 Time Required to Perform Basic Operations The time which is required to perform some of the basic operations depends on which references to elements of B UE/D are stored to represent the structure. The time which is required to perform many of the operations which retrieve information from the structure (5,' 26', 7' 8' l0o' 1ll,and 212) is minimized if all of the references to these elements which were described in Section 3. 1 are stored. However, the operations f3 and 4', which create and destroy elements of B, may require more time to perform if all of these references are stored.- Consequently, even when a large amount of storage is available, the average response time r is not necessarily minimized by storing all of the references to elements of BUE/D. In some applications, not enough storage is available to store all of these references. In this event, those which are to be omitted should be selected so that r is minimized subject to the storage constraint. Whenever a particular type of reference is omitted from the structure, an operation which would normally examine one of these references to identify an element of B UE/D must search a portion of the structure in order to identify that element. This search of the structure may be performed in either of the following two ways: (1) The program which is operating on the structure may search the structure itself.

149 (2) The picture generator may identify the appropriate element of B U E/D to the program which is operating on the structure as this element is encountered in the course of generating the picture. Generally, the former method has been used when the picture generator has been a program, whereas the latter method has been used when the display processor hardware has been used as the picture generator. However, the method to be used can be chosen independently of the way in which the picture generator is implemented. If, in order to perform a basic operation, a portion of the structure is searched by the program which is operating on it, the procedure which is used may be much simpler than Algorithm 3.1. For example, if f7 is applied to the class D[e] in the second list structure described in Section 3.1. 4, the only elements of B which must be examined are those whose first component is D[e]. However, if Algorithm 3.1 is used, all elements of B which are components of paths from e to entities in E0 and all elements D[et] E E/D such that there exists a path from e to e' must be examined. Consequently, the average time which is required to perform a basic operation which requires a search is often larger if the picture generator, rather than the program which is operating on the structure, performs the search. However, if the display processor is used as the picture generator, the total time during which the computer is devoted to searching the structure is generally smaller if the display processor identifies the appropriate elements of B UE/D to the program.

150 Like those operations which may wait for the picture generator to identify certain elements of B UE/D, the operations which modify elements of B must often wait for the picture generator to finish Algorithm 3.1, as will be discussed below in Section 3.3. 2. 1. The average time r (~) which is required to perform Operation I may then be expressed as the sum of the average time which elapses while the program which is operating on the structure waits for the picture generator and the average time which elapses while this program performs the remainder of the operation. Whenever the program is not waiting for the picture generator, the computer generally must contribute both to the execution of the operation and the generation of the picture. The average time rY(() may then be expressed as follows: r (5) =rm(a)+ (if(Q)- nw(f))g+ n(f)tf, (3.32) where r (k) is the average time which the program which is operating m on the structure devotes to the execution of instructions which contribute to Operation Q, n (1) is the average total number of times that the picture is produced while Operation I is performed, nw(2) is the average number of times that the picture is produced while the program which is operating on the structure is waiting for the picture generator, and tf is the time which elapses while the picture is generated once.

151 The second term in this equation represents the average amount of time that the execution of instructions which contribute to Operation f is suspended while the computer is devoted to the generation of the picture. The last term represents the average amount of time that the program which is modifying the structure must wait for the picture generator either to identify an element of BUE/D or to complete Algorithm 3lo * The quantities rm () and nw(k) are determined by the way in whichOperation k is implemented. The average number of times nf(l) that Algorithm 3. 1 is performed while Operation I is being performed, however, is also determined by the manner in which the display is refreshed. Since the picture must be continually generated, r (2) may also be expressed as follows: rf(i) = nf(P)tf. (3.33) By considering both this equation and Equation 3.32, nf(1) may be eliminated to yield r-(l) = m()tf/(tf- g) +n(tf (3.34) If rw(l) is defined to be the average time which the program which is operating on the structure must wait for the picture generator to reach a particular part of the structure so that the Operation I may be completed, this equation may be written as follows: *Whenever ni (C)>0, the picture generator must stop generating the picture very briefly in order to either identify an element of BUE/D to the program which is modifying the structure or allow this program to modify references to elements of B. The time which is required to execute computer instructions while the picture generator is stopped is much less than tf, and, consequently, it does not appear in this equation. However, this time will not be ignored later when Operations C3 and q4 are discussed.

152 r(Y) =r (~) tf/(tf - g) +r(2). (3.35) The factor tf/(tf - g) may be interpreted to be a degradation in response which results from the fact that the computer must contribute both to the performance of Operation 2 and to the generation of the picture. In general, then, this factor will appear in each equation which describes the average time which is required to perform a basic operation as a factor in a term which represents the time during which the computer executes instructions which contribute to the operation while the picture is being generated. 3.3. 2. 1 Time Required to Modify the Structure The basic operations which modify the structure are!, 12, 3, SL4 and 5'- Operations 1 and 2, respectively, create and destroy elements of C/D, whereas Operations Q. and 4,respectively, create and destroy elemen of B. Operation,15 was defined to modify an existing element of B in the structure {B,E/D,, y7}. The time which is required to perform each of these basic operations is discussed below, 3. 3. 2.1.1 Creating and Destroying Elements of E/D The time which is required to create and destroy elements of E/D ( via -1 and 22) depends chiefly on the storage allocation algorithm which is used, rather than on the way in which the structure is implemented. Creating an element of E/D involves creating a storage block and copying information into it, whereas destroying an element of E/D involves destroying a storage block. (Operation 12 is assumed to be applicable to the class D[e] only after all elements of B whose first or second component is D [e ] have been destroyed.) Consequently, the average time which is required to create an element of E/D is

153 ( )=(g+ rcE/DOsI + E/D-EO/D /E/D D)tf/(tf-g), (3.36) where r is the average time which is required to create a storage g block, and r is the time which is required to copy the contents of one storage location into another. Similarly, if rd denotes the average time which is required to destroy a storage block, the average time which is required to destroy an element of E/D is r(2) = dtf/(tf - g). (3.37) 33. 2. 1.2 Creating Elements of B The time which is required to create and destroy elements of B (via Q3 and f4), however, is much more dependent on the way in which the structure is implemented. The process of creating an element b e B involves creating a storage block, copying information into this storage block, and inserting this block into the existing structure. If references to values of i are not stored in the structure, the process of inserting the block into the structure involves storing a reference to this block in the block which is to represent j(b). However, if values of y are stored in the structure, a reference to this block must be stored in both the block which is to represent g(b) and the block which is to represent'(b) In either case, the element of

154 B UE/D which is to be g'(b) must be identified, for a reference to it must be stored in the block which is created to represent bo This element is easily identified, however, for a reference to it is stored in the block which represents p(b). The process of creating an element of B is complicated by the fact that the picture generator and the program which is modifying the structure must often be synchronized in order to store references to the newly created element in the structure. For example, Figure 3. 7 illustrates some of the difficulties which occur if this synchronization is not performed when modifying the structure {B,E/D, gl, }. Figure 3. 7a shows a picture which contains the two light buttons e and e2 and a border e5. In addition, the set of light buttons e3 is represented in the structure, and the entity e4, which represents a set of arrows which point left and right, is also represented. The latter set contains the arrow e6 in Figure 3. 7a. The purpose of the program which operates on this picture is to allow the user to create arrows by referring to e1 and e2 with a light pen. If he selects el, an arrow which points to the left is created, whereas, if he selects e2 an arrow which points to the right is created. Figure 3. 7b shows the form which the picture should assume if the user selects e1. (G({e6}) is assumed to represent translation.) Figure 3. 7c, however, shows the form which the picture might assume if the picture generator and the program which modifies the structure are not synchronized. This distorted picture is produced if a reference to p(e4, e7) is stored in

155 0 2 le e 1 le 3. {e} 0 13 LEFT RIGHT {e} {el} {e I2} {e6} 1e1 6e1I e e e i(p(X, e3))=p(X, e4) (p(, e4))=p(X, e5) y(p(e4, e6))=(I, G( {e6}), I) y(p(X, e4))=(G({e4}) 1 G(e4}), I) {i} aa. Original Picture 10^l e{e4} {e} e 7. 6 {e5} 0 LE FT RIGHT {e 6,e7} {el} {e2} b. Modified Picture e 7 \Y r~6 LEFT RIGHT c. Distorted Picture Figure 3.7 Example of Picture Distortion Due to Lack of Synchronization

156 the block which represents {e4} while the entity e6 is being plotted and before 1'(p(e4, e6)) has been determined by the picture generator. The picture generator then proceeds to display e7,el, and e2. However, since G'(pe)) =G({e }) was modified just after it was used in the picture generation process, these entities are not displayed at the proper coordinates. Since the picture is assumed to be continually generated, the picture is soon restored to its correct form shown in Figure 3. 7bo However, the momentary distortion of the picture may move e2 under the light pen and cause another arrow to be created, contrary to the intentions of the user. If the picture is not to be distorted when an element of B is added to the structure {B,E/D,,,y}, the references to the newly created element of B must be stored in the structure between generations of the picture.. The program which is modifying the structure, then, must either wait until the picture generator has completed Algorithm 3.1 and store references to the newly created element of B before a picture is again generated from the structure, or it must interrupt the picture generator, store references to this element, and then restart the picture generator with the first step of Algorithm 3.10 The former procedure is time-consuming, and, consequently, may not be suitable if many elements of B are to be created in response to a single input. The latter procedure provides for much more rapid creation of elements of Bo However, the picture may momentarily disappear if a large number of elements of B are created in rapid succession.

157 Because the picture generation process is assumed to have priority over the process of responding to control language inputs, a program which creates a new element of B for the structure {B,E/D, L, y} will be assumed to wait for the picture generator to complete Algorithm 3. 1 before storing references to the newly created element. The time at which 23 is initiated is generally independent of the picture generation process. Consequently, when the program which is modifying the structure is ready to store references to a newly created element of B, it is equally likely that the amount of time which is needed for the picture generator to complete Algorithm 3.1 is any value between 0 and tf. The average time which the program which is modifying the structure must wait is then tf/2. Even if the topological structure is {B,E/D,F'}, synchronization of the program which is modifying the structure with the picture generator may be necessary. If a reference to an element of BUE/D which occupies more than one storage location is to be modified, the program which is modifying the structure must insure that the picture generator does not interpret this reference when it is only partially modified. This condition is insured if the program which is modifying the structure waits for the picture generator to complete Algorithm 3 1o However, the operation may be completed more rapidly if the program which is modifying the structure interrupts the picture generator, stores references to the newly created element

158 of B, and then resumes the picture generator from the point in Algorithm 3.1 at which it was interrupted. Although the alternative to interrupt the picture generator was discarded above when discussing the addition of an element of B to the structure {B,E/D,, y}, the picture generation process is not affected appreciably if the picture generator is resumed, rather than restarted with the first step of Algorithm 3.1. Consequently, the picture generator will be assumed to be interrupted when necessary in order to store references to a newly created element of B for the structure {BE/DF'}o The time which is required to interrupt and resume the picture generator will be assumed to be small and will be ignoredo The average time which is required to synchronize the program which is modifying the structure with the picture generator and to store references to a newly created element of B will be denoted by r1. Then, the average time which is required to create an element b e B may be expressed as follows: r(5) =g+ f - g + rb)tf/(-g) + (1 (3.38) The first step in creating an element of B is to create a storage blocko This process requires the average time r o The average time which g is required to copy information into this storage block is r sb c b Because a reference to j'(b) must be stored in this block, the term ri(L10) is included in this equation to represent the average time which is required to identify the element which is to be /i'(b) from

159 the element which is to be ji(b) (which is specified). Finally, r1 is the average time which is required to insert the completed block into the existing structure. (rl is rw(13) plus the time which is required to store references to a newly created element of B.) 3.3. 2 1.3 Destroying Elements of B A program which performs Operation B4 must also be synchronized with the picture generator. Whenever an element of B in the structure {B,E/D, L, y} is to be destroyed, the references to it which appear in the structure must be modified when the picture generator is not operating. Otherwise, the same type of problem as that shown in Figure 3 7 might occur. Consequently, a program which removes an element of B from the structure {B,E/D, A.Ly} must wait for the picture generator to complete Algorithm 3.1 before it modifies references to this element. As has been mentioned above, the average time which this program must wait for the picture generator is tf/2. References to an element p(e,e')eB in the structure {B,E/D,F'} must be modified while the picture generator is not displaying e' as a collection of entities in E0o Otherwise, a reference to p(e,e') may later be restored from the push-down stack by Algorithm 3.1 after

160 p(e,e') no longer exists. The necessary synchronization with the picture generator may be accomplished either by waiting for the picture generator to complete Algorithm 3.1 or by waiting until p(e, e') is not on the push-down stack via Algorithm 3.3, which is given below. Algorithm 3.3 Procedure for insuring that p(e, e') B is not on the push-down stack used by Algorithm 3.1 when references to this element are modified, (1) Store in the block which represents D[ e] an indication to the picture generator to halt after setting X to D[ e] in Step 2 of Algorithm 3. 1 (2) Wait until either p(e,e') is not on the push-down stack used by Algorithm 3.1 or the picture generator has halted. (3) Modify references to p(e,e'). (4) Remove the indication to the picture generator which was stored in Step 1 and resume the picture generator if it halted. I

161 If the program which is modifying the structure uses Algorithm 3.3 to synchronize with the picture generator, the time which it must wait depends on both tf and the time which is required to generate the part of the picture which is being modified~ In order to discuss this time interval, t (D[e]) is defined to be the time which is required to s display an entity in D[e] as a collection of entities in E0. Then, if references to an element of B whose first component is D[e] are to be modified and the picture generator is displaying an entity in D[e], the average time which the program which is modifying the structure must wait is ts(D[e] )/2. The probability that the picture generator is displaying an entity e' e D[e] is t (D[e] ) f — E 4V(e). f e' D[e] If the average time which is required to determine that a given element p(e",e) is not on the push-down stack is assumed to be small relative to t (D[e]), the time which the program which is modifying the s structure must wait to synchronize with the picture generator is then ts(De3 ) t (D[e] ) (e 2 tf e'e D[e] Since t (D[e]) E *(e') < tf for D[e] g {X}, the above quantity is e'eD[e] less than or equal to tf/2.

162 Note, however, that e4 may be applied to elements of B after they have been removed from the structure. For example, in order to destroy the two rows of polygons in the picture shown in Figure 2.1 (whose set B is shown in Figure 2.10), p(X,e4) and p(X,e6) may first be destroyed. Then, p(e4,el)= p(e 6 e7) p(e4,e2) =p(e6, es), and p(e4, e3) = p(e6, e) no longer are part of the structure which is being scanned by the picture generator. These elements may be subsequently destroyed via I4' The program which destroys these latter elements, however, may modify references to these elements immediately, since the probability that any one of them is on the push-down stack used by Algorithm 3. 1 is zero. As a result, the actual time which is required to execute Algorithm 3. 3 is diffuicult to specify. The above discussion has indicated an upper bound for this time through the use of the function t. s However, values of to are also difficult to specify for any class other than {X}o. For simplicity, then, a program which destroys an element of B which appears in either of the structures {B,E/D,F'} or {B,E/D, j, y} subsequently will be assumed to wait for the picture generator to complete Algorithm 3.1 before it modifies references to this element. With this assumption, the average time tf/2 which the program waits for the picture generator is an upper bound for the time which the program would wait if Algorithm 3.3 were usedo

163 The average time which is required to synchronize the program which is modifying the structure with the picture generator and to remove references to an element of B from the structure will be denoted by r2(i. e., r2 is rw( 4) plus the time which is required to modify references to the element of B which is to be destroyed). Then, the average time which is required to perform Operation Q4 may be expressed as follows: r () = rdtf/(tf- g) + rt(f9) + rf( 10) + r2o (3.39) The average time which is required to destroy the storage block which represents p(e,e') e B is rd. Before this block is destroyed, however, the block which represents g(p(e, e)) B must be identified, for it contains a reference to p(e,e') which must be changed. The average time which is required to identify this block is ri(19). The value to which this reference should be changed is t'(p(e, e)). The average time which is required to determine this value is r (110). If references to values of p are stored, the references to p(e,e') in the block which represents i'f(p(e,e')) must also be changed to references to i(p(e,e')). 3.3.2. 1.4 Modifying Elements of B in the Structure {B,E/D,, y} Operation /15 may be applied to the element p(e,e') e B by changing the value of the reference to D[ e'] which is stored in the block which represents p(e,e'). In order to avoid the type of problem depicted in Figure 3 7, this reference must be changed when the pushdown stack used in Algorithm 3o1 is empty. Consequently, the

164 program which is modifying the structure must wait until the picture generator completes Algorithm 3. 1 before it changes this reference. The average time rl(f15) which is required to perform this operation is then approximately tf/2. (The time which is required to modify the reference is much less than tf/2 and, therefore, may be ignored.) 3.3.2.2 Time Required to Interrogate the Structure The remaining basic operations which were defined in Section 3.3.1 interrogate the structure. The procedure which is used to perform each of these basic operations generally is determined by which references to elements of BUE/D are stored in the structure and whether or not the display processor performs Algorithm 3. lo The various procedures which will be considered for each operation are discussed below, together with the average time which is required to perform each operation by each procedure. 3.3.2.2.1 Identifying P(D[ e] ) for a Given Class D[e] Operation f5 may be performed in the following three ways: (1) The ring which links elements of P(D[e]) with D[e] may be examined. (Whether or not this ring exists is determined by the design decision u10, which will be described in Chapter 4.) (2) The picture generator may identify each element of P(D[e]) to the program which is interpreting the structure as it is encountered in the course of generating the picture. (3) The structure may be searched by the program which is interpreting it in order to identify the elements of P(D[el).

165 The first of these procedures is clearly the fastest, since it does not require that the entire structure be searched by either the picture generator or the program which is interpreting the structure. However, if each set P(D[e]) is not represented by a ring, one of the other two methods must be used. Of the remaining two methods, searching the structure with the program which is interpreting it is generally faster, However, less computation time may be required if the picture generator identifies the elements of P(D[e] ). The design decision u4 (to be discussed in Chapter 4) describes which of these procedures is used if each set P(D[e] ) is not represented by a ring. If each set P(D[e]) is represented by a ring, this ring may be implemented either with forward pointers only or with both forward and backward pointers, as determined by the design decision ul, which will be discussed in Chapter 4. The amount of time which is required to remove a block from the ring is often less if both forward and backward pointers are stored, but the average time which is required to perform -5 is independent of this feature. The following algorithm may be used to identify the elements of P(D[e] ) from this ring: Algorithm 3.4 Procedure for identifying the elements of P(D[e] ) from a ring which represents P(D[ e]). (1) Let X = and let x = De]. (2) Let x be the element of B UE/D which is referenced by the forward pointer which is stored in the block which represents

166 x. If x=D[ e], terminate with X=P(D[e] ). Otherwise, let X X U {x} and repeat this step. If the initialization step is considered to require a negligible amount of time, the time which is required to perform this algorithm is the total time which is spent performing Step 2 of the algorithm. This step is performed 1 + fP(D[e) I times, since the ring which represents P(D[e]) contains 1+ IIP(D[e]) I blocks. Since each element of B can belong to only one set P(D[e]), Z IP(D[e]) I = IB (3.40) D[e] E/D and the average cardinality of P(D[e]) is [B I/IE/D. Consequently, the average time which is required to perform Algorithm 3.4 is r(5) = = (T +T )(1+ IBI/IE/D )tf/(tf-g), (3.41) [u10= where T is the time which is required to obtain a pointer from a p block in the structure, and Tc is the time which is required to compare two pointers to elements of B UE/D in order to determine whether or not they refer to the same element. If each set P(D[ e ) is not represented by a ring of storage blocks, the entire structure must be searched by either the picture generator or the program which is interpreting the structure in order to perform

167 f5' If the program which is interpreting the structure must wait for the picture generator to search the structure, it must first synchronize with the picture generator by waiting for the picture generator to finish Algorithm 3. 1 Then, it must wait a time t to obtain from the picture generator all elements of a set P(D[e] ) The average time which is required to perform 5 by this procedure is then approximately 3tf/2o If the program which is interpreting the structure is to search the structure in order to perform operation 15, a simpler procedure than Algorithm 3. 1 may be used. Clearly, there is no need to examine the coordinate transformation matrices which appear in the structure. Furthermore, no element of B need be examined more than once, since the purpose of 15 is to determine a set of elements of B, rather than to determine entities from the structure. Not only does no element of B need to be examined more than once, but those elements of B which are components only of paths from e' e D[e] to other entities need not be examined at all, An algorithm which the program which is interpreting the structure may use in order to perform operation 5 is the following: Algorithm 30 5 Procedure for determining P(D[e] ) from a structure in which P(D[ e] ) is not explictly represented.

168 (1) Let S = {X}, Y = 0, Z = 0, let b be the element of B such that ji(b)= {X}, and empty a push-down stack for use in this algorithm. (2) Save b on the push-down stack. Let X e E/D be the second component of b. If X =D[e], let Z = ZU{b} and proceed with Step 5. (3) If X / Y, let Y =Y U{X}. Otherwise, proceed with Step 5. (4) If X cE/D - E0/D0, let b be the element of B such that u(b) =X, and proceed with Step 2. (5) If the push-down stack is empty, terminate Z = P(D[e]). Otherwise, restore b from the push-down stack. If t'(b)e B, let b ='(b) and proceed with Step 2. Otherwise, repeat this step. i In order to illustrate this algorithm, its application to the structure depicted in Figures 2.1, 2.3, and 2.10 is shown below. In this example, Algorithm 3. 5 is applied to determine P({e5 }). The same values of g, are assumed for this example as were assumed for the example which was given to illustrate Algorithm 3.1. Each step is represented below by its number and the items which are affected by performing it. (1) X={X} Y =0 b =p(X, e5)

169 (2) Stack contains p(X, e5) X = {e5} Z = {(X, e5)} (5) b =p(X,e5); Stack empty b =p(X, e4) (2) Stack contains p(X, e4) X ={e4, e6} (3) Y= {{e4,e6}} (4) b =p(e, el) (2) Stack contains p(X,e4),p(e4,el) = {e1, e2, e7, e8} (3) Y = {{e,e6}, {e, e2. e7. e8}} (5) b =p(e4,el); Stack contains p(X,e4) b = P(e4,e2) (2) Stack contains p(X, e4),p(e4, e3) X={e3, e9} (3) Y = {{e4,e6},{e,e2,e7,e8},{e3,e9}} (5) b =p(e4 e3); Stack contains p(X,e4) (5) b =p(X,e4); Stack empty b =p(X, e6) (2) Stack contains p(X, e6) X ={e4,e6} (5) b =p(X,e6); Stack empty

170 Note from this example that each element of B is examined exactly once. By contrast, the elements p(e4,e) =p(e6,e7),p(e4,e2) = p(e6e8), and P(e4,e3) =p(e6,e9) are each examined twice when Algorithm 3.1 is applied to the same structure. Redundant examination of these elements is avoided in Algorithm 3. 5 by not examining any elements of B whose first component is {e4,e6} the second time that [e4,e6} is encountered ii.e., as the second component of p(X,e6)). Although e5 E0 in this example, no more elements of B would be examined if e, were not an element of E0, because Step 3 is not performed whenever X = {e5}. As was noted for Algorithm 3. 2, the subset of B UE/D which is examined by Algorithm 3. 5 is difficult to describe for the general application of the topological structure. Consequently, a general expression for the time which is required to perform this algorithm will not be derived. However, a method for determining this time for individual applications is illustrated in Chapter 5, where this time must be determined in order to apply the cost function to specific examples. 3. 3.2. 2. 2 Identifying values of ju' Since values of J'I are needed in Step 4 of Algorithm 3.1, references to these values are assumed to be stored in the blocks which represent elements of B. Then, the picture generator does not need to search the structure to compute these values. Furthermore, a

171 reference to each element b e B such that pa(b) e E/D is assumed to be stored in the block which represents i(b), for this reference is needed in Step 2 of Algorithm 3. 1. The time which is required to perform operation &6 or L10 is then the time which is required to examine one of these references. Generally, if the picture generator is a program, these references are pointers in a list structure, and r~(f6)U =r ( )l ptf/(tf g). (3.42) (Recall that T is the time which is required to obtain a pointer from the structure.) However, if the display processor itself is the picture generator, these references are commonly stored as display processor jump commands. An amount of time T.' is then required to identify the block which is referenced by each jump command, and (3.43) r u6 =rf f 10)| 1TJt /(tr =)t (3.A V1 V1 3.3. 2 2.3 Identifying the Last Element of B Needed to Form a Subpicture Although a reference to each element b E B such that ji(b) E/D must be stored in the block which represents g(b), a reference to b' e B such that I'(b')e E/D is not necessarily stored in the block which represents p'(b'), since it is not needed to generate the picture. If this reference is stored (as deterni ned by the design decision u9 to be described in Chapter 4), it is generally implemented as a pointer in a list structure, and (7) Tptf/(tf-g) (3.44)

172 However, if this reference is not stored, a portion of the structure must be searched in order to perform Operation i7. The shortest search which can be used to perform this operation is described by the following algorithm: Algorithm 3. 6 Procedure for identifying b eB such that L'(b)= D[ e] for a given class D[e] eE/D - E0/D0o (1) Let b be the element of B such that A(b)= D[e] (Operation 6;.) (2) Let b ='(b). (Operation L 0). If O'(b)=D[e], terminate. Otherwise, repeat this step. I The first step of this algorithm is performed only once, If it is assumed that Operation k7 is applied to classes in E/D - EO/D0 with equal probability, the average number of times that Step 2 is performed is IB [/( IE/D - IE0/D0 I). The average time which is required to perform Operation X7 by Algorithm 3. 6 is then r (7 =r( 6)+(r(10)+Tc (tfg)) B/(-g/E/D [- EO/D0 I) (3 4 3.3.2.2.4 Retrieving G(D[e] )1 From D[e] e E0/D As has been mentioned above in Section 3.1.3, each matrix G(D[e])1 is stored explicitly only for D[e] e EO/DO. Consequently, operation 8 is defined only for classes in EO/D0. Since the matrix G(D[ e] ) must be stored in each block which represents D[e] e EO/D

173 in any implementation of the structure {B,E/D,L,y}, re(.p) is generally proportional to s, the average storage which this matrix occupies, and is independent of the references to elements of B E/D which are stored in the structure. The value of r2(f 8) depends on the format which G(D[e] ) is stored for D[e] cEO/D0, which, in turn, depends on whether the computer or the display processor performs Algorithm 3.1. An expression for r(Q8) will be given in Chapter 4. 3. 3. 22.5 Identifying Values of /l The time which is required to perform operation 9- depends on whether or not references to values of Aj are stored in the blocks which represent elements of B, Since values of A are not needed to generate the picture, references to values of i are generally stored as pointers, if they are stored at all. Consequently, if these references are stored (as determined by the design decision u8 to be described in Chapter 4), r~(%g) =T tf/(tf-g). (346) u81 However, if these references are not stored, values of tL must be determined by searching the structure. An algorithm for performing /9 in this way is the following: Algorithm 3. 7 Procedure for identifying /(p(e,e')) for a given element p(e,e')e B. (1) Let d =D[e], the first component of p(e,e') (Operation tll). (2) Let b be the element of B such that p(b) = d (Operation I6). If b=;l(e,e'), terminate with d= ii(e,e')).

174 (3) If i'(b)=p(e,e'), terminate with b=p(p(e,e')). Otherwise, let b=M'(b) (Operation 10) and repeat this step. 3 Steps 1 and 2 of this algorithm are each performed only once. If Operation g9 is assumed to be applied to elements of B with equal probability, the average number of times that Step 3 is performed is ( IB /( IE/D I - IE /D 1) - 1)/2. (Note that Step 3 is never performed with b such that A'(b)=D[e].) Then, the average time which is required to perform Operation Lg by Algorithm 3. 7 is r (9g)u =r( ll)+r+ ( 6)+Tctf/(tf-g) 8 + (r (Q10) + Tctf/(tf-g))( B /( IE E/DO -)-1)/2. (3.47) Since r(6) = r(10), ()u8 =(ll)+(r( )+Tct/(tf-g))(l+ B I/( [E/D I- IE0/Do 1))/2. V- (3.48) 3.3. 2. 2. 6 Identifying the First Component of an Element of B The time which is required to perform Operation [11 depends on whether or not a reference to D[e] is stored in each block which represents an element p(e,e') eB (as determined by the design decision u6, which is described in Chapter 4). If this reference is stored, it is generally stored in the form of a pointer, and r,(11)a =Tptf/(tf-g). (3.49) =T^'WV^ (3.49) u-l If this reference is not stored, Operation L1 may be performed by the following algorithm: Algorithm 3.8 Procedure for identifying D[e] for a given element p(e, e') E B.

175 (1) Letb =p(e,e'). (2) Let b ='(b). If be E/D, terminate with b =D[e] Otherwise, repeat this step, I If it is assumed that Operation 11 is applied to various elements of B with equal probability, the average number of times that Step 2 of this algorithm is performed is (1+ IB l/(E/D - IE0/D0 1))/2. Then, if the time which is required to perform Step 1 is assumed to be insignificant, the average time which is required to perform Operation I11 by this algorithm is ri 11) =(rf(10o)+Tbtf(tf-g))(1+ B l/(IE/D - IE/D0))/2 u6 (3. 50) Tb denotes the time which is required to determine whether a block represents an element of B, E0/D0, or E/D-E0/D0. 30 3. 2 2o 7 Identifying the Second Component of an Element of B A reference to the second component D[e'] of each element p(e, e') eB is commonly stored in the block which represents that element. (Whether or not this reference is stored is determined by the design decision u7, which is described in Chapter 4.) If the picture generator is a program, this reference is generally stored as a pointer, and r,(12)I =Tptf/(tf -g). (3.51) u7=1 u l= However, if the display processor itself generates the picture, this reference may be stored in a different format. This format is not necessarily the same as that used to store references to values of'.f In particular, references to values of p' are commonly formatted as display processor jump commands, whereas references to second

176 components of elements of B are formatted as display processor subroutine calls. The reason for this difference is that the return pointers which are stored when the subroutine calls are executed form the push-down stack which is needed in Algorithm 3. lo If T' denotes the time which is required to identify the block which s a display processor subroutine call references, r(u2 ) =Ts tf/(tf-g). (3. 52) u7=1 s ul 1 However, if each set P(D[e] ) is represented by a ring of storage blocks, a reference to D[e'] may not be stored in the block which represents p(e,e'). In the absence of this reference, the second component D[e'] of an element p(e,e') EB is identified as the element of E/D which is part of the ring which contains the block which represents p(e,e'). An algorithm for performing Operation 12 in this way is the following: Algorithm 3 9 Procedure for identifying the second component D[e'] of p (e,e') from the ring which represents P(D[e']). (1) Let b =p(e,e'). (2) Let b be the element of BUE/D which is referenced by the forward pointer which is stored in the block which represents b. If b cE/D, terminate with b= De']. Otherwise, repeat this step. I

177 The average number of times that Step 2 of this algorithm is performed is (1+ IB 1/IE/D 1)/2. if the time which is required to perform Step 1 is assumed to be insignificant, the average time which is required to perform Operation ~ 12 by Algorithm 3.9 is rf (f 12) -(Tp+T b) t/(f/(tf-g))(+ B /E/D )/2. (3.53) 3. 3. 2. 2. 8 Retrieving Values of F' and y Operations i13 and 14 each involve examining a block which represents an element of B to obtain information which is stored within that block, Consequently, r i(13) and rF(f14) do not depend on the references to elements of BU)E/D which are stored in the structure. Generally, the average time rf('13) which is required to determine F'(p(e,e')) is proportional to sf. The time which is required to perform Operation 14 however, may vary radically with the way in which the structure is implemented. For example, r_(f14) is the time which is required to read the high order half of the third word in the list structure shown in Figure 3 2. However, in the program which is described in Appendix A, the application of Operation l14 to p(e,e') e B involves determining the length of the storage block which represents p(e,e') if either y (p(e,e'))= (I,G(D[ e'] ),I) or y(p(e,e'))= (G(D[ et] )l, G(D[ e]), G(D[ e] )-l) Otherwise, the length of the storage block must first be determined to establish that either y(p(e,e'))= (G(D[ e']) l, G(D[ e'] ),I) or

178 y(p(e,e')) = (I,G(D[e'] ),G(D[e'] ) ), and then the two push jump commands in the block must be compared to select one of these two values. Like r~(e8), the average time which is required to perform each of these basic operations depends on whether the computer or the display processor performs Algorithm 3.1. Expressions for r( 13) and r{(14) will be given in Chapter 4. 3o4 Conclusion The cost of an implementation of the topological structure was defined to be the average time which is required to operate on the structure in order to respond to a control language inputo The constraints which restrict the set of possible implementations of the structure were defined to be limitations on both the amount of storage which is available to contain the structure and the amount of time which elapses while the picture is generated once. The storage required by an implementation of the structure, the interference of the picture generation process with the response to control language inputs, and the cost itself were then discussed. Before this discussion can be applied to compare various implementations of the topological structures, however, the cost function and constraints must be described as functions of the various design decisions. The cost function and constraints are expressed in this way in the following chapter.

Chapter 4 DESIGN DECISIONS The discussion in Chapter 3 may be applied to determine the optimum implementation of the topological structure for a given equipment configuration and application. As a preliminary step, however, the cost must be described as a function of various design decisions. In order to describe the cost in this way, each design decision is considered to be a binary - valued variable. The value of each design decision represents a choice of one of two possible methods of implementing some feature of the topological structure. The optimum implementation of the topological structure is then described by the set of values for these design decisions which minimizes the cost. The design decisions which will be considered are defined below. The storage s which is required by the topological structure, the total time g which is arrested from the computer in order to generate the picture, the time tf which elapses while the picture is generated, and the cost r are then expressed as functions of these design decisions. Finally, the constraints which apply to the design decisions are described. 4.1 Definition of a Set of Design Decisions A list of suitable design decisions for the topological structure is shown in Table 4o1. Each of these decisions may 179

180 Design Decision Interpretation U1 The display processor, rather than the computer, performs Algorithm 3.1. U2 The display processor, rather than the computer, transforms subpictures to produce entities in E0. u3 The topological structure is {B,E/D,, y}, rather than {BE/DF'}o u4 Operation 15 is performed by Algorithm 3. 5. u. Values of H are saved on the push-down stack in Algorithm 3,1. u6 ~ ~ A reference to the block which represents D[ e] is stored in the block which represents p(e,e') for all p(e,e')EB. u7 A direct reference to the block which represents D[ e'] is stored in the block which represents p(e, e') for all p(e, e') eB. Table 4.1 Design Decisions

181 Design Decision Interpretation U8 A reference to the block which represents p(b) is stored in the block which represents b for all be B. u9 A reference to the block which represents b B such that,I'(b) =D[ e] is stored in the block which represents D[ e] for all D[ e] EE/D-EO/D0. U10 The blocks which represent the elements of u10 each set P(D[ e]) are linked together in a ring with the block which represents D[ e]. u11 Both forward and backward pointers are stored in each block in the ring which links the blocks which represent elements of each set P(D[ e ) with the block which represents D e]. Table 4.1 (cont.). Design Decisions

182 assume only the value 0 or 1. The interpretation which is given in the table for each decision is the interpretation for that decision when it assumes the value 1. The opposite interpretation is assumed if the value of the decision is 0. For example, u3 = 1 implies that the structure is {B,E/D,,y }, whereas u3 = 0 implies that the structure is {B,E/D,F'}. The design decisions ul and u2 describe how the picture generator is implemented. If u1 = u = 0, the picture generator is entirely a program. Because of hardware restrictions, this type of picture generator was used in early computer graphics programs, e. g., SKETCHPAD [67,68] and SKETCHPAD III [28 ]. Although most later display processors did not impose as severe restrictions, some more recent computer graphics programs, e.g., PENCIL [74 ], PLAN-PGS [ 11 ], and DIM [ 5 ], have also used this type of picture generator. If u1 = 0 and u2 = 1, the picture generator is partly a program and partly display processor hardware. The picture generator for GRAPHIC -2 [ 12 ] was implemented in this manner. If u = u = 1, the picture generator is entirely display processor hardware. This type of picture generator has been used by the author in the program which is described in Appendix A, as well as in earlier efforts [ 26 ]

183 Although no attempt to implement a picture generator for which U1 = 1 and u2 = 0 is known to the author, such a picture generator is certainly conceivable. For example, consider a three-dimensional display processor which is capable of drawing vectors which are specified by x,y, and z components, but which does not include a rotation capability. Furthermore, assume that a topological structure which involves only coordinate transformations which are translations in the x,y, and z directions may be implemented with u = u2 = 1. However, suppose that this display processor is to be used to display two-dimensional pictures which involve only translations in the x and y directions and rotations in the xy plane. Then, the topological structure may be implemented in the same way, with the exception that entities in E0 are formed by the program (i.e., u2 = 0) so that the z coordinate is interpreted as a rotation angle, rather than as a third coordinate. The value of u3 is not obvious for many implementations. As has been mentioned in Chapter 2, artificial entities must be introduced into the structure {B,E/D, j, y} to permit some entities to be modified without transforming the coordinates of other entities. Similarly, artificial entities must be introduced into the structure {B,E/D,F'} to provide for the enforcement of some concatenation constraints as a consequence of generating the picture. Many applications require both that some concatenation constraints be enforced and that some entities be treated independently of other

184 entities. Consequently, which form the topological structure should assume often cannot be determined by inspection. Because the artifical entities which must be represented by the structure are determined by the value of u3, the cardinalities of the sets B, E/D, and EO/Do, as well as the sums Z I(e) and eE E-{X} S 4*(e), depend on the value of u3. This fact may be expressed eEE as follows: iBI = (l-u) qbf + u3 qbg, (4.1) IE/DI= (l-u)qdf +u3 qdg (4 2) E0/ DO= (-u3) qdOf + u3 qdOg (4.3) (e)= (l-u3) qsf + U3qsg (4.4) and z Af(e) (l-u3) qsOf + u3 q0g' (4.5) ei E0 where qbf is the cardinality of B for the structure {B,E/D,F'}, qbg is the cardinality of B for the structure {B,E/D,, },

185 qdf is the cardinality of E/D for the structure {B,E/D, F'}, qdg is the cardinality of E/D for the structure {B,E/D, i,y}, qdf is the cardinality of EO/DO for the structure {BE/D,F'}, qdOg is the cardinality of EO/DO for the structure {B,E/D,,y}, qsf is Z 4 (e) for the structure{B,E/D,F' ee E-{X} qsf is 2 4 (e) for the structure {B,E/D,, y}, s~ ee E-{k} qsOf is Z A'(e) for the structure {B,E/D,F'}, and 0 qsOg is Z */(e) for the structure {B,E/DL, y}o The various coefficients of u3 and (1-u3) in these equations are determined from the form which the topological structure assumes for the application under consideration, as will be demonstrated in Chapter 5. The design decision u4 may assume the value 1 only if u0 = 0, since the purpose of linking the blocks which represent the elements of each set P(D[ e]) together in a ring with the block which represents D[ e] is to allow operation f5 to be performed by a much simpler algorithm than Algorithm 3. 5. If u = u = 0, the picture generator is assumed to identify the elements of each set P(D[ e]) to a program which is applying operation QL to the class D[ e] o Since there is no advantage to saving matrices on the push-down stack in Algorithm 3ol when U3 = 1, u== 1 If = u5 = 0,

186 the inverse of a matrix which is a value of F' must be determined whenever Step 4 of Algorithm 3.1 is performed. The remaining design decisions u6,.,ull specify which nonessential references to elements of BUE/D are stored in the structure in order to reduce the average time which is required to perform certain basic operations. One of these parameters, u7, affects the time which is required to generate the picture, as it affects gx, the average time during which the computer is devoted to the picture generation process in order to identify the second component of an element of B. Clearly, u10 = O ull X 0. 4.2 Effect of Design Decisions on Storage The average storage sb which is required to represent an element of B, the average storage sd0 which is required to represent an element of EQ/Do, and the storage sd which is required to represent an element of E/D-EO/D0 have been described by Equations 3.4, 3.6, and 3.7 as sums of smaller storage terms. Each of these equations contains a term which represents storage which is unusable because the various items which are to be stored cannot be packed arbitrarily. Because many of the design decisions describe which items are to be stored in each type of storage block, this average unusable storage is a function of many design decisions, and, therefore, is difficult to describe. However, if certain assumptions are made about the way in which the items in each block may be packed, an algorithm may be specified to determine the size cf that storage block without actually computing the

187 unusable storage which it contains. 4. 2 1 An Algorithm for Computing Sizes of Storage Blocks The items which are stored in a block which represents an element of BUE/D will be assumed to be packed subject to the following restrictions: (1) Each item which occupies more than one storage location occupies consecutive locations. (2) Only the first location which an item occupies may be only partially occupied by that item. The purpose of this restriction is to allow the format of an item to remain fixed, regardless of the way in which it is packed with other items. The first of these restrictions does not appreciably limit the flexibility of the implementation. If the display processor performs Algorithm 3.1, each item must be stored in consecutive locations so that the display processor can access the item as a unit. If the computer performs Algorithm 31l, each item is more easily accessed if it is stored in consecutive locations, rather than in pieces which are scattered throughout the block, The second restriction, however, does limit the flexibility of the implementation if certain items must be stored in a given part of a storage location. For example, if each display processor command must be stored in the low order half of a location, the last n-l locations of those which are occupied by an item which is

188 described by n commands must be considered to be completely occupied. Consequently, another item which is not represented by a display processor command cannot be stored in the vacant half of any of these locations. Whenever these restrictions are satisfied, the following algorithm may be applied to determine the size of the smallest storage block which can contain n given items. In the discussion of this algorithm, [ x] denotes the greatest integer less than or equal to x. Algorithm 4.1 Procedure for determining the minimum number x of storage locations which are required to hold n items whose individual storage requirements are xl, x2, o., x locations. xl, x2,., x are not necessarily integers, but are assumed to be ordered such that x - [ xi]> xi1 - [ xi+] for i = 1, 2,.., n-l. (This ordering is not necessarily unique.) (1) Let i = 1 and j = n. i (2) If j = i, let x = - [-xk] and terminate. k=l (3) If x. = [xi], let i = i+l and proceed with Step 2. (4) If x = [x ] or x + x [xi] +1or x.+x [xj] + 1, l 1 j- i 1 j+Orx+ [x +1 let x. = x. + x. and let j = j - 1. Otherwise, let i = i + lo. 1 with Step 2. | Proceed with Step 2.

189 As an example of this algorithm, consider the storage of 7 items whose individual storage requirements are the following: x1= 1 5 locations x2 = 0.4 locations x3 = 2.3 locations x4 = 0. 3 locations x5 = o 25 locations x6 = 0 25 locations x7= 1 locations These lengths are ordered as required for Algorithm 4.1. Each step of this algorithm as it applies to these values is indicated below by its number and the items which are affected by performing ito (1) i = 1 j=7 (4) xl = 2 5 j=6 (4) x = 2. 75 j=5 (4) i=2 (4) x2 = 1 65 j=4

190 (4) X2 = 1.95 j=3 (4) i=3 (2) x= - [ -2.75] + [ - 1.95] + [ - 2.3])= 8 locations Note that 8 locations are needed to store the seven items in 7 this example, although Z x. = 7. The additional location is needed i+l 1 to insure that all locations, other than the first one, which are occupied by a particular item are completely occupied by that item. To illustrate this point, a minimal storage arrangement is shown in Figure 4, la, and a fully packed storage arrangement is shown in Figure 4. lb. In these figures, the storage which is occupied by each item is indicated within that item. If the items were packed as shown in Figure 4. lb, only 7 locations would be required to store the 7 items. However, in violation of the second restriction stated above, the item which occupies 1. 25 locations would then occupy only part of the last location in which it is stored. Although other minimal storage arrangements than the one shown in Figure 4. la are possible, any minimal storage arrangement for this example requires 8 locations. Algorithm 4.1 may be applied to help compute the average storage which is required by a block which represents an element of B, EO/DO, or E/D-E /D0. For Algorithm 4.1 to be applicable to this task, each item which is stored in each block which represents an element of one of the sets B,EO/D0, or E/D-EO/DO is assumed to occupy either (1) the same number of locations in each block which represents an element of the set, o

191 1. 5.3.25 2.3 1.25 1.0 a. A Minimal Storage Arrangement 1.25.25 1. 5.4.3 2.3 _.,............... 1.0 b. A Fully Packed Storage Arrangement Figure 4.1 Packing of Items Into Storage Blocks

192 (2) an integer number of locations in each block which represents an element of the set. With this assumption, the total storage per block which is occupied by those items which occupy the same amount of storage in each block may be computed by Algorithm 4. 1. The average storage per block is then this storage plus the average amount of storage which is occupied by the items which do not occupy the same amount of storage in each block. The average storage sb which is required to represent an element of B has been described by Equation 3.4. The only terms other than Swb in this equation which are averages are sf and s. If these terms are assumed to be averages of integers, Algorithm 4 1 may be applied to determine the sum of the other terms. This sum may then be added to sf and s to yield sb. In this way, the necessity to compute swb is avoided. Generally, each value of F' does occupy an integer number of storage locations. However, each value of y commonly occupies less than one storage location. For example, each value of y may be represented by two bits in a list structureO If each value of y does not occupy an integer number of locations, but it occupies the same amount of storage in each block which represents an element of B, Algorithm 4 1 may be applied to compute the sum of all terms in Equation 3.4 except sf. Then, sf may be added to this sum to yield sb. The average storage sd0 which is required to represent an element of EO/DO has been described by Equation 3. 6. The terms other than

193 swd in this equation which represent averages are s 0 and s. Generally, the number of locations which each subpicture which is associated with a class in EO/D0 occupies is an integer. Furthermore, each matrix G(D[ e] )1 for D[ e] e EO/DO is generally stored in an integer number of locations. Consequently, SwdO is independent of the storage which is occupied by these items, and Algorithm 4.1 may be applied to the terms so, st, sp, and srO to yield the sum sO + st+ + sp + s wdO- Then, this sum may be added to s30 and s to yield Sdo The storage sd which is required to represent an element of E/D - E0/Do has been described by Equation 3.7. Since sd represents the actual storage which is occupied by a block, rather than an average amount of storage, it may be computed directly by applying Algorithm 4ol to so, st, sp, sr, and s. Thus, the necessity to compute swd is avoided. The above discussion has indicated methods for computing Sb SdO, and s without first determining swb, wd, or swd In this discussion, each term in Equations 3.4, 3.6, and 30 7 has been assumed to be the storage which is occupied by one item. However, if u1 = ull = 1, s is the storage which is occupied by both forward and backward pointers to elements of a ring which represents a set P(D[ e]), and, if u9 = 1, s is the storage which is occupied by references to both the first and last elements of a set p ({e} x S(e)).

194 Then, =s'+s" (4 6) P P P where s' is the storage which is occupied in each block which represents p an element of BU E/D by a forward pointer to an element of a ring which represents a set P(D[ e]), and s " is the storage which is occupied in each block by a backward p pointer to an element of a ring which represents a set P(D[ e]). Furthermore, s -= +S, (4.7) where s? is the storage which is occupied in each block which represents an element D[ e ] e E/D - EQ/D0 by a reference to the first element of the set p({e}x S(e)), and s is the storage which is occupied in each block which represents an element D[ e] E E/D-EO/DO by a reference to the last element of the set p({e} x S(e))o In order to provide for the most efficient packing of this information, s' and s rather than s, will be considered to be arguments to p p p Algorithm 4.1. Similarly, s,' and s, rather than s, will be considered to be arguments to Algorithm 4.1.

195 The storage quantities needed to compute sb are then so t, p se s, s sf and s those needed to 5D 5t' 5?' 5??I'' Se' sI'j compute sd0 are s, st, S Sp 0 and Sg and those needed to compute sd are so, st, sp, sp", sr, s, and s " These storage quantities are described below as functions of the design parameters. 4. 2. 2 Storage of Items Common to All Blocks The overhead storage so which is associated with creating and destroying each storage block may assume several different forms. For example, some storage may be reserved at each end of each storage block as shown in Figure 3.1. Alternatively, overhead storage may be reserved at only one end of each block. This storage could contain such information as the length of the block and a flag to indicate whether or not the block is in use. The overhead storage which is associated with a particular block may even appear in a table which is external to the block itself. Because the overhead storage may assume many forms, the way in which other information may be packed with the overhead information is difficult to parameterize. Consequently, this overhead storage will be considered to contain only items which occupy integer numbers of locations.

196 The storage st which is needed in each block which represents an element of BU E/D to hold information which describes whether the block represents an element of B, E/D- EO/DO, or EO/DO depends on whether or not the display processor performs Algorithm 3.1. As has been mentioned in Section 3.1, st may be zero if the display processor performs this algorithm and the type of element which each block represents may be determined from its format. Similarly, st may be zero if the computer performs Algorithm 3.1 and the type of element which each block represents may be determined from some feature of the block, as in the examples described in Section 3.1. 4. Consequently, St = (1- u) S + St+u, (4. 8) where St is the storage in each block which is occupied by information t which identifies the type of element that each block represents if the computer performs Algorithm 3.1, and St' is the storage which is occupied by this information if the display processor performs Algorithm 3.1. Generally, if St, 0 and St O, St = St = 2 bits. The storage quantities s' and s "which are required to link each P P block in a ring which represents a set P(D[ e] ) to adjacent blocks in the ring are zero if u1 =. If u1 = 1, s is the storage which is 10 10 P

197 occupied by a pointer, If u10 = ull = 1, s is also the storage which is occupied by a pointer. However, if u10 = 1 and ull = 0, p = 0. Then, if Sp denotes the storage which is occupied by a pointer, s'=OSp (4.9) and sp UlSp (4.10) Sp 11 p Recall that l = 1 u u10 = 1. 4o 2, 3 Storage of Items Which Describe an Element of B The storage se which is required to reference the first component of an element of B is S if these references are stored, or zero p otherwise. Consequently, se = uSp. (4.11) Similarly, the storage s which is required to reference a value of; is S if references to values of /J are stored, or zero otherwise, i.e., s = u8p (4.12) However, the storage s' which is required to store a reference to the second component of an element of B and the storage s' which is required to store a reference to a value of pu' depend on whether the display processor or the computer performs Algorithm 3.1. If the display processor performs Algorithm 3.1, se' is the storage which is required to hold a display processor subroutine call command,

198 whereas s' is the storage which is required to hold a display processor jump command. These quantities will be denoted S and Sj, respectively. (If the display processor command set does not include one of these commands, ul is constrained to be zero.) If the computer performs Algorithm 3.1 and u10= 1, u7 may be zero. Consequently, se' may be zero, since D[ e'] may be identified from p(e, e') by sequencing through the ring which represents P(D[ e] ). The quantities se' and s' may then be expressed as follows: e'=ulSs + u7(1 l) Sp, (4 13) and'= U Sj + (1-u1) Sp. (4.14) The average storage which is required to represent a value of and the average storage sy which is required to represent a value of F? and the average storage s which is required to represent a value of y each depend on whether the computer or the display processor performs Algorithm 3.1. Furthermore, sf = 0 if the structure is {B,E/D, A,y}, whereas s = 0 if the structure is {B,E/D,F'}. These two quantities may then be expressed as follows: sf= (- u3) (1- u) Sf + (1- u3) u Sf (4.15) where Sf is the average storage which is required to represent a value of F' if the computer performs Algorithm 3.1, and Sf' is the average storage which is required t r ire represent a value of

199 F' if the display processor performs Algorithm 3.1, and =u3 (1- ) S +u3u (4.16) where S is the average storage which is required to represent a value of y if the computer performs Algorithm 3.1, and S' is the average storage which is required to represent a value y of y if the display processor performs Algorithm 3.1. (Sf Sf S, and S' are estimated from both hardware specifications and the forms which the structures {B,E/D,F'} and {B,E/D, j, y} assume for the application under consideration.) 4o 2 4 Storage of Items Which Describe an Element of E/D As described in Chapter 3, the subpicture which is associated with each class D[ e] E/D - E0/DO is represented by references to elements of B whose first component is D[ e]. Since these elements are assigned an order for purposes of generating the picture, references to only the first and last of them are generally stored. Since the reference to the first of these elements is needed in order to generate the picture, it may be implemented as either a pointer or a display processor jump command, depending on the value of ul. The reference to the last of these elements is optional. If it is stored, it is stored as a pointer. The amounts of storage s3' and s " which are occupied by these two references are then the following: s'= (1- ul) Sp +U1S, (4. 17)

200 and s "- u9Spo (4.18) However, for each class in Eo/DO, the associated subpicture must be represented explicitly, either as a table of plotting information or as a display processor program. Furthermore, since a different number of artificial entities may be needed for the structure {B,E/D,F'} than for the structure {B,E/D, pL, y}, the average storage which is occupied by one of these subpictures -depends on which structure is used. Then, 0o= (1 3) ((1 u2) S + u2 Sf) + u3 ((1- u2) Sg+ u Sg (419) where Sf is the average storage which is required to represent a subpicture 13f which is associated with a class in Eo/DO as a table of plotting information for the structure {B, E/D, F'}, S, is the average storage which is required to represent a subpicture which is associated with a class in E0/DO as a display processor program for the structure {B,E/D, F'}, Sag is the average storage which is required to represent a subpicture which is associated with a class in EO/D0 as a table of plotting information for the structure {B, E/D, A, y}, and S'is the average storage which is required to represent a subpicture which is associated with a class in EO/Da as adisplay processor program for the structure {B,E/D, L, y}.

201 The storage which is occupied by each matrix G(D[ e]) for D[ e] eE0/DO depends on whether the display processor or the computer performs Algorithm 3.1. Furthermore, these matrices are not stored if the structure is {B,E/D,F'}, rather than {B,E/D,, y}. The average storage which is occupied by one of these matrices is then sg U3 ((1- up) Sg +u S ), (4.20) where S is the average storage which is occupied by a matrix g G(D[ e] )- for D[ e] eE0/DO if the computer performs Algorithm 3.1, and S' is the average storage which is occupied by one of these matrices if the display processor performs Algorithm 3,1. (S and S' are estimated from the hardware specifications and the form g g which the structure {B,E/D, j,,y} assumes for the application under consideration.) Although each matrix G(D[ e] ) 1 is stored only for D[ e] eE0/D0, some storage may be required in each block which represents a class D[ e] E/D - EO/DO to hold information which describes the computation of G(D[ e] ) if the display processor performs Algorithm 3.1. For example, in the program which is described in Appendix A, an extra jump command is needed for this purpose in each block which represents an element of E/D -EO/Do. The storage which is needed for this purpose will be denoted by Sa. If u2 = 0 and u1 = 1, a display processor command must be included in each block which represents an element of EO/DO to stop the display processor and interrupt the

202 computer. This storage will be denoted Sh. Finally, some storage is required in each block which represents an element of E/D to hold the display processor commands which return from a display processor subroutine call. This storage will be denoted S. Then, the storage r which is required to store display processor commands Wi ich serve only to control the display processor may be summarized as follows: SrO = u (u2Sh + (1- u2) Sr), (4.21) and sr= u1 (Sr + 3 Sa) (4.22) 4.3 Effect of Design Decisions on Picture Generation Time As has been described in Section 3,3.2, the total time g during which the computer is devoted to the picture generation process while the picture is generated once and the time tf which elapses while the picture is generated once affect the time which is required to perform basic operations. These quantities are expressed as functions of the design parameters below. 4.3. 1 Time During Which the Computer is Devoted to Picture Generation Recall from Equation 3.2.6 that g = (gs + gr+ gm + gh gb+ gn x) - (e) e E-{X} + (gc + gt) e

203 Each of the quantities gs, gr, gmgh gb' gn gx gt' and gt whic appears in this equation depends on one or more design parameters. The average times gs and g during which the computer must be devoted to the picture generation process in order to save items on the push-down stack and to restore these items from the push-down stack during Steps 2 and 4 of Algorithm 3.1 depend on whether the computer or the display processor performs Algorithm 3.1. Furthermore, these quantities are proportional to each other, since all items which are saved in Step 2 of this algorithm are restored in Step 4 of the algorithm. As has been mentioned in Section 3. 2.1, the program may save either a reference to an element of B or both a reference to an element of B and a coordinate transformation matrix during Step 2. Consequently, gs and g also depend on the design parameter u. Since gs and gr are proportional to each other, the sum g5 + gr which appears in Equation 3.26 may be expressed as follows: gS + gr= (1 - U) Gs+u + u5( G- u1)UGs ++ u5 G' (4. 23) where G is the time which is required for the computer to save and restore a reference to an element of B, G' is the time during which the computer is suspended while s the display processor saves and restores a reference to an element of B,

204 Gs" is the average time which is required for the computer to save and restore each value of H, and G'" is the average time during which the computer is suspended s while the display processor saves and restores each value of H. The average time g during which the computer is devoted to the picture generation process while a value of H is premultiplied by either a value of F' or a value of G' depends on whether the computer or the display processor performs the matrix multiplication. Furthermore, as described in Chapter 3, gm also depends on the average complexity of values of F' or G'. Since this complexity may differ for these two functions, gm depends on whether the structure is {BE/D,F'} or {B,E/D, Li, y}. Since second components of elements of B must be identified in order to determine values of G' gm also depends on whether or not a reference to the second component of each element of B is stored in the block which represents that element, as described by the value of u7. To summarize, gm (1- u3) ((1 - u) Gmf + u1Gmf + 3 ((1- Ul) (umg + (1- u7) Gm )+ u Gmg) (4,24) where Gmf is the average time which is required for the computer to premultiply a value of H by a value of F', G' is the average time during which the computer is suspended mf

205 while the display processor premultiplies a value of H by a value of F', G is the average time which is required for the computer to mg premultiply a value of H by a value of G' if u7=1, G g is the average time during which the computer is suspended while the display processor premultiplies a value of H by a value of G', and G " is the average time which is required for the computer to mg premultiply a value of H by a value of G' if u7 = 0. (Gmf Gmf'GG,G' and G "are estimated from both hardware Gmf Gmf mg mg m mg specifications and the forms which the structures {B,E/D,F'} and B, E/D, j, y} assume for the application under consideration.) The average time gh during which the computer is devoted to the picture generation process while a value of H is premultiplied by the inverse of a value of F' or by a value of G" is also determined by the design parameters ul, u3, and u7. However, gh= 0 for the structure {B, E/D, F' if premultiplication by inverses of values of F' is avoided by saving values of H on the push-down stack. Consequently, gh= (1 - 5)(1 - u3) ((1- ) Ghf + U1 hf') + u3 ((1- ul) (u7 Ghg + (1- u7) g ) + lGhg (425) where Ghf is the average time which is required for the computer to premultiply a value of H by the inverse of a value of F', Ghf' is the average time during which the computer is suspended

206 while the display processor premultiplies a value of H by the inverse of a value of F', Ghg is the average time which is required for the computer to premultiply a value of H by a value of G" if u7 = 1, Gh' is the average time during which the computer is suspended while the display processor premultiplies a value of H by a value of G", and G " is the average time which is required for the computer to hg premultiply a value of H by a value of G" if u = 0. (GhfGhf,GhgGhg', and Ghg" are estimated from hardware specifications and from the forms which the structures {B,E/D,F') and {B,E/D,,y} assume for the application under consideration.) The average time gh during which the computer is devoted to the picture generation process while the element beB such that [i (b) = D e ] for a given class D[ e] is identified depends on ul, since ul describes whether this reference is stored as a pointer or as a display processor jump command. Furthermore, if ul= 0, the computer must determine whether or not b exists before it attempts to identify this element. The average time which is required for this process depends on the relative cardinalities of EO/DO and E/D. Since these cardinalities are functions of u3, gb also depends on u3. To summarize, gb (1- u1) ((1 - u3) Gbf +u3 Gbg) + u Tj, (4.26) where Gbf is the average time which is required for the computer to determine whether or not a class D[ e] belongs to EO/DO,

207 and, if it does not, to identify beB such that ji(b)= D[ e] for the structure {B,E/D,F'}, Gbg is the average time which is required for the computer to determine whether or not a class D[ e] belongs to EO/D0, and, if it does not, to identify beB such that A(b)= D[ e] for the structure {B, E/D, A,7y, and T. is the time during which the computer is suspended while a jump command is transferred to the display processoro (Gbf and Gbg are estimated from both hardware specifications and the forms which the structures {B,E/D,F'} and fB,E/D, I,y} assume for the application under consideration.) The only design parameter which affects the average time g during which the computer is devoted to the picture generation process while g'(b) is being identified for a given be B is ul, i.e., gn= (1 - u1) (T + Tb + ul T (4.27) (Recall that T is the time which is required to read a pointer from the structure and that Tb is the time which is required to determine whether a storage block represents an element of B, EO/Do, or E/D- E0/D0.) If u1 = 0, the computer reads the pointer to the block which represents g' (b) from the block which represents b. Whether the block which represents A' (b) belongs to B or E/D is then determined in order to select the step of Algorithm 3. 1 which is to be performed next. However, if ul= 1, the display processor identifies pL' (b) by simply executing a jump command. The average time gx during which the computer is devoted to the

208 picture generation process while the second component of an element of B is identified also depends on whether the computer or the display processor performs Algorithm 3l1. If the computer performs this algorithm and the blocks which represent the elements of each set P (D[ e]) are linked together in a ring with the block which represents D[ e], an explicit reference to the second component of each element of B need not be stored in the block which represents that elemento If T is the time which is required to transfer a subroutine s call command to the display processor, gi =u7(1- U1) T + u Ts +(1 - ul) (1 - 7) T (1 + [B l/E/D ) /2. (4 28) The average time g which is required for the computer to produce c eF E from H(e) and 3(e) is nonzero only if the display processor itself does not perform this task. Furthermore, since a different number of artificial entities may be needed for the structure {B,E/D,F'} than for the structure {B,E/D,I l,y}, this average time also depends on which form the structure assumes. Then, gc = (1 - u2) ((1 - u3) Gcf +3 Gcg) (4. 29) where Gcf is the average time which is required for the computer to produce an entity in E0 for the structure {B,E/D,F'}, and cG is the average time which is required for the computer to cg produce an entity in E0 for the structure {B,E/D, ji, y}. (Gcf and G are estimated from both hardware specifications and the cg average amount of information which must be converted into display processor format per entity in EO for the application under consideration.)

209 The average time gt during which the computer is suspended while an entity in E0 is transferred to the display processor depends on the form of the information to be transferred. If the display processor forms eEE0 from H(e) and 3(e), gt is the average time xvhich is required to transfer these items to the display processor, whereas, if the computer forms e from H(e) and 3(e), gt is the average time which is required to transfer the result of this computation to the display processor. Furthermore, since a different number of artificial entities may be needed for the structure {B,E/D,F'} than for the structure {B,E/D,, y}, gt also depends on which structure is used. To summarize, = (1 - 3) ((1 - U2) Gtf + u) + 3 ((1 - u2) tg + u2Gtg) (4.30) where Gt is the average time during which the computer is suspended while an entity which has been formed by the computer is transferred to the display processor for the structure {B, E/D, F'} Gf' is the average time during which the computer is suspended while the subpicture ((e) for an entity in ecE0 is transferred to the display processor for the structure {BE/D,F'}, Gt is the average time during which the computer is suspended tg while an entity which has been formed by the computer is transferred to the display processor for the structure {B,E/D,, y}, and

210 G tg is the average time during which the computer is suspended while a subpicture 3(e) for an entity ee E0 is transferred to the display processor for the structure {BE/D, l, y}. (Gcf and Gc are estimated from both hardware specifications and the cf cg average amount of information which must be transferred to the display processor per entity in E0 for the application under consideration.) 4. 3 2 Time Which Elapses While the Picture is Generated In order to describe the time tf which elapses while the picture is generated, the total time which is required for the display processor to plot entities in En, exclusive of the time which is required to obtain information which describes these entities from the computer, is considered. Since the number of artificial entities which are present in the picture depends on whether the structure is {B,E/D,F'} or {B,E/D, y}, this plotting time depends on which structure is used. In further discussion, the plotting time will be denoted Tdf for the structure {B,E/D,F'} and Tdg for the structure {B,E/D,,y } Since the display processor must form each entity ec E0 from 3(e) and H(e) if u2= 1, an additional amount of time may be required to transform 3(e). For example, if an entity in E0 is described to the display processor as a translation transformation and a list of relative vectors, the entity may be displayed by first drawing an invisible vector to the coordinates at which the entity is to be displayed and then plotting the vectors relative to the resulting coordinates. No part of the entity can be displayed while the invisible vector is being drawn. However, the invisible vector is usually drawn much more rapidly than the visible parts of the entity, since only the endpoints of this vector must be

211 determined accurately. In further discussion, the time which is required for the display processor to transform a subpicture into an entity in E0 will be assumed to be small when compared to the time which is required to plot the entity, and, consequently, it will be ignoredo However, if the display processor performs Algorithm 3.1, the time which elapses while it performs the transformation which is described by a value of F', G', or G" cannot be ignoredo Several of these transformations are generally performed in order to produce a single entity in E0. If the structure is {B,E/D,F'}, and ttf(p(e,e')) denotes the additional time to that which is required to access memory which is required to perform the transforrm tion which is represented by F'(p(e,e')), the total time Ttf which is consumed in this process is T = 2 (e) ttf ((e,e')). (4.31) (e, e')EA (The factor 2 is included in this equation to account for the fact that the transformations represented by both F'(p(e,e')) and F(p(e,e')) must be performed p(e) times.) If the structure is {B,E/D, j, y}, the time Tt which is required to perform the transformations which are represented by values of G' and G' is much more difficult to express for the general application. However, if the form of the structure is known, Ttg may be expressed much more easily. Specific values of Tg will be estimated for several examples in Chapter 5 tg where they are needed to optimize implementations of the structure.

212 In many hardware configurations, the display processor cannot suspend the computer continuously by accessing its memory continuously. For example, the display processor may be interfaced to the computer so that it can use only every other cycle. In this event, the total time g during which the computer is suspended while the picture is generated is less than the total time that elapses while the display processor accesses memory in order to perform Algorithm 3.1. However, the time which elapses during this process is generally proportional to g. Consequently, the factor c is defined to be the ratio of the time which elapses while the display processor accesses memory to the time during which the computer is suspended while the display processor accesses memory. For example, if the display processor can use only every other memory cycle, ac= 2. This factor is used below to help describe t. If the computer performs Algorithm 3.1, this algorithm may be performed while entities in En are being plotted by the display processor. If the display processor has a vector drawing capability, the time which is required to plot each entity e' EE is generally greater than the time which is required to compute H(e) and to determine 3(e) for any other entity ee E0 Then, H(e) and 3(e), where ee E is the next entity in E0 to be displayed after e'EE0 is displayed, may be determined while e' is being plotted by the display processor, and tf is the total time which

213 is required to plot all entities in E0. By contrast, if the display processor must perform Algorithm 3.1 itself, the computation of H(e) and 3(e) for ee E cannot be overlapped with the plotting of an entity e' E0o Consequently, for this type of operation, tf is the sum of the total plotting time for entities in E0 and the time which elapses while values of H and p are computed for these entities. As will be described in Section 4.5, g will always be assumed to be less than the total plotting time for entities in E0 if u = 0. If this condition is assumed to imply that the time which is required for the computer to determine H(e) and 3(e) for each entity ee E is less than the time which is required to plot this entity, tf may be expressed as follows: t = (1- u)Tdf +u Tdg + u1 (g + (1- u3) T +3 Ttg). (4. 32) 4. 4 Effect of Design Decisions on Response Time As has been described in Chapter 3, many of the basic operations may be implemented in a variety of ways. These various methods of implementation are described by various sets of values for the design decisions. Consequently, the average time which is required to perform each basic operation is a function of the design parameters, In addition, the frequency of occurrence of each basic operation is a function of the design parameter u3, i.e.,

214 f(i = (1- u3) ff(i) + u3 fg (i), i 1, 2,. o 15, (4. 33) where ff(Li) is the frequency of occurrence of Operation {. for the structure {B,E/D,F'}, and fg(fi) is the frequency of occurrence of Operation.i for the structure {B,E/D, /, y}. (Note that ff()= f= ff(4) = ff(5) = O ) The average time which is required to perform each basic operation is expressed as a function of the design decisions below. 4. 4.1 Operations Which Modify the Structure The average time rl which is required to synchronize with the picture generator and to store references to a newly created element of B and the average time r which is required to synchronize with the picture generator and remove references to an element of B which is to be destroyed depend on the values of the design parameters, The possible references to an element p(e, e')E B which must be changed when that element is created or destroyed are the following: (1) A reference to p(e,e') which is stored in the block which represents /i(p(e,e')). This reference is always present, since it is needed to generate the picture. (2) A reference to p(e, e') which is stored in the block which

215 represents g'(p(e,e')), If A'(p(e,e'))EE/D, this reference is stored only if u9= 1, if'I(p(e,e'))E B, this reference is stored only if u8= 1. (3) References to p(e,e') which are stored in the elements of the ring which represents P(D[ e']). These references exist only if u10 = 1, and the number of them is determined by the value of Ull1 The first of these references may be stored as either a pointer or as a display processor jump command, depending on whether the computer or the display processor performs Algorithm 3.1, The time which is required to store this reference in the structure is then R = (1- u) Rp + ulRj, (4.3 4) where pR is the time which is required to store a pointer, and R. is the time which is required to store a display processor jump command. If a reference to be B is stored in the block which represents i'(b), it is stored as a pointer, since it is not interpreted by the display processor. Whether or not this reference is stored for a particular element bE B may depend on whether'(b) belongs to B or E/D. Since there are IE/DI - IEO/D0 elements bEB for which Iu(b)EE/D, the probability that p(b)EB is (IB - IE/D| + 1E0/D0 I)/IB. The average time which is required to store this reference is then

216 RA = u9Rp (E/DI- IEO/DO )/IBI +u8 Rp (B - IE/DI + EO/D0 J)/B I (4.35) The time which is required to add an element bE B to P(D[ e]) or to remove it from P(D[ e] ) depends on whether both forward and backward pointers or just forward pointers are stored in the ring which represents P(D[ e]). The time which is required to store references to a new element of B in the ring which represents P(D[ e] ) is Ra = u10 Tp + (U10 + ull) Rp (4.36) Since the order in which blocks appear in the ring is not interpreted, the new block may be inserted at any position in the ringO So that no part of the ring need be searched, the block is assumed to be inserted in the ring after the block which represents D[ e] o A time T is then required to obtain the forward pointer from the block which P represents D[ e] so that it may be stored in the new block. Once this pointer is obtained, (u10 + u1l) pointers to the new block are stored in the ring. The average time which is required to remove a block from the ring which represents a set P(D[ e]) is Rr= u (l- U11) (R +(1+ IBI/IE/DI)(T +T)) + 2u11(T + R). (4.37) If u10 = 0 (and, consequently, ull = 0), the ring does not exist, and R = 0. If only forward pointers are stored in the ring (ul0 = 1 and u= 0), the entire ring must be searched to find the block which contains

217 a pointer to the block to be removed. The average number of blocks in this ring is 1+ IB I/IE/D |. Each time that a pointer is examined during the search (which requires the time T ), it must be compared with the address of the block to be removed (which requires the time T ) in order to determine whether or not the search should c be terminated. When the search is complete, the pointer to the block to be removed is changed to the forward pointer which is stored in the block to be removed. If both forward and backward pointers are stored in the ring (i.e., u10 = ull= 1), the forward and backward pointers in the block to be removed are examined to identify the blocks which contain pointers to the block to be removed. The pointers to the block to be removed which are stored in these blocks are then changed. The average time which is required to synchronize with the picture generator and store references to a newly created element of B is then r1 R +R'+R +u3tf/2 (4.38) (Recall from Chapter 3 that the program which is modifying the structure must wait for Algorithm 3.1 to be completed only if the structure is {B,E/D, 4, y} in order to store references to a newly created element of B.) Similarly, the average time which is required to synchronize with the picture generator and remove references to an element of B from the structure is r2=R +R'+R + tf/2 (4.39) (Recall from Chapter 3 that the program which is modifying the structure must always wait for Algorithm 3.1 to be completed in order to modify references to an element of B which is to be destroyed.) Then, from these equations and Equations 3.38 and 3.39, the average

218 times which are required to perform operations 23 and 24 (which create and destroy elements of B) are the following: r( 3) =(rg+rcsb) tf/(tf - g) + r(0)+ R + R + Ra+ u3 t/2, (4.40) and r(4) = rdtf/(tf - g) + r(9) + r (10) + R + R' +Rr +tf/2. (4.41) The average times which are required to perform the basic operations ^ and 1 2 (which create and destroy elements of E/D) haw been described by Equations 3.36 and 3 37. The average time which is required to perform operation 215 (which modifies the second component of an element of B in the structure {B,E/D, j,,y}) has been described in Chapter 3 as being approximately tf/2. Because tf/2 is very large when compared to the time which is required to modify a reference, no attempt will be made to estimate ri(15) more precisely, i.e., r-(15)= tf/2. (4.42) 4.4.2 Operations Which Interrogate the Structure As described in Chapter 3, Operation 25, whict of a set P(D[ e] ), may be performed by examining a ring tit u10 = i), by Algorithm 3.5, or by waiting for the picture generator to identify

219 these elements. As has been described, the average time which is required to perform Algorithm 3,5 is difficult to express for the general application. However, the design parameters on which it depends can be easily specified. Since the number of times that each step of the algorithm is performed depends on the cardinalities of the sets B, E/D- E0/D0 and E0/D0, the time which is required to perform the algorithm depends on u3o Furthermore, since references to second components of elements of B are examined by the algorithm, the time which is required to perform the algorithm depends on the way in which these references are stored, which is described by u! and u7. Then, by recalling Equation 3 41 and the fact that the program which is modifying the structure must wait a time 3tf/2 in order to perform.i if the picture generator identifies the desired elements, r,(j5) may be expressed as follows: r,(f5) = (U1O(Tp+Tc) (1+ IBI/IE/DI) + U4 ((1- u3) ((1- ul) (U7Rsf+ (1 - u) Rs) + u1R") + u3 ((1- u) (uRsg+ (1 7) R ) + 7 sf 1 sf 3 1 7Rsg s u1 Rs,))tf/(tf- g)+ 3 (1 - 4)(1 - ) tf/2 (443) where Rsf is the average time which is required to perform Algorithm 3. 5 for the structure {B, E/D, F' } with u1= 0 and u7= 1,

220 R' is the average time which is required to perform sf Algorithm 3.5 for the structure {B,E/D,F'} with U= 7 = 0, R is the average time which is required to perform Algorithm 3.5 for the structure {B,E/D,F'} with u=1, R is the average time which is required to perform sg Algorithm 3. 5 for the structure {B,E/D,, y} with u= 0 and u7 = 1, R' is the average time which is required to perform sg Algorithm 3.5 for the structure {B,E/D, g, y} with u.l = u 0, and R. "is the average time which is required to perform sg Algorithm 3.5 for the structure {B,E/D, -,,y} with u = 1. As has been described in Chapter 3, operations Q6 and 10 each require the same amount of time to perform. Each of these operations involves examining a display processor jump command if u1= 1, or a pointer if u = 0. Consequently, if Tj' denotes the time which is required to identify the block which a display processor jump command references, r'(16)= r (l0o) = ((1- ) Tp+ u1 T) tf/(tf-g (44)

221 The time which is required to perform Operation C7 (which identifies b B for a given l (b)E E/D) depends on the value of u9. If u9= 1, this operation involves the examination of a pointer, whereas, if Ug = 0, Operation 10 must be performed several times in succession. Consequently, from Equations 3.44 and 3.45, r(7)= u9 Tptf/(tf - g)+ (1 -u9) (r{(6) + (r (10) + Tctf/(tf- g)) [B /(E/D I - IE0/D0)). (4.45) Similarly, Operation g9 (which identifies be B for a given g'(b)e B) depends on the value of u8. From Equations 3.46 and 3.48, r (. = u8Tp tf/(tf - g) + (1 - u8)(rf (11) + (r(I10) + T tf/(tf- g))(l+IBI/(IE/DI- IE0/D01))/2). (4.46) The time which is required to retrieve transformation matrices from the structure depends on the format in which these matrices are stored. Generally, this format is determined by which device, the computer or the display processor, performs Algorithm 3.1. Consequently, r,(g8)= ((1- ul)Rg+u1Rg ) tf/(tf- g) (4.47) where R is the average time which is required to retrieve the matrix g G(D[ e] )1 from the structure for a class D[ e] eE0/D0 if the computer performs Algorithm 3.1, and

222 R' is the average time which is required to retrieve this g matrix if the display processor performs Algorithm 3.1. Similarly, rf ( 13) ((1 - ul) Rf + ulRf tf/(tf - g) (4 48) where Rf is the average time which is required to retrieve the matrix F' (p(e,e')) from the block which represents p(e,e') if the computer performs Algorithm 301, and ftU is the average time which is required to retrieve this matrix if the display processor performs Algorithm 3 1o The time which is required to determine the form of y(p(e,e')) by examining the block which represents p(e,e') also is determined by the format in which this sequence is represented. This format is determined by which device performs Algorithm 3.1, i.e., r (14)= ((1 - ul)R+ ulR^) tf/(tf - ) ( where R is the time which is required to determine the form of y(b) if the computer performs Algorithm 3.1, and R' is the time which is required to determine the form of y(b) if the display processor performs Algorithm 3.1. The time which is required to perform Operation 211 (which identifies the first component of an element of B) depends on whether

223 or not a reference to the first component of each element of B is stored in the block which represents that elenment. If this reference is stored, it is examined to perform f11; otherwise, Algorithm 3.8 must be applied. From Equations 3.49 and 3.50, the average time which is required to perform this operation is then r (f1) = u6 Tptf/(tf - g)+(l- u6) (r (fl10) + btf/(tf- g)) (1+ IB /(IE/DI - IEO/D01))/2). (4.50) The time which is required to perform Operation L2 (which identifies the second component of an element of B) depends on whether or not an explicit reference to the second component of each element of B is stored in the block which represents that element. This reference may be stored as either a pointer or a display processor subroutine call command, depending on the value of ul. From Equations 3.51, 3.52, and 3.53, the average time which is required to perform this operation is A (f 12)= u7 ((- ul) Tp+ u1 ) tf/(tf -g) + (1- u7) ((Tp+Tb)tf/ (tf -g)) (1+ IB/IE/D1)/2. (4. 51) (Recall that Ts'denotes the time which is required to identify the block which a display processor subroutine call references.) 40 5 Constraints Because there are eleven design parameters, each of which may

224 assume two values, the number of implementations of the topological structure which can be specified for a given hardware configuration is 2 = 2048. However, only 480 of these implementations are possible because the design parameters are not independento Furthermore, for certain applications, not all of these 480 implementations are possible. The constraints on the design parameters which result from the way that these parameters w re defined are described below. The constraints which are imposed on the design parameters by the hardware configuration and the application are then described. The constraints which may be derived from the definitions of the design parameters are the following: a3=1 =u =0 (4.52) 3 5 u7 =0 u10 = 1 and ul= 0 (4.53) u10=1 u4 =0 (4. 54) 1=0 = > 11 =0 (4.55) Equation 4.52 states that matrices cannot be saved on the push-down stack if the structure is {B,E/D, p, y}o This constraint is true because Step 4 of Algorithm 3.1 does not necessarily restore J to a value which it assumed previously for this structure. Consequently, nothing can be achieved by saving matrices on the push-down stack,

225 Equation 4. 53 states that each set P (D [ e ]) must be represented as a ring in the structure so that the second component of each element of B may be identified if a reference to this component is not stored in each block which represents an element of B. However, the display processor is assumed to be incapable of identifying this component from this ring. Consequently, this equation also states that the display processor must not perform Algorithm 3 1 if no explicit reference to the second component of each element of B is stored in the block which represents that element. If each set P (D[ e]) is represented as a ring in the structure, the best way to perform Operation Q5 is to examine this ring. Consequently, Equation 4.54 states that f5 is not performed by Algorithm 3. 5 if each set P (D[ e]) is represented in this way. Equation 4. 55 states that both forward and backward pointers are not stored in the ring which represents a set P (D[ e]) if this ring does not exist. Other constraints which depend on the application of the structure are limitations on the values which s and tf are allowed to assume. If the picture generator program (which is needed if u = 0) occupies an appreciable amount of storage, the amount of storage which is available may be a function of ul. However, the picture generator program generally occupies much less storage than the topological structure, and, consequently, the error introduced by assuming that

226 the maximum available storage for the structure is independent of u1 is not significant. Then, if smax denotes the amount of storage which is available to represent the structure and t denotes the max amount of time which is available to generate the picture, these constraints may be written as follows: s max (4. 56) and tf< t (4 57) f- max However, these constraints do not completely describe the limitations which are imposed by the application. In addition to these limitations, the computing time which is available to operate on the structure may be limited by the time during which the computer must be devoted to the picture generation process. In deriving Equation 3.34, the picture was assumed to be continually generated, even while the response to a control language input is being processed. Then, if g > tf, the computer must be completely devoted to the picture generation process, and no time may be spent responding to control language inputs. Consequently, a finite response time is achieved only if g < tf. (4. 58) 4.6 Conclusion The number of implementations which may be specified by the design parameters is small enough that these implementations may be

227 easily enumerated with a computer program. Consequently, the optimum design of the topological structure for a specific hardware configuration and application may be easily determined. A program which enumerates the possible implementations for a specified hardware configuration and application is described in Appendix B. The results obtained by applying this program to several applications for the DEC 339 [1, 52 ] are described in the following chapter,

Chapter 5 APPLICATIONS The cost function and constraints have been described as functions of eleven design decisions in Chapter 4. The application of the equations stated in that chapter to a given application of the topological structure and a given hardware configuration remains to be demonstrated. In this chapter, two example applications of a DEC 339 [ 1, 52 ] (with the extended arithmetic element and VA38 character generator options) are studied through the use of these equations. The results which are given were obtained through the use of the programs which are described in Appendix Bo Because of hardware limitations, the only coordinate transformations which will be considered in these two examples are translations (in two dimensions). The display processor may easily perform these transformations by drawing invisible vectors. Although the DEC 339 display processor does include a scale facility, this facility provides only the very coarse scale factors 1, 2,4, and 8. Furthermore, vectors which are drawn with scale factors 4 and 8 appear on the screen as dotted lines, whereas those drawn with scale factors 1 and 2 appear as solid lines. For these reasons, coordinate transformations which scale coordinates will not be considered. This limitation of the discussion to only very simple coordinate transformations does not 228

229 restrict the values which the design decisions may assume. One hardware limitation, however, does restrict the values hich the design decisions may assume. The DEC 339 display processor is not capable of saving coordinates (i e., representations of coordinate transformations which are translations) on a push-down stack*, although it is capable of saving references to elements of B. Consequently, the constraint u 1 =1 u5 = 0 (5.1) is imposed on the design decisions by the DEC 339 hardware. Furthermore, the matrix J in Algorithm 3. 2 cannot be saved on the push-down stack whenever the display processor performs Algorithm 3.1. However, since the only coordinate transformations which are considered are translations, Algorithm 5.1, which is described in Section 5. 2.1 below, may be substituted for Algorithm 3. 2. This algorithm does not save coordinate transformation matrices on a push-down stack, but it is otherwise very similar to Algorithm 3. 2. 5.1 Methods of Implementation In order to estimate the parameters which describe an application of the topological structure for the DEC 339, the method by which *Rather simple display processors which can save coordinates on a push-down stack have been suggested [ 44 ], and at least one modern display processor, LDS-1 [ 18 ], can save general transformation matrices on a push-down stack.

230 certain features of the topological structure are implemented for given values of the design decisions must be specified. For example, if 2 = 0, each subpicture which is associated with a class in EO/D0 must be stored as a table of plotting information. However, this table may be stored in any one of several formats. In order to determine the average storage Sf or S/g which is occupied by one of these subpictures for either value of U3, the format of this table must be specified. The formats which will be considered for storing various items are described below in Section 5.1.1. Then, in Section 5.1. 2, elementary instruction sequences are given for performing very primitive operations, such as examining a pointer or storing a jump command in the structure. These methods of implementation will be assumed when parameters are estimated later in Section 5.3. 5.1.1 Storage Formats The items which may be stored to represent a topological structure on a DEC 339 are the following: (1) a pointer, (2) a display processor jump command, (3) a display processor push jump (i.e., subroutine call) command, (4) a display processor pop (i e., subroutine return) command, (5) a display processor internal stop command (i.e., a command which stops the display processor and interrupts the computer),

231 (6) a pair of coordinates which represents a coordinate transformation matrix, (7) a subpicture for a class in EO/DQ, (8) a value of y, and (9) a block type. Table 5.1 shows the number of locations which each item occupies, as well as the format of each item. The symbols "VEC", "SVEC", and "CHAR" represent the vector mode (11218), short vector mode (11418), and character mode (11718) commands, respectively. The formats for values of y for ul =1 are assumed to be those used by the program which is described in Appendix A. Because of their complexity, these formats are not shown in Table 5.1. Shaded areas in each format are areas into which other items may be packed, whereas unlabeled areas do not contain any useful information. Note that all variable length formats are considered to occupy an integer number of locations so that Algorithm 4.1 may be applied to help compute Sb, Sd0, and sdo In addition to the items shown in this table, one additional location is assumed to be needed at each end of each storage block for storage allocation purposes. 5. l 2. Elementary Instruction Sequences Sequences of instructions which examine and modify these items are shown in Table 5. 2, together with the time which is required to perform each sequence. At the beginning of each sequence, location P is assumed to contain a pointer to the first word of each item which is

232 Item Number of Locations Format Pointer 5/6 | address Jump or push jump 5/3 m command command _.. address Pop or internal stop 23 command command Coordinate transformation matrix: A x u =0 2 A y u-i,~ 3. I__ VEC u =l 3 1 _ Ax ___ Ay Some subpictures for classes in E/Do: n u2= 0, n vectors 2n+ 1 x Y n Table 5.1 Storage Requirements for DEC 339

233 Item Number of Locations Format u2= 1, n vectors 2n+l VEC ARn n CHAR u2=1, u3= 0, character 4 _ code esc SVEC 00678 CHAR u2=, u= 1, character 2 code esc A sequence y(p(e,e')): u1= 0 1/9 2 bits U= 1: (I,G(D[ e']),I) 4 (I,G(D[ e'] ), -1 G(D[ e']) 2 See Appendix A (G(D[Ge(])De (G(D[ e'] )-1, G(D[ e']),I) 2 (G(D[ e']) 1, G(D[ e']),G(D[ e'] ) 10 A block type 1/9 2 bits Table 5.1 (cont.) Storage Requirements for DEC 339

234 Function Sequence Time Required 1. Examine pointer LAC I P.005 msec DAC P1 2. Interpret push jump ISZ P.007 msec or jump command LAC I P as a pointer DAC P1 3. Check block type LAC I P.008 msec against given block AND M type SAD C JMP ---- JMP ---- 4. Compare two pointers LAC P1.005 msec SAD P2 JMP ---- JMP ---- 5. Save word on push-down DAC I PS,005 msec stack ISZ PS 6. Restore word from CLA CMA o005 msec push -down stack TAD PS DAC PS 7. Premultiply by value LAC I P.016 msec of F' (u1= 0) TAD X DAC X ISZ P LAC I P TAD Y DAC Y 8. Premultiply by inverse LAC I P.022 msec of value of F' (ul = 0) CMA TAD (1) TAD X DAC X Table 5o 2 Elementary DEC 339 Instruction Sequences

235 Function Sequence Time Required 8. (cont.) ISZ P LAC I P CMA TAD (1) TAD Y DAC Y 9. Copy one word LAC I P1.006 msec DAC I P2 10. Store pointer in LAC P1.005 msec structure DAC I P 11. Store jump command LAC P1.046 msec in structure LRSS 14 XOR (2000) DAC I P ISZ P AND (7) LLS 14 DAC I P 12. Read transformation LAC I P.012 msec matrix (u = 0) DAC X ISZ P LAC I P DAC Y 13. Read transformation ISZ P.082 msec matrix (u1= 1) LAC I P JMS S DAC Y ISZ P LAC I P JMS S DAC X Table 5 2 (cont.) Elementary DEC 339 Instruction Sequences

236 Function Sequence Time Required 13. (cont.) S, 0 ALS 7 GSM ALS 1 LRS 10 SZL TAD (1) JMP I S 14. Read form of y(p(e,e')) LAC I P.007 msec (u1=0) AND M DAC T 15. Read form of y(p(e,e')) CLA CMA.012 msec for (u= 1) TAD P (I,G(D[ e']),I) DAC P CMA o014 msec for SAD C (G(D[e']), G(D[e']), JM-P G(D[ e'] )-1) SAD Cl JMP ----.03 msec ISZ P otherwise ISZ P LAC I P ISZ P ISZ P CMA TAD I P SPA JMP - - JMP -- 16. Read value of F' DZM X.012 msec (u1= 1) DZM Y identity matrix LAC I P AND (7777).094 msec otherwise Table 5.2 (cont.) Elementary DEC 339 Instruction Sequences

237 Function Sequence Time Required 16. (cont.) SAD (1121) SKP JMP L Sequence 13 L, 17. Read G'(p(e,e')) or LAC I P.006 msec G"(p(e,e')) (u1 0) AND M SNA JMP -- 18. Convert table of n LAC I P (.007+.017n) msec coordinate pairs into DAC T vector mode coordinates ISZ P (u2=0) L, LAC I P GSM SZL TAD (2001) DAC I P1 ISZ P ISZ P1 ISZ T JMP L Table 5.2 (cont.) Elementary DEC 339 Instruction Sequences

238 to be examined or modified. The contents of other locations which appear in these sequences are interpreted as follows: PS: pointer to the last item on a push-down stack. M: mask used to clear selected bits of the accumulator. C,C1: masks against which the content of the accumulator is to be compared. P1,P2: pointers. X,Y: x and y coordinate values. T: other forms of data. All arithmetic is assume d to be tw's complement arithmetic. A storage allocation scheme similar to that shown in Figure 3 1 is also assumed. Sequence 15 in the table examines the overhead information which is needed for this allocation scheme in order to determine the length of a storage block. This length is then used to help determine the form of the value of y which is associated with that block. 5. 2 Time Required to Perform Algorithms 3. 2 and 3. 5 Although Algorithms 3. 2 and 3. 5 have been described in Chapter 3, the time which is required to perform each of these algorithms has not been discussed. However, the time which is required to perform Algorithm 3. 2 (which computes a matrix G(D[ e] )1 must be estimated in order to estimate the parameters G mg, G mg Ghg, Ghg mg' mg' hg' hg' and Ghg", which represent average times necessary to premultiply a matrix by values of G' and G" under various conditions. Similarly,

239 the time which is required to perform Algorithm 3. 5 (which may be used to perform Operation k ) must be estimated in order to estimate the parameters R R Rsf, Rs R s R' and R g which represent sf sf )sf sg' sg' sg' the time required to perform this algorithm for various values of the design decisions. Although the time which is required to perform these algorithms is difficult to estimate for the general application of the topological structure, these times are easily estimated if the elements of BU E/D which are examined by the algorithms can be identified. These elements generally can be identified once the application of the structure is known, as will be demonstrated in Section 5.3. 5o 2o 1 Time Required to Compute G(D[ e] )l The operations which are performed by Algorithm 3o 2 may be summarized as follows: For each D[ e'] EE0/Do examined: (1) Determine that D[ e'] is an element of E0/D0 (Step 2). (2) Read G(D[ e']) (Step 2). For each D[ e'] eE/D-E0/D0 examined: (1) Determine that D[ e'] is an elene nt of E/D-E0/D0 (Step 2). (2) Identify b B such that tL(b)=D[ e'] (Step 2). For each be B examined: (1) Read form of y(b) so that G'(b) may be compared with G"(b) (Step 3) (2) Identify 1L'(b) (Step 4),

240 (3) Determine whether or not g'(b)eB (Step 4). For each b=p(e',et")eB examined with G(b)-=G"(b): (1) Save b with matrix J on push-down stack (Step 3)o (2) Restore b and matrix J from push-down stack (Step 5). (3) Identify D[ e"] (Step 3)~ (4) Perform matrix multiplication indicated in Step 5. Consequently, if the elements of B U E/D which are examined by Algorithm 3. 2 can be identified, the time which is required to compute G(D[ e] ) by this algorithm can be estimated. As has been mentioned above, the DEC 339 display processor is not capable of saving coordinate transformation matrices on a pushdown stack. Consequently, Algorithm 3. 2 cannot be executed by this display processor. However, since the only coordinate transformations which are considered are translations, these transformations are commutative, and the following simplified form of Algorithm 3.2, which does not save coordinate transformation matrices on a pushdown stack, may be executed by this display processor. Algorithm 5.1 Procedure for computing G(D[ e] ) when all coordinate transformations are commutative. (1) Let J=I, let X=D[ e], and empty a push-down stack for use in this algorithm.

241 (2) If there exists an element b'EB such that gi(b')=X, let b=b' and proceed with Step 4. (3) If the number of elements b" on the push-down stack for which G(b") I is even, let J=JG(X)1 Otherwise, let J=JG(X). Proceed with Step 60 (4) If G'(b) f G'(b), proceed with Step 5. Otherwise, save b on the push-down stack. Let X be the second component of b and proceed with Step 2. (5) If /I'(b)EB, let b=p'(b) and proceed with Step 4. (6) If the push-down stack is empty, terminate with J=G(D[ e] ) Otherwise, restore b from the push-down stack and proceed with Step 5. 1 In order to illustrate this algorithm, the steps which are needed to compute G(D[ e]) from the structure shown in Figure 3. 6 are shown below. Each step is represented by its number and the items which are affected when it is performed. (1) J= I X= D[ e] (2) b=p(e, e) (4) Stack contains p(e, el) X= D[ el] (2) b = p(el,e4)

242 (4) Stack contains p(e, el), p(e, e4) X= D[ e4] (3) J=G(D[ e4 )1 (6) b = p(el, e4); Stack contains p(e, el) (5) b=p(el, e) (4) Stack contains p(e,el), p(el, e5) X= D e5] (3) J=G(D[e4] )-1 G(D[e5]) (6) b = p(el, e5); Stack contains p(e, el) (5) b= p(e, e); Stack empty (5) b=p(e,e2) (5) b=p(e,e3) (4) Stack contains p(e, e3) X= DI e ] (2) b = p(eg,e8) (4) Stack contains p(e,e3), p(e3 e8) X= D[ e8] (2) J= G(D[e] )G(D[ e5]) G(D[ e]) (6) b= p(e3,e8); Stack contains p(e, e3) (5) b = p(e3,e9) (4) Stack contains p(e,e3), p(e3,e9) (3) J= G(D[ e4] )1 G(D[ e5]) G(D[ e8]) G(D[ e91 )1

243 (6) b= p(e3,e9); Stack contains p(e,e3) (6) b= p(e,e3); Stack empty Note that the matrix G(D[ e] )1 which is computed by this algorithm differs from that computed by Algorithm 3. 2 for the same structure. The matrix computed by Algorithm 5.1 is G(D[ e] ) = G(D[ e4] )-G(D[ e5] ) G(D[ e8] )G(D[ e9] ), whereas that computed by Algorithm 3.2 is G(D[ e] )= G(D[ e4] ) G(D[ e5] )G(D[ e9] ) G(D[ e8] ) According to Equation 3 5, the correct result is obtained by Algorithm 3.2. However, if the coordinate transformations vhich are represented by values of G are commutative, the result obtained by Algorithm 5.1 is equal to this result. The operations which are performed by Algorithm 5 1 may be summarized as follows: For each D[ e'] e E/Do examined: (1) Determine that D[ e'] is an element of E//D0 (Step 2). (2) Postmultiply J by either G(D[ e'] ) or G(D[ e]) (Step 3). For each D[ e'] E/D -EO/D0 examined: (1) Determine that D[ e'] is an eleme nt of E/D -E0/Do (Step 2). (2) Identify b B such that- L(b)=D[ e'] (Step 2). For each be B examined: (1) Read form of y(b) so that G'(b) may be compared with G"(b) (Step 4).

244 (2) Identify g'(b) (Step 5). (3) Determine whether or not g'(b)eB (Step 5). For each p(e', e")eB examined with G'(p(e', e"))G"(p(e', e")): (1) Save p(e',e") on the push-down stack (Step 4)0 (2) Restore p(e',e") from the push-down stack (Step 6). (3) Identify D[ e"] (Step 4). Note that the only difference between these operations and those performed by Algorithm 3.2 is that matrix multiplications are performed differently. The values of Gmg Gmg G', Ghg, Ghgt and Ghg" which are shown in Tables 5. 5 and 5 9 below were Ghg hg estimated as the total time during which the PDP-9 must be devoted to the picture generation process in order to perform these operations for various values of ul and u7. 5. 2.2 Time Required to Perform Algorithm 3. 5 The time which is required to perform Algorithm 3. 5 may be estimated by a similar procedure. The operations which are performed by this algorithm may be summarized as follows: For each p(e', e") examined: (1) Save p(e',e") on the push-down stack (Step 2). (2) Restore p(e',e") from the push-down stack (Step 5). (3) Identify D[ e"] (Step 2).

245 (4) Compare D[ e"] with D[ e] to determine whether or not these classes are identical (Step 2), (5) Identify i'(p(e',e")) (Step 5) (6) Determine whether or not 1'(p(e',e"))EB (Step 5). For each D[ e'] EE/D-{D[ e] } examined: (1) Let Y = Y U {D[e']} (Step 3). (2) Determine whether or not D[ e'] EE0/D0 (Step 4). For each D[ e'] E/D-(EO/D U D[ e]) examined: (1) Find bEB such that i(b)=D[ e'] (Step 4). For each p(e',e")E B-P(D[ e]): (1) Determine whether or not D[ e"] EY (Step 3). For each be P(D[ e]): (1) LetZ= ZU{b} (Step 2.) The values of Rs, RS' Rsf Rs R and R" which are shown sf, sf sf sg' sg' sg in Table 5,9 below were estimated as the total time which is required to execute PDP-9 instructions which perform these operations. When these parameters were estimated, the sets Y and Z were each assumed to be stored as a list of pointers in consecutive memory locations. The test to determine whether or not a particular element of E/D is an element of Y in Step 3 of the algorithm was assumed to be performed by searching the table which represents Y.

246 5.3 Optimum Implementations for Specific Applications The two example applications of the DEC 339 to be considered are (1) a text editor and (2) a graph theory input program. The purpose of the text editor is to display a page of text (which has been previously prepared by some other means) so that both characters and lines may be added to it or removed from ito The purpose of the graph theory input program is to allow the user to draw and modify undirected graphs to be processed by an analysis program. (Some of the applications of such a graph theory program have been discussed by M. S. Wolfberg [ 76 ] o) The text editor is discussed because of its simplicity and because it shows the merit of the structure {B,E/D, /j,y} for an extreme case. However, this example does not illustrate the design decision u4, for operation 5 is never performed, and it does not illustrate the design decision u2, for characters are assumed to be produced directly by the display processor. Furthermore, We) = 1 for every entity e in this example. The graph theory example, however, illustrates every design decision, as well as certain entities e E for which 4(e)>lo 5.3.1 A Text Editing Program In order to estimate the parameters which describe the text editor, the form which the topological structure assumes for this application must be specified. The forms of structure which will be

247 considered are shown in Figure 5.1. Generally, the picture X is considered to consist of lines of text, each of which consists of several characters. However, the artificial entities e0, e, e2', "., en',e le2, *,en "' which have been described in Chapter 2, must also be represented in the structure {B,E/D, l, y}. (Although each character is depicted as being in a separate class in EO/Do in this figure, all characters which differ only in their positions on the screen are considered to be represented by one class in EO/Do.) 5.3.1.1 Estimation of Parameters Since the number of entities which are being displayed at the time that a control language input occurs affects the time which is required to respond to that input, the parameters which describe the text editor will be expressed as functions of n, the number of lines of text, and nc, the average number of characters per line. Since there are 64 printing ASCII characters, the number of elements of E0/DO which represent characters will be assumed to be 64. The control language inputs which will be considered are the following: kl: Insert a character at a specified position in a specified line. k2: Insert a line (which contains no characters) at a specified position with respect to other lines. k3: Delete a specified character. k4: Delete a specified line.

248 {h} {el} fe2 fe a. {BE/D, F' {X} ~o^^^^,/ ~~ \ V+1 {eo} \ e' {e 2} 0 1 0 1 0 1..' /. Y(P(ei'ei'))=(I,G(D [ e]),G(D[ e]) i=l, 2,..., n {el e" e " e b. {B,E/D, A, } Figure 5 1 Topological Structures for Text Editing

249 As will be discussed, none of the responses to these inputs involves the execution of Operation 25' Consequently, u4=0, and Rsf, Rsf, 50 4 sf Sf R sf Rsg Rsg' and Rg" "will not be estimated. All characters sf' sg' sg' sg will be assumed to be produced by the VA38 character generator, which is part of the display processor. Consequently, u2=1, and Sag, SigI Gcff Gtf Gcgs and Gtg will not be estimated. Gs"' is not estimated because the display processor cannot save coordinate transformation matrices on a push-down stack, Tables 5.3 through 5. 5 show values of the parameters for the text editing application, The structure size parameters in Table 5.3 were determined directly from Figure 5.1. The storage parameters in Table 5.4 were determined from Table 5.1. (Sf' is a function of n and qbf because the value of associated with the first character in each line is I, which is not stored. Furthermore, the storage required for each value of F' which is stored is 6 locations, since the inverse of each value is also assumed to be stored so that the display processor can perform Step 4 of Algorithm 3,1.) The time parameters in Table 5, 5 generally were determined from Table 5. 2, from hardware specifications, and from the discussion of Algorithms 5. 1 and 3. 5 in Section 5. 2. To facilitate interpretation of this table, references to the applicable instruction sequences from Table 5o 2 are included for each entry. The only parameter which is

250 Parameter Value qbf "nc +n qbg n nc +3n + 1 qdf n + 65 qdg 2n + 67 qdOf 64 qdOg 66 9sf "nc" + n qsg ninc + 3nf + 1 qsOf nfn qsOg nn c"n + 1 Table 5 3 Structure Size Parameters for Text Editor

251 Parameter Value (locations) SO 2 St 1/9 St' 1/9 S 5/6 5/3 S5 5/3 S. 5/3 -S 5/3 Sr 2/3 Sh 2/3 ~Sf,~~~ 2 Sf 6- 6n /qbf "Sf Not estimated S5' 4 S 2 g Table 5.4 Storage Parameters for Text Editor

252 Parameter Value (locations) S 4 g S 1/9 S' 4 - 2n /qbg S Not estimated 3g sog 2.015 Table 5.4 (cont.) Storage Parameters for Text Editor

253 Parameter Value (milliseconds) Instruction Sequences T,005 1 T..002 T 004 T.'.007 2 Ts'.007 2 Tb.008 3 T o005 4 n Ttf. 0024 njnc(nc-1)+. 1536n +.00722 Z 20-il Tdf.02 nnc Ttg.0024 nfnc Tdg.02 n n +. 0036 n +. 1536 Gs.01 5, 6 G'.003 Table 5.5 Time Parameters for Text Editor

254 Parameter Value (milliseconds) Instruction Sequences Gs".02 5, 6 G "' Not estimated s Gmf.016 7 Gmft.003-.003n /qs Ghf.022 8 Gh.003-.003 n /qsf G.006 17 mg G 0 mg G ".006 17 mg Ghg (.05+. 067nc) n /qsg hg c f sg hg (.009+.012nc) n/qsg Ghgt (.05+. 054n+. 000203125npnc)ns/qsg Gbf (. 012 qdf- 004 qdf) /qsf Table 5.5 (cont.) Time Parameters for Text Editor

255 Parameter Value (milliseconds) Instruction Sequences Gbg (. 012 qdg - 004 qd0g)/qsg Gcf Not estimated Gtf Not estimated Gtf'.004 G Not estimated cg Gig Not estimated tg Gtg (. 003+. 002(n +n nc))/qsOg r.15 g r c 006 9 rd.15 R.005 10 P R..046 11 Rf.012 12 Rf' 094-.082nQ/qbf 16 Table 5~5 (cont.) Time Parameters for Text Editor

256 Parameter Value (milliseconds) Instruction Sequences R.012 12 g R'.082 13 g R.007 14 R y'.012+. 018n /qbg 15 Rsf Not estimated Rsf Not estimated R' Not estimated sf R " Not estimated sg R' Not estimated sg R " Not estimated sg tT " Not estimated Table 5.5 (cont.) Time Parameters for Text Editor

257 not included in these tables is a, which has the value 5. The parameters Ghg, Ghg', and Ghg which are shown in h hg, hg' Table 5. 5 are essentially average times required to perform Algorithm 5.1 for various values of ul and u7. The elements of B U E/D which are examined by this algorithm are easily identified from Figure 5. lb. From this figure, an inverse of a value of G is seen to be computed once for each line of text, as it is the last component of each y(p(ei, ei)) for i=1,2,...,nQ. When Algorithm 5.1 is executed for the line ei, an average of n classes in EO/DO (which contain characters for line ei) are examined, one class in E/D-EO/D0 (which contains the entity ei') is examined, and an average of nc elements of B (one for each character in line ei) are examined. Furthermore, for each element beB which is examined, G'(b) = G"(b) =I. Some of the parameters shown in Table 5. 5 were estimated rather coarsely. The storage allocation times r and rd were g d estimated by examining storage allocation subroutines which were used in a previous DEC 339 program [27]. The parameters Ttf and Ttg were estimated by multiplying the total number of points in certain invisible vectors by the plotting time per invisible point. The estimation of the number of points in these vectors is depicted in Figure 5.2. Figure 5. 2a shows magnified views of several vectors drawn at different angles. Since each point in each vector can be

258 number of points = number of points = length of longer - / - -, length of component component --- _.- / v ^ number of points = l:,,....sum of component lengths a. Types of Vectors..-. — character vector - ^ — 2 — _ line vector b. Vectors for {B,E/D,F'} - line vector + c. Vectors for {B,E/D, L, y} Figure $~2 Estimation of Ttf and Ttg for Text Editor

259 situated at one of only a finite number of positions, the number of points in each vector is either (1) the length of the longer component of the vector (in points) or (2) the sum of the lengths of the components of the vector. Since most vectors are drawn at angles which are not rational fractions of w, the number of points in a vector is assumed to be the sum of the lengths of its components. (Note that this assumption introduces no error for horizontal or vertical vectors, although it does introduce error for other vectors which are drawn at angles which are rational fractions of Tr.) Figures 5. 2b and 5. 2c show examples of invisible vectors which must be drawn to perform coordinate transformations which correspond to values of F' and inverses of values of Go In Figure 5.2b, the line vector corresponds to the matrix F'(p(X,ei)), whereas the character vector corresponds to a value of F' which describes the position of a character in the line ei. In Figure 5. 2b, the line vector corresponds to the matrix "(p(e, ei')) = G(D[ ei'] ) 1 Since all other values of G' and G" in the structure shown in Figure 5. lb are identity matrices, these line vectors are the only invisible vectors which were considered when Tt was estimated. The average number of times that each basic operation is executed in order to respond to each of the inputs kl, k2, k3g, and k4 is shown

260 in Table 5. 6. In order to determine values of the functions ff and fg, each input which invokes one of these responses is assumed to be equally likely. The values of these functions are then the averages of the entries in each row in Table 5.6. 5. 3 1.2 Results of Analysis The programs which are described in Appendix B were applied to the parameters and operation frequencies which were estimated above to study various implementations of the structure for various values of n, and nc. For each pair of values of nQ and n considered, 5f c a c only 48 implementations satisfied the constraint g<tf. The only significant design decision on which the cost was found to depend was u3. The cost of the best implementation for each value of u3 is plotted in Figures 5.3 and 5.4. Figure 5.3 shows the cost versus the average number of characters per line for about half the maximum number of lines, whereas Figure 5. 4 shows the cost versus the number of lines for about half the maximum number of characters per line. The label on each curve is the set of values of the design decisions. For example, the label 11100011000 means that ul=u2=u3=U7=u8=l and 4=u5=u6=u9=u10=11=0 The results which were obtained show clearly that the structure {B,E/D, J, y} is superior to the structure {B, E/D,F'} for this application.

261 {B,E/D,F'} kl k2 k3 k4 2i 0 1 0 0 22 0 0 0 1 23 l+nc/2 l+n /2 nc/2 n /2 q4 n /2 n /2 l+nc/2 l+nc+n /2 25 00 0 0 5 60 0 0 1 27 0 0 0 0 2 0 0 0 0 29 0 0 0 0 1lo nc/2 n /2 nc/2 nc+n /2 ji 0 0 0 0 212 nc/2 nQ/2 nc/2 nQ/2 13 nc /2 nQ/2 nc/2 n2/2 Table 5.6 Values of the Function n for Text Editor

262 kl k2 k3 k4 4 ~0 0 0 0 15 0 0 0 0 {B,E/D,/x, y} kl k2 k3 k4 0 2 0 0 ~f2 0 0 0 2 3 1 3 0 0.,f 0 0 1 3+n C f5 0 0 0 0.gf 0 0 0 1 l9 0 0 0 0 Table 5.6 (cont.) Values of the Function n for Text Editor

263 kl k2 k3 k4 0 0 0 0 nc 1 ~ 0 0 0 2 0 0 0 0 ~12 213 0 0 0 0 14 0 0 0 0 5 0 0 0 0 Table 5.6 (cont.) Values of the Function n for Text Editor

264 rJ )o 11000011000 (Ig — / Y) cc mX I 0' J / UJ /1 o / I-0 Cl) FRVE[~GE CNFFCCTE [S PER/ Figure 5.3 Text Editor Cost for n = 20 o / / 11100011000 00 16.G0 32.00 IL8.00 s6..00 80.00 RVERRGE CHRRRCTERS PER LINE Text Editor Cost for no= 20

265 U) T0 o 11000011000 0.U, ii I'" -- C: (f) v c0.o^ 8,00 L6, aQ ~ ta, oo ~ 2, 0111000 0 0 - O /.00 8.00 iS6.00 L00. 32. 00 40. 00 N!J'I-~ ( OF L I NES Figure 5.4 Text Editor Cost for d: + too 8.0/.0 aia 20 00 i~~~~~li1e OF L I NE >o~~~~~Fgr 5. a:0~~~Tx EdtrCs fr/ =3

266 The optimum implementation 11100011000 whose cost is shown in Figures 5. 3 and 5. 4 requires less storage than the implementation 11000010000, which is the implementation with u3=0 which requires the smallest amount of storage. Furthermore, the maximum value of tf for the implementation 11100011000 is less than or equal to the maximum value of tf for any other implementation. Consequently, f regardless of the maximum values which the storage s and the elapsed time tf are allowed to assume, {B,E/D, p, y} is the better structure for this application of the DEC 339. However, if only a small amount of storage is available, the implementation 11100011000 may not be possible. In this event, the implementation 11100010000, which differs from 11100011000 only in that values of u are not stored, is the optimum implementation. (The cost of this implementation is only slightly larger than that for 11100011000.) If insufficient storage is available for this implementation, the text editor cannot be implemented, Because ff(f 5) = fg(Q5) = 0, u4 was constrained to be zero when this application was analyzed. Similarly, because characters are assumed to be produced by the VA38 character generator, u2 was constrained to be 1. Even more design parameters were found to be fixed when the possible implementations were enumerated. u1 was found to be 1, indicating that the computer could not find characters to be plotted as rapidly as the display processor could plot them.

267 Because ul1l, u5=0 in accordance with Equation 5.1. Furthermore, Equation 4. 53 states that u7=0 ==> u =0. The contrapositive of this implication is ul=l ==> u7=1. Consequently, u7 =1 for this application. 5.3. 2 A Graph Theory Program The second example to be considered is a program which allows the user to draw and modify undirected graphs. The forms which the topological structure may assume for a specific graph are shown in Figure 5. 5. The graph which these structures represent consists of the four vertices el,e2,e3, and e4 and the two edges e5 and e6. Each edge is considered to be a part of each vertex which it connects. In this example, e5 connects el to e2, and e6 connects e2 to e3. In addition to the edges which connect each vertex to other vertices, each vertex also has as one of its parts a vertex symbol. These vertex symbols are the entities ell, e12, e3, and e14. Each edge is composed of two line segments, so that it may be easily bent. These line segments are the entities e7, e8, e9, and e10 in the figure. The entities el5, e16, e7, and el8 in Figure 5. 5b are artificial entities whose purpose is to position the vertices. The sequence y(p(e,e')) in the structure shown in Figure 5. 5b which are not (I,G(D [e' ] ),I) are the following: y(p(X,ei)) = (I,G(D[ ei] ) G(D[ ei] )-), i= 1,2,3,4 y(p(el,e5))= (I, G(D[ e5] ), G(D[ e5] )-1) y(p(e2,e6)) = (I, G(D[ e6] ), G(D[ e6] )-1)

268 {e1} {e4} l e {ell', e2e3, e14} a. {B,E/D,F'} {el2] {e4 } 0 3 / {8e7} {el}J {e9} {ell {ell, e12 e13, e14 b. {B,E/D,Y,y} Figure 5. 5 Topological Structures for Graph Theory

269 y(p(e2,e5))= (G(D[ e5] ) G(D[ e5]), I) y(p(e3,e6))= (G(D[ e6] )1, G(D[ e6]) I) Furthermore, G({ellel, e13,el4})= Io With these values, each vertex may be moved independently by modifying e5, el6, e7, and el8, and the head and tail systems of each edge are the tail systems of the vertices which it connects. 5.3. 2.1 Estimation of Parameters The parameters which describe the graph theory program will be expressed as functions of nv, the number of vertices in the graph, ne, the number of edges in the graph, and 2, the average number of points in each line segment which constitutes an edge. The control language inputs which will be considered invoke the following responses: kl: Create a vertex. k2: Destroy a vertex and all edges connected to it. k3: Create an edge between two specified vertices. k4: Destroy an edge. k5: Move vertex and adjust all edges connected to it so that other vertices are not moved, k6: Bend an edge.

270 Tables 5. 7 through 5. 9 show values of parameters for the graph theory application. When these values were estimated, each vertex symbol was assumed to be a cross (+) which was drawn with three invisible vectors and two visible vectors. (The length of each arm of this cross was assumed to be 32 points.) Although the assumed formats for subpictures for classes in EO/DO shown in Table 5o 1 require the same amount of storage for either value of u2, Sf differs from Sf' for this application. The reason for this difference is that an additional vector must be included in the subpicture for each line segment which is part of an edge whenever u = 1 so that the display processor coordinates are restored before Step 4 of Algorithm 3.1 is performed.'~" Gm' G " Ghg G' and Gh " which The parameters Gmg' G, Gg', Gh, G,'and Ghg which are shown in Table 5.9 are essentially the average times required to perform Algorithm 5.1 for various values of u1, u3, and u7. The elements of BU E/D which are examined by this algorithm are easily determined from Figure 5o 5b and the above discussion of values of y. From the discussion, an inverse of a value of G is seen to be computed once for each vertex and twice for each edge. Whenever G(D[ e] ) is computed for a vertex e, the set of elements of B which are examined is p({e} x S(e)). Values of G' and G" are equal only for the first two elements of this set. Consequently, the elements

271 Parameter Value qbf 2n + 4n v e qbg 3n + 4n qbg v e qdf nv+3ne+2 qd 2n +v+3ne +2 v e qdOf 2ne +1 qdOg nv + 2ne +1 qsf 2n + 6n qsfv e qSg 3n + 6n q0Of n + 4ne 4,q Oa 2n + 4n sOg v e Table 5. 7 Structure Size Parameters for Graph Theory Program

272 Parameter Value (locations) S0 2 St 1/9 St' 1/9 Sp 5/6 SS 5/3 S^~~~. ~5/3 S 5/3 S. 2/3 S^~~~ h ~2/3 5s 2 Sf' (6n + 12ne)/qbf Table 5o 8 Storage Parameters for Graph Theory Program

273 Parameter Value (locations) SPf (6ne + 11)/qdOf Spf' (10ne + 11)/qdO S 2 g S' 4 g S 1/9.S. 4- (2n + 4ne)/qb Sg (6ne + 3nv + l)/qd Sp' (6n, +3n + ll)/qdg Table 5.8 (cont.) Storage Parameters for Graph Theory Program

274 Parameter Value (milliseconds) Instruction Sequences T. 005 1 Tj.002 T.004 Tj'.007 2 T'.007 2 Tb.008 3 T.005 4 Ttf.0024fe+. 1536nv Tdf.0056ne+. 1696nv Ttg.0012Qn +. 0768n tg e v Tdg.0044en +. 2464n Gs.01 5, 6 G' e.003 Table 5.9 Time Parameters for Graph Theory Program

275 Parameter Value (milliseconds) Instruction Sequences Gs.02 5, 6 G "' Not estimated Gmf.016 7 Gmf ( 003nv+009n )/gbf Ghf.022 8 Gh (o 003n+. 009n)/qbf Gmg 184ne/qsg 17 Ggt.033ne/qsg G t".1915n /q 17 mg e sg Ghg ( 224ne+.178nv)/qsg hgt ( 037n +.033n)/qsg hg (.224n +.178n )/q hg e v sg Gbf (.012qdf- 004qdOf)/qsf Table 5.9 (cont.) Time Parameters For Graph Theory Program

276 Parameter Value (milliseconds) Instruction Sequences Gbg (. 012qdg-o 004qdog)/qsg Gcf ( 164n +ol77nv)/qsof 18 Gtf ( 028ne+. 015nv)/qsof Gtf' (. 02ne+. llnv)/qs0f G (.164n +.341nv)/qs 18 cg e v sOg Gtg (. 028ne+. 022nv)/qg tg (02ne +016nv)/qog r.15 r.006 9 c rd.15 R.005 10 p R..046 11 Rf.012 12 Rf'.012+.082(nv+2ne)/qbf 16 Table 5.9 (cont.) Time Parameters for Graph Theory Program

277 Parameter Value (milliseconds) Instruction Sequences R.012 12 g R.082 13 g R.007 14 R'.~012+(. 036ne+. 018nv)/qbg 15 Rs. 0395qbf+. 02qdf- 005qd0f+. 00325ne - 11525 Rf.0475qbf+ 02qdf- 005qd+. 00975n -. 13775 R s.0435qbf+ 022qdf-.007qdf+ 00325n -. 12525 Rsg. 0395qbg+. 02qdg- 005qdg+. 00325ne-. 11525 Rsgt.0475qbg+. 02qdg- 005qdg+. 00975ne-. 13775 Rsgt.0435qbg+. 022qdg- 007qd0g+. 00 O325ne 225 25 Table 5.9 (cont.) Time Parameters for Graph Theory Program

278 {B, E/D, F' k1 k2 k3 k4 k5 k6 l1 0 3 0 6n /n 3 12 0 l+6ne/nv 0 3 6ne/nv 3 13 2 0 4 0 1.5+9ne/n 3 14 0 2+8ne/nv 0 4 1.5+9ne/n 3 15 0 2ne/n 0 1 1.5ne/nv 4. 5 6 0 2ne/nv 0 1 3ne/ 105 f7 0 0 0 0 0 f.0 0 0 0 0 0 89 0 0 0 +00 0 0lo ~ 1+4ne/nv 0 1 1. 5+6ne/nv 1. 5 41 0 0 0 0 3 /12 0 6n/nv 0 2 9ne/nv 3 Table 5.10 Values of the Function n for Graph Theory Program

279 kl k2 k3 k4 k5 k6 13 0 0 0 0 15+7.5n/n 3 1o 5+7.5e / v 14 ~ 0 0 0 0 0 - 15 ~0 0 0 0 0 15 {B,E/D,j,y} k1 k2 k3 k4 k5 k6 L1 2 0 3 0 1.5+6ne/n 3 f2 0 2+6ne/nv 0 3 1 5+6n /n 3 f3 3 0 4 0 0 0 Sq 0 3+8n /n 0 4 0 0 4 e v i- 0 2n /n 0 1 0 1.5 5e v 06 0 l+2ne/n 0 1 1.5+3ne/n 4.5 0 0 0 0 0 0 X7 J8 0 0 0 0 1.5+6ne/n 3 Table 5010 (cont.) Values of the Function n for Graph Theory Program

280 kl k2 k3 k4 k5 k6 Qg 0 0 0 0 0 0 L10 0 +4ne/nv 0 1 1.5+6ne/nv 1. 5 0 0 0 0 0 3 f12 0 1+6ne/nv 0 2 1. 5+9ne/nv 6 3 0 0 0 0 0 0 4 0 0 0 0 3n/n 0 15 00 0 0 0 1.5+6ne/n 3 Table 5.10 (cont.) Values of the Function n for Graph Theory Program

281 of EO/Do which are examined are the class which contains the artificial entity in S(e) and the class which contains the vertex symbols. The only element of E/D-E0/Do which is examined is D[ e]. Whenever G(D[ e'] )1 is computed for an edge e' the two elements of p({e'} x S(e')) are examined. For each element bep({e'} x S(e)), G'(b) = G"(b). Consequently, the elements of EO/DO which are examined are the two classes which contain line segments which constitute e'. The only element of E/D-E0/D0 which is examined is D[ e'] o In order to estimate the parameters Rsf, R, Rs R R' sf' sf I sf sg' sg' and R g", the elements of B U E/D which are examined by Algorithm 3. 5 must also be identified. However, in order to estimate these parameters accurately, the elements of E/D to which Operation 15 is applied for this application must first be identified. These elements of E/D can be identified only after the basic operations which constitute the response to each control language input have been considered. The average number of times that each basic operation is executed in order to respond to each of the inputs kl, k2, k3, k4, k and k6 is shown in Table 5 10. As in the editor example, these inputs were assumed to be equally likely in order to compute values of ff and fg The values shown in the table for inputs k5 and k6 are actually 1. 5 times the values needed to move a vertex once or to bend an edge once, for these inputs are assumed to be terminations of continuous user

282 activity. For example, in order to move a vertex, the user might aim the light pen at the vertex and then move the pen. The vertex is then positioned many times at the coordinates of the light pen to give the appearance of continuous movene nt. When the user terminates his action by removing the light pen, an average of half of the process of moving the vertex to the last light pen coordinates sampled has not been completed. Since the user generally has moved the light pen since these coordinates were sampled, the position of the vertex must be updated once more to insure that its final position is correct. Then, since the input k5 is considered to be the termination of user activity, the average number of times that each basic operation must be performed in order to respond to this input is 1. 5 times the number of times that it must be performed to move the vertex once. (Although movement of the vertex while the user is inputting coordinates with the light pen might also be considered to be the response to an input, the time required to perform this response is generally not critical if the pen can be tracked at a sufficient speed.) From Table 5.10, Operation _5 must be performed in order to respond to the inputs k2, k, ks, and k6 for the structure {B,E/D,F'), and in order to respond to the inputs k2, k4, and k6 for the structure {B,E/D, Ci, y}. With the exception of 2/3 of the time that this operation is performed in order to respond to k6 for the structure {B,E/D,F'}, this operation is executed in order to identify the elements of P(D[ e])

283 such that e represents an edge. Whenever Operation C5 is applied in this way and is performed by Algorithm 3.5, all but two elements of B, those in p({e}x S(e)), are examined. Similarly, all elements of E/D, other than the two classes which contain line segments which constitute e, are examined. However, 2/3 of the time that Operation f5 is executed in order to respond to k6 for the structure {B,E/D,F'}, it is applied to identify the elements of a set P(D[ e'] ), where e' is a vertex. Whenever Operation 5 is applied in this way and is performed by Algorithm 3. 5, all of the elements of B-p({e' }x S(e')) are examined, and all elements E/D are examined. Then, by considering the probability of each input, the average times Rsf, Rsf Rsf Rg, R' and R s" which are required to perform Algorithm 3. 5 sg' sg' sg for various values of ul, u3, and u7 can be estimated. However, if B is assumed to be large when compared to the average number of edges per vertex, the error introduced by assuming that J5 is always applied to identify the elements of P(D[ e]) such that e is an edge is not significant. This assumption was made when the values of these parameters shown in Table 5.9 were estimated. 5. 3. 2. 2 Results of Analysis The programs which are described in Appendix B were applied to the parameters and operation frequences which were estimated above in order to compare various implementations of the structure for various values of nv, ne, and Q. For a small number of edges (about 1/4 the number of vertices), 208 implementations satisfied

284 the constraint g <tf. However, for larger numbers of edges, 224 implementations satisfied this constraint. The costs of eight selected implementations which satisfied this constraint for all values of n and ne tested are plotted in Figures 5.6 through 5.8. Whenever s axand t are sufficiently large (i. e., max rmax whenever s m > 11920 locations and t > 122 mse~), the implementation m ax - m ax01001011010 is the optimum implementation for all values of n and n tested, However, if s is reduced to 8959 locations, the optimum' max implementation becomes 01001010000. Note that this implementation differs from 01001011010 only in that references to values of v are not stored and the ring which represents each set P(D[ e ]) is not stored. If either s < 8959 locations or t < 122 msec, a structure max max which describes a graph with n == 140, n = 175, and k= 100 cannot be implemented. For all values of s such that 8959 < s < 11920, max max the cost of the optimum implementation is greater than the cost of the implementation 01001011010 and less than the cost of the implementation 01001010000. However, the enumeration of the implementations for which u = 0 showed that g was only slightly less than tf for these implementations. Since tf is the total time required to plot entities in E0 whenever u1= 0, the fact that g is only slightly less than tf indicates that the optimum implementations discussed above may not be practical. In

285 L.) To! C )C 6C3 0 -0 L J ii l a. I10000011000.11100111011 4^,- Z I \ ~O-~Figure 5.6 \ Graph Theory Program Cost for e 100ld = 100

286 0 - -_ 0 H-0 CT 10000011000 0 _CD _C <L o,0,cQ 100 1 0010011000 >~. G"rap /Teor Por Cofrn 011010011100 i-0 // I /// / 0100101000 ^^' i= _ ^^^^ ^ 01001011010.0oo0 l0. CO0 t30.00 120.00 1 CO. Oo 200.00 NUMBER OF EDGES Figure 5. 7 Graph Theory Program Cost for n = 80 and ~ = 100 V~~~~~00~~

287 LLJ C) e,) U).1000011000 r4, 1. X 0 0 100100111000 -G T P C f n ooooo/aod 1 ^1- i1011000111000 2 / 0100011000 c~ /y. 11100111011 c G. To 1 0000 100 o 010010o000 01001011010 ~ /, ]/~ - ------- j -- O0 ~0 IO.CO 0.00 120. O0 160.O0 ZOO.00; NUMBER OF VERTICES Figure 5.8 Graph Theory Program Cost for ne/n = 5/4 and ~- 100 v

288 particular, in the course of drawing a graph for which =- 100 points, the user may produce an intermediate graph for which f < 100 points. If u1= 0, tf may then approach g for this intermediate graph, and thus prevent response to further user inputs. To test this possibility, the implementations for n =80, ne = 100, and l= 50 were enumerated. Only 128 implementations, all with u = 1, were found to satisfy the constraint g < tf. Because implementations with u1 = 0 may not be practical for this application, an attempt was made to find the optimum implementation for which u = 1 (assuming that smax and tm were very large). i max max However, no optimum was found for all values of ne and n tested. e v v For n < 25 and n = 100, the optimum implementation was found to be 11100111011, whereas, for other values of n and n tested, the v e optimum implementation was found to be 11000011010. The significant difference between these two implementations is that one is an implementation of the structure {B,E/D,,,y}, whereas the other is an implementation of the structure {B,E/D,F'}. The structure {B,E/D,F'} is better when n e/nv is small because tf/(tf-g) is smaller for this structure. However, when n /n is large, the sum of the frequencies of the operations which must synchronize with the picture generator is larger for the structure {B, E/D,F'} than for the structure {B,E/D, IL,y}. In particular, ff(14) >f (/3)+fg(4)+fg(15)

289 for n /n > 8/3. Consequently, {B, E/D,,, y} is the better structure for large ne/nv Other implementations whose costs are plotted in Figures 5. 6 through 5.8 were found to be the best implementations with further constraints on the design decisions. The implementations 10110111000 and 10010011000 were found to be the best implementations for u = 1 and u2 = u1=0 (assuming large smax and tma). Since u10 = 0, these implementations use Algorithm 3.5 to perform Operation Q5. If u4 is also constrained to be zero (i. e., Algorithm 3. 5 is not used to perform Operation L5), the best implementations are 10100111000 and 10000011000, Note that again no optimum implementation exists for all values of n and n tested. The worst e v possible implementations for this application are 10100010100 and 10000010100. The costs of these implementations are insignificantly different than the costs of the implementations 10100111000 and 10000011000 shown in Figures 5. 6 through 5, 8. 5o4 Conclusion The application of the cost function to two applications for a specific hardware configuration has been demonstrated. From the results obtained for these applications, implementations with u =0 have been shown to often not satisfy the constraint g<tf. Consequently, the picture generation process must often be interrupted in order to

290 respond to user inputs if one of these implementations is used. The nonexistence of a unique optimum has also been demonstrated. However, even when a unique optimum does not exist, the cost function may be applied to select the implementations which should be considered.

Chapter 6 CONCLUSIONS 601 General Design Principles Three major design principles have been illustrated in this paper. The first of these is that the accepted method of representing coordinate transformations, namely as values of the function F', is not necessarily the best method for all applications. In Chapter 2, the structure {B,E/D, t, y}, in which coordinate transformations were represented differently, was described. Through the application of the cost function which was developed in Chapters 3 and 4, this structure was shown in Chapter 5 to provide faster response than the conventional structure B, E/D,F'} for certain applications. The structure {B,E/D,,y, however, is not the only other structure which can be specified. For example, a hybrid of these two structures might be developed so that concatenation constraints are enforced as a consequence of refreshing the picture, but no artificial entities are needed in order to manipulate some entities independently of other entities. Secondly, the danger of using a computer program as the picture generator whenever the picture generation process is to have priority over the response to user inputs has been illustrated. In this paper, the picture generation process was assumed to have this priority, and the constraint g <tf was imposed to insure a finite response time. 291

292 As illustrated by the graph theory example in Chapter 5, whether or not a computer program may be used as the picture generator may even depend on the behavior of the user. For this example, the optimum picture generator is a computer program if the user consistently draws edges of sufficient length throughout his session with the computer. However, if he draws edges of greatly varying lengths, the computer will cease to respond if the average of these lengths becomes too small. Thirdly, the necessity to synchronize a program which is modifying the structure with the picture generator in order to perform certain operations on the structure was illustrated. By always waiting for the picture generator to reach a particular part of the structure, rather than interrupting the picture generator and restarting it with the first step of Algorithm 3.1, a program which operates on the structure does not interfere with the picture generation process. Although an operation on the structure is generally completed more rapidly if it is performed while the picture is not being generated, the picture may momentarily disappear if many operations which modify the structure are performed in this way in rapid succession. Consequently, responses such as continuous movement or deformation of entities are not practical unless the program which is modifying the structure is synchronized with the picture generator.

293 6. 2 Limitations A significant consideration which has been ignored throughout this paper is that a topological structure may not contain suitable information for generating two-dimensional projections of threedimensional pictures. In particular, if hidden lines or surfaces are not to be displayed, the position and geometry of each entity in E0 must be known before any entity in E0 can be displayed. Consequently, in order to display this type of picture, a geometric description of the picture must first be formed from the topological structure. However, for some applications, a suitable projection is produced if only the lines or surfaces in each entity in E9 which are obstructed from view by other parts of that entity are not displayed. This projection may easily be generated from the topological structure by Algorithm 3.1 with u = 0. 6.3 Strengths and Weaknesses The development in this paper may be applied to an existing hardware configuration to determine the best way to implement a topological structure for a proposed application. This ability is useful to the programmer of computer display equipment, for he is often given the task of utilizing an existing hardware configuration, but he has no control over the design of that configuration. Because some operations on the structure require synchronization with the

294 picture generator, the topological structure is expected to be supported by a system program, rather than by each individual application program. However, at the time that such a system program is written, the major applications of the topological structure generally are known. The discussion in this paper may then be applied to these major applications to determine which implementations of the structure should be considered. The estimation of parameters for a particular application, however, is a somewhat tedious process. In the worst case, 106 of these parameters are not zero, and, therefore, must be estimated. However, many of these parameters (e.g., Tp, Tj, Ts, Sp, etc.) assume the same value for all applications of a particular hardware configuration, and need not be estimated separately for each application.

Appendix A AN IMPLEMENTATION OF THE STRUCTURE {B, E/D, g, y} The structure {B,E/D, i,y} which was described in Chapter 2 has not been implemented previously. For this reason, the author has developed a program for a DEC 339 [1, 52 ] to demonstrate the feasibility of implementing this structure, as well as to provide a tool for experimenting with several applications of the structure. This program includes a compiler for a graphically-inputted language which is similar in form to that described by W. M. Newman [45,46] This compiler allows the user to specify an application program by drawing a state diagram of it and describing each state. The compiler is designed to facilitate preparation of programs which respond to user inputs by modifying and interpreting the structure, but it is poorly suited to the preparation of other types of programs. The implementation of the structure for this program is described below. The graphically-inputted state diagram language is then described. A. 1 Implementation of the Structure The hardware configuration for which this program was implemented does not include any form of back-up storage (e. g., magnetic tape, disk, etc.)o Consequently, the entire program is resident in core memory whenever any part of it is being executed. For this reason, only a small amount of storage is available for the structure, and the design 295

296 parameters for the structure we re chosen such that redundant information is not stored. However, although storage is used ineffectively if ul= 1 (i. e., the display processor can interpret only the low order 12 bits of each 18-bit word), u1 was chosen to be 1 so that the execution of Algorithms 3.1 and 5.1 by the display processor could be demonstrated. Furthermore, u4 was chosen to be zero so that the use of the picture generator to perform Operation ~5 could be demonstrated. The values chosen for the design parameters were then u= = u2 = u = u7 = 1 and u4= U5 = = u=u9= u10= ll=O. The formats which we re chosen for the storage blocks which represent elements of BU E/D are shown in Figures A. 1 and Ao 2. The display processor commands which appear in these formats perform the following functions: JUMP: Jump command (2 words). Transfer control of the display processor to the location whose address appears in the second word of this command. PJMP: Push jump command (2 words). Call a display processor subroutine by first saving the address of the next command on a push-down stack in the PDP-9's memory, and then transferring control of the display processor to the location whose address appears in the second word of the PJMP command.

297 ) —-— JUMP to iof first element of p( e} x S(e)) ( —-— ^ JUMP..._ to( of first element of p({e} x S(e)) POP a. Block Format for D[ e] e E/D - E0/D (.) ——. VEC j components of invisible vector which represents G(D[ e] )1 POP commands which draw 3(e) POP b. Block Format for D[ e] e EO/DO Figure A. 1 Block Formats for Elements of E/D

298 ~ —— ~Ft PJMP- ~ ~3 —~ PJMP'! to()of D[ e'] __ to(of D[ e'] JUMP PJMP to(of'(p(e e')) T to)of D[ e'] 4 - PJMP'PJMP too f D[ e'] to2f D[ e'] JUMP JUMP to( of /'(p(e,e')) to( of /'(p(e,e')) a. y(p(e,e')) =(I,G(D[ e'] ),I) () —- INT PJMP. tolof D[ e'] INT 7 JUMP Blk F t to()of / t'(p(e,e')) b. y(p(e,e'))=(G(D[ e'] )-1,G(D[ e']) G(D[ e'] (3) —tjPJMP ~i- PJMP to 1 of D[ e'] -- toof D[ e'] PJMP PJMP - to 2 of D[ e']: to(of D[ e'] JUMP JUMP to 3 of i'(p(e,e')) | to( )of 1L'(p(e,e')) c. y(p(e,e'))=(I,G(D[ e'] ),G(D[ e'] )-1) d. y(p(e,e'))(G(D[ e'] )-1,G(D[ e']) Figure A.2 Block Formats for Elements p(e,e')EB

299 POP: Pop command (1 word). Return from a display processor subroutine by first removing the last address from a push-down stack in the PDP-9's memory and then transferring control cf the display processor to the location specified by this address. INT n: Set intensity to level n (1 word). As used here, INT 0 renders all further display invisible until an INT 7 command is executed, VEC: Enter vector mode (1 word). As used here, display the (invisible) vector whose components are stored in the next two locations, and then proceed with the command which follows the second of these components. The type of element which each block represents is not stored explicitly in that block, for it may be easily determined by identifying the command which is stored in the first location in the block. If this location contains a VEC command, the block represents an element of ED/DO; if it contains a JUMP command, the block represents an element of E/D-EO/D0; if it contains a PJMP command, the block represents an element of B. Each block has one or more "entry points", i.e., locations at which the display processor may begin execution of that block. The various entry points are labeled (, (, (, and () in Figures

300 A. 1 and A. 2 and have the following significance: (i): The display processor begins at this entry point of a block which represents an element D[ e] EE/D in order to plot an entity in D[ e] after H(e) has been computed. ()-: The display processor begins at this entry point of a block which represents an element D[ e] EE/D in order to determine G(D[ e]) (.: Immediately after finishing with the element p(e,e')EB, the display processor begins at this entry point of the block which represents P'(p(e,e'))EBU E/D in order to continue plotting an entity in D[ e]. (4-: Immediately after finishing with the element p(e,e')EB, the display processor begins at this entry point of the block which represents i'(p(e,e')) EBUE/D in order to continue the process of determining G(D[ e]). For each p(e,e')EB for which no entry point (4is shown, this entry point is considered to be the entry point ()of the block which represents 4'(p(e,e')). Each item in these storage formats has been considered to occupy an integer number of locations. Since the DEC 339 display processor can interpret only 12 bits of an 18-bit word, there are actually 6 bits

301 in each word into which other items could be packed. However, since each item in these formats occupies at least 12 bits, these items cannot be packed in accordance with the second restriction stated for Algorithm 4.1. Consequently, no generality is lost by assuming that each item occupies an integer number of locations. The block whose format is shown in Figure A. 2b was not actually implemented, for it was thought not to be useful at the time that the program was written. Whereas a sequence y(p(e,e')) of the form (G(D[ e'] )G(D[ e] ),G(D[ e] ) 1) is much less frequently used than a sequence of any other form, its effect cannot be simulated through the use of artificial entities and values of y which assume the other three forms. Consequently, provision for this sequence should be included in future programs which support the structure {B,E/D,,,y}. A. 2 The Display Language As has been mentioned above, a compiler similar to that described by W. M. Newman [45,46] was included in the program. In order to specify an application program to this compiler, the user must specify both (1) a state diagram for the application program, and (2) the operations which are performed when the application program is in each state. These two parts of the language are described below.

302 A. 2.1. The State Diagram A state diagram for a program is essentially a flow chart in which inputs, as well as Boolean conditions, are specified to control the flow of execution. For example, Figure A. 3a shows the state diagram for a simple program which creates a line and then continually rotates this line about one end point. When the letter "A" is received from the keyboard the message "END" is typed, and the program is terminated. Figure A. 3b shows this state diagram as it would be inputted to the compiler. Each box in the diagram represents a state. The'XI" in each box in this diagram indicates that some operations are associated with that state. Each labeled path in the diagram represents a transition between two states which occurs upon completion of the operations associated with the initial state if the input designated by the label occurred while these operations we re being executed. In this example, if the letter "A" is received from the keyboard (a condition designated by the label "K(A)") while the line segment is being rotated, a transition to the final state of the program occurs as soon as the line segment has been rotated to a new position. Each unlabeled path represents a transition between two states which occurs upon completion of the operations associated with the initial state if no other transition occurs. In this example, the unlabeled path from the initial state represents an unconditional transition, since there are no

303 No letter "A" received from keyboard Rotate line Initial State through small V'^ angle /,/ C re..ate Create. /// line / /Letter "A" received -/ from keyboard Type "END" a. A State Diagram. A K(A) b. A State Diagram in Compiler Form Figure A. 3 Representation of State Diagrams

304 other paths from the initial state. The other unlabeled path, however, represents a transition which occurs only if the transition to the final state does not occur. The information needed to form labels which are used to condition state transitions is shown in Table A. 1. Each label consists of a device code followed by a character code in parentheses. (The lossof-tracking device is an exception, since it is considered to have only one character.) Examples of labels are B(TEST),P(+), L(1), L(53), K( *), R(A), and XO In the event that more than one of the inputs which condition transitions from a particular state is received while the program is in that state, only the one from the device which appears first in this table is interpreted when the operations associated with that state are completed. The tracking pattern device (code P) indicated in this table is an interpretation of subsequent motion of the light pen after a light pen hit. * Whenever a light pen hit occurs on any entity and light pen tracking is not in progress, tracking is started and subsequent motion of the light pen is interpreted. The user may then produce a tracking pattern input by moving the light pen in one of the ways shown in Figure A.4. In this figure, the crosses denote positions of light pen hits, *These interpretations of light pen motion were found to be useful in a previous program [25, 27]. A discussion of methods for interpreting light pen motion is given in a previous report by the author [27].

305 Device Code Interpretation Applicable Characters B Boolean input All variable names (i. e., all (test for nonzero) combinations of from one to four alphanumeric characters, the first of which is alphabetic). Whenever the value of the designated variable is nonzero, the Boolean input is considered to have occurred. X Loss of tracking No characters specified. L Light pen hit Class numbers for EO/D0 (described in Section A. 2. 2 below). P Tracking Pattern "*" for circular motion, "+ for vertical stroking motion, "- " for moving away from the light pen hit. K Keyboard character All ASCII characters R Paper tape reader All ASCII characters character Table A. Device Codes

306 a. Circular Motions (*) 4v11 W I4 b. Vertical Stroking Motions (t) c. Motions Away From Light Pen Hits (.) Figure A. 4 Example Tracking Pattern Characters

307 and the arrows denote paths of the pen. The tracking pattern characters are interlocked so that no more than one cf them can occur between two successive losses of tracking. A. 2. 2 Specification of Operations Associated With a State The operations which are associated with each state are specified by a list of text statements. Each statement consists of a key word followed by a list of parameters. Each parameter is either a decimal integer between -999 and 999, a variable name, a text list, or an expression. With the exception of the special variable name *, each variable name is a string of from one to four alphanumeric characters, the first of which is alphabetic. The value of each variable is either a pointer to an element of BUE/D or an integer. The special variable name * is preassigned the value D[ X]. A text list is a string of quoted phrases interspersed with variable names. For example, if the variable B1 has the value 5 and GLUT has the value -20, the statement TYPE "THERE ARE " B1 " ITEMS AT " GLUT DEGREES." would cause the text THERE ARE 5 ITEMS AT -20 DEGREES. to be typed. (The quote character itself cannot be outputted.) An expression is used only in an ASSIGN statement and is a string of variable names and numbers separated by the binary operator symbols

308 t+t", tttT "*t, and "/", which represent addition, subtraction, multiplication, and division, respectively. In addition, the first symbol may be preceded by the unary operator symbol "-" which denotes unary minus. Any operator which appears to the left of a second operator has higher precedence than the second operator. For example, if X is a variable whose value is 6, the expression X- X/2 has the value 0, rather than the value 3. The function of each statement is shown in Table A. 2. In this table, Pi denotes the ith parameter in each statement. (All parameters which are not specified when these statements are written are assumed to be zeros.) To facilitate interpretation of light pen hits, the EXPOSE statement allows the application program to assign a class number (a number between 1 and 63) to each class in E0/DO. Whenever a light pen hit occurs on an entity in a class D[ e] e E0/DO which has been assigned the class number n, a light pen input (code L) with the character n is produced, and further light pen hits are disabled until the next UNBLOCK stateme nt is executed. As a simple example of the use of these text statements, consider the program whose state diagram is shown in Figure A. 3. In the initial state of this program, a vector with x and y components each of length 100 points may be created by the following statements:

309 Statement Interpretation ASSIGN pi expression The expression is evaluated, and the resultant value is stored as the value of P1. BLANK P1 p2 P3 A class in E0/DO is created and a pointer to this class is stored as the value of p3. The subpicture which is associated with this class is an invisible vector whose x component is P2 and whose y component is Pl. (One of the ways of performing Operation y.) CHEW p1 If the class in E/D which is referenced by p1 is not currently part of the topological structure from which a picture is being generated, the storage occupied by this class is returned to the free storage pool. Furthermore, the storage occupied by all elements of BUE/D which are needed to generate entities in this class, but which are not parts of the structure fro m which a picture is being generated, is returned to the free storage pool. (The initial step of this operation is Operation {2.) DEFINE pi text list A class in E0/D0 is created and a pointer to this class is stored as the value of pi. The subpicture which is associated with this class is the string Table A. 2 Text Statements

310 Statement Interpretation DEFINE (cont.) of characters which is produced by scanning the text list. This subpicture is drawn from a point near the lower left hand corner of the first character to a point near the lower right hand corner ct the last character. These points were chosen so that two of these subpictures appear as one text string when concatenated to each other. Each character is 8 points wide. (One of the ways of performing Operation 1l.) EXPOSE p1 p2 The class in EO/DO which is referenced by p! is assigned the class number P2. FIND pi p2 P3 The x and y coordinates of the last light pen hit on an entity in a class which has the class number p1 are stored as the values of p, and p3 respectively. If pi is zero, the last x and y coordinates at which the tracking cross was displayed are stored as the values of p2 and p3, respectively. GENERATOR P1 P2 P3 A pointer to the class in E/D which is the second component of the pith element of B whose first component is referenced by P2 is stored as the value of p3. If there is no such class, p3 is set to Table A. 2 (cont.) Text Statements

311 Statement Interpretation GENERATOR (cont.) zero, (Corresponds roughly to Operation,6' followed by several Operations 1O, followed by Operation f12') HOMOGENIZE pi p2 A class in E0/DO is created and a pointer to this class is stored as the value of p2. The subpicture which is associated with this class is identical to that which is associated with the class which is referenced by p1. (One of the ways of performing Operation qo) INSERT p1 p2 p3 p4 P5 An element of B, whose first component is the class which is referenced by p2 and whose second component is the class which is referenced by p1, is created. The value of i for the newly created element is the p3th element of B whose second component is referenced by PA~ y(p(e,e')) for this new elen nt p(e,e')eB is (G(D[ e'] ),G(D[ et] ),I) if p5<0, (I,G(D[ e']),I) if p =0, or (I,G(D[ e'] ),G(D[ e'] )1) if p5 > 0. (Corresponds roughly to Operation I3. ) Table A. 2 (cont.) Text Statements

312 Statement Interpretation JUSTIFY p1 p2 The absolute value of P2 is stored as the value of pi. LOCATE pi P2 P3 P4 The x and y coordinates of the entity in the class which is referenced by P2 the p1th time that this class is encountered during the picture generation process are stored as the values of pq and P4, respectively. MEASURE p1 p2 P3 The x and y coordinates which represent the value of G(D[ e]) are stored as the values of p2 and p3, respectively, where p1 references D[ e] cE/D. (Corresponds roughly to Operation u8. ) NONPRIMITIVE p A block which is to represent an element of E/D-Eo/D0 is created and a pointer to this block is stored as the value of p'1 (One of the ways of performing Operation!'.) OWNER p, P2 P3 A pointer to the first component of the eleme nt of P(D[ e]) which is on the push-down stack used by Algorithm 3.1 the p1th time that D[ e] is encountered Table A. 2 (cont.) Text Statements

313 Stateme nt Interpretation OWNER (cont.) during Step 2 of Algorithm 3.1 is stored as the value of p3, where P2 references the class D[ e]. If this element of P(D[ e] ) does not exist, p3 is set to zero. (Corresponds roughly to part of Operation'5.) PUNCH text list The result of scanning the text list is punched on paper tape. QUERY pi P2 P3 A pointer to the second component of the p2th element from the end of the push-down stack used by Algorithm 3.1 at the time of the last light pen input on an entity in a class in E0/D0 whose class number was p1 is stored as the value of p3. REMOVE p1 p2 P3 The p2th element of B whose first component is referenced by P, and whose second component is referenced by p3 is destroyed. (Corresponds roughly to Operation 24.) SUBSTITUTE p, p2 p3 P4 The second component of the p2th element of B whose first component is referenced by p, and whose second component is referenced by p3 is Table A. 2 (cont.) Text Statements

314 Statement Interpretation SUBSTITUTE (cont.) replaced with the element of E/D which is referenced by p4. (Corresponds roughly to Operation I15 ) TYPE text list The result of scanning the text list is typed on the teletype. UNBLOCK Light pen hits are enabled. VISIBLE pi P2 P3 A class in EO/DO is created and a pointer to this class is stored as the value of p3. The subpicture which is associated with this class is a visible vector whose x component is P2 and whose y component is p1o (One of the ways of performing Operation &l.) Table Ao 2 (cont.) Text Statements

315 VISIBI E 100 100 P INSERT P * The following statements are suitable for the state of this program during which the line is rotated: GENERATOR 1 * P MEASURE P X Y ASSIGN X -Y/10+X ASSIGN Y X/10+Y VISIBLE Y X R SUBSTITUTE * 1 P R CHEW P These statements measure the components of the current vector, generate a new vector which is a rotated form of this original vector, substitute the new vector for the old one, and destroy the old vector. (Note that the ordering of the terms in the ASSIGN statements is important because of the left precedence rule stated above.) Finally, the statement TYPE "END" is associated with the final state of this program to complete the program specification.

316 A. 2.3 An Example of an Application Program The example program shown in Figure A. 3, while instructive because of its simplicity, does not illustrate much use of the topological structure. Furthermore, this example does not illustrate the use of very many of the text statements. For these reasons, a second example, which is a modification of the graph theory application described in Chapter 5, is given below. Note that there is no text statement in Table A. 2 which performs Operation 14. However, according to Table 5.9, Operation 14 is needed in order to respond to input k5. While other methods may be used to respond to k5 without using Operation 14' these methods are rather complicated. Consequently, the graph theory program described here is assumed to respond to input k5 by moving only vertices which are not connected to other vertices by edges. The responses to other inputs are those described in Chapter 5. The inputs k, k2,.. o,k6 will be assumed to be generated as follows: kl: Point to INK light button with light pen to create a vertex. k2: Point to vertex to be destroyed and generate P(+) input. k3: Point to one vertex to be connected to a second vertex by a new edge and generate P(*) input. A mark (the character "/") will appear on this vertex. Now point to the second

317 vertex. The mark is now removed and the new edge is created. k4: Point to edge to be destroyed and generate P( +) input. k5: Point to vertex to be moved and generate P(-) input. The 5 vertex (if not joined to other vertices by edges) will move with the light pen until tracking is lost. k6: Point to edge to be bent and generate P(-) input. A point on the edge will move with the light pen until tracking is lost. The inputs k5 and k6 have been interpreted loosely here as inputs which start continuous movement of objects. These inputs as defined in Chapter 5 are actually the loss of tracking after each of the objects has been moved. The program whose state diagram is shown in Figure A. 5 and whose text statements are shown in Table A. 3 provides the desired responses to these inputs. In Figure A. 5, the states have been numbered to facilitate discussion. These numbers do not actually appear when the diagram is drawn on the display screen. In Table A. 3, these numbers are used to associate text statements with the various statements. The program begins execution in State 1 by creating the light button "INK" and the vertex symbol class in EO/DO. It then proceeds

318 41 P() L(1) 1 L(2) B(NXT: P(*) 7 13 1 P(+) 1\.6 State Diagram for Graph Theory Program B(NXT) \\~~ - B (NXT) 14 15 Figure A. 5 State Diagram for Graph Theory Program

319 State Statements ~~1 ~ NON PRIMITIVE N DEFINE T "INK" INSERT T N HOMOGENIZE N T CHEW N INSERT T * EXPOSE T 1 NONPRIMITIVE N BLANK -32 0 T INSERT T N VISIBLE 64 0 T INSERT T N BLANK -32 -32 T INSERT T N VISIBLE 0 64 T INSERT T N BLANK 0 -32 T INSERT T N HOMOGENIZE N V CHEW N EXPOSE V 2 2 UNBLOCK 4 QUERY 3 1 N GENERATOR 2 N 1 LOCATE 1 T XP I FIND 0 X Y MEASURE T XT YT ASSIGN XT XT-X+XP ASSIGN YT YT - Y +YP VISIBLE YT XT R EXPOSE R 3 SUBSTITUTE N 1 T R CHEW T Table A. 3 Text Statements for Graph Theory Program

320 State Statements 4 (cont.) GENERATOR 1 N T MEASURE T XT YT ASSIGN XT XT+X-XP ASSIGN YT YT+Y-YP VISIBLE YT XT R EXPOSE R 3 SUBSTITUTE N 1 T R CHEW T 5 QUERY 3 1 N OWNER 1 N T REMOVE T 1 N OWNER 1 N T REMOVE T 1 N CHEW N 6 FIND 1 X Y NONPRIMITIVE N INSERT V N BLANK Y X T INSERT T N INSERT N * 0 0 1 7 GENERATOR 3 N NXT 8 GENERATOR 1 N T FIND 0 X Y BLANK Y X R SUBSTITUTE N 1 T R CHEW T 9 QUERY 2 1 N 10 CHEW N Table A. 3 (cont.) Text Statements for Graph Theory Program

321 State Statements 11 REMOVE * 1 N REMOVE N 1 V ASSIGN I 2 GENERATOR 2 N NXT 12 OWNER 1 NXT T REMOVE T 1 NXT ASSIGN I I+ 1 GENERATOR I N NXT 13 DEFINE T "/" INSERT T N 1 V 1 GENERATOR 1 N TP MEASURE TP X Y 15 UNBLOCK 16 REMOVE N 1 T CHEW T QUERY 2 1 NP NONPRIMITIVE N INSERT NN N 1 V 1 INSERT NN NP 1 V -1 GENERATOR 1 NP T MEASURE T XP YP ASSIGN X XP-X/2 ASSIGN Y YP- Y/2 VISIBLE Y X T VISIBLE Y X TP INSERT T NN INSERT TP NN EXPOSE T 3 EXPOSE TP 3 Table A.3 (cont.) Text Statements for Graph Theory Pr;ogram

322 to State 2, where it enables the light pen and waits for a light pen input. Since no vertices or edges are being displayed, the light pen input which eventually occurs is an input on the light button "INK", which causes the program to enter State 6. In State 6, the program creates a vertex at the coordinates of the light pen hit and proceeds to State 7. It then alternates between States 7 and 8 to move the vertex until tracking is lost. When tracking is lost, the program returns to State 2 to wait for another input. After several vertices are created in this way, the user aims the light pen at one of them. The program then enters State 9, where it immediately identifies the vertex and waits for a tracking pattern to be recognized. If the user removes the pen without generating a tracking pattern, the program returns to State 2 without modifying the vertex. If he generates a P(-) input, the program enters State 7 and moves the vertex as it did just after the vertex was created. If he generates a P(+) input, the program enters State 11. In State 11, the program sets NXT to nonzero if there are edges to be deleted, or zero otherwise. If NXT is nonzero, the program proceeds to State 12, where it deletes all of the edges which were connected to the vertex. It then proceeds to State 10, where it destroys the remainder of the vertex, and then to State 9. The program waits in State 9 for tracking to be lost, since the only other exits from State 9

323 require tracking pattern inputs, which are now prohibited (because one of them has occurred) until tracking is lost. If, instead of a P(+) input, the user generates a P(*) input, the program proceeds to State 13, where it marks that vertex, and then to State 14, where it waits for tracking to be lost. After tracking is lost, the program proceeds to State 15, where it enables the light pen and waits for a light pen hit on another vertex. When this light pen hit occurs, the program proceeds to State 16, where it generates the edge, and then to State 9, where it waits for loss of tracking. After several edges have been created in this way and the program is again waiting in State 2, the user may aim the light pen at an edge. The program then proceeds to State 3, where it waits for a tracking pattern input. If the user generates a P( ) input, the program proceeds to State 5, where it deletes the edge, and then returns to State 3 to wait for loss of tracking. If, instead of a P(+) input, the user produces a P(-) input, the program proceeds to State 4, where it bends the edge. The program remains in this state until tracking is lost. A. 3 Operation of the Program The program which is described here is self-contained. It should be loaded from paper tape via hardware read-in mode, starting at location 0. The program is also self-starting. When the program

324 starts, it waits for one of the following commands from the teletype: LOAD Load a binary paper tape previously prepared by this program. PUNCH Punch a binary tape of the application program which is currently in memory. RUN Run the application program which is currently in memory. UNCOMPILE Generate a state diagram for the program which is currently in memory. (Only the first character of any one of these commands is needed. The program will complete the command.) Initially, the program which resides in memory is a null program. However, if the UNCOMPILE command is issued, light buttons will appear on the screen to enable a state diagram to be drawn. These light buttons are interpreted as follows: CREATE A state symbol is created and moved with the light pen until tracking is lost. CONNECT The program enters a connect state during which transitions may be drawn with the light pen. This state is terminated via an ESCAPE light button. DEVICE A list of device codes is displayed. Upon

325 selecting one of these device codes with the light pen, the user should type the character for that device on the keyboard. The light pen should then be aimed at a state transition symbol to either add or change a label. TRANSLATE The program enters translate state during which the entire diagram may be moved by aiming the light pen at a state symbol. This state is terminated via an ESCAPE light button. COMPILE The program asks the user to indicate the initial state with the light pen, and then it compiles the program. The LOAD, PUNCH, RUN, and UNCOMPILE teletype can mands are then enabled. State symbols are created via the CREATE light button. Once a state symbol is created, it may be deleted via a P( ) input or moved via a P(-) input. If a P(*) input is given on a state symbol, the state diagram is compiled, and the text statements associated with that state are uncompiled and displayed on the screen. (Initially, no text statements are associated with a state symbol.) The user may then insert or delete text statements via the teletype.

326 To facilitate the insertion or deletion of text statements, a cursor is provided on the screen. Whenever the cursor is not visible, it is positioned on an imaginary line just before the first line of text. The line feed character advances the cursor on the statements which are being displayed. If the cursor is advanced past the last statement, it is again positioned on the imaginary line just before the first line of text. In order to insert a statement, the user types the first character of its keyword (which is completed by the program), followed by the parameters for that statement. The statement is then inserted just below the cursor, and the cursor is advanced. In order to delete a statement, the user positions the cursor on that statement (via the line feed character) and types a rubout character. The user returns to the state diagram via the ESCAPE light button. State transitions are created via the CONNECT light button described above. They are labeled via the DEVICE light button described above. Once a state transition is created, it may be deleted via a P( +) input, or bent via a P(-) input. Once the program is compiled (via the COMPILE light button described above), it may be punched (via the PUNCH teletype command), run (via the RUN teletype command), or again uncompiled. Whenever a program is run, it may be terminated at any time via the manual

327 interrupt button. The LOAD, PUNCH, RUN, and UNCOMPILE commands are then again enabled. A. 4 Suggested Improvements As has been mentioned in Section A. 1 above, a means of representing a sequence y(p(e,e')) =(G(D[ e'] )1, G(D[ e'] ), G(D[ e'] )1) should be included in an implementation of the structure {B,E/D, L,y}. This program, then, should be extended to allow the use of elements of B which are represented by blocks with the format shown in Figure A. 2b. The display language also could be improved. Since the purpose of this program was to illustrate the structure, rather than the language, not much thought was given to the language. However, one shortcoming of the language which is closely related to the structure is that there is no facility to store pointers to elements of B. In order to designate an element of B, the user must supply such parameters as "the ith element of B whose first component is p1", or "the ith element of B whose first component is p, and whose second component is P2. Not only is this specification clumsy, but, in more complicated programs, the value of i for such a specification may be difficult to determine. Another difficulty with the display language used here is that not all of the basic operations can be performed easily. In particular, Operations Q5, P7, P9, and P14 cannot be performed easily. As was

328 demonstrated, the inability to perform Operation 14 so greatly complicated the process of responding to one of the inputs that this response was considered impractical to program. Finally, some of the features of the language itself could be improved. With a little more effort, one could eliminate the JUSTIFY statement by defining an absolute value operator to be included in expressions. Furthermore, a more standard expression scanner could be written so that a predefined precedence could be assigned to each operator and could be altered through the use of parentheses. These refinements, however, are not as significant as those improvements which affect the use of the structure, for the expressions which appear in application programs which are prepared with this program are generally rather simple.

Appendix B PROGRAMS USED FOR ANALYSIS Four programs were prepared for the IBM 360/67 under MTS [ 40 ] to compare implementations of topological structures for various applications of various hardware configurations. One of these programs (OPT) enumerates the implementations for which g < tf for a given set of parameter values and sorts these implementations according to cost. The output of this program is not printed, but it is saved on files so that it may be further processed. The other three programs (PRINT, CON, and PLOT) are post-processors which operate on the data in these files to print the tables, to apply the constraints s < s and t < t and to plot the cost of selected - ax f- max' implementations versus parameters which describe the application (e. go, n and n for the text editor described in Chapter 5). The c 1! behavior of each of these programs is described below. Bo1 Enumeration The program OPT, which enumerates implementations for which g < tf and sorts these implementations according to cost, was designed to be run from a teletype, rather than in batch mode. This program contains a command language interpreter which accepts the following commands: 329

330 ALTER: Alter the values of parameters whose symbols are inputted on the teletype to values inputted on the teletype. CALCULATE: Call the subroutine PAR, which must be supplied by the user, to evaluate some or all of the parameters which describe the application and hardware configuration. LIST: Type a list of the current values of the parameters which describe the application and hardware configuration. READ: Read values of parameters which describe the application and hardware configuration from a file which has been produced by either a combination of ALTER and SAVE commands or the SOLVE command. SAVE: Save the current values of the parameters which describe the application and hardware configuration on a specified file, SOLVE: Enumerate the implementations for the current values of the parameters which describe the application and. hardware configuration for which g< tf, sort these implementations according to cost, and output tables of results on a specified file.

331 Since the first two letters of each of these commands distinguishes it from all other commands, only the first two letters of each command must actually be typed. The first five of these commands serve only to aid the input of parameter values and do not contribute to the enumeration of implementationso However, the SOLVE command applies the equations stated in Chapters 3 and 4 to compute values of s, g, tf and r. A simplified flow chart of the response to the solve command is shown in Figure B. 1. The applicable equations from Chapters 3 and 4 are also indicated in this figure. The details needed to run this program are best illustrated by example. In order to illustrate these details, the operation of this program in order to obtain the results plotted in Figure 5.3 is shown below. In the sequences of teletype information shown, the characters which are typed by the user are underlined, whereas those typed by the program are not underlined. In order to run the program for the text editor application of the DEC 339, the user might type the following command: $RUN OPT + EDIT The file EDIT in this example contains the object program for the subroutine PAR which evaluates those parameters whose values depend on the application which is being considered. A suitable

332 Start \ — n - 0 ---- ^ u.-2-i+ n 2[ 2-1], ------ _i=l,2,...,11 Stop ) onstraint\ Sort solutions for 1 Violated which r was computed and write table on file (Equations 4. 52-4.55) n > 2047 7| —I ICompute s by Algorithm 4. 1 (Equations 4.8-4. 22) _ - ==_Compute g (Equations In -n+l 3. 26,4.4,4. 5,4. 23-4.30) Compute r (Equations. i3.36,3.37, C1 g<t,__ Compute f 4.33-4.37, (Equation 4.32) 4.40-4.51) Figure B. 1 Flow Chart for the SOLVE Command

333 FORTRAN program for the subroutine PAR for this example is shown in Figure B, 2. The COMMON statement in this program contains a list of variables which correspond to the parameters which describe the application and hardware configuration. These variable names, however, are not necessarily the same as those which are inputted with the ALTER command, and are not the names used in the text. The correspondences between these various types of notation are shown in Table B. 1o The binary - valued variables SW1 and SW2 in the COMMON statement describe whether or not the parameters S and S', respectively, are averages of integer numbers of locations. If one of these variables is a 0, the corresponding parameter is the average of integer numbers of locations; otherwise, it is not. When execution of the program begins, the value of every parameter is set to zero. The program then waits for a command. Suppose now that the user wishes to input all of the parameters which are peculiar to the DEC 339 hardware configuration, but which are independent of the application. He then types the following sequence: AL:.005,TP:.002,TJ:.004,TS:.007,TJ' =.007,TS' =.008,TB

334 SUBROUTINE PAR IMPLICIT REAL(N) INTEGER SW1, SW2 REAL FF(15),FG(15) COMMON BF,B G,EDF,EDG,EDOF,EDOG, SUMF, SUMG,SUMOF,SUMOG,TDF,TDG, I TP,TJ,TS,TJI,TS1,TB,TC,SO,SP,SS,SJ,SA, I ST,ST1,SR,SH,SBF,SBF1, SBG, SBGI,SF,SFI,SG,SGI,SGAM,SGAMI,GS,GSI,GS2, GS3,GMF,GMF1,GMG,GMGI,GMG2,GHFGHF1,GHG,GHGI, GHG2,GBF,GBG,GTF,GTFI,GTG,GTGI,GCF,GCG,RGBAR, I RC,RDBAR,RP,RJ,RSF,RSFI,RSF2,RSG,RSGI,RSG2, RG,P G I,R F,R F1,RGAM,RGAM 1,SIGMA,TTF,TTG,FF,FG, SWISW2 WRITE(6,1) FORMAT('ENTER NL, NC:') EAD(5.2) NL,NC 2 FORMAT(2F10.0) F = NL*NC+NL B G NL*NC+3.* NL+ 1. EDF =NL+65. EDG2.* NL+67. EDOF-=64. EDOG=66. SUMF=BF SUMG=BG SUMOF=NL*NC SUMOG NL*NC+NL+. SFI 6.-6.* NL /B F SBF1 -4. IS=0-O I NL NL DO 100 I-=,INL iO0 IS=IS+IABS(I-20) TTF=. 0024*NL*NC*(NC- 1. )+. 1536*NL+.0072*I S TDF=.02*NL*NC GBF=(.012*EDF-.O04*EDOF)/SUMF GMF.I =. 003-.003*NL/SUMF GHF. GMFI R F1.094-.082*NL/BF GTFI-.004 Figure B.2 PAR Subroutine for Text Editor

335 S GA M = 4.- 2. *NL/EB G SW2=0 SBGI=2.015 TTG=. 0024*NL*NC TDG=. 02*NL*NC+.0036*NL+. 1536 GBG=(.012*EDG-.004*EDOG)/SUMG GMG=.006 GMG2=.006 GHG=(.05+.067*NC)*NL/SUMG GHG2:(.05+.054*NC+. 000203 125*NL*NC)*NL/SUMG GHGI=(.009+.012*NC)*NL/SUMG RGAMI.012+.0 8*NL/BG GTG1 ( 003+. 002* ( NL*NC+NL) )/SUMG FF(1 )-.25 FF(2).25 FF(3 ) -.5+.25* NL+.25*NC FF( 4).5+.25*NL+.5* NC FF(6)=.25 FF( 10) -.25*NL+.5*NC FF ( 12) =25* NL+.25*NC FF( 13 ) -.25*NL+.25* NC FG(1)=.5 FG(2)=.5 FG(3)=1. FG(4)=1.+.25*NC FG(6)=.25 FG(10)=.25*NC RETURN END Figure B. 2 (cont.) PAR Subroutine for Text Editor

336 ALTER Command COMMON Statement Symbol Used in Text Symbol Symbol qbf BF BF qbg BG BG qdf EDF EDF qdg EDG EDG qdg qdOf EDOF EDOF qdOg EDOG EDOG qf SUMF SUMF sa SUMG SUMG sg q sOf SUMOF SUMOF qs g SUMOG SUMOG so SO SO St ST ST S'ST' ST ST1 S SP SP p Table B. 1 Notation for Parameters

337 ALTER Command COMMON Statement Symbol Used in Text Symbol Symbol S SS SS S S. SJ SJ J S SA SA a S SR SR r Sh SH SH Sf SF SF S5' SF' SF1 Sjz SBF SBF Sf St SBF' SBF1 S SG SG g S' SG SG1 g S SGAM SGAM y S' SGAM' SGAM1 y S3 SBG SBG S SBG' SBG1 Bg Table B. 1 (cont.) Notation for Parameters

338 ALTER Command COMMON Statement Symbol Used in Text Symbol Symbol T TP TP p T. TJ TJ T TS TS s T.' TJ' TJ1 ] T' TS' TS1 s T TB b T TC TC c Tt TTF TTF Tdf TDF TDF df Ttg TTG TTG T TDG TDG dg G GS GS s G' GS' GS1 G " GS" GS2 S Gs' GS"' GS3 Table B.1 (cont,) Notation for Parameters

339 ALTER Command COMMON Statement Symbol Used in Text Symbol Symbol G GMF GMF mf G' GMF' GMF1 mf Ghf GHF GHF Ghf GHF' GHF1 hf G GMG GMG mg G' GMG' GMG1 mg G " GMG" GMG2 mg Ghg GHG GHG G,' GHG' GHG1 hg G, " GHG" GHG2 hg Gbf GBF GBF G GBG GBG bg Gcf GCF GCF Gtf GTF GTF Gtf' GTF' GTF1 tf Table Bo1 (cont.) Notation for Parameters

340 ALTER Command COMMON Stateme nt Symbol Used in Text Symbol Symbol Gcg GCG GCG Gtg GTG GTG G' GTG' GTG1 tg r RG- RGBAR g r RC RC C r, RD- RDBAR R RP RP p R. RJ RJ ^R RF RF Rf' RF' RF1 R RG RG g R RG RG RG1 g R RGAM RGAM R RGAM' RGAM1 Rsf RSF RSF Table B.1 (cont.) Notation for Parameters

341 ALTER Command COMMON Statement Symbol Used in Text Symbol Symbol R sf RSF' RSFl R' RSF" RSF2 sf Rs" RSF" RSF 2 R RSG RSG sg R RSG' RSG1 sg R " RSG" RSG2 sg a SIGMA SIGMA ff( i) FF(i) FF(i) f g(i) FG(i) FG(i) Table B.1 (cont.) Notation for Parameters

342 =.005,TC -2,SO =.833333,SP =.666667,SS =1.666667,SJ =1.666667,SA =.11 111,ST =..1 11,ST' =.666667,SR =,666667,SH -2,SF 2, SG s4,SG' =. 1 11,S GAM =DOES EACH SEQUENCE REQUIRE THE SAME AMOUNT OF STORAGE?.Y ES =.01,GS. 003,GS' =.02,GS" =99999999999999,GS'' =.016,GMF =.022,GHF =. 15,RG=.006,RC =. 15,RD-.005,RP

343 =..046,RJ =.012,R G =.082,RG'.012,R F =.007,RGAM =5,SI GMA In order to terminate the ALTER command, the user types an end-offile. Note that when a value of S is inputted, the program requests information necessary to set SW1 to the proper value. Now suppose the user wishes to type a list of the current values of the parameters and to save them on the file DEC 339 for future use, He first issues the command LI to produce the listing of these parameters, which is shown in Figure B.3. After verifying that these values are correct, the user saves the parameter values on the file DEC 339 as follows: SA ENTER FILE NAME: DEC339 These parameter values may be restored at a later time as follows: RE ENTER FILE NAME: DEC339

344 PF 0.0 BG 0.0 EDF 0.0 EDG = 0.0 EDOF 0.0 EDOG 0.0 SUMF 0.0 SUMG 0.0 SUMOF 0.0 SUMOG 0.0 TDF 0.0 TDG 0.0 TP 0.005 TJ 0.002 TS 0.004 TJ' 0.007 TS' 0.007 TB - 0.008 TC 0.005 SO 2.000 SP 0.833 SS = 1.667 SJ 1.667 SA 1.667 ST. 111 ST'. 11 SR 0.667 SH 0.667 SBF 0,0 SBF' 0.0 SBG = 00 SBG' 0.0 SF 2.000 SF' 0.0 SG 2.000 SG' 4.000 SGAM 0.111 SGAM' 0.0 GS 0010 S' 0.003 GS' = 0.020 GS' ***** ** GMF 0,016 GMF' 0.0 GMG 0.0 GMG' 0.0 GMG' 0.0 GHF 0.022 GHF' 0.0 GHG 0.0 GHG' 0.0 GHG'' 0.0 GBF 0.0 GBG 0.0 GTF 0.0 GGTF' 000 GTG 0.0 GTG' 0.0 GCF 0.0 GCG = 0.0 RG- 0.150 RC 0.006 RD- 0.150 PP 0.005 RJ = 0.046 RSF 0.0 RSF' 0.0 RSF'' 00 RSG 0.0 RSG' 0.0 RSG'' 0.0 RG 0.012 RG' = 0.082 RF 0.012 RF 0.0 RGAM = 0.007 RGAM' = 0. SIGMA 5.000 TTF 0.0 TTG 0.0 FF(1) 0.0 FF(2)= 0.0 FF(3) 0.0 FF(4) = 0.0 FF(5) 000 FF(6) 0.0 FF(7) 0.0 FF(8) 0.0 FF(9) = 00 FF(10) 0,0 FF(11) = 00 FF(12) 0.0 FF(13) 0,0 FF(14) 0.0 FF(15) 0.0 FG(l) = 0,0 FG(2) 0,0 FG(3) 0,0 FG(4) 0.0 FG(5) = 0.0 FG(6) 0.0 FG(7) 0,0 FG(8)' 0.0 FG(9) 0.0 FG(10) 0.0 FG(11) 0.0 FG(12) 000 FG(13) 0.0 FG(14) 0.0 FG(15) 0.0 SW I SW - * Figure B.3 Listing of Parameters for DEC 339

345 The user now wishes to produce the data necessary to obtain Figure 5.3. In order to request enumeration of the implementations for n = 20 and n = 5, he engages in the following teletype conversation: CA ENTER NL,NC: 20, 5 SO ENTER FILE NAME: RESULTS TITLE: EDITOR NL = 20 NC =5 ENTER 0 MASK: 0001 ENTER 1 MASK: 01 The request to enter nf and nc is typed by the subroutine PAR, which is called in response to the CALCULATE command. In response to the SOLVE command, the program requests the name of the file on which results are to be outputted and a title to be outputted with these results so that they can be identified. The program then requests two 11-bit masks. The 0 mask contains l's in those positions which correspond to design decisions which are to be constrained to assume

346 the value 0, whereas the 1 mask contains l's in those positions which correspond to design decisions which are to be constrained to assume the value 1. (Bits in these masks which are not specified are assumed to be zeros.) In this example, u4 is constrained to be zero and u2 is constrained to be 1. In order to compute the other information needed for Figure 5.3, the user types CALCULATE and SOLVE commands to tabulate implementations for other values of n. (Note that these subsequent results C may be appended to the file RESULTS by specifying RESULTS(LAST+l) if RESULTS is a line file, or simply RESULTS if RESULTS is a sequential file.) The user terminates the program by typing an end-of-file in lieu of a command. To permit flexibility of operation, the program was written so that it may be restarted (via the $RESTART command) after it has been terminated in this way. Be 2 Printing Because the program OPT produces a large amount of output, this output is written on files in binary format. The program PRINT was written to read these files and print the information which they contain in readable format. PRINT was designed to be run in batch mode. The program reads from data set number 0 and writes on data set number 6. Consequently, the MTS command $RUN PRINT 0 = RESULTS

347 will print all of the tables of results prepared by the example run of OPT described above. B. 3 Application of Constraints The user often desires to vary smax and t for a particular max max application of a particular hardware configuration. Consequently, the constraints s < s and t < t are not applied by the program OPT. - max - max Instead, the tables which OPT produces contain values of s and tf, and these constraints are applied by the post-processing program CON. CON is designed to be run from a teletype. In order to start this program, the user issues the MTS command $RUN CON The program begins execution by waiting for a command from the user. The commands which are interpreted are the following: READ A file of results prepared by OPT is read for consideration. TEST Values of smax and t are accepted from the max max user and the optimum implementation in each table in the file of results being considered which satisfies the constraints s < s and - max t < t in every table in the file is identified to f- max the user. As in the program OPT, only the first two characters of either of

348 these commands must be typed. In order to illustrate this program, its application to a file GRAPH which contains data for the graph theory application described in Chapter 5 for =100, ne =100, and n = 20, 25, 35, 50, 65, 80, 100, 120, and 140 is considered. The following teletype conversation identifies the optimum implementations for each value of n with v sm = 24000 locations, t = 500 msec, and u = 1. max m ax P RE ENTER FILE NAME: GRAPH TE ENTER. SMAX, TMAX: 24000, 500, ENTER 0 MASK: 0 ENTER 1 MASK: 1 OPTIMUM SOLUTION IN EACH TABLE: 1767 1767 707 707 707 707 707 707 707 (The 0 and 1 masks have the same meaning here as in the program OPT.) Each solution is identified here as the decimal equivalent of the binary number ull u0...u1. These decimal numbers will be

349 called the names of the various implementations. Thus, 1767 is the name of the implementation 11100111011 and 707 is the name of the implementation 11000011010. (Note that the binary representation of each implementation is ul u2...Ull, rather than ull u10 *..ul.) B.4 Plotting Figures 5.3, 5.4, 5. 6, 5.7, and 5.8 were preparea by the program PLOT. This program was designed to be run from a teletype. It allows the user to plot the cost of up to 16 implementations per graph versus an application parameter. The plot description is written on data set number 9 for later post-processing under MTS [ 20 ]. For example, this program may be applied to plot the cost of the implementations 1767 and 707 from the file GRAPH used in the example given in Section B. 3. The teletype conversation to generate this plot would be the following: $RUN PLOT 9 =PLOTQUE ENTER FILE NAME: GRAPH ENTER ABSCISSA VALUES: 20, 25, 35, 50, 65, 80, 100, 120 140, ENTER ABSCISSA LABEL:

350 NUMBER OF VERTICES ENTER NUMBER OF CHARACTERS IN THIS LABEL: 18 ENTER CURVE NAMES: 1767, 707, ENTER CURVE NAMES: As indicated, the program will continue to request curve (i.e., implementation) names after a list of names has been given. Each list of curve names is plotted on a separate graph. If the user desires to read a new file when the program requests more curve names, he should type a null line. If, however, he wishes to terminate the program, he should type an end-of-file.

BIBLIOGRAPHY [ 1] 339 Programmed Buffered Display, DEC-09-I6FA-D, Digital Equipment Corporation, Maynard, Massachusetts, May 1968. [ 2] Alien, To Ro, and J. E. Foote, "Input/Output Software Capability for a Man-Machine Communication and Image Processing System", Proceedings of the Fall Joint Computer Conference, 1964, pp. 387-396. [3] Baecker, R., "Picture-Driven Animation", Proceedings of the Spring Joint Computer Conference, 1969, pp. 273-288. [4] Ball, N. Ao, et al., "A Shared Memory Computer Display System", IEEE Transactions on Electronic Computers, Vol. EC-15, No. 5, October, 1966, pp. 750-756. [ 5] Baskin, H. B., and S. P. Morse, "A Multilevel Modeling Structure for Interactive Graphic Design", IBM Systems Journal, Vol. 7, Nos. 3 and 4, 1968, pp. 218-228. [ 6] Boehm, B. W., et al., "POGO: Programmer-Oriented Graphics Operation", Proceedings of the Spring Joint Computer Conference, 1969, pp. 321-330. [ 7] Bond, A. Ho, et al., "An Interactive Graphical Display Monitor in a Batch-Processing Environment with Remote Entry", Communications of the ACM, Vol. 12, No. 11, November 1969, pp. 595-603. [ 8] Brenner, A. E., and P. de Bruyne, "A Sonic Pen: A Digital Stylus System", IEEE Transactions on Computers, Vol. C-19, No. 6, June 1970, pp. 546-548. [ 9] Calvert, T. W., "Projections of Multidimensional Data for Use in Man-Computer Graphics", Proceedings of the Fall Joint Computer Conference, 1968, pp. 227-231 [10] Cameron, So Ho, et al., "DIALOG: A Conversational Programming System with a Graphical Orientation", Journal of the ACM, Vol. 10, No, 6, June 1967, pp. 349-357. 351

352 [11] Chen, F. C., and Ro Lo Dougherty, "A System for Implementing Interactive Applications" IBM Systems Journal Vol. 7, Nos. 3 and 4, 1968, pp. 257-270. [12] Christensen, C., and E. N. Pinson, "Multi-Function Graphics for a Large Computer System", Proceedings of the Fall Joint Computer Conference, 1967, pp. 697-711. [13] Cohen, D., and T. M. P. Lee, "Fast Drawing of Curves for Computer Display", Proceedings of the Spring Joint Computer Conference, 1969, pp. 297-307. [14] Dertouzos, Mo L., "PHASEPLOT: An On-Line Graphical Display Technique", IEEE Transactions on Electronic Computers, Vol. EC-16, No. 2, April 1967, pp. 203-209. [15] Devere, Go S., et al., "The DAC-I System", Datamation, June 1966. [16] Eastman, C. M., "Representations for Space Planning", Communications of the ACM, Vol. 13, No. 4, April 1970, pp. 242-250. [17] Enguolo, Ko Jo, and J. L. Hughes, "A General-Purpose Display Processing and Tutorial System", Communications of the ACM, Vol. 11, NOo 10, October 1968, pp. 697-702. [ 18] Evans & Sutherland Line Drawing System Model 1 System Reference Manual, Evans & Sutherland Computer Corporation, Salt Lake City, Utah, January 1970. [19] Farmer, N. A., "A Digital Comparator for Use with Computer Displays", IEEE Transactions on Computers, Vol. C-18, No. 3, March 1969, ppo 269-270. [ 20] Fronczak, E. J., The University of Michigan Plot Description System and Related Calcomp 780/763 Post-Processing, Technical Report 29, Concomp Project, University of Michigan, Ann Arbor, Michigan, August 1970. [ 21] Gott, A. Ho, et alo, "Teaching Heart Function —One Application of Medical Computer Animation", Proceedings of the Spring Joint Computer Conference, 1969, pp. 637-647.

353 [ 22] Hamilton, J. A., A Survey of Data Structures for Interactive Graphics, Memorandum RM-6145-ARPA, The Rand Corporation, Santa Monica, California, April 1970. [ 23] Hirsch, P. M., et al., "Kinoforms and Digital Holograms", Pertinent Concepts in Computer Graphics, Ed. by M. Faiman and J. Nievergelt, University of Illinois Press, Chicago, Illinois, 1969. [ 24] Hodes, L., "A Programming System for the On-Line Analysis of Biomedical Images", Communications of the ACM, Vol. 13, No. 5, May 1970, ppo 279-283. [ 25] Irani, Ko B., V. Lo Wallace, and J. H. Jackson, "Conversational Design of Stochastic Service Systems from a Graphical Terminal", Computer Graphics 70 International Symposium, Brunel University, Uxbridge, Middlesex, England, April 15, 1970. 26] Jackson, Jo Ho, An Executive System for a DEC 339 Computer Display Terminal, Concomp Project Technical Report 15; also Systems Engineering Laboratory Technical Report 32, University of Michigan, Ann Arbor, Michigan, December 1968. [ 27] Jackson, J. H., SELMA: A Conversational System for the Graphical Specification of Markovian Queueing Networks, Technical Report 23; Concomp Project, University of Michigan, Ann Arbor, Michigan, October 1969. [ 28] Johnson, To E., "SKETCHPAD III - A Computer Program for Drawing in Three Dimensions", Proceedings of the Spring Joint Computer Conference, 1963, ppo 347-353. [ 29] Joyce, J. D., and Mo J. Cianciolo, "Reactive Displays: Improving Man-Machine Graphical Communication", Proceedings of the Fall Joint Computer Conference, 1967, pp. 713-721. [30] Knuth, Do E., Fundamental Algorithms, Addison-Wesley Publishing Col, Reading, Massachusetts, 1968. [31] Konkle, Ko Ho, "An Analog Comparator as a Pseudo-Light Pen for Computer Displays", IEEE Transactions on Computers, Vol. C-17, No. 1, January 1968, pp. 54-55.

354 [ 32] Kubert, Bo, et alo, "The Perspective Representation of Functions of Two Variables", Journal of the ACM, Vol. 15, No. 2, April 1968, ppo 193-204. [ 33] Kulsrud, Ho Eo, "A General Purpose Graphic Language", Communications of the ACM, Vol. 11, No. 4, April 1968, pp. 247-254o [34] Lang, C. Ao, and J. C. Gray, "ASP —A Ring Implemented Associative Structure Package", Communications of the ACM, Volo 11, No. 8, August 1968, pp. 550-555. [35] Lechner, B. J,, "Liquid Crystal Displays", Pertinent Concepts in Computer Graphics, Edo by M. Faiman and J. Nievergelt, University of Illinois Press, Chicago, Illinois, 1969. [ 36] Lee, To M. Po, "A Class of Surfaces for Computer Display", Proceedings cf the Spring Joint Computer Conference, 1969, ppo 309-319. 37] Lesem, L. Bo, "Computer Synthesis of Holograms for 3-D Display", Communications of the ACM, Vole 11, No. 10, October 1968, pp, 661-674. 38] Licklider, J. C. R., "A Picture Is Worth a Thousand Words — and Costs", Proceedings of the Spring Joint Computer Conference, 1969, pp. 617-621. [ 39] Metzger, R. A., "Computer Generated Graphic Segments in a Raster Display", Proceedings of the Spring Joint Computer Conference, 1969, ppo 161-172. [40] Michigan Terminal System, (2nd Ed.), University of Michigan Computing Center, Ann Arbor, Michigan, 1967. [41] Miller, J. C., and C. M. Wine, "A Light Pen for Remote Time-Shared Graphic Consoles", IEEE Transactions on Computers, Vol. C-17, No, 8, August 1968, ppo 799-802.

355 [42] Miller, J. C., and C. M. Wine, "A Simple Display for Characters and Graphics", IEEE Transactions on Computers, Vol. C-17, No. 5, May 1968, pp. 470-475. [43] Morrison, R, A., "Graphic Language Translation with a Language Independent Processor", Proceedings of the Fall Joint Computer Conference, 1967, ppo 723-731. [44] Myer, T. H,, and I. E. Sutherland, "On the Design of Display Processors", Communications of the ACM, Vol. 11, No. 6, June 1968, pp. 410-414. [45] Newman, Wo M., "A High-Level Programming System for a Remote Time-Shared Graphics Terminal", Pertinent Concepts in Computer Graphics, Ed. by M. Faiman and J. Nievergelt, University of Illinois Press, Chicago, Illinois, 19690 [46] Newman, W, M., "A System for Interactive Graphical Programming", Proceedings of the Spring Joint Computer Conference, 1968, ppo 47-54. [47] Ninke, W. Ho "Graphic-l —A Remote Graphical Display Console System", Proceedings of the Fall Joint Computer Conference, 1965, pp. 839-846. 48] Noll, A. M., "A Computer Technique for Displaying n-Dimensional Hyperobjects", Communications of the ACM, Vol. 10, No. 8, August 1967, pp. 469-473. 49] Ogden, So, and N. Wadsworth, "On-Line Graphics at The University of Utah", Datamation, November 1969, ppo 159-165. [ 50] Ophir, D., et al., "GRAD: The Brockhaven Raster Display", Communications of the ACM, Vol. 11, No, 6, June 1968, pp. 415416. [ 51] Ophir, D., et al., "Three-Dimensional Computer Display", Communications of the ACM, Vol. 12, No, 6, June 1969, pp. 309-310. [ 52] PDP-9 User Handbook, F-95, Digital Equipment Corporation, Maynard, Massachusetts, January 1968. [ 53] Raffel, J. I., Semiannual Technical Summary Report to the Advanced Research Projects Agency on Graphics, Lincoln Laboratory, Massachusetts Institute of Technology, Lexington, Massachusetts, December 1965o

356 [ 54] Roberts, Lo G., "A Graphical Service System with Variable Syntax", Communications of the ACM, Volo 9, No. 3, March 1966, pp. 173-175. [ 55] Roberts, Lo G., "Graphical Communication and Control Languages", University of Michigan Engineering Summer Conference Notes on Computer Graphics, 1965. [ 56] Roberts, L. G., "Homogeneous Matrix Representation and Manipulation of N-Dimensional Constructs", University of Michigan Engineering Summer Conference Notes on Computer Graphics, 1965. [ 57] Roberts, L. G., Machine Perception of Three-Dimensional Solids, Lincoln Laboratory Technical Report No. 315, Massachusetts Institute of Technology, Lexington, Massachusetts, May 1965. [ 58] Rose, G. A., "'Intergraphic', A Microprogrammed, GraphicalInterface Computer", IEEE Transactions on Electronic Computers, Volo EC-16, No 6, December 1967, pp. 773-784. [ 59] Rose, G. Ao, "'Light-Pen' Facilities for Direct View Storage Tubes —An Econo mical Solution for Multiple Man-Machine Communication". IEEE Transactions on Electronic Computers, Vol. EC-14, Noo 4, August 1965, pp. 637-639. [ 60] Rougelot, R. So, "The General Electric Computer Color TV Display", Pertinent Concepts in Computer Graphics, Ed. by M. Faiman and J. Nievergelt, University of Illinois Press, Chicago, Illinois, 1969. [ 61] Shaw, A. C0, "Parsing of Graph-Representable Pictures", Journal of the ACM, Vol. 17, No. 3, July 1970, ppo 453-481l [ 62] Shaw, A. C., The Formal Description and Parsing of Pictures, Stanford Linear Accelerator Center Report No0 84, Stanford University, Stanford, California, March 1968. [ 63] Siders, Ro A., et alo, Computer Graphics, American Management Association, New York, New York, 1966.

357 [ 64] Sproull, R. F., and I. E. Sutherland, "A Clipping Divider", Proceedings of the Fall Joint Computer Conference, 1968, ppo 765-775. [65] Sutherland, I. E., "A Head-Mounted Three Dimensional Display", Proceedings of the Fall Joint Computer Conference, 1968, pp. 757-764. [ 66] Sutherland, I. E., "Computer Displays", Scientific American, June 1970, ppo 56-81. [ 67] Sutherland, 1o E., SKETCHPAD: A Man-Machine Graphical Communication System, Lincoln Laboratory Technical Report Noo 296, Massachusetts Institute of Technology, Lexington, Massachusetts, January 1963. 68] Sutherland, I. E., "SKETCHPAD - A Man-Machine Graphical Communication System", Proceedings of the Spring Joint Computer Conference, 1963, pp. 329-346. [ 69] Sutherland, W. Ro, et al., "Graphics in Time-Sharing: A Summary of TX-2 Experience", Proceedings of the Spring Joint Computer Conference, 1969, pp. 629-636. [ 70] Sutherland, W. R., The On-Line Graphical Specification of Computer Procedures, Ph.D. Thesis, Department of Electrical Engineering, Massachusetts Institute of Technology, Lexington, Massachusetts, January 1966. [ 71] System Reference Manual —Adage Graphics Terminal, Adage, Inc., Boston, Massachusetts, March 1968. [72] Theiss, C. M., "Computer Graphics Displays of Simulated Automobile Dynamics", Proceedings of the Spring Joint Computer Conference, 1969, pp. 289-296. [ 73] Uber, G. T,, et al., "The Organization and Formatting of Hierarchial Displays for the On-Line Input of Data", Proceedings of the Fall Joint Computer Conference, 1968, pp. 219-226. [ 74] Van Dam, A., and D. Evans, "A Compact Data Structure for Storing, Retrieving, and Manipulating Line Drawings", Proceedings of the Spring Joint Computer Conference, 1967, pp. 601-608.

358 [ 75] Williams, R., "On the Application of Graph Theory to Computer Data Structures", Computer Graphics 70 International Symposium, Brunel University, Uxbridge, Middlesex, England, April 15, 1970. [ 76] Wolfberg, M. S., An Interactive Graph Theory System, Technical Report 69-25, The Moore School of Electrical Engineering, University of Pennsylvania, Philadelphia, Penn., June 1969. [ 77] Wylie, Co, et al.,'Half-Tone Perspective Drawings by Computer", Proceedings of the Fall Joint Computer Conference, 1967, pp. 4958.

UNIVERSITY OF MICHIGAN 3 9015 03025 2541111 I 3 9015 03025 2541