SOLID MODELLING USING LINEAR OCTREE REPRESENTATION By
Total Page:16
File Type:pdf, Size:1020Kb
SOLID MODELLING USING LINEAR OCTREE REPRESENTATION By SHEUNG-LAI SUNNY HO B.Math (Hons.), University of Waterloo, 1983 A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE in THE FACULTY OF GRADUATE STUDIES (DEPARTMENT OF COMPUTER SCIENCE) We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA October 1985 © Sheung-Lai Sunny Ho, 1985 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at the University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the head of my department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. Department of COH?0T£R SCIENCE The University of British Columbia 1956 Main Mall Vancouver, Canada V6T 1Y3 Date OCTOBER 2., Abstract Object representation is the backbone of any solid modelling system. Hierarchical spatial decompositions of objects called octrees introduced very efficient algorithms for boolean set operations and some restricted classes of geometric transformations. Linear octrees, a compact encoding of the octrees, result in a significant reduction of storage requirements, and lead to simpler algorithms for most modelling operations. This thesis investigates some properties of linear octrees with emphasis on object genera• tion. By interpreting linear octree node digits as binary numbers, some simple conversion and node trimming algorithms are found, which when combined with a node enumeration algorithm, generate the linear octrees of cuboidal volumes efficiently. A simple and uniform approach is devised to perform arbitrary geometric transformations by means of cuboid generation. Exper• iments shows these algorithms maintain the efficiency of special cases while degrading linearly with the number of intermediate nodes generated. ii Contents Abstract ii Contents iii List of Figures vi List of Tables vii Acknowledgement viii 1 Introduction 1 2 Object Representations 3 2.1 Solid Objects 3 2.2 Primitive Instancing 3 2.3 Boundary Representation 4 2.4 Spatial Enumeration 6 2.5 Octrees 6 S Linear Octree Representation 9 3.1 The Linear Octree 9 3.2 Terms and Notations 10 3.3 Basic Operations 12 3.3.1 Conversion of a node to its lowest and highest order voxel coordinates . 12 3.3.2 Conversion to the largest node from its lowest order voxel coordinate ... 13 3.3.3 Sequential node generation • • 13 3.3.4 Trimming against a lower bound • • 15 3.3.5 Trimming against an upper bound 16 3.3.6 Normalizing an object • • 17 3.4 Object Generation • • 17 3.4.1 Parametrically defined objects 17 3.4.2 Cuboid 18 iii 3.4.3 Ellipsoid 19 3.5 Other solids '. 20 4 Modelling Operations 21 4.1 Geometric Transformations 21 4.1.1 Translation 21 4.1.2 Scaling 23 4.1.3 Rotations 25 4.1.4 Compound Transformations 30 4.2 Boolean Set Operations 30 4.2.1 Union 31 4.2.2 Intersection 33 4.2.3 Difference 33 5 Implementation and Results 36 5.1 A Solid Modelling Package 36 5.2 Representation of Linear Octrees 37 5.2.1 Internal Representation 37 5.2.2 External Representation 38 5.2.3 Input/Output 39 5.2.4 Node Retrieval 40 5.2.5 Normalization 40 5.3 Operations on linear octree nodes 40 5.4 Modelling Operations 41 5.4.1 Translation 41 5.4.2 Scaling 42 5.4.3 Rotations 43 5.4.4 Normalization 43 5.4.5 Boolean Set Operations 44 5.5 Auxiliary Library Functions , 44 5.5.1 Object Generation 44 5.5.2 Rendering 45 5.6 User Commands 46 5.7 Results and Evaluation 46 6 Conclusion 51 6.1 Summary 51 6.2 Future Work 52 Bibliography 54 iv A The Solid Modelling Package 56 A.l The Linear Octree Library 56 A.2 User Programs 61 v List of Figures 2.1 Construction of an object by set operations on primitive instances 4 2.2 Unwanted edges produced from union of two objects 5 2.3 An "impossible" object from boundary representation 5 2.4 An object and its octree representation 7 3.1 Digit assignments for linear quadtrees and linear octrees 11 3.2 A circular disk of diameter 15 in a domain of resolution 4 consists of 54 nodes. 12 3.3 Conversion of octree nodes to their corner voxels 13 3.4 Conversion to octree nodes from their lowest order voxels 14 3.5 Node 2FFF trimmed by lower bound y = 10 15 3.6 Node 3FFF trimmed by upper bounds x = 10 (a), and x = 11 (b) 16 4.1 Translation of a node by different multiples of 2 22 4.2 Scaling a node by different factors 24 4.3 Severe fragmentation results for almost any angle of rotation 25 4.4 Holes and duplicates resulting from forward mapping 26 4.5 Re-sampling of pixels in target under backward mapping 27 4.6 Region occupied by a node of size d x d 28 4.7 Partition of 2FFF under expand(2FFF, 213F) 34 5.1 An overview of the solid modelling package 37 5.2 Data structure of an object 39 A.l Various stages in creating an object 63 vi List of Tables 5.1 Badness of objects vs. badness of translation components 41 5.2 Execution times for object generations 48 5.3 Execution times for translation by (ta,t9,tz) 49 5.4 Execution times for scalings by (s„, s9, »x) 49 5.5 Execution times for rotations by $ degrees 50 5.6 Execution times for boolean set operations 50 vii Acknowledgement I would like to thank my supervisor, Dr. Gunther F. Schrack for his guidance and suggestions for this thesis, and to thank Dr. Robert J. Woodham for reading the final draft. The variety of computing facilities at UBC has added fun to the serious academic work. Spe• cial thanks are directed to all fellow graduate students who have been very helpful in answering questions. viii Chapter 1 Introduction Solid modelling refers to the theory and practice for computing the properties of and ma• nipulating solid objects represented by some abstract data structures. It is becoming popu• lar in many computer graphics applications. Evolving throughout the past decade, the tech• nology has now been transferred from the stage of research projects to production systems [REQU82,REQU83]. Areas such as engineering design, manufacturing, architecture, and medi• cal imagery are using solid modelling as a standard tool. In recent years, even the advertisement and movie industries are using the technology to achieve special effects. Object representation [REQU80] is the basic foundation of any solid modelling system. Un• til now, most systems used boundary representation and/or primitive instancing as their basic building blocks. Such schemes provide a good approximation of real solids and allow exact ge• ometric transformations, but make boolean set operations, a necessity in solid modelling, and geometric and topological property calculations somewhat difficult. To overcome these, a spa• tial enumeration scheme called octreet [JACK80,MEAG82] was introduced, which decomposes hierarchically the three-dimensional Euclidean space (2JS) and expresses the objects residing in it in the form of ordered 8-ary trees. However, octrees often require excessive amounts of 1 CHAPTER 1. INTRODUCTION 2 storage for their nodes and pointers even for moderately complex objects. The linear octree [GARG82] was devised to reduce the storage requirement dramatically by storing only the leaf nodes using a special encoding scheme. This thesis takes a different look at linear octrees to take full advantage of their mathemat• ical properties. Efficient algorithms were derived that extensively use bitwise operations. A complete set of modelling operations is also described. Chapter 2 gives a brief overview of var• ious solid representation schemes. Chapter 3 describes the linear octree as used in this thesis, on which new operations, such as node trimming, and object generation algorithms are derived. The standard geometric transformations—translation, (arbitrary) scaling, and rotations, which make use of the new object generation algorithms, are discussed in Chapter 4. Boolean set operations—union, intersection, and difference—and rendering techniques are also included for completeness. An experimental implementation is described in Chapter 5, along with some evaluations on the solid modelling package. Chapter 6 summarizes this work, lists unsolved problems, and suggests possible extensions and future work. Chapter 2 Object Representations 2.1 Solid Objects The primary interest of solid modelling is manipulation of solid "physical" objects. More precisely, these objects are subsets of E3 that are well-behaved, represent able, and occupy non-zero volume; curves and surfaces are not considered valid solids in this context. In addi• tion, boolean set operations are regularized so as to maintain closure. The following sections briefly outline 3ome of the common solid representation schemes and lists their advantages and disadvantages. A thorough survey can be found in [REQU80]. 2.2 Primitive Instancing Primitive solids such as cubes, spheres, and prisms can be represented easily and exactly by just a few parameters. Most mechanical parts can be constructed by applying set operations on instances of these primitives, such as the object in Figure 2.1. Set operations can be simplified since intersections of object surfaces can be solved analytically. However, the restricted class of solids makes primitive instancing difficult to extend to a wider range of applications. Production systems do not rely solely on primitive instancing, but rather include it as a means for input.