PROGRAMMING PARAMETERISED GEOMETRIC OBJECTS
IN A VISUAL DESIGN LANGUAGE
by
Omid Banyasad
Submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy
at
Dalhousie University Halifax, Nova Scotia
June 2006
© Copyright by Omid Banyasad, 2006
ii
DALHOUSIE UNIVERSITY
- DATE:
- June 12, 2006
AUTHOR: TITLE:
Omid Banyasad PROGRAMMING PARAMETERISED GEOMETRIC OBJECTS IN AVISUAL DESIGN LANGUAGE
DEPARTMENT OR SCHOOL: DEGREE: PhD
Faculty of Computer Science
- CONVOCATION: October
- YEAR: 2006
Permission is herewith granted to Dalhousie University to circulate and to have copied for non-commercial purposes, at its discretion, the above title upon the request of individuals or institutions.
Signature of Author
The author reserves other publication rights, and neither the thesis nor extensive extracts from it may be printed or otherwise reproduced without the author’s written permission.
The author attests that permission has been obtained for the use of any copyrighted material appearing in the thesis (other than the brief excerpts requiring only proper acknowledgment in scholarly writing), and that all such use is clearly acknowledged.
iii
Table of Contents
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ix List Of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii List of Abbreviations Used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiii Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv CHAPTER 1: Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Design Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 Computer-Aided Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.2 Mechanical Design Versus Digital Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Design Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.4 Research Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.5 Organisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
CHAPTER 2: Solids in Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.1 Lograph Syntax and Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.2 LSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.3 Relating Lograph to LSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 2.4 Design Synthesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.4.1 Masterkeying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.4.2 Keys and Locks in LSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 2.4.3 Key-Lock Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.4.4 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
iv
CHAPTER 3: Deterministic Lograph+C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.1 Lograph Execution Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.1.1 Order of Transformation Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.1.2 Ordering Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.1.3 Ordering Cells in Cases and Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2 Lograph+C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.2.1 Constraint Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.2.2 Constraint Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3.2.3 Constraint Satisfaction Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.2.4 Constraint Logic Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 3.2.5 Constraints in Lograph+C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3.3 Lograph Programming Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.3.1 Lograph Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 3.3.2 Lograph Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.3.2.1 Facilitate Navigation in Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 3.3.2.2 Orientation Cues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 3.3.2.3 Reducing Disorientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.4 Interpreter Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.4.1 Translating Lograph to Prolog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 3.4.2 Interpreting Lograph Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
3.4.2.1 Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3.4.2.2 Merge Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 3.4.2.3 Deletion Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 3.4.2.4 Backtracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.4.3 Running Programs in Debug Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.4.3.1 Finding A Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.4.4 Finding All Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 3.4.5 Just-in-Time Programming and User Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
v
3.5 Implementation Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 3.6 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
CHAPTER 4: Automatic Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.1 Mental Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 4.2 Drawing Query Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.2.1 Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 4.2.2 Foresighted Wire Adjustment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 4.2.3 Merge and Deletion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 4.2.4 Automatic Layout for Run Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
CHAPTER 5: A Formal Model for Solids . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5.1 Formal Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 5.2 Sample Look . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
5.2.1 Factoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .100 5.2.2 Relaxed Factoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 5.2.3 Sample Value Assignment Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
5.3 Transformation and High-level Parameterisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 5.4 Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
5.4.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 5.4.2 Reduction Formalism and Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118 5.4.3 Reducing Solids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136 5.4.4 Reduction Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142 5.4.5 Reduction Algorithm Optimisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147 5.4.6 Incremental Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150
5.5 Behaviour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .157 5.6 Multiple Behaviours . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163 5.7 Motion Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
vi
5.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172
CHAPTER 6: Solid Modeling for LSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
6.1 Explicit Components and Operations in LSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175
6.1.1 Explicit Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175 6.1.2 Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .178
6.2 Common Solid Modeling Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179
6.2.1 Classical Solid Modeling Schemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
6.2.1.1 Constructive Solid Geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181 6.2.1.2 Boundary Representation (b-rep) . . . . . . . . . . . . . . . . . . . . . . . . . . .181 6.2.1.3 Sweep Representation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182
6.2.2 Other Representations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .182 6.2.3 Commercial Solid Modelers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183
6.3 PLaSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183
6.3.1 Non-geometric Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 6.3.2 Geometric Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 6.3.3 PLaSM Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185
6.4 LSD and PLaSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186 6.5 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194
CHAPTER 7: Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
7.1 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197 7.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198
7.2.1 Programming Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 7.2.2 Animation of Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .199 7.2.3 Defining Behaviours by Demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200 7.2.4 A Continuous Domain Constraint Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202
7.3 Final Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .204
vii
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 Appendix A: LSD Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 Appendix B: Formal Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Appendix C: Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
C.1 Interpreter Engine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 C.2 Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
C.2.1 Basic Reduction Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247 C.2.2 Optimised Reduction Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 C.2.3 Reduction Algorithm Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .250
C.3 Translator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253
viii
List ofTables
Table 2-1: A key-lock matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 Table 3-1: Boundary conditions for the initial invocation of a literal. . . . . . . . . . . . . . . . . . . . 66 Table 3-2: Case selection for the recursive meta-call to a literal. . . . . . . . . . . . . . . . . . . . . . . 67 Table 4-1: Wire adjustment algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 Table 6-1: Relating the generic blueprint for a knot to Definition 5.21. . . . . . . . . . . . . . . .190 Table A.1: Symbols in LSD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
ix
List Of Figures
Figure 2.1: A function cell. ........................................................................................................................................... 16 Figure 2.2: A list in Lograph........................................................................................................................................ 17 Figure 2.3: A literal cell. ................................................................................................................................................. 17 Figure 2.4: Cases of the definition Concat......................................................................................................... 18 Figure 2.5: Execution steps of a query in Lograph........................................................................................ 19 Figure 2.6: A query with a guard terminal.......................................................................................................... 20 Figure 2.7: Components of a key solid with two possible bit cuttings.............................................. 21 Figure 2.8: The LSD designs Key and Partial-Key............................................................................................. 23 Figure 2.9: Two cases of the design Bit................................................................................................................ 24 Figure 2.10: A key specification, and the replacement rule...................................................................... 25 Figure 2.11: The assembly process......................................................................................................................... 26 Figure 2.12: Key assembly process.......................................................................................................................... 27 Figure 2.13: A side view of a lock and one of its keys................................................................................ 29 Figure 2.14: Lock and Partial-Lock cases............................................................................................................. 31 Figure 2.15: Chamber design..................................................................................................................................... 32 Figure 2.16: Open and Member definitions...................................................................................................... 33 Figure 2.17: Masterkeying problem........................................................................................................................ 34 Figure 2.18: Query result.............................................................................................................................................. 35 Figure 3.1: A relation cell.............................................................................................................................................. 45 Figure 3.2: A constraint cell (a) and its specification (b)............................................................................ 46 Figure 3.3: Definition member.................................................................................................................................. 48 Figure 3.4: Execution mode icons........................................................................................................................... 54 Figure 3.5: A query window and a query runtime window..................................................................... 55 Figure 3.6: The control flow diagram for the replacement of a literal............................................... 68 Figure 4.1: Expansion of a query graph................................................................................................................ 80
x
Figure 4.2: Wire adjustment....................................................................................................................................... 81 Figure 4.3: Shrinking a query graph......................................................................................................................... 86 Figure 5.1: A Square in the design space............................................................................................................ 93 Figure 5.2: An unsuccessful application of Bonding....................................................................................... 96 Figure 5.3: Application of Bonding to two rectangles.................................................................................. 97 Figure 5.4: Sample looks of two trapezoids...................................................................................................... 99 Figure 5.5: A scaling operation................................................................................................................................114 Figure 5.6: Solid Arm(b,c,d,e,l,a,r)..........................................................................................................................119 Figure 5.7: A Partial-Robot solid............................................................................................................................142 Figure 5.8: An equality constraint graph............................................................................................................143 Figure 5.9: A simplified equality constraint graph.........................................................................................146 Figure 5.10: A Robot with articulated arm......................................................................................................169 Figure 5.11: Two curves representing two motions for Robot...........................................................170 Figure 5.12: Two motions for Robot..................................................................................................................171 Figure 6.1: Designs Pol and Partial Pol................................................................................................................187 Figure 6.2: Slice solid, and LSD representations of Slice and the bond operation.....................188 Figure 6.3: A query (a) and its state before merge and deletion (b)...............................................189 Figure 6.4: An anchor-knot graph.........................................................................................................................189 Figure 6.5: Reduced anchor-knot graphs..........................................................................................................192