Lecture Notes in Computer Science Edited by G. Goos and J. Hartmanis
421 Tamiya Onodera Satoru Kawai
A Formal Model of Visualization in Computer Graphics Systems
Springer-Verlag Berlin Heidelberg NewYorkLondon ParisTokyoHong Kong
Editorial Board D. Barstow W. Brauer P. Brinch Hansen D. Gries D. Luckham C. Moler A. Pnueli G. Seegmeller J. Stoer N. Wirth Authors Tamiya Onodera IBM Research, Tokyo Research Laboratory 5-19, Sanban-cho, Chiyoda-ku Tokyo 102, Japan Satoru Kawai Department of Graphics and Computer Science The College of Arts and Sciences, The University of Tokyo 3-8-1, Komaba, Meguro-ku Tokyo 153, Japan
CR Subject Classification (1987): 1.3.4 ISBN 3-540-52395-2 Springer-Verlag Berlin Heidelberg New York ISBN 0-387-52395-2 Springer-Verlag NewYork Berlin Heidelberg
Thiswork is subjectto copyright.All rightsare reserved,whetherthe wholeor part of the material is concerned,specificallythe rights of translation,reprinting,re-useof illustrations,recitation, broadcasting,reproductionon microfilmsor in otherways,and storagein databanks.Duplication of this publicationor partsthereofis onlypermittedunderthe provisionsof the GermanCopyright Law of September9, 1965,in its versionof June 24, 1985,and a copyrightfee must a}waysbe paid. Violationsfall underthe prosecutionact of the GermanCopyright Law. cOSpringer-VerlagBerlin Heidelberg 1990 Printed in Germany Printing and binding: DruckhausBeltz, Hemsbach/Bergstr. 2145/3140-543210- Printed on acid-freepaper
Preface
The field of computer graphics has expanded rapidly during the last decade. It provides a comprehensive way for computers and human beings to communicate, and is indispensable in modern computer systems. In order to facilitate the building of such systems, the kernel systems of computer graphics are designed and implemented to provide programmers with a set of fundamental graphics functions for producing pictures.
Visualizalion refers to the total process of transforming graphical objects from system-specified representations into their final representations. Unfortunately, visualization in conventional kernel systems is only poorly described: the specification documents are incredibly thick and most of the essential parts are written in natural language, relying on the incomplete framework of a viewing pipeline. The model of a viewing pipeline is insufficient, since it models only the viewing process, ignoring the important process of attribute rendering of graphical objects, and does not define the central concept of graphical output primitives. Moreover, the diversity of standards and proposed standards by the ISO for kernel systems embarrasses the computer graphics community, since we do not have a model on which two standards can be compared. All of these problems motivate the construction of a general, concise, and formal model of visualization. The main purpose of this book is to present a formal model of visualization called a visualizing
ne~. We give the model in a unified and axiomatic manner based on the mathematical concept of correspondence, which is a general form of mapping. Surprisingly, various attribute rendering processes, including pattern filling, are described there in a uniform way, and graphical output primitives are defined as mappings from finite generable objects. A visualizing net is a concise model that not only allows an unambiguous and comprehensive description of systems but can also be the center of the documentation. In addition, a visualizing net is far more general than a viewing pipeline. This implies that all visualizations in conventional kernel systems can be described by means of a visualizing net: we do so in Section 3.3. This book is primarily intended for students or researchers interested in the formal aspects of computer graphics, which have been paid little attention by most researchers. One reason is that the research done so far in this field is not closely linked to actual systems.
IV We try in this book to link the model to reality. That is, we present the design and implementation of a kernel system called a graphics nucleus, which provides the full functionality of a visualizing net. The system is based on one general and expressive drawing technique, called geometry-driven drawing, which is the consequence of our abstraction of attribute rendition. For instance, it can draw roads or railways as simply as dotted lines. Kernel system designers can also benefit from our work, since it contains a discussion of what a kernel system should be and expresses a view on how to avoid building complex, hopeless systems. Chapter 2 will be helpful for those who are interested in correspondence, since it contains indepth discussions on this subject, which has hitherto received far less attention than mapping or functions. Familiarity with computer graphics kernel systems and with first-order logic is assumed. Acknowledgements We are thankful to Messrs. T. Kamada, S. Matsuokz, H. Morishima, and C. Lee of the Kawai Laboratory of the University of Tokyo for their helpful discussions and valuable criticisms. We would also like to express my gratitude to Mr. H. Yokouchi of IBM Research, Tokyo Research Laboratory for his mathematical suggestions. Finally, We are grateful to Mr. McDonald of IBM Research ' Tokyo Research Laboratory for his careful proof-readlng.
Tokyo, Jauuary 1990
Tamiya Onodera Satoru Kawai
Co~e~s
Introduction 1.1
The Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1.2
O v e r v i e w s of C o m p u t e r G r a p h i c s S y s t e m s . . . . . . . . . . . . . . . . . . . . . . .
3
1.2.1
Output Primitives and Primitive Attributes ..................
3
1.2.2
Viewing Pipeline
6
1.2.3
Picture Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
1.3.1
Specifying GKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
1.3.2
Mallgren's Specification
1.3.3
Detailed Viewing Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
1.3.4
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
1.3
2
Mathematical
..............
. . . . . . . . . . . . . . . . . . .
10
..............................
Framework
2.1
Correspondences
2.2
O p e r a t i o n s on C o r r e s p o n d e n c e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
2.3
Equalities
17
2.4
E x t e n s i o n s of C o r r e s p o n d e n c e s
Formal 3.1
Model
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
21
of Visualization
F o r m a l i z a t i o n of B a s i c C o n c e p t s in C o m p u t e r G r a p h i c s
...............
25
. . . . . . . . . . . . . . . . . . . . .
25
3.1.1
Pictures and Picture Transformations
3.1.2
Picture Sum
3.1.3
G e o m e t r i e s a n d G e o m e t r y 3_-'ransformations . . . . . . . . . . . . . . . . . .
26
3.1.4
Geometric Transformations
27
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
26
CONTENTS
VI
4
Restrictive T r a n s f o r m a t i o n s . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
3.1.6
Replications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
3.].7
Pictorializing T r a n s f o r m a t i o n s
. . . . . . . . . . . . . . . . . . . . . . . . .
28
3.1.8
Firite Ordered Geometries
. . . . . . . . . . . . . . . . . . . . . . . . . . .
28
3.1.9
Equalities
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
3.2
Visualizing Nets
3.3
Specifying V i s u a l i z a t i o n s in C o n v e n t i o n a l S y s t e m s 3.3.1
Polyline in G K S
3.3.2
P o l y m a r k e r in G K S
3.3.3
Line in P o s t s c r i p t
..............
; . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33 34
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
3.3.4
Fill A r e a ]'n G K S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36
3.3.5
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
Graphical 4.1
5
3.1.5
Nucleus
G e o m e t r i c a n d Pictorial P r i m i t i v e s . . . . . . . . . . . . . . . . . . . . . . . . . . .
41
4.1.1
F o r m a l i z a t i o n of G r a p h i c a l P r i m i t i v e s
. . . . . . . . . . . . . . . . . . . . .
41
4.1.2
S o u n d P r o p e r t y of P r i m i t i v e s . . . . . . . . . . . . . . . . . . . . . . . . . .
43
4.2
Graphical Nucleus
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
4.3
I m p l e m e n t a b i l i t y of a G r a p h i c a l N u c l e u s . . . . . . . . . . . . . . . . . . . . . . . .
44
4.4
Optimization Considerations
47
Implementation
of a Graphical
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Nucleus
5.1
G e o m e t r i c a n d Pictorial P r i m i t i v e s in p N u d e u s
. . . . . . . . . . . . . . . . . . . .
49
5.2
R e p r e s e n t a t i o n of Visualizing Nets
. . . . . . . . . . . . . . . . . . . . . . . . . . .
50
5.3
Geometries and Geometry T~ansformations
. . . . . . . . . . . . . . . . . . . . . .
51
5.3.1
Restrictive G e o m e t r i e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
51
5.3.2
Geometries
51
5.3.3
Geometry Transformations
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
52
CONTENTS 5.4
5.5
5.6
Pictures and Picture Transformations
. . . . . . . . . . . . . . . . . . . . . . . . .
53
5.4.1
Pictures and Picture Naming
. . . . . . . . . . . . . . . . . . . . . . . . . .
53
5.4.2
Picture Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
55
Pictorializing Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.5.1
Pictorializing a Point Geometry . . . . . . . . . . . . . . . . . . . . . . . . .
56
5.5.2
Pictorializing a Lattice Geometry . . . ~ . . . . . . . . . . . . . . . . . . . .
57
5.5.3
P i c t o r i a l i z i n g a Line G e o m e t r y
. . . . . . . . . . . . . . . . . . . . . . . . .
58
Backend Display Function -- peval . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
Extending
7
VII
a Graphical
Nucleus
6.1
Simulating a Conventional Graphics Interface
. . . . . . . . . . . . . . . . . . . . .
6.2
Picture Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
65
6.3
Generalized Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
66
Conclusion
63
69
Appendices
75
Appendix
A
Proofs
of Propositions
Appendix
B
pNucleus
Reference
and
Theorems
77
Manual
B.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
B.2
Starting the pNucleus System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
B.3
Functions
85
B.4
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.3.1
Control Functions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
B.3.2
Graphical Functions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
87
B.3.3
Utility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
89
F o r m a l S y n t a x of t h e p N u c l e u s S y s t e m . . . . . . . . . . . . . . . . . . . . . . . . .
90
B.4.1
Basic Data Types
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
B.4.2
Geometries
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
CONTENTS
VIII
B.5
B.4.3
Pictures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
B.4.4
Invoking Transformations . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
Examples
Appendix
C
.........................................
Implementation
92
I s s u e s ~n p N u ¢ l e u s
C.1
Sectioning a Line Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.2
Transformations for Mapping a Rectangle onto a Quadrangle C.2.1
xy-Ttansformation . . . . . .
C.2.2
Two-Dimensional Projective Transformatioa
Bibliography
95 ............
.......................... .................
96 96 97
99
List of Figures
1.1
Typical o u t p u t primitives
1.2
GKS viewing pipeline
1.3
P H I G S viewing pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.1
Divergent a n d convergent correspondences . . . . . . . . . . . . . . . . . . . . . . .
16
2.2
C o r r e s p o n d e n c e for illustrating Proposition 3 . . . . . . . . . . . . . . . . . . . . .
19
2.3
Correspondences for illustrating the equality in T h e o r e m 1 . . . . . . . . . . . . . .
20
2.4
C o r r e s p o n d e n c e s for illustrating the equality ix T h e o r e m 2 . . . . . . . . . . . . . .
21
2.5
Diagram representing b o t h sides in the equality of T h e o r e m 4 . . . . . . . . . . . .
23
3.1
Picture t r a n s f o r m a t i o n derived from a divergent correspondence
26
3.2
Replication defined by three survergent correspondences
3.3
................................
5
..................................
7 7
..........
28
..............
Intrusion of a geometric t r a n s f o r m a t i o n into a restrictive t r a n s f o r m a t i o n w h e n t h e application order is reversed
.............................
30
3.4
P a t t e r n generation when Dom rl 5& Dora p . . . . . . . . . . . . . . . . . . . . . . .
32
3.5
Visualizing net
33
3.6
Visualizing net of GKS polyline
3.7
Effects of two different restrictive t r a n s f o r m a t i o n s of polyline
3.8
Visualizing net of GKS polymarker
3.9
Effects of two different restrictive t r a n s f o r m a t i o n s of polymarker
..................................... ............................ ............
35
.....................
.....
36
.........
37
...........................
3,10 Visualizing net of Postscript line 3.11 Visualizing net of GKS fill area
34
.
.
.
.
.
.
.
.
.
4.1
E x a m p l e s of geometric primitives
4,2
Soundness of geometric ~nd pictorial primitives
5.1
Region specified by the expression in Example 5.1
.
.
.
.
37 .
.
.
.
.
.
........................... ...................
..................
.
.
.
.
.
.
.
.
.
38
42 43
52
LIST OF TABLES
X 5.2
Picture to which the name *h is assigned
5.3
Pictorialization of a Point Geometry . . . . . . . . . . . . . . . . . . . . . . . . . .
57
5.4
Pictorialization of a Lattice Geometry
58
5.5
Development of Secfiors
5.6
Pictorialization of a Line Geometry
6.1
Conventional picture storing by pNucleus
7.1
Pictorializaiton of a line geometry
7.1
Pictorializaiton of a line geometry (continued) . . . . . . . . . . . . . . . . . . . . .
72
7.2
Pictorialization of a polygon geometry
73
C.1
Determining section height vectois . . . . . . . . . . . . . . . . . . . . . . . . . .
96
C.2
Pictorialization of a line geometry by two-dimensional projective -transformation
98
.........................
................................
List
1.1
.......................
..........................
.......................
...........................
........................
54
59 60
66
71
of Tables
GKS primitives with p a r a m e t e r s supplied in the invocation and with basic attributes controlling their appearances
..............................
2.1
Results of applying correspondence operations
B.1
Data type notation
....................
...................................
4
18
86
Chapter
1
Introduction
Visualization in a kernel system for computer graphics refers to the total process of transforming of graphical objects from system-specified representations into their final visuM representations. The visualizations of graphical objects in conventional kernel systems have been described in the form of natural language documents which rely on the ambiguous and incomplete framework of a
viewing p@eline [8,9,11,10], but not on the basis of any formal model. The reason why the viewing pipehne is insufficient as a model of a visuahzation is that it literally models only the viewing process of the system: it does not contain the important process of
attribute rendering of graphical objects. Moreover, graphical objects are supposed to be subject to successive transformations in the viewing pipeline model, but these objects and transformations are left ambiguous and are defined merely in an intuitive manner. In general, a well-established model is indispensable for an unambiguous 'and' comprehensive description of a system. The main purpose of this book is to present a formal model of visualization, called a visualizing net. We also introduce a new graphics system called a graphical nucleus. The system is designed directly with the framework of a visualizing net. The treatment of graphical objects is much freer and the organization of transformations within it is variable.
1.1
The Outline
The rest of this chapter overviews conventional graphics kernel systems and related work on formal approaches to computer graphics systems. Chapter 2 presents the mathematical framework for our model of visualization. The basic concept
is correspondence, which is the most general form of mapping. We pay much attention to one-tomany correspondences: these play an important role in the book. We consider the usual operations, such as composition and inverse, and less common, such as restriction, domain-priority-sum and image-priority-sum. Three extensions of a correspondence are given: one for the power set of its domain, the second for the closure of its domain, and the third for a correspondence space. We also present theorems and many equalities, some of which are used in subsequent chapters.
2
CHAPTER 1. INTRODUCTION
Chapter 3 is the main chapter of this volume. It contains the definition of a visualizing net. We begin the chapter by formahzing basic concepts in computer graphics. First, we identify the two distinct objects of geometry and ?icf~tre. The former is defined to be a partial mapping whose domain and range are a subset of Euclidean space and a set of reasonable values, respectively. The latter is defined to be a subset of Euclidean space. Geometric ~ransforma~ions and restrictive
transformations (clippings) are defined for each of the two. Second, we clarify the concept of attribute rendering, which has been ignored in conventional viewing pipelines. It is treated as what we call a pic*orializing ~ransformalion, which turns a geometry into a picture by repeatedly transforming and pasting a given pattern picture 'along' a given geometry. We continue by defining a visualizin9 ne~ to be any direct acyclic graph that generates a picture and is composed of the abovementioned transformations. This implies that the organization of component transformations is not fixed. The chapter also analyzes visualizing processes of graphical primitives in conventional kernel systems in terms of the model of a visualizing net, detecting overlooked ambiguities and insufficiencies. All of these are presented in a unified and axiomatic manner upon the mathematical framework established in Chapter 2. For instance, geometric transformations and restrictive transformations, which appear inherently different, are formalized within the same framework. In addition, relations recognized in graphics system are concisely formulated and are vafidated with a few definitions and theorems. Chapter 4 shows a new graphics system called a gvaphica~ nucleus, which is designed within the framework of the visualizing net and therefore inherits much generality and flexibility from the model. Before showing the definition of the system, we define graphical output primitives as geometric primitives and pictorial primitives, which are mappings from finitely generable objects to geometries or pictures. A formal study of the implementability of a graphical nucleus is also made.
Chapter 5 describes the reahzation of a prototype of a graphical nucleus called pNucleus. The system is written in Franz Lisp. The representations of a visualizing net and of the objects within it are elucidated. Chapter 6 examines possible extensions of the pNucleus system. The topics include simulating functional interface as in GKS, reafizing more general picture storage, and what we call generalized text. A visualizing net is a transparent in the sense that its user can access the intermidate results in the net, modify them and give them to another visualizing net. Together with the organization
1.2. OVERVIEWS OF COMPUTER GRAPHICS SYSTEMS variability this intermidate result accessibility make the system very extensible. Chapter 7 presents our conclusions. Appendix A presents the proofs of propositions and theorems in Chapter 2. Appendix B and Appendix C contain a reference manual for pNucleus and the implementation details of the system, respectively. The manual contains a description of the functions provided by pNucleus and of its syntax. The implementation details given in Appendix C are all related to the pictorializing transformation tht handles a line. The model we present in this volume gives guidance in and suggests the possibility of a newgeneration computer graphics system. For instance, we describe a new method of drawing, which may be called a geometry-driven drawing. It is done by formalizing the sets of attributes simply as pictures and by abstracting pictorializing transformations from various attributes renditions; conventional systems just give each graphical primitive a speciahzed set of attributes and a separate description of attribute rendition. We also show the possibility of treating geometries and pictures as freer data by allowing any valid sequence of any transformations. We believe that these indicate the right direction for the development of graphics systems. 1.2
O v e r v i e w s of C o m p u t e r G r a p h i c s S y s t e m s
This section overviews the output features of conventional graphics systems. It wa not until the advent of the Core system [8] that concepts in computer graphics were organized as an integrated system. Most of these concepts were inherited by GKS [9], the internationM standard for twodimensional computer graphics systems, although some were reorganized, refined, or newly added. PHIGS [11] was designed on the principle that it should be as compatible with GKS as possible. In CGI [10] the device interface specification is based on the GKS workstalion interface. (Workstations are an abstraction of physical devices with input and/or output capabilities. GKS incorporates physical devices, such as refresh tube, storage tube, plotter, and even sequential file for long-term filing, as workstations, so that they are controlled by a uniform logical interface - - the workstation interface. The system can support multiple workstations at the same time.) Conventional systems therefore have much in common, and it is possible to describe the output features of any of these systems with few particulars of the specific system. Note that we follow the descriptions given in the documents specifying the above systems. 1.2.1
Output Primitives and Primitive Attributes
In conventional systems, pictures are considered to be drawn as a collection of graphical output
primitives. Their visuM representations are controlled by corresponding sets of output primitive
4
C H A P T E R 1. I N T R O D U C T I O N
GKS Primitive polyline
Parameters
Basic Attributes
number of points
linetype"
points
fine width scale factor* polyline color index*
polymarker
number of points
marker type*
points
marker size scale factor" polymarker color index"
text
text position
text font and precision*
character string
character expansion factor" character spacing* text color index* character height character up vector text path text alignment
fill area
number of points
fill area interior style*
points
fill area style index* fill area color index* pattern size pattern reference point
Table 1.1: GKS primitives with parameters supplied in the invocation and with basic attributes controlling their appearances
attributes that are defined for each primitive. Table 1.1 contains GKS output primitives together with parameters supplied in the invocation of a primitive and basic attributes applied to a primitive. These primitives are drawn in Figure 1.1 with three different settings of attributes.
Some attributes are not contained in the table. They are called aspect source flags, and are related to the methods of specifying the values of the attributes marked by asterisks in the table: these attributes can be either directly given independently of workstations or indirectly obtained via the bundle table for that primitive in each workstation. Each workstation has four bundle tables: a polyfine bundle table, a polymarker bundle table, a text bundle table, and a fill area bundle table.
1.2. OVERVIEWS OF COMPUTER GRAPHICS S Y S T E M S
~////
~
5
/ /\ \ / / /
(a) polyline *
+ *
*
"k +
+
,k' ,k
(b) polymarker
abc
abc (e) text
(d) fillarea Figure 1.1: Typical output primitives
abc
/
6
CHAPTER 1. INTRODUCTION
The elements in these tables, called bundles, consist of the attributes marked by asterisks. For example, the polyline primitive has three aspect source flags - - the liuetype ASF, the line-width scale factor ASF, and the polyline color index ASF - and one more attribute, called a polyline bundle table index. If the value of the linetype ASF is BUNDLED,the actual value of the linetype is obtained through the bundle table element indexed by the polyline bundle table index. Otherwise, the value of the linetype ASF is INDIVIDUAL, and the actual value of the Iinetype is simply the value of the attribute of linetype. GKS originally allowed only bundle specification for primitive attributes. Bundle tables are similar to color lookup tables, which most devices had when GKS was being designed. The lookup table allows concise specification of colors: a color is specified by an index, not by a set of three values of red, green, and blue. In addition, since such devices usually store color lookup table indices in a frame buffer and since these indices are interpreted by harware, any change to a table entry (not to a frame buffer) is immediately reflected in drawings on the display screen. The designers of GKS wanted to allow users to do this when specifying other attributes. However, most devices in those days were designed to be compatible with the predecessor of GKS, or Core, which allows only individual specification. A compromise was therefore made and the system became more complex. Similar output primitives are provided by other conventional systems with similar sets of attributes, although PHIGS covers three-dimensional graphics and CGI has additional complicated primitives and more detailed sets of attributes, since it deals with devices from low-end to high-end. 1.2.2
Viewing Pipeline
Conventional systems give users the following model or notion about their inner processing for the visualization of output primitives:
When the user invokes an output primitive, he or she is supposed to pass the primitive together with its attributes into a vie~oing pipeline, through which the primitive (or in complex cases, even some of its attributes) is subject to a sequence of transformations. The primitive is then successively refined by the values of its attributes into a visual representation. Figures 1.2 and 1.3 show the viewing pipeline in GKS and in PHIGS, respectively. There are two major components in a viewing pipeline: geometric transformation and clipping [15].
Geometric transformations, as the name implies, geometrically transforms a primitive. We can
1.2.
O V E R V I E W S OF C O M P U T E R GRAPHICS S Y S T E M S
7
I WC Normalization Transformation
I NDC
Clipping Rectangle Stored
non-s~;gment segment
INDC
Segment Transformation
I NDC Workstation Transformation I DC
Clipping
Figure 1.2: GKS viewing pipeline
~
t WC al and Global Modeling Transformation]
I NDC
Viewing Transformation I NDC Viewing Projection I NDC
Workstation Mapping I DC Figure 1.3: PHIGS viewing pipeline
q
8
CHAPTER 1. INTRODUCTION
identify three types of geometric transformation in a viewing pipeline, depending on how we specify them:
1. Window-io-viewpori mappings are specified by two rectangles called a window and a viewport. In general, both are parallel to the coordinate axes.
2. Imagings are specified directly by a matrix or by a combination of three primitive imagings of translation, scaling, and rotation.
3. Projections are specified by a set of viewing parameters such as the view reference point, the view plane normal~ and the view up vector. Alternatively, geometric transformations can be seen in terms of the concepts of the coordinate systems provided by a graphics system. The type, the domain coordinate system, and the range coordinate system of a geometric transformation are closely related to its graphical semantics in a system. For example, GKS has three coordinate systems, which are the world coordinate system (WC), ~he normalized device coordinate system (NDC), and the device coordinate system (DC). It provides three types of geometric transformation: normalization transformations are window-to-viewport mapping from WC to NDC, segment transformations are imaging from NDC to NDC, and workstation transformations are window-to-viewport mapping from NDC to DC. PHIGS has five coordinate systems, which are the modeling coordinate system (MC), the world coordinate system (WC), the viewing coordinate system (UVN), the normalized projection coordinate system (NPC), and the device coordinate system (DC). It provides five types of geometric transformations: local modeling transformations and global modeling transformations are imaging from MC to WC, viewing transformations are window-to-viewport mapping from WC to UVN, viewing projections are projection from UVN to NPC, and workstation mappings are window-toviewport mapping from NPC to DC. Clipping removes parts of primitives ~hat lie outside a given region. Generally speaking, clipping follows geometric transformation. The clipping boundary is often obtained from the preceding geometric transformation. The normalization transformation and the workst:Ltion transformation in GKS are both followed by clipping against their viewport. The workstation transformation in PHIGS is followed by clipping against its viewport, and the viewing projection by clipping against the view volume.
1.2.3
Picture Storage
Every conventional system includes a storage, which is considered to be placed between a certain
1.3. RELATED W O R K
9
two adjacent component transformations in the viewing pipeline. The very position of the storage splits the viewing pipeline into two parts. The system can process graphical objects in the viewing pipeline, building up the intermediate result in the storage from the first part of the viewing pipeline. The group of graphical objects in the storage is given a name, referred to by this name, and manipulated as a whole. Such a group is called a segmenl in GKS and Core, or a s~ruc~ure in PHIGS. Different systems provide different functions for picture-storing facilities. PHIGS allows the nesting and editing of a group, while the other systems do not. Screen update is realized by these picture-storing facilities. For instance, the storage in GKS is located between the "clipping rectangle stored" and "segment transformation" shown in Figure 1.2. This implies that screen updates occur when the setting of the workstation transformation changes. There are many other events that cause screen update: change of a segment transformation, change of a bundle representation, and so on. Screen update may be performed 'immediately' after some events when the required facifities are reafized by hardware. After other events, it may be performed by the software routine that retrieves the stored pictures one by one and processes them in the latter part of the viewing pipeline. This is called implicit regeneration. Since this is usually a time-consuming process, the system provides an option as to whether the implicit regeneration should be 'allowed' or 'suppressed.' Those famifiar with the v i editor and t h e / e t c / t e r r a c a p file may know similar situations in screen update. 1.3
Related Work
This section reviews previous major contributions to the formalization of graphics systems. 1.3.1
Specifying GKS
Dace et al. [3,4] applied to graphics software the two existing specification methods intended for general software systems. They first specified a simplified GKS system, applying the constructive technique known as the Vienna Development Method [23]. The simplifications, which they claim are made for illustrative purposes, include ignoring input facilities, restricting graphical output primitives to a polyline and fixing the workstation transformation. After specifying the system, they examined its external behavior and compared intuitive understanding with formal analysis. The behavior is intuitively described as follows: Consider the three workstation W1, W2 and W3. W1 supports dynamic modification for
10
C H A P T E R 1. I N T R O D U C T I O N changing the polyline bundle representations. W2 requires implicit regeneration, where the implicit regeneration mode currently takes the value of gLLOWED.W3 is the same as W~ except that the current implicit regeneration mode is StWPRESSED. Suppose that three workstations have the same polyline bundle representations and have no primitives outside segments. Then, if the same pictures are drawn and the same changes to the polyline bundle representations are made, the same pictures will appear on W1 and W2, and will be on W3 after the additional invocation of REDRAW ALL SEG~IEIqTS.
They 'formulated' the above description, and gave a formal proof of the formulated description by establishing the several invariants of the system behavior. They also applied the algebraic technique known as OBJ [24] to the specification of the same GKS system. Since OBJ specifications can be 'executed' by using data-type equations (axioms) as rewrite rules, they were able to check the above behavior in several actual cases with the OBJ interpreter, instead of proving it.
1.3.2
Mallgren's Specification
Mallgren [1] first succeeded in specifying interactive graphics programming languages. In principle, he used the axiomatic specification technique developed by Hoare [22]. He also employed algebraic data-type specification techniques in describing graphical data types such as picture, geometric transformation, region, and color. In addition, he devised a new technique based on algebraic specification to describe interactions in graphics systems. He then gave actual specifications to his prototype graphics language and two existing graphics systems, X P L / G and Core. He began his work by formalizing graphical concepts themselves before applying general specification techniques. This is necessary in order to describe the semantic features of a graphics system. Here, we introduce his formalization. He first gave the definitions for the following graphical concepts: 1. A picgure is a partial mapping from U to C. The set U is some chosen universe, which is typically E 2 or E 3. The set C is any set of reasonable values, which are referred to as colors. 2. A region is a set of points in U. 3. The sum of two pictures PI and P2, denoted by P1 + P2, is defined as follows:
1.3. RELATED W O R K
11
(P1 + P2)(q) =-
I P~(q)
q E D~ - 92
P2(q)
q ~ D2 - Dt
Pl(q)+P~(q) q E D2 A D, 4. A graphical transformation is a function that maps pictures to pictures.
5. A geometric transformation is a graphical transformation characterized by a mapping on U. The effect of a geometric transformation T g < G >, characterized by the mapping G : U ~ U, on a picture P is T g < G > (P) = {(G(x), P(z))]z e domain(P)}. (Note that a partial mapping is represented in terms of the set of pairs of each element in the domain and its mapped value.)
6. A restrictive transformation is a graphical transformation characterized by a region R. The effect of a restrictive transformation T" < R >, characterized by the region R, on a picture P is
T" < R > (P) = {(p, P(p))[p e R n domain(P)}. He then formulated the basic relations involved in a graphical transformation as below, and gave them a formal proof." Composition rules:
Tg < G1 > oT 9 < G2 >= Tg < Gl o G~ > T" < R1 > oT ~ < R2 > = T " < Rl n R2 > Commutation rules:
Tg
oT"
=T"
oTg
T" < R > o T g < G > = T g < G >oT" < G-I(R) > Distributive rules: Tg (P~)+T
T" < R > ( P 1 ) + T "
g(P2)=7
(P2)=T"
'9(P~+P2)
(PI+P2)
Following the presentation of these formalized concepts and relations~ he initiated discussions on the speci~cation of graphics programming languages, which was his original goal. 1.3.3
Detailed Viewing Pipeline
Onodera and Kawai [2] presented a formalization of computer graphics systems by specifying the concept of a viewing pipeline in detail. They first considered a mapping from the set X to the set Y ' , which is the set of all the tuples of the elements in Y: they named such a mapping a pipeline fuzction from X to Y. They represented
12
C H A P T E R 1. I N T R O D U C T I O N
any component process in a viewing pipeline as a parameterized plpehne function~ which is called an operation. For examples clipping dealing with hnes is a pipehne function from the set of lines
to the set of lines~ with two parameters corresponding to a window and a viewport. Note that clipping a line may generate more than one line. The detailed viewing pipeline can be represented as a sequence of operations. The authors consider a set of detailed viewing pipelines (DVPs) to specify a graphics system. Since any conventional graphics system gives a separate description of attribute rendition to each graphical output primitive, they defined a different DVP for each primitive. They also assumed that output primitives are eventually converted into line segments, or vectors~ in defining operations representing an attribute rendering, which seems to limit its application. They also considered the see of DVPs to formalize the output capabilities of a graphics system and even a graphics terminal. Another contribution of their work was their suggestion of the possibility of automatically generating of a graphics system on ~he basis of the DVP specifications. They presented the following procedure for implementing graphics system G with display device D so that the device capabilities are fully utilized: 1. Construct an operation sequence L O S (logical operation sequence), which is considered to be a formalization of G. 2. Construct an operation sequence P O S (physical operation sequence), which is considered tc be a formalization of D. 3. Transform L O S equivalently so that the component operations existing also in P O S occupy the rlghtmost successive positions in the same order as in P O S . 4. Realize as a device driver the leftmost successive operations, which are considered not to exist in P O S . For third stop, they presented the L O S conversion algorithm together with the proof of its validity. For this purpose, they established the commutative or pseudo-commutative relations between two operations and derived three concepts about two operation sequences: order-adaptiveness, the exceeding set, and realizability.
1.3.4
Comments
The work done by Duce et al. has been to specify the GKS system~ especialiy the external behavior of the system. The given specification appears as complex as if it were a program implementing GKS. In addition, they simply followed the viewing model of GKS and did not devise their own. Mallgren began his work by formalizing the basic graphical concept. Although we will do so in this
1.3. R E L A T E D W O R K
13
book, our purpose is not to specify a graphics programming language but to establish some model of visualization for specifying a graphics system. In this sense, our direction is closer to that of our previous work on a detailed viewing pipeline. However, the detailed viewing pipeline was just an extension of a conventionM viewing model: the treatment of attribute rendition is unsatisfactory and the assumption the authors made was restrictive. As shown in Section 1.3.3, the construction of an appropriate model of a system may be helpful in the automatic generation as well as in the specification of that system. It will also serve as a common model for the comparison of two systems. Carson's work [6], which attempts to make a common model of computer graphics systems, was initiated for this very reason, since we already have many computer graphics standards, including proposals.
Chapter Mathematical
2 Framework
This chapter establishes the mathematical foundation for our discussion. The base concept is correspondence [19], which is a general form of a mapping. Traditionally, one-to-many correspondences receive less attention than many-to-one. The former are not even named, although the latter are called mappings or partial mappings. Both types of correspondence, however, play an important role in this book. Operations on correspondences are introduced. In addition to the normal operations of inverse and composition, those specific to our goal of formalizing a graphics system are defined. They are
restriction, domain-priority-sum, and image-priority-sum. We complete the mathematical framework by defining three forms of extension of a correspondence. When a correspondence on M is given, we try to extend it to the power set of M~ to the closure of M, and to a correspondence space, respectively. We list many equalities in this chapter. Some are used in subsequent chapters and others are presented here for the sake of the completeness of our discussion on correspondences.
2.1
Correspondences
Let M and N be sets. When G C M × N is given, 7 = (G, M, N) is called a correspondence from M to N. The set G is called the graph of the correspondence and denoted as Gr 3'. The domain of 3', Dom 7, is defined as Dora 7 = {m](m, n) E G}, while the image of 7, Im 7, is defined as Im 3"
= {~t(m, ~) c a } . For x C M, 7(z) denotes the set {yl(x, y) C G}, and, for A C M, 3'(A) denotes the set U 3'(z). $CA
(3'(x) = ¢ when z ~ Dom 3'.) Two correspondences are defined to be equal if and only if they have the same graph. Correspondences are the most general form of a mapping: they are inherently partial. When 7 satisfies in addition Dora 7 = M, it is called a ~olal correspondence. A correspondence 7 is caned convergent if the predicate (Vz C Dom 3' : I7(z)l = 1) holds. This
C H A P T E R 2. MATHEMATICAL F R A M E W O R K
16
Figure 2.1: Divergent and convergent correspondences type of correspondence is usually called a parliaI mapping. A convergent correspondence 3` is called
a mapping if it also satisfies M = Dora 3`. A correspondence 3' is called divergent if the predicate (Vy E I m 3' : 17-1(Y)1 -- 1) holds. A correspondence 7 is called suT,verger~, if 7 is both divergent and convergent. E x a m p l e 2.1 Let 71 and 72 be the following correspondences: 3`, = ({(1, a), (2, a), (2, b)}, (1, 2, 3}, (a, b, c})
3`2 = ({(1, b), (3, b)}, (1, 2, 3}, {~, b, c}) See Mso Figure 2.1. The former is divergent and the latter is convergent. correspondence.
2.2
Neither is a total
[]
O p e r a t i o n s on C o r r e s p o n d e n c e s
We consider five unary or binary operations on correspondences. Although not every mapping has an inverse mapping, every correspondence 7 = (G, M, N ) has an
inverse 3,-1 = (G -1, N, M), where G -1 = {(y, z)t(z, y) E G}. For any correspondences 7, = (G1, M1, M2) and 72 = (G2, Mz, Ms), the correspondence from i l to M3, 73 -- (G3, M1, Ma), can be defined, where Ga = {(~,, z3)l(3x2 C m 2 : (~t, x2) E G1 A (z2, x3) e G2)}. 73 is called the composition of 71 and 72~ denoted _by "/2 o 71In addition to these received operations, we introduce three operations for our formalization of graphics systems Let 7 -- (G, M, N) be a correspondence and let R be any subset of M. The restriction of 7 onto
2.3. EQUALITIES
17
R, denoted by "/IR, is defined as follows:
Gr (TLR) = {(~,v)l(~,y) • Gr 7 A ~ •
~}.
For ally correspondences 7, = (G,, M, N) and 72 = (G2, M, N), the image-priority-sum of 72 and 71, denoted by 72 • 71, is defined by the rule Gr (72 @ 71) = {(zl, x2)l(zl, x2) • Gr 71 V ((xx, z2) • Gr 72 A z2 ~ Im 71)}Similarly, the domain-priority-sum of 72 and 71, 72 + 71, is defined by the rule Gr (72 + 7,) : {(*1, xz)[(z,, x2) E Or 71 V ((zl, z2) e Gr "/2 A zl ~ Dom 71)}It is worthwhile to note that these two kinds of sum are not commutative but associative. E x a m p l e 2.2 Consider the correspondences in Example 2.1 again and let R = {1, 3}. Then, the graphs of the restriction of 71 on R and two sums of 72 and 71 are as follows: Gr 711R = {(1,a)} Gr (72 + 71) = {(1, a), (2, a), (2, b), (3, b)}
ar (72 * 7,) = {(1, a), (2, a), (2, b)} The element (1, b) E Gr 72 is not contained in Gr (3'2 + 3'1) since 1 ff Dora 3'1. None of the elements in Gr 3'2 is included in Gr (72 (3 71), since b E I m 71- Similarly, Gr (71 + 72) = {(2, a), (2, b), (1, b), (3, b)} and Gr (71 (3 72) = {(1, b), (3, b), (1, a), (2, a)}. This shows that neither domain-priority-sum nor image-priorlty-sum is commutative.
[]
Table 2.1 shows what type of correspondence the result of each operation in the previous section would be in terms of the types of operand. For instance, we can see from the symbol "CON," which is on the last column in the third row, that if 71 and 72 are both convergent, so is the domain-priority-sum of the two. "DI" indicates that it is a divergent correspondence and "X" that it can be of either type.
2.3
Equalities
The relations, or equalities, between correspondences and their operations are fisted below, and can all be easily verified. We let 3' = (G, M, N), 71 = (G1,3/1, M2) and 72 = (G2, M2, M3). (2.1)
7(Dora 7) = I m 7
18
C H A P T E R 2. M A T H E M A T I C A L F R A M E W O R K
71
'72
71-1
72°71
72@71
72+71
DI
DI
CON
DI
DI
X
CON
CON
DI
CON
X
CON
Table 2.1: Results of applying correspondence operations
(2.2)
( ' 7 - ' ) - ' = "r
(2.3)
Dom '7-' = I m
(2.4)
Im "7-1 = Dom "7
(2.5)
(72 o 71)(A) = 72('71(A)), f o r A C M1.
(2.6)
('72 o ~,)-1 = '7;1 o 7; 1
(2.7)
Dora (72 o 71) = 7;1(D om 72)
(2.8)
Im (72 o 7,) = 7~(Im 7,)
We let R, RI, and R2 be a subset of M in the next four equalities. (2.9)
(7[R)(A) = 7(A N R), f o r A C M.
(2.10)
('TIR,)IR~ = '71(R, n R2)
(2.11)
Dom (TIR) = R N Dom "7
(2.12)
Im (TIR) = '7(R)
We let 7,, '72, and 73 be correspondences from M t o n
in the remaining equalities.
(2.13)
('72 • '71)(A) = ('72(A) N I--m--~l)U 'T,(A), f o r A C M.
(2.14)
('72 * '7,)-' = '7~-' + '7;'
(2.15)
Dora ('72 * '7,) = '7;'(I~ "72 n Ix~ ~)u
(2.16)
Im ('72 @ "7,) = Im 72 U Im 7,
(2.17)
(72 + 71)(A) = 72(A N Dom ~-1) O 71(A), f o r A C M.
(2.1s)
('72 + 7,)-' = "7;' * '7;'
(2.19)
Dom (72 + 71) = Dom '72 O Dora 71
(2.20)
Im (72 + "71) = "72(Dom "72 N Dora ~-1) u Im "71
(2.21)
72 + (72 + '71) = (73 + 72) + "71
(2.22)
"73 @ (72 * "71) : ('72 (B 72) * 71
Dora "7,
Only the proofs of Equalities 2.21 and 2.22 are given ill Appendix A. Here we present four propositions and two basic theorems. The first three propositions highlight the basic properties of divergent correspondences. All the proofs are given in Appendix A.
2.3. EQUALITIES
19
2
Figure 2.2: Correspondence for illustrating Proposition 3 P r o p o s i t i o n 1 Let 7 = ( G , M , N ) , A C M and B C M.
1..y(A u B) = ~(A) u ~(B). ,~. ~(A n
B) c ~(A) n ~(B).
3. 7 ( A N B ) = 7 ( A ) N T ( B )
i f T is divewerd.
D
P r o p o s i t i o n 2 Let 7 = (G, M, N ) and A C M . 1. 7-1(7(A)) D A n Dora 7.
[]
P r o p o s i t i o n 3 Let 7 = (G, M, N) be divergent. For any R C M, (71R)-' -- 7-~17(R). []
E x a m p l e 2.3 Let us show that the equality does not hold if 7 is convergent. Let R = {2} and consider the following convergent correspondence 7: =
frO, z), (2, z)}, {i, 2}, {x})
Then,
Gr @ R ) -1 = {(~, 2)}, while
Gr ~-II~(R ) ----{(~, 1), (~, 2)} since "7(R) = {z}. See also Figure 2.2.
D
P r o p o s i t i o n 4 Let 71 = (G, M, N), 72 : (G, M, N), aud R C M .
I. The equality (72 + 71)]R = (72}R) + (711R) holds. 2. The equality (72 • 7t)lR = (721R) • (7x[R) holds i f ' h ( R ) = Im 71. The first theorem below indicates the way of reducing the composition of two restrictions to one,
20
C H A P T E R 2. M A T H E M A T I C A L
M1
M2
M3 -
R1
FRAMEWORK
X
R2
Figure 2.3: Correspondences for illustrating the equality in Theorem 1 while the other specifies the condition on which the composition operator o is distributive over the image-priority-sum operator ~. Theorem
1 Let 7, = (G,, M,, M2) ~nd 72 = (~s, M2, M3). The eqn~Iitu
(72LRs) o (TdR,) = (Ts o 7,)](7?'(R2) n R,) holds if and only if T1 is convergenL [] Theorem
2 Let 7, = (G,, M,, M2), 72 = (G2, M,, M2) and 73 = (G~, Ms, M3). The equality
~ o (7s • 7,) = (7~ o 72) • ( ~ o 7,)
holds if and only if 73 is divewent. [3 E x a m p l e 2.4 Let us see that the equality in Theorem 1 does not hold if 7, is divergent. Consider the following sets and correspondences: M, = {a, b}, M2 = {1, 2}, M~ = {z, y} R, = M1, R2 = {2} C M2 7, = ({(a, 1), (a, 2)}, 11//1,M2) 72 = ({(1, x), (2, V)}, Ms, 11//3) See also Figure 2.3. In this case, 7, is divergent. Since 7,IR, = 7, and Gr %lR2 = {(2, y)}, Gr (72lR2) o (7,IR,) = {(a,y)}. On the other hand, since 71-'(R2) N R, = {a} and Gr 72 o 7, = {(a, ~), (a, y)}, Gr (72 o 7zlT~-'(Rs) fq R,) = {(a, ~), (a, y)}. []
E x a m p l e 2.5 Let us check that the equafity in Theorem 2 does not hold if 73 is convergent. Suppose that /1//1, 21//2, and 21//3 are the same as in the above example.
Consider the following
2.4. EXTENSIONS OF CORRESPONDENCES
M1
M2
21
M3
Figure 2.4: Correspondences for illustrating the equality in Theorem 2 correspondences: ~,~ = ({(a, ])}, M~, M~) 3'2 = ({(b, 2)}, M,, M2) 3'2 = ({(1, z), (2, z)}, M2, Ms) See also Figure 2.4. Since Gr 3'2 $ 3", = {(a, 1), (b, 2)},
Gr 3'2 o (3"~ ~ 3'~) = {(a, ~), (b,
~)}.
On the other hand, since Gr 3"2 o 3"2 = {(a, z)) and Or 72 o 3'x = {(b, z)},
Gr (3'~ o3"~) ~ (3'203",) = {(a, ~)}. E]
2.4
Extensions of Correspondences
In this subsection we define three extensions of a correspondence on a set. Let 7 = (G, M, M ) be a correspondence on M. W h e n 7 is a correspondence, the mappiug :r = (G, 2 M, 2 M) is naturally derived by the rule, n
i=1
is called the power se~ ez~ensiort of 3'. The ®-closure of a set S, denoted by S*, is defined as S U (S ® S) U (S ® S ® S) .... When 3' is a
mapping, the mapping 7* = (G, M*, M*) can be defined by the rule ( m l , ... , m . ) e M" ~-~ ( 3 " ( m l ) , . . . , ~(m,)).
3" is called the ®-closure ezlertsiort of 3". The last extension of a correspondence is for a set of correspondences. Let us denote by F(X, Y) the set of correspondences (correspondence space) from a set X to a set Y. When the above 3' and
22
C H A P T E R 2. M A T H E M A T I C A L F R A M E W O R K
a set N are given, the mapping from F(M, N) to P(M, N), denoted by .~N, can be obtained by the rule
; e r(M, S') A p' s.~. Gr
o' =
{(m, ,~)[(3(m', m) e Gr 7 A (m', n) e Gr p}.
The superscript of ON may be omitted when there is no confusion. By the definition of ~, the following equalities hold:
(2.23)
5(p) = p o'[-'
(2.24)
Dom 5(P) = 7(Dom p)
These extension operators obey the distributive law as described in the proposition below. Proposition 5 1. When "[1 and "f2 are a total correspondence, 2. When T1 and72 are a mapping,
"[2 o"-'-71 = 72 o ~¢1
('[2o'Yi)* = 7 ~ o 7 ~
3. When 71 and 72 are a correspondence,
'[2 o-~7i = ~'2 o "71
The following two theorems are quite interesting, though neither of these equalities holds unconditionally. The proofs are given in Appendix A.
T h e o r e m 3 Let 7 = ( G , , M , M ) ,
Pl = ( G 1 , M , N ) and P2 = ( G 2 , M , N ) .
1. The equality Zy(p2 + Pl) = Z/(P2) + zf(Pl) holds if "[ is divergent. 2. The equality "Y(P2~ P~) = "Y(P2) q~ 7(Pl) holds if'[ is divergent and Dom "[ = Dora Pt. []
T h e o r e m 4 Let 71 = (GI, M, M ) , "[2 = (G2, M, M ) and p = (Gp, M, N ) . The equality
('y2 • "[,)(p) = ~2(p) + ~,(p) holds if Dom 71 = Dora p.
[]
Figure 2.5 shows that the same pair of sets are given priorities in both sides of the above equality. The reason that the condition Dora 71 = Dora p is required will be explained in an intuitive m a n n e r in Section 3.1.9.
23
2.4. EXTENSIONS OF CORRESPONDENCES
M
P
M
P
--'~N
M "Y2
~'N
~1 (P)
--- N
P
M
M
*N
\ These sets are given priorities.
/
~,2(p)+~.l(p) N
These sets are given priorities
Figure 2.5: Diagram representing both sides in the equality of Theorem 4
Chapter 3 F o r m a l M o d e l of V i s u a l i z a t i o n
This chapter first gives a formalization of basic concepts in computer graphics, resorting to the mathematical framework constructed in the previous chapter. After identifying the two distinct concepts of
geometries and pictures, geometric transformations and restrictive transformations are
defined for each. In addition, a pictorializing transformation and a cumulative transformation are introduced. The former is the key to formalizing attribute rendering. Our formM model of visualization, called a
visualizing net, is then defined by using the above six
transformations. We also give specifications of visualizations of output primitives in conventional graphics systems in terms of a visualizing net. We will reveal ambiguities hidden in conventional specifications and point out deficiencies of conventional visualizing processes.
3.1 3.1.1
F o r m a l i z a t i o n o f B a s i c C o n c e p t s in C o m p u t e r
Graphics
Pictures and Picture Transformations
k picture is defined as a convergent correspondence (partial mapping) whose domain and image are a subset U of a Euclidean space and a set C of reasonable values, respectively. The set of pictures is denoted by P . This is the same as Mallgren's definition of a picture [1], and is generally accepted in the field of picture processing. Partiality is needed because the background region of a picture is supposed not to be assigned any color. The reason neither domains nor images are made very concrete is to deal with various types of pictures, such as two-dimensional or three-dimensional, black-and-white or colored. It is worthwhile noting that we can take U as a more general set than Euclidean spaces, as far as the discussions in Sections 3.1.1 through 3.1.3 are concerned.
A picture traesformation is a mapping from P to P . If a correspondence d on U is divergent, d c is a picture transformation. T h a t is, for any p E P , d(p)(= p o d -1) is also a picture: Table 2.1 shows that, since d -1 and p are both convergent, so is p o d -1. Figure 3.1 gives an intuitive illustration of how d transforms a picture p:
d(p) maps u in its domain to the same color as the one to which p
C H A P T E R 3. FORMAL MODEL OF VISUALIZATION
26
U
Domd
Domd~)-
C
/~
Figure 3.1: Picture transformation derived from a divergent correspondence maps the element that d maps to u. The hatched region represents the domain of the transformed picture.
3.1.2
Picture Sum
The sum of two pictures P2 and Pl is directly defined to be P2 + pl by using domain-priority-sum. Note that Table 2.1 shows that if Pl and P2 are pictures, so is P2 + Pl- This definition can be also regarded as representing the temporal display priority in the picture generation: the picture Pt has been generated after p~ and therefore takes priority of display. The mapping ~¢ from P x P to P, which maps (P2,Pt) to p~ + P l , is called a cumulative transfor-
mation. 3.1.3
Geometries and Geometry
Transformations
A subset of U is called a geometry. The domain of a picture is a geometry.
Usual geometric
entities on U, such as lines, point sequences, and areas, are also geometries. The set of geometries is denoted by G.
A geometry transformation is a mapping from G to G. When c is a correspondence on U, ~ is a geometry transformation.
3.1. FORMALIZATION OF BASIC CONCEPTS IN COMPUTER GRAPHICS 3.1.4
27
Geometric Transformations
The mappings on U called non-singular a ~ n e transformations play the central role in computer graphics systems. We denote the set of those mappings by M, since they can be represented by matrices. For any m E M, r~ and rh can be derived, rh and ~ are named a geometric geometry transformation and a geometric picture transformation, respectively, and are each regarded as a formalization of what is called a geometric transformation. The mapping t 9 from M × G to G, which maps (re, g) E M x G to rh(g), and the mapping t~ from M x P to P, which maps (re,p) E M × P to rh(p), are also referred to as geometric geometry transformation and geometric picture transformation, respectively.
3.1.5
Restrictive Transformations
Let g be a geometry. Two mappings (id[g) and (id[g) can then be derived, where id is the identity mapping from U to U. The two are named restrictive geometry transformation and restrictive
picture ¢ransformation, respectively, and are each thought of as a formalization of clipping. The mapping t, from G × G to G, which maps (9~,g2) E G × G to (id[gl)(g~), and the mapping ~R from G × P to P, which maps (9, P) C M x P to (id[g)(p), are also referred to as restrictive geometry transformation and restrictive picture transformation, respectively. Note that the two concepts of geometric transformation and clipping, which appear inherently different in conventional viewing models, are formalized in a unified manner.
3.1.6
Replications
Pattern filling is widely employed as an interior style for regional output primitives in conventional graphics systems. The filling is performed conceptually in two steps, the first of which is the infinite or sufficient filling of the whole space by the replication of a basic pattern. In the second step, the whole space is clipped against the area to be filled. The first operation is called replieatiou. A replication of a picture p can be represented by (r, @ ...r2 @ rl)-, where rl is a survergent correspondence and Dora ri(1 < :
i <:
n) is equal to Dora p. The picture p may be ca]led a
pattern. For (r, @...r2 @rl)" to be a picture transformation, ri must be a divergent correspondence. It will be clear in Section 3.1.9 why the other conditions for rl are needed. We do not require each r~ to be disjoint, as in conventional kernel systems such as GKS. Figure 3.2 gives an example of this general form of pattern generation.
CHAPTER 3. FORMAL MODEL OF VISUALIZATION
28
~
Domd
patternpicture p
"~ r3er2eqlUV
mappedby,~~N'~ ~r2@ mappedbyr2~ ) mappedbyr1~-~1 v~
C
~'--~ r,[-,(p)
Figure 3.2: Replication defined by three survergent correspondences 3.1.'/
Pictorializing Transformations
A formalization of attribute rendering can be given in terms of a replication. That is, an attribute rendition is defined to be a mapping from P x G to P, which maps (p, g) E P x G to (ink ¢ ... q~
ml)'(p), where ( m a ¢ ... ¢ ml)" is a replication of p and mi(k > i > 1) is constructed from the geometry g- This transformation is called a pictorializing transformation and denoted by ~p. As an example, we take the process of attribute rendering of a line through three line attributes such as line type, line width, and fine color, as in conventionM kernel systems. We regard the values of these attributes as collectively specifying one picture, which is one input to the pictorializing transformation. Together with the other input of the line geometry, the pictoriMizing transformation first constructs a replication: it generates a number of nonsingular affine transformations to 'paste' thz selected picture along that geometry. It then transforms the pictlzre by means of this constructed replication. Note that our formalization of attribute rendering is at the level of abstraction where it is unnecessary to describe such details as the set of attributes of a graphical primitive.
3.1.8
F i n i t e O r d e r e d Geometries
A finite ordered geometry is defined to be a member of U*. It can be considered as a sequence of
3.1. F O R M A L I Z A T I O N OF B A S I C C O N C E P T S IN C O M P U T E R G R A P H I C S
29
points. A sequence of points is essential in computer graphics system: graphical output primitives, windows, and clipping rectangles are all specified through a sequence of points.
Note that a
sequence of points is not necessarily a subset of U, but a multiset. As in pictures and geometries, geometric and restrictive transformations can be considered for finite ordered geometries. They are denoted as m* and (id]g)* by @-closure extensions, where
mCMandgCG.
3.1.9
Equalities
Here we enumerate equations involving the abovementioned transformations. All are derived from the propositions and theorems in Chapter 2. In what follows, m, g~ and p are members of M, G, and P respectively, whether or not they have any subscript. Equalities 3.1 and 3.2 follow Theorem 1. (3.1)
(idlg~) o (idlg,) = (idtg~ rig1)
(3.2)
rao (idig) = (idlm(g)) o m
In the latter, m can be replaced by (mlU) and both sides are simplified to (mlg). Proposition 5 and Equalities 3.1 and 3.2 validate the following equations: (3.3)
(ms o rnl) = rb,2 o r~,
(3.4)
(idlg~) o (idlg,) = (idlg2 n gx) ~
(3.5)
~ o (idlg) = (idlm(g)) ^ o
Similarly, (3.6)
(3.7) (3.8)
~ o (id[g) = (id[m(g))- o5~
(3.9)
(,~ oml)* =~; om;
(3.1o) (3.11)
(idlg2)* o(id]g,)* =(id]g2Ngx )"
(idlg2) o (idlg,) = ( i d ] g 2 n g l )"
m* o(id[g)* =(idlm(g))* om*
The reason for the intrusion of m into the restriction in Che (R.H.S) of Equafity 3.8 is intuitively illustrated in Figure 3.3.
Theorem 3 validates the next equafities. (3.12)
(id]a)(p2+pl)=(idlg)(p:)+(id[g)(pl)
(3.13)
rh(p2+p,) = S z ( p 2 ) + ~ ( p l )
C H A P T E R 3. FORMAL MODEL OF VISUALIZATION
30
J ~ __------ -q. i
\
_ clipping rectangle
/-
I
l (~aTg)
t~
l m"
i (idlm(g)~
clipping - rectangle
Figure 3.3: Intrusion of a geometric transformation into a restrictive transformation when the application order is reversed
3.2. VISUALIZING NETS
31
The next three equations are related to repfication, where p is a member of P and ( r , ~ . . . ~2 Or1)" is a rephcation of p. (3.14)
~o(r,@...r2@rl)-=((mor,~)~)...(mor2)@(mort))"
(3.15)
(idl9) o (rn ~ . - - T 2 ~ rl)" = ((rnfr~x(9)) ~.--(r2Ir~-l(9)) @ (rllri-l(9))) -
(3.16)
(v. * . . . r 2 * r , ) ' ( p ) = ~.(p) + . . . + ~2(P) + ~I(P).
Equalities 3.14 and 3.15 are derived from Theorems 1 and 2. The latter requires ri to be convergent. On lhe other hand, Equality 3.16 follows Theorem 4, which requires that Dom rl = Dom p(1 < i < n - 1). All these conditions are satisfied by the definition of replication. E x a m p l e 3.1 Let us give an intuitive explanation, in terms of pattern generation, as to why the above condition is necessary in order that Equality 3.16 holds. We assume that i=2 without loss of generality. Figure 3.4(a) shows a picture p and two survergent correspondences rl and r2; p assigns a single color in C to a circular region in U, while rl and r2 are simply translations of a square. We intentionally make the domain of p not equal to that of rl, and the images of rx and r2 overlapping. The pictures that both sides represent are illustrated in Figure 3.4(b) and (c). The image of r~ obscures the one of r2 in r2 • ra, and this causes a circle to be partly obscured in (r2 @ ra)'(p). On the other hand, the domains of ~,(p) and ;~(p) are disjoint, and that of ~2(p) + ~,(p) consists of two full circles. Note that it does not matter if Dora r2 = Dora p: r2's priority is lower on either side.
[]
In our formalization, these equafities are not regarded as axioms: instead, they can be proved on an even broader mathematical base.
3.2
Visualizing Nets
A visualizing net is
a
mapping to P, composed of the six transformations defined in the previous
section, tg, tG, t,, tR, rp, and to. A visualizing net can be represented by a direct acyclic graph whose nodes are component transformations and whose leaves are variables of the type of picture, geometry, or matrix.
E x a m p l e 3.2 The mapping
(gl, ml, p, g2, ra2, g) ~ tR(gl, to(m1, ~p(p, t,(g~, tg(m2, g))))) is a visualizing net. Figure 3.5 shows the DAG representation of this visualizing net.
32
CHAPTER 3. FORMAL MODEL OF VISUALIZATION
j U
U
U
C
(a)
U
U
U
r2¢r~
~
(r2er~('p),
(b)
U
2(P)+r"~(P)
rl(P) - ~ (c)
Figure 3.4: Pattern generation when Dora rl :~ Dom p
3.3. S P E C I F Y I N G V I S U A L I Z A T I O N S IN C O N V E N T I O N A L S Y S T E M S
MxG {tg G xG t r PxG
33
a sequence of geometry transformations
tn MxP {tG GxP {tR P
a sequence of picture transformations
Figure 3.5: Visualizing net
Visualizing nets can be generated by the following grammar. In other words, this grammar specifies how to organize visualizing nets validly.
TERMINAL SYMBOLS:
m, g, p, ( , ) , tg, ~a, ~,, IR, rp! t~
NONTERMINAL SYMBOLS:
G, P
START SYMBOL: P PRODUCTION RULES:
P --* g~(PP) I t a ( m P ) I tR(GP) ]tp(PV) [ p G ---* tg(G ) I ~,(GG) [ g D
m, 9, and p each denotes not a variable itself but an occurrence of a variable of that type. The typical organization of a visualizing net is one in which a sequence of geometry transformations is followed by only one pictorializing transformation, which in turn, is connected to a sequence of picture transformations. The visualizing net in Example 3.2 is such a case.
Note that there
are two intrinsically different transformations involved - - geometry transformations and picture transformations. As we will show in the next section, the visuafizing processes of most output primitives in conventional graphics systems can be specified in terms of a typical visualizing net.
3.3
Specifying Visualizations in Conventional Systems
This section specifies the visualizations of output primitives in conventional graphics systems in terms of a visualizing net. Each visualizing net is presented in a DAG representation, for clarity.
CHAPTER 3. FORMAL MODEL OF VISUALIZATION
34
normalization
/
a sequence of points
transformation---_~ M x G segment
~ tg
transformation --~ M x G Itg workstation _MxG transformation'J~ i tg
GxG
~tr line type _ . ~ P x G
tp
line color tR
.
clipping rectangle
P
Figure 3.6: Visualizing net of GKS polyline
3.3.1
Polyline in GKS
The process of visualizing polyline in GKS is modeled by a visualizing net, as shown in Figure 3.6.
According to the GKS document, three geometric transformations - - normalization transformation, workstation transformation, and segment transformation - - take place at the stage of the geometry transformations, although GKS has no distinct concepts of geometry and picture. This can be understood by observing that, for instance, a different setting of the workstation transformation in GKS does not affect the intervals between dashes when a dashed line is drawn. The pictorializing transformation takes as its input picture the one selected according to three polyline attributes, line type, line width and line color: this picture will determine the appearance of the line. The selected picture is replicated along the geometry of the line and the resulting picture becomes the output of the pictorializing transformation. This picture can be thought of as a greatly extended version of a so-called bit pattern :[or line types. Some graphics terminals are equipped with a mechanism of user-definable line types, which are specified through bit patterns of a certain length (16, 128, and so on). When the vector generator draws dots constituting a fine, it repeatedly references this bit pattern and draws a dot only if the referred dot is 'on'. The position where clipping occurs is not precisely specified in GKS. It is not defined whether clipping takes place at the stage of geometry transformations or at the stage of picture transfor-
3.3. SPECIFYING VISUALIZATIONS IN CONVENTIONAL SYSTEMS
~ )ictorializingltransformation
J
35
1/clipping rectangle
restrictive geon~etry transformation
clipping rectangle
restrictive geometry transformation pictorializing1transformation
\
\
Figure 3.7: Effects of two different restrictive transformations of polyline
mations. Figure 3.7 shows the differences in the visual effects between these two types of clipping sequence. The two pictures have different representations near where the clipping was performed.
3.3.2
Polymarker in GKS
The visualization of polymarker in GKS is modeled in terms of a visualizing net, as shown in Figure 3.8.
Three geometric transformations are applied in the sequence of geometry transformations, since the GKS markers are not geometrically transformed. The pictoriahzing transformation takes as the pattern picture the one defined by three marker
C H A P T E R 3. FORMAL MODEL OF VISUALIZATION
36
a sequence of points normalization / transformation---__~ M x G segment { tg transformation --~ M x G
~t
workstation MxG g transformation"~" { tg GxG f {tr markertype / ~ - P x G t~, maker size 1/ / ---.... ~" marker color / A G xP ~tR clipping rectangle P Figure 3.8: Visualizing net of GKS polymarker attributes and replicates it in the marker positions. That is, it places the picture in each of the marker positions. The position of clipping is specified in a more exact manner than for polyline. The GKS document says that the restrictive geometry transformation must be performed and that it does not matter whether the restrictive picture transformation occurs. Figure 3.9 shows the differences caused by two different restrictive transformations. In the left sequence, a fraction of the marker outside the clipping rectangle is visible.
3.3.8
L i n e in P o s t s c r i p t
Figure 3.10 shows the process of pictorializing line in Postscript [12].
There is one geometric transformation specified by a CTM (current transformation matrix). This is considered to be a geometric 'picture' transformation. A CTM is not regarded as a geometric geometry transformation, because a different CTM setting can cause differcnt linewidths. It is worthwhile noting that PostScript has no geometry transformation. As with polyline in GKS, such attributes as dash, linewidth, linejoin, and linecap determine an input picture for the pictoriahzing transformation, and the way in which it constructs a replication.
3.3.4
Fill A r e a in G K S
Figure 3.11 shows the process of visualizing a fill area in GKS whose interior style attribute is
3.3. SPECIFYING VISUALIZATIONS IN C O N V E N T I O N A L S Y S T E M S
37
clipping rectangle /-
.. 1. restrictive geor~etry transformation
pictorializingltransformation clipping rectangle
1
restrictive geometry transformation
)ictorializingI transformation
(}O( Figure 3.9: Effects of two different restrictive transformations of polymarker
current dash a sequence of points current linewidth / current linejoin current linecap P xG t n current ~ transformation ~ matrix (CTM) / G
/
MxP
i tG
xP
tR
P
current clippingpath Figure 3.10: Visualizing net of Postscript fine
CHAPTER 3. F O R M A L MODEL OF VISUALIZATION
38
interior style index
k
pattern up vector pattern base vector reference point
P xG.~p
a sequence of points--~G x P itR normalization ~ M x P transformation ~ tG segment ii MxP transformation ~ tG MxP workstation f ~ tG transformatio~/~
clipping rectangle
x P
~tR
p
Figure 3.11: Visualizing net of GKS fill area
PATTERN. Later we will touch on the process of visualizing the otherwise rendered fill areas.
Unlike in polyline or polymarker, a sequence of points does not flow through the main channel of the visuMizing net but defines the geometry for one restrictive picture transformation. Instead, a lattice defined by three attributes - - pattern height vector~ pattern width vector, and pattern reference point - - flows through the main channel. This modeling results from the careful reading of the corresponding part of the GKS document. The first transformation takes as a pattern the picture specified by the interior style index and replicates it along the lattice. The restrictive picture transformation then cfips the lattice against the geometry of the region specified by a point sequence. Following this, three geometric transformations and the additional restrictive transformation are performed in order. All the transformations occur in a sequence of picture transformations. The visualizing process for interior styles such as SOLID and HATCH can be described in a similar way to PATTERN: a sequence of points specifies the restricting region. On the other hand, the visuMizing process for the interior style HOLLOW is akin to the one for GKS polyline: a sequence of points is supposed to flow through the mMn channel of the net. This suggests the HOLLOWed fill area is inherently different from the otherwise rendered fill area, although they traditionally belong to the same group of fill areas.
3.3. SPECIFYING VISUALIZATIONS IN C O N V E N T I O N A L S Y S T E M S 3.3.5
39
Comments
Here we make a few observations drawn from giving specifications to the visualizing processes of conventional output primitives. First, we have exposed the ambiguities contained in such specifications as those given in Chapter 1.2. The ambiguities of clipping in GKS are possibly brought about by the lack of a distinction between geometry and picture. The GKS document specification does not even refer to two types of polyline clipping. On the other hand~ it recognizes the difference between two types of polymarker clipping. This is presumably because the changeover from geometry to picture is more drastic in polymarker. Second, the visualizing processes in conventional systems are rigid. The system designers organize them statically and the users can never change them dynamically. They are also limitied. GKS polylines are not subject to geometric picture transformations, nor are PostScript lines subject to geometric geometry transformations. Third, a conventional visualizing process is not orthogonal to the processed output primitive. Each output primitive has its own visualizing process. This necessitates a fuller description of a system: every primitive is given a separate visualizing specification. In addition, it prevents new primitives from being adding without affecting other parts of the system. Finally, the pictorializing transformation is so descriptive that it can specify every type of attribute rendering process, and so abstract that it can do so in a unified manner.
Chapter 4 Graphical Nucleus
Conventional systems realize only a part of the functionality of a visualizing net in their visualizing process. GKS and Postscript only allow either geometry transformations or picture transformations, and their viewing pipeline is rigid and dependent upon a graphical primitive. This chapter discusses a graphics system designed directly within the framework of a visuafizing net with 'full' functionality. The system is called a graphical nucleus. The objects involved within a visuafizing net, geometries and pictures, are conceptual at the net's level of abstraction. How can they be specified? The first section deals with this subject and gives definitions to the concept of a graphical primitive. The important property of a graphical primitive, called soundness, is also identified. After defining a graphical nucleus, we formally investigate its implementability, where the primitives with the soundness property play a central role. Some optimization considerations are also mentioned.
4.1 4.1.1
Geometric and Pictorial Primitives F o r m a l i z a t i o n of G r a p h i c a l P r i m i t i v e s
As in the formalization of geometric transformations and clippings, a graphical primitive is separately formalized for a geometry and for a picture. A geometric primitive is a partial mapping from a set of finitely generable objects to the set of geometries, while a pictorial primitive is a partial mapping from the set of finitely generable objects to the set of pictures. In this book we consider a finite ordered geometry as a finitely generable object: other viewpoints are possible provided they obey a certain condition described below. This means that we deal with geometric primitives from U* to G and pictorial primitives from U* to P.
E x a m p l e 4.1 Figure 4.1 illustrates typical instances of geometric primitives. The numbers carried by points indicate the order in which points appear in each finite ordered geometry. The simplest example is 7rt,~, which maps a sequence of points into the geometry of a line connecting them in order. A more complex example of line generation is 7r,vl, which constructs the geometry of a
CHAPTER 4. GRAPHICAL NUCLEUS
42
ITln,,,/
20
i •
2
4
6
O
6 10
ITspl
Q 3
5
o
D
1
•
~.
o
2
3
5
•
@
Figure 4.1: Examples of geometric primitives
spline curve from a sequence of points by applying a certain technique of spline curve generation. T h e geometric primitive 7r. . . . maps a sequence of points into the geometry of a n interior region as defined in the J o r d a n curve theorem. Finally, 7r~., generates the geometry of a circle from a sequence of two points so t h a t the first point is its center a n d the second point is a point on its perimeter.
Example
[]
4 . 2 We can consider the pictorial primitive 7rr;,~ < c > which generates from a sequence
of points the picture whose d o m a i n is a regional area defined as in 7r. . . . a n d in which every element in the d o m a i n is m a p p e d to one color c. Let us denote by
p(c)
the uniform-colored picture, t h a t
is, the one whose d o m a i n is U a n d which maps every u E U to c E C. T h e n , the above pictorial primitive is formulated by a restrictive t r a n s f o r m a t i o n as follows: ~p,~, < c >: 9 ~ Dom ~p,~ < c > 4 []
(i4~ .... @)'(p(c))
4.1. GEOMETRIC AND PICTORIAL PRIMITIVES
g
17 (g)
'v
U*
U*-----~ P r~
13"
(g)
'TT
~G
rrl* U* m* (g)
43
"G r~ (~r (g))
m*
U*
-p
m*(g)
~r( m* (g))
,'7( m" (g))
Figure 4.2: Soundness of geometric and pictorial primitives
4.1.2
Sound Property of P r i m i t i v e s
A geometric primitive 7r is called sound if the following predicate holds: (Vm E M : ~ o T r = ~r om*) Similarly, a pictorial primitive 7r is called sound if the following predicate holds: (Vm E M : t h a t
= 7r o m*)
See also the diagram in Figure 4.2. Not all the primitives satisfy this condition, as shown in the example below.
E x a m p l e 4.3 The geometric primitives 7rm, 7r,pt, and 7r. . . . all satisfy the soundness condition. In particular, this property of the methods of generating spllne curves is known as the shape-invariaatunder-transformation or Cauthy relation, which asserts that the sum of the base functions is equal to 1.
[]
E x a m p l e 4.4 The geometric primitive vd, c is not sound, since ~r,~,c always generates a circle but some geometric transformations convert a circle to a skewed ellipse. We believe that this way of generating a circle originated in mathematics but is not suitable for computer graphics. The general forms of circles, or ellipses, should have been specified by three points that define a pair of conjugate diameters. (See [10]).
[]
In fact, not a few graphics terminals or systems provide unsound graphical primitives, such as circles and rectangles. Obviously, these primitives bring about an unpleasant inconsistency in the viewing process. E x a m p l e 4.5 We can verify from the soundness of 7r. . . . that 7rpla is sound. For Vg E U*, ,~(~,.~ < c > (g))
44
CHAPTER 4. GRAPHICAL NUCLEUS = ( ~ o (~dI~ . . . . (g))')(p(c)) = ( ( i d l m ( ~ . . . . (g))- o ~)(p(c))
(3.s)
Since ~(p(c)) = p(c) and r~(A) = re(A) (A C U) by definition, =(idlr~(~r . . . . (g)))'(p(c))
=(idlv .... (m'(g)))'(p(c)) =~
4.2
(soundness of ~ ' ~ )
< c > (m'(g))
Graphical Nucleus
A graphical nucleus is a system whose geometric or pictorial primitives are all sound and which allows any visual net. The requirement for soundness is relevant to the implementability discussed in the next section. If we imitate the title of the famous book on algorithms and data structures by N. Wirth, our approach to specifying a graphics system can be concisely expressed as "primitives + visualizing net = graphical nucleus." The organization of its visualizing net is variable and is not dependent on a primitive.
This
orthogonality of a visual net and primitives makes a graphical nucleus open: adding a new geometric or pictorial primitive causes no problem. The generality of attribute rendering in a graphical nucleus, which is brought about by regarding attribute renditions as pictorializing transformations in a unified manner, make it much more descriptive than conventional systems. For instance, let us consider drawing a railway or road on a map. It is drawn in a graphics nucleus simply by giving an appropriate pattern picture to an appropriate pictorializing transformation. On the other hand, users in a conventional system will have to specify one by one the details of the geometry of railway or road patterns. Moreover, there are no limitations on pictures for pictorializing transformations. If a graphical nucleus provides marker drawing like that in conventional systems, the system can draw any markers, including pictures that are originally provided for the graphical representations of characters. On the other hand, the conventional systems make a strict distinction between makers and characters: markers cannot be drawn by a text primitive, nor can characters be drawn by a marker primitive.
4.3
Implementability
of a Graphical Nucleus
We examine in this section the implementability of a graphical nucleus. Let H~ and H v be the set of its geometric primitives and the set of its pictorial primitives, respectively. Note that all the primitives are sound by definition.
4.3.
IMPLEMENTABILITY
45
OF A G R A P H I C A L N U C L E U S
In the following claims, we first assert that any geometry and any picture comply with certain specific forms. We also present the proofs, which is based upon induction on their structures, that is, on the production rules generating them.
Claim 1 The geometry in a visualizing net is in the form of
N~,(g,),
~here ~, e
rig.
i
We prove the claim by induction on the structure of a geometry.
Proof:
STEPI:
The arbitrary geometry generated by a geometric primitive takes the specified form.
STEP2(A): Suppose the production rule G ---* t g ( M G ) is applied.
~(Ni ~,(g,)) =Ni ~(~,(9,))
(Prop. 1)
=Ni ~,(m*(~,))
(soundness of ~)
STEP2(B): Suppose the production rule G --* t , ( G G ) is applied.
(idl N =J(gJ))'(N~,(g,)) j
i
=(Nj ~J(g~))N(fl~,(g,)) In both cases we have shown that the form is preserved. []
Claim 2 The picture in a visualizing ne~ is in the form of
~ ( id[ N ~r,j(gij) )" ( ~,(gl ) ),
; j where 7rlj E lig and 7ri E lip. Proof:
We prove the claim by induction on the structure of P.
STEP1: Any picture generated by a pictorial primitive takes the specified form. STEP2(A): Suppose the production rule P --* t ~ ( M P ) is apphed.
i
j
(3.13) (3.8)
i
j
=~2(idl n m('~Ag~i))-(~(~',(g0)) i
(Prop. 1)
j
=~2(idl n,~,J(m'(y~A))'(~,(m'(g,)))
(soundness of 7%,Try) i j STEP2(B): Suppose the production rule P --4 t R ( G P ) is applied. From the result of Claim 5.1,
CHAPTER 4. GRAPHICAL NUCLEUS
46
=E( dl ffl :
i
ffl
(idl(f]
(3.12)
f-I(f-I
k
(3.7)
j
STEP2(C): Suppose the production rule
P -~ te(PG ) is applied.
By the definition of pictorializing
transformations,
(m~ @ ... ~ ml)- (~i (id' ~ 7:~j(g~i))'(~r~(gl))1 \" j /
By applying the same transformations as in case (a),
= ~ ~(idl A ~,J(m*k(gq)))-ffr~(m*(g~))) k
i
STEP2(D):
j
The proof in the case that the production rule
In every case we have shown that the form is preserved.
P -~ t:(PP)
is applied is self-evident.
[]
Let us return to our original problem of the implementability of a graphical nucleus. We describe how each component transformation is to be realized. Claims 1 and 2 indicate that the geometric transformations for a picture and for a geometry can both be reduced to the transformations for a finite ordered geometry, which are easily implemented. On the other hand, the restrictive transformations are simply accumulated, because they are inherently unsound. For instance, they usually destroy a geometry. A restricted ellipse is never an ellipse, but an elliptic arc or elliptic arcs. Similarly, a restricted polygon is no longer a polygon but appears to be a collection of line segments. This means that, for 7r E IIg, such a relation as
Vg c
G:
(idlg)
o ~r = ~r o ( i d l g ) *
cannot be established. The implementation of a pictorializing transformation is therefore to handle the form of input geometries into which the restrictive transformations are accumulated. That is, we need to implement a procedure that generates a set of matrices for a replication from its input geometry of the form specified in Claim 1. The final output of a visualizing net is rasterized. It is natural to assume that rasterizing a picture is distributive over the picture sum, +. Together with this, Claim 2 shows that we have to implement a procedure that rasterizes a picture whose form is
(id I ~,(g,))-(~(g))(~, ~ Hg,~ c II~). i
4.4.
OPTIMIZATION CONSIDERATIONS
47
The restrictive transformations also remain here.
4.4
Optimization
Considerations
In this section we discuss how to simplify or optimize an implementation of a graphical nucleus. The two procedures in the previous section can be simplified when we take advantage of the fact that, in most graphics systems, not all kinds of geometry are necessarily used to specify a restrictive transformation.
Neither line geometries nor texts ate never used as clipping regions
in conventional systems. O n the other hand, a considerable reduction in computing costs can be obtained by delaying the effect of a pictorializing transformation. A geometry that can be used to specify a restrictivetransformation is called a restrictive geometry. Let us denote by II,g the set of the geometric primitives that can generate a restrictive geometry. The forms of a geometry and a picture are then simplified to
and (idl n~r~(g~))'(~r(g))
(~r~E lI,g,~r E lip),
i
respectively. This reduces the number of cases that have to be considered in implementing the two procedures. Next, let us consider delaying the effect of a pictorializing transformation. As we have seen, a pictorializing transformation is immediately replaced by a replication in the proof of Claim 2. That is,
~p(v, g) = ( m ~ . . . . .
-~l)(p).
Subsequent picture transformations, if any, are supposed to apply the (R.H.S) in the proof. We consider the alternative, where tp(p,g) is not transformed and is itself subject to picture transformations. Since the successive application of picture transformations can be simplified by using Equalities 3.6~ 3.7, and 3.8, the counterpart of Claim 2 in the implementation of the delayed pictorializing transformation is as follows: Claim 3 The picture in a visualizing ne~ is the sum of pictures of the form (idl N -,(g,))- (,~(g)) i or
((idl n ~(g~)) o m)'(~,(;, ~(g)))
48
C H A P T E R 4. G R A P H I C A L N U C L E U S
where 7rl E Hp and m E M .
[]
It will be obvious that this leads to a reduction in the number of multiplications. Let us consider a picture generated by tp(p,g). Assume that the pattern p contains Np points and is replicated N, times along the geometry g, and that this picture is supposed to be subject to geometric transformations N~ times subsequently. The straightforward implementation needs Np × N, × Nt point-by-matrlx multiplications, whereas the delayed version requires N, matrix-by-matrix multiplications plus Np x N, point-by-matrix ones. This considerably reduces the computing costs. Moreover, if tp is sound for 7r, that is,
~(tp(p, ~(g))) = tAP, ~(-~'(g))), the picture of the second form is simplified to (idl A ~'(g~))-(t~(P, ~('~*(g))))" i
This requires only Nt matrix-by-matrix multiplications and Np point-by-matrix multiplications. Unfortunately~ we must mention that tp is rarely sound for any geometric primitive.
Chapter Implementation
5
of a Graphical
Nucleus
This chapter describes the implementation of a prototype system of a graphical nucleus, called
pNucleus. The system is written in Franz Lisp [20]. We present first a set of primitives in pNucleus, then the representations of the invocation of component transformations of a visualizing net, geometries, and of pictures. These representations are called V-expressions, G-expressions, and P-expressions, respectively. Appendix B contains a formal specification of the syntax in pNucleus denoted by the extended BNF. The implementation details of the component transformations are also described. The claims in Chapter 4 provide support for the validity of our implementation. Finally, the backend function p e v a l , which performs the actual conversion of pictures with specified representations into a visual medium, is mentioned together with the method of implementation. 5.1
G e o m e t r i c a n d P i c t o r i a l P r i m i t i v e s in p N u e l e u s
Suppose II,g,IIg, and IIp are given the same definitions as in Section 4.3. The system of pNucleus contains the following set of primitives:
II,, = {~ .... }
II~ = {%i**} where 7rt,,, 7r..... and 7rpict are introduced in Examples 4.1 and 4.2 and the others are defined as follows: 7rpt
simply generates from a sequence of points the geometry consisting of the specified points.
~rtat
generates from a sequence of three points P1,P2, and P3 the lattice whose reference point is P1 and whose width vector and height vector are P1P2 and P1P3, respectively.
The primitives of 7rrt and 7rz~t are originally meant for polymarker drawing and fillarea drawing, respectively. All the primitives are carefully selected to be sound.
CHAPTER 5. IMPLEMENTATION OF A GRAPHICAL NUCLEUS
50 5.2
Representation of Visualizing Nets
This section introduces V-ezpre~sions, which are the pNucleus representation of a visualizing net. The component transformations of a visualizing net are realized by Lisp functions.
The two
geometry transformations, geometric and restrictive~ are invoked by the following expressions, respectively: (*gtran*geom '<matrix> ') (*rtran*geom ' < r e s t r i c t i v e
geometry> ') .
The apostrophe(') indicates that the quoted argument is evaluated before a function is called. The expressions that represent a geometry are called G-e¢pressions. As defined in the previous section, a restrictive geometry can only be given in pNucleus by the specific geometric primitive 7r~¢~. G-expressions will be described in the next section. The two picture transformations, geometric and restrictive, are represented by the following expressions, respectively: (*gtran*pict
'<matrix> ' < p i c t u r e > )
(*rtran*pict
'
geometry> ' < p i c t u r e > ) .
The expressions giving a picture are called P-ezpressions, and will be explained in Section 5.4. The other two transformations are as follows:
(*pict*tran '