UFDC Home  myUFDC Home  Help 



Full Text  
SOLID MODELING USING IMPLICIT SOLID ELEMENTS By JONGHO LEE A DISSERTATION PRESENTED TO THE GRADUATE SCHOOL OF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE DEGREE OF DOCTOR OF PHILOSOPHY UNIVERSITY OF FLORIDA 2003 Copyright 2003 by Jongho Lee To my lovely family ACKNOWLEDGMENTS I would like to express my sincere gratitude to my advisor and the chairman of my supervisory committee, Dr. Ashok V. Kumar, for his guidance, encouragement and patience throughout my study. I feel myself very fortunate not only to have benefited from his academic guidance but also to have enjoyed his invaluable friendship. Without his assistance this study would never have been completed. I am also grateful to my committee members, Dr. John C. Ziegert, Dr. John K. Schueller, Dr. Carl C. Crane and Dr. Baba C. Vemuri, for their advice, comments and patience in reviewing this dissertation. I would also like to thank my parents, brothers, my wife, Duyoung Kim, and my lovely two daughters, Jasmine and Anna, for their valuable love and continuous support during my study. TABLE OF CONTENTS Page A C K N O W L E D G M E N T S ................................................................................................. iv LIST OF TABLES .............................. ..... .... .. .. ............... ....... viii LIST OF FIGURES ......... ......................... ...... ........ ............ ix A B S T R A C T .......................................... ..................................................x iii CHAPTER 1 IN TR OD U CTION ............................................... .. ......................... .. 1.1 O overview ..................................................................................................... ....... 1 1.2 G oal and O bjectives.......... ......................................................... ............... .4 1.3 O utlin e ......................................................................... . 4 2 SOLID REPRESENTATION SCHEMES ....................................... ............... 6 2 .1 G eom etric M o d elin g .................................................................... .....................6 2.2 Constructive Solid Geometry (CSG).............................................. ............... 7 2.3 Boundary Representation (BRep) ............................................... ............... 11 2.4 H ybrid System ............................................ .. .. .... ........ ......... 13 2.5 Sw eep Features ........................ .... .. .. .................. .......... .... ............... 14 2.6 Im plicit Surfaces or Level Set Surfaces..................................... ............... 15 3 IM PLICIT SOLID ELEM EN TS ........................................ .......................... 17 3.1 Definition of Implicit Solid Elements...........................................................17 3.2 Definition of the Solid within an Implicit Solid Element............... ................ 20 3.3 3D H exahedral Solid Elem ents....................................... .......................... 21 3.4 D efining and Editing Prim itives .......................... .... ......... ............... .... 23 3.5 Defining Complex Geometries using Implicit Solid Elements ..........................25 3.6 Heterogeneous Solid Model Capability.....................................................26 4 TWO DIMENSIONAL PRIMITIVES ............................................ ............... 28 4.1 2D Primitives by 9Node Quadrilateral Elements..............................................28 4.2 M apping in 2D Solid Elem ents....................................... .......................... 32 5 CONSTANT CROSSSECTION SWEEP......................................................36 5.1 E xtrude E lem ents ................................................................ .. .. .............. 37 5.2 Revolve Elements .................................. .. .. .. ........ ...............40 5.3 Sw eep Elem ents .................. ...................................... .. ...... .... 42 6 VARIABLE CROSS SECTION SWEEP ...................................... ............... 46 6 .1 Straight B lend E lem ent.............................................................. .....................47 6.2 Sm ooth Blend Elem ent........................................................... ............... 55 6 .3 S w e ep B len d ................................................................. ................................6 7 7 CSG REPRESENTATION USING IMPLICIT ELEMENTS .................................69 7.1 Surface N orm al V ectors .......................................................... .....................69 7.2 Set membership classification within an element............... ............ 74 7.3 Constructive Solid Geometry using Implicit Solid Elements...............................77 8 VOLUME OF THE SOLID MODEL ............................................. ............... 88 8.1 Linear Approximate Step Function .................................................. 88 8.2 Constructing the Step Function for the CSG Solid................................... 91 8.3 Computing the volume of the solid .............................. ...............93 9 ALGORITHM FOR GRAPHICAL DISPLAY................................... .................. 101 9.1 Overview of Com puter Graphics............................................... .................. 101 9.2 2D Prim itive D display .......................................................... ............... 102 9.3 2D B oolean R esult D display ........................................ .......................... 104 9.4 3D Prim itive D display .......................................................... ............... 106 9.5 3D B oolean R esult D display ........................................ .......................... 108 9.6 Discussions and Suggestion for improvement..............................116 10 CONCLU SION AND DISCUSSION ................................................................. 118 10.1 Conclusion .................................... ............................... ......... 118 10.2 Future W ork .................. .................. ................ .......... .......... .... 119 APPENDIX SCENEGRAPH AND CLASS STRUCTURE..........................................................120 A. 1 SceneGraph Structure for Java3D............... ...................... ............... 120 A .2 SD M odeler C lasses................................................. .............................. 121 A .3 SD M odeler Class Structure ........................................ ........................ 122 L IST O F R E FE R E N C E S ......................................................................... ................... 125 BIOGRAPHICAL SKETCH ............................................................. ..................127 LIST OF TABLES Table pge 31. Basis functions for the 9 node quadrilateral element .............................................. 19 32. Hexahedral 8node basis functions....... .. ........... .... ..................... ........... 22 33. Hexahedral 18node basis functions................ ......................... ...............22 41. Samples of 2D primitive design ......... ....... ....................................... 30 42. Analytical solutions for the 4 node quadratic element mapping (parallelogram) ......34 43. Analytical solutions for the 4 node quadratic element mapping (nonparallelogram)35 71. Surface normal vectors on the boundary of the element ..........................................73 81. Simple examples for Boolean operation between approximate step functions where fi and f2 both represent squares......................................................... ............... 90 82. Function operator denoted by B where hA and hB are any arbitrary step functions ....93 83. Volume integration of Figure 86 by changing subdivision number where exact volume is 1.589 (Order of integration = 3, e =0.001)...................................98 84. Volume integration of Figure 86 by changing the order of gauss integration where exact volume is 1.589 (Subdivision # = 4, e =0.001) .......................................... 99 85. Volume integration of Figure 86 by changing E in the linear step function where exact volume is 1.589 (Order of integration = 3, Subdivision # = 4)....................99 86. Examples for computing the volume of the solid .............................................99 LIST OF FIGURES Figure pge 21. Exam ple of C SG binary tree structure................................... ...................... ........... 8 22. Comparison between the ordinary Boolean and regularized Boolean operation .........8 23. Regularized Boolean treatment in overlapped case.....................................................9 24. Examples of neighborhood models on the vertices in 2D.............................. 10 25. Mathematical description of the primitives by halfspaces A) Halfspace by xy plane B) Block by half spaces C) Cylinder by half spaces ...............................11 26. Basic concept of BRep model ............................................................................12 27. Example of typical BRep data structure................... ..... ....................... 13 31. Quadrilateral 9node element in two different coordinate systems A) Parametric space (r, s coordinates) B) Real space (x, y : Global coordinates)........................18 32. Density distribution within a 9 node quadratic element A) Density fringes B) Density contours C ) D ensity Plot ................................................ .............................. 20 33. Solids defined using 3D hexahedral elements A) 8 Node element B) 18 Node e le m e n t ........................................................................... 2 3 34. Editing the face represented using 2D element .............................................. .24 35. Three ways of editing solids represented using 3D element.................................. 25 36. Implicit representation of planar face using shape density function A) Density Grid B ) C ontours of density function .................................................................... ..... 25 37. 3D Composition Destribution A) 8node element B) 18node element...................27 41. 2D primitive examples A) Rectangle B) Circle C) Ellipse .....................................28 42. Constructing a 2D primitive by the part of an existing shape .............. .................31 43. 2D primitives and its nodal density distribution A) Quarter circle B) Semi circle C) Triangle D ) W edge shape............................................... .............................. 31 51. 2D primitive element and the corresponding extrude element...............................37 52. Solid created by extruding ellipse ........................................ ......................... 39 53. Extrusion of profile defined using multiple elements ................ .............. ..........40 54.. Cylindrical coordinate system for revolving .................................. ............... 40 55. Mapping from cylindrical to Cartesian coordinates ................................................41 56. Exam ples for revolved solids ............................................................................... 42 57. Relationship between the global and local coordinate systems...............................43 58. Examples of solids created using sweep elements ............................................. 45 61. Two neighboring straight blend elements having quadrateral 9 node elements as 2D p ro file ............................................................................ 4 9 62. A straight blend element having quadratic 9 node elements as 2D profiles..............50 63. Cross section at a certain t* in the straight blend element........................................52 64. Examples of straight blend using blend elements ............................................... 55 65. Two neighboring smooth blend elements having quadratic 9 node elements as 2D p ro file ............................................................................ 5 7 66. A smooth blend element having quadratic 9 node elements as 2D profile ...............60 67. Cross section at a certain t* in smooth blend elements ...........................................62 68. Examples of Smooth blend using blend elements.................................................67 71. Flow chart for setmembership classification in an individual solid element ............76 72 C SG tree data structure.............................................................................. ........ 77 73. 2D Boolean operation in CSG ............. .............................................................78 74. 3D Constructive Solid Geom etry Tree ............................................ ............... 79 75. surface normal vectors and corresponding triangles ...............................................82 76. Constructing a triangle from one normal vector.............................. ...............82 77. Constructing two triangles from two normal vectors..............................................83 78. Constructing three triangles from three normal vectors ............................................84 79. Neighborhood model using graphical method................................. ............... 86 81. Linear approximate step function graph............................................ .................. 88 82. Transform from the implicit surface function to its linear approximate step function89 83. Implicit surfaces defining a solid within an element in the parametric space A) 2D solid elem ent B) 3D solid elem ent ............ .................................. ............... 91 84. Labeling CSG tree nodes for constructing the approximate stepfunction ................92 85. Subdivision of the 2D element and subdividing method A) Quadtree subdivision in a 2D element B) An example of quadtree representation structure C) An example of octree representation structure ........................................... .......................... 95 86. A simple 2D example used for comparing the numerical integration results by changing some parameters such as subdivision number, order of integration and ...................................... ......................................................................... 9 8 91. Graphics of a curve ................................ .................................... 101 92. Graphics of a sphere and its triangulation ..... ......... ...................................... 102 93. Ray methods for finding points on the boundary of the solid in 2D ........................103 94. Computing the points on the boundary of the ellipse...............................................104 95. U nion of tw o squares in 2D ........................... ................................ ............... 105 96. Bounding box for a 2D solid element........ ............................ ................. 106 97. Computing the points on the boundary of the solid A) 2D profile to be swept B) Points on the extrude C) Points on the revolve D) Points on the sweep................107 98. Finding the points on the boundary of the varying cross section sweep ................ 108 99. 3D C SG tree structure.............................................................................. .... ........ 110 910. All triangleArrays composing the base and dependent solid ..............................111 911. Bounding cylinder method between two elements.................................................112 912. All triangleArrays relevant to intersected elements ..............................................112 913. TriangleTriangle intersection A) PlaneEdge intersection B) EdgeEdge intersection ............................................................... .. .... ......... 113 914. TriangleArrays having actually intersected triangles............................................113 915. Mapping the triangle in space onto the local uv plane .............. .... ...............114 916. Subdivided triangles after Delaunay triangulation ...............................................115 917. Flow chart for constructing the graphics for the 3D Boolean result ............ ......116 A1. SceneGraph structure for the solid modeler using implicit solid elements ............120 A2. Class structure for the solid modeler using implicit solid elements........................122 A3. ShapeDensity class structure ............. ............................................ .................123 A4. InteractiveComm and class structure............................................... .................. 123 A5. CommandList class structure.................................. ............................. 124 A6. PositionConstraint class structure...................................................................... 124 Abstract of Dissertation Presented to the Graduate School of the University of Florida in Partial Fulfillment of the Requirements for the Degree of Doctor of Philosophy SOLID MODELING USING IMPLICIT SOLID ELEMENTS By Jongho Lee August 2003 Chair: Ashok V. Kumar Major Department: Mechanical and Aerospace Engineering A solid modeling technique using implicit surface representation is presented where the implicit surface function (referred to here as density function) is defined by piecewise interpolation within quadrilateral elements in 2D and hexahedral elements in 3D. Within each element the density function is defined as a parametric function. The solid is defined as the region within the element where the density is greater than a threshold or "level set" value. The boundary of the solid is therefore a contour of the density function along which the density is equal to the level set value or the boundary of the element where the density is greater than the level set value. Simple shapes or primitives can often be defined using a single implicit solid element while more complex geometry can be represented either using a grid/mesh of elements or by Boolean combination of simple primitives. The geometry of the primitives can be edited or modified by changing the density values at the nodes of the elements, by changing the size of the element as well as by changing the level set value. In this study, hexahedral elements are presented along with basis functions that can be used to represent primitive solids created by sweeping 2D geometry along trajectories that can be lines, arcs or arbitrary parametric curves. In traditional solid modeling software based on the BRep (boundary representation) approach, solid primitives are often created by sweep operations. The elements described in this study enable the representation of such solids using implicit surfaces. This primitive representation scheme is axes independent because the implicit function representing the solid is defined as a parametric function within quadrilateral or hexahedral elements while general implicit surface functions are axes dependent. In general it is easier to determine whether a given point is inside, outside or on the boundary of a solid if the boundary is represented using implicit equations. Since it is necessary to repeatedly classify points in this manner for many graphical display and volumetric property evaluation algorithms implicit representation is particularly suited for representing primitives in a CSG tree. For the implicit solid element representation, it is also necessary to first map from global coordinates to parametric coordinates to perform this classification. This mapping is shown to be easy to perform if the elements have parallel edges and faces. The volume of the solid can be computed by defining the linear approximate step function, which has a unit value almost everywhere in the interior of the solid and zero in exterior of the solid. This linear approximate step function can be numerically integrated to compute the volume. CHAPTER 1 INTRODUCTION 1.1 Overview Solid modeling is the fundamental technology on which CAD/CAM/CAE (Computer Aided Design/Manufacturing/Engineering) systems have been built. Solid modeling technique (sometimes called volumetric modeling) has been used for many applications including visualization, geometry design, assembly verification, engineering analysis and generating NC machining codes. The use of solid models for design and manufacturing is becoming more widespread with the increasing availability of computer technology. Solid models enable one to construct unambiguous models of threedimensional objects. Such unambiguous models are necessary to construct algorithms for automatically computing volumetric properties such as surface area and volume of the solid. Algorithms for automatic generation finite element mesh for engineering analysis also depend on the ability to construct precise, unambiguous models of solids. Algorithms have also been developed to generate tool paths for machining given the solid model of the part to be machined. More recently developed fabrication and prototyping technology called the layeredmanufacturing technique (also known as rapid prototyping or the solid freeform fabrication technique) also need solid models of the part to be constructed. The most popular schemes in current solid modeling are Boundary Representation (or BRep) and Constructive Solid Geometry (CSG). In BRep, a solid is represented by the boundary information of the solid where vertices, edges and faces (geometry information) are saved together with the information on how they are connected to build the boundary of the solid (topology information). The geometry of the boundaries are represented using parametric equations of the form X(u) or X(u,v) where X is a position vector of a point on the curve or surface. In CSG representation, Boolean operations applied on primitives that are simple shapes such as a block, cylinder, sphere or cone are saved in the binary tree data structure where primitives are defined by Boolean combination of halfspaces. Half spaces are implicit equations of curves or surfaces that are represented as f(x,y) > 0 (curves) or f(x,y,z) > 0 (surfaces). Current commercial solid modeling systems typically use a hybrid system where the solid is constructed by the Boolean combination of primitives that are represented using BRep models. The BRep model of the resultant solid is automatically constructed from the CSG tree using algorithms known as Boundary evaluation. In almost all current solid modeling systems, a feature based approach is provided as the user interface for creating solids where primitives are constructed by sweeping 2D profiles along a trajectory. Such sweep features for creating 3D primitives are popular because it enables the user to create primitives interactively. BRep solid models use parametric equations for geometric components such as lines, curves and surfaces. Creating BRep primitives by sweep operations is simple and straight forward because it is easy to define the equations of surfaces created by sweeping a curve along a trajectory in the parametric form. However, it is difficult to construct such sweep primitives by a Boolean combination of halfspaces as is done in traditional CSG systems. Solid modeling systems based on BRep models is very difficult and expensive to implement. The main reason for the difficulty is that the BRep model for the resultant geometry has to be constructed automatically from BRep models of the primitives using the information about the Boolean operations used to combine them. For each regularized Boolean operation, the boundary evaluator algorithm, detects intersections between participating solids, computes intersection geometries (intersection points and curves as well as subdivided faces) and classifies them according to whether the geometry is in, on or outside the final solid defined by the Boolean operation. As mentioned earlier, BRep models need topology information as well as geometric information. Constructing connectivity (topology) between geometric components automatically is very difficult to be performed for complex geometries. And it is also very expensive to classify a given point, curve or face as being inside, outside or on the solid. The procedure for such classification is called setmembership classification. In traditional CSG models, the topology of the solid is not explicitly represented. Therefore, there is no need for Boundary evaluation algorithms. An algorithm is needed to generate the graphics of the resultant solid using the information available in the CSG tree. Even though in general the graphics image is difficult to generate for implicit curves and surfaces, the implementation of a CSG solid modeling system is easier because there is no need for Boundary evaluation algorithms. However, in order for such a modeling system to be useful it is necessary that a feature based modeling interface can be constructed. No attempt has been made to construct sweep features using implicit curves and surfaces since all current solid modeling systems use BRep models. Therefore one of the motivations of this study is to develop a feature based solid modeling system where all the boundaries of the solid are represented using implicit equations. 1.2 Goal and Objectives The goal of this research is to study the feasibility, advantages, and disadvantages of building a feature based solid modeling system that uses only implicit equations for curves and surfaces as it is done in traditional CSG solid modeling systems. Such solid models in this thesis are referred as implicit solid models. In order to develop such a system, implicit solid elements that are quadrilateral and hexahedral elements used to represent implicit curves and surfaces respectively have been used. The main objectives of the thesis are listed below. 1. Develop quadrilateral implicit solid elements to represents simple 2D primitives such as circles, ellipses, rectangles and triangles. 2. Develop hexahedral implicit solid elements to represent solid primitives obtained by extruding, revolving or sweeping 2D primitives defined using quadrilateral implicit solid elements. 3. Develop hexahedral implicit solid elements to represent a solid primitive obtained by blending between two or more different 2D primitives 4. Construct algorithms for displaying solids created by Boolean combinations of primitives represented using implicit solid elements. 5. Construct algorithms for automatically computing volumetric properties. 1.3 Outline In Chapter 2, current popular solid modeling techniques are introduced to give an overview for the reader. In Chapter 3, the definition of implicit solid elements is described and in Chapter 4, simple 2D primitives using 2D implicit solid elements are introduced. In Chapters 5 and 6, constant crosssection sweep elements and variable crosssection sweep elements are described respectively. Algorithms for set membership classification at a given point with respect to a primitive and a solid represented by a CSG tree structures are described in Chapter 7. In Chapter 8, the method to compute the 5 volume of the solid is presented and in Chapter 9, issues associated with generating the computer graphics of the solid are described. Finally, Chapter 10 provides conclusions and discussions. CHAPTER 2 SOLID REPRESENTATION SCHEMES 2.1 Geometric Modeling Geometric Modeling systems are used in the design process for visualization, assembly verification, engineering analysis, generating NC machining codes, etc. It often eliminates the need for making many physical prototypes to test design concepts. There are three different types of geometric modeling systems: wireframe modeling, surface modeling and solid modeling. Wireframe Modeling is the earliest method, where a shape is represented by its characteristic lines and points. Although it has some advantages such as simple user inputs and ease of implementation, the following two disadvantages make this representation unpopular. First, the shapes represented only by lines and points are very ambiguous. Second, there is no information about the inside and outside boundary surfaces of the object. Therefore it cannot be used for mass property computation, tool path generation or finite element analysis. Surface Modeling has surface information in addition to the wireframe model information. Therefore, the tool path for the NC machines can be generated for the surfaces. However, since it also does not have information to distinguish between the inside and the outside of the object, Boolean operations cannot be used to combine such models and it is difficult or impossible to construct other algorithms for automatically manipulating such models as an example when generating a mesh. SolidModeling was introduced to overcome some of the limitations of the other schemes mentioned above. Solid modeling techniques began to develop in the late 1960s and early 1970s. The fundamental concepts and definitions of solid modeling are well introduced in many books [Hoffmann, 1987, Zeid, 1991., Mortenson, 1997., Lee, 1999]. The most popular schemes in current solid modeling are Boundary Representation (or B Rep) and Constructive Solid Geometry (CSG). In BRep, a solid is represented by the boundary information of the solid where vertices, edges, and faces are saved together with the information on how they are connected to build the boundary of the solid. In CSG representation, Boolean operations applied on primitives are saved in the binary tree data structure. These two representation schemes are described in the following section. 2.2 Constructive Solid Geometry (CSG) The constructive solid geometry representation technique defines complex solids as Boolean combinations of simpler solids called primitives. A Boolean operation is one of the best methods to create complex solids. It dramatically increases the repertoires of the shapes to be modeled. A binary tree data structure is used to save the Boolean operations between primitives. The following is an example of CSG tree data structure, where the final solid is generated by the union of the primitive A and B, followed by the difference of the primitive C. In this tree structure, leaf nodes (or primitive nodes) represent primitive solids and branch nodes have Boolean types such as union, difference, and intersect. Boolean operations can be explained by set theory. However, the set theory applied here is different from the original set theory. A modified Boolean operation has been defined for solid modeling which is referred to as Regularized Boolean operation, where the Boolean combination results between primitives are closed and dimensionally homogeneous. A B Figure 21. Example of CSG binary tree structure The following example shows how the regularized Boolean operation is different from the original Boolean operation. Regularized Boolean operations are denoted by u , n*, and * respectively while the ordinary Boolean operations are denoted by u, n, and AA Union Intersection Difference * Figure 22. Comparison between the ordinary Boolean and regularized Boolean operation As shown in Figure 22, problems always occur when the boundaries of the primitives overlap. These special cases can be treated to create a regularized result by comparing the directions of both boundary normal vectors. For example, in the regularized intersection, if both boundary normal vectors have the same direction, the boundary is also the boundary of the regularized Boolean combination. On the contrary, if they have opposite directions, it should be removed to construct the regularized Boolean combination. The following shows allspecial cases, where nA and nB are the boundary normal vectors of the primitive A and B at the overlapped part respectively. u ON IN nON OUT OUT ON Figure 23. Regularized Boolean treatment in overlapped case The method using normal vectors for the regularized Boolean combination in solid modeling cannot be used when multiple normal vectors are involved. For instance vertices in 2D or 3D and edges in 3D cannot be simply classified as in, out or on the solid because those have multiple normal vectors. This problem can be solved by using a neighborhood model where points close to the given point (or in its neighborhood) are examined. Figure 24 shows an example of a neighborhood model where a small disk symbolizes the neighborhood, and the shaded area indicates points inside the solid. The neighborhood model at a point for the Boolean result is constructed by applying the Boolean operation to the neighborhood models at the point for the two participating solids. On AUB A ( A B B On AUB A B Figure 24. Examples of neighborhood models on the vertices in 2D There are three important subsets defined by a solid, where the solid is considered a set of points. Those are the set of interior points, points on the boundary of the solid, and all points outside the solid. Setmembership classification of a point involves assigning the point to one of these sets. It is an essential step to do a Boolean operation. Primitives are simple shapes such as a block, cylinder, sphere or cone, where the mathematical descriptions of the primitives are defined by the intersection of a set of curved or planar halfspaces. A half space divides the space into two regions, for instance, an infinite xy plane divides the space into the region of z>0 and the region of z<0 as shown in Figure 25A. Figure 25B and Figure 25C show how to define the primitive block and cylinder by halfspaces respectively. Where the block is represented by the intersection of six planar halfspaces and the cylinder is represented by the intersection of a cylindrical halfspace and two planar halfspaces. z b xxa Sy>b (A) (B) (C) Figure 25. Mathematical description of the primitives by halfspaces A) Halfspace by x y plane B) Block by half spaces C) Cylinder by half spaces Arrows indicate the direction of the material. The detailed mathematical descriptions can be represented as follows: Block: a Cylinder : 0 < x2 + y2 r2, a This kind of description is good for set membership classification because the sign of the implicit function representing the half space can be used to classify the point. CSG representation does not include topology information and therefore additional computation is necessary to determine the connectivity between boundary entities. Such connectivity information is used in many applications such as mesh generation and tool path generation for machining. 2.3 Boundary Representation (BRep) The BRep model of a solid consists of parametric equations of the vertices, edges and faces of the solid together with the connectivity information between them. The geometry information in a BRep model is composed of surface equations, curve equations, and point coordinates. The connectivity between the geometric entities is the topology information which is the interrelationship among faces, edges and vertices. It is based on the idea that the boundary of a solid consists of faces (surfaces) bounded by edges (curves), which in turn are bounded, by vertices (points). In BRep, a face is a subset or limited region of some more extensive surface. For example, planar faces are subsets of infinite planes that are bounded by edges, while curved faces are represented as parametric surfaces bounded by edges. Thus, these equations are saved in the BRep data structure. The topology information is represented as relations between faces, edges, and vertices. In Figure 26, the face Fi is composed of four edges (El, E2, E4, E3) and each edge is represented by two vertices. El V2 V1 F2 Fl E2 Fl E4 V3 V4 E3 Figure 26. Basic concept of BRep model An array of faces, edges, and vertices can be used to represent this kind of simple polyhedral model. Figure 27 shows the typical data structure [Spatial Technology Inc., 1995] used to represent BRep models which consists of shells, faces, loops, half edges(or coedges), and vertexes. Figure 27 shows classes used to represent the solid model. A solid is denoted as a BODY which consists of one or more LUMPs. A LUMP is a connected 3D region whose boundaries are represented using closed SHELLs. A closed SHELL consist of a list of faces forming a closed volume. As mentioned earlier, the geometry of a face is defined by a parametric surface equation and is bounded by LOOPs that define its external and internal boundaries. Loops are defined as a list of halfedges (COEDGEs), which are edges with a direction. Half edges are connected together to form loops such that the direction of the loop is counter clockwise for the external boundary and clockwise for internal boundaries when the face is viewed from the outside. Assigning directions to loops in this manner assists in determining whether a given point is inside, on, or outside the solid. If the solid has a lot of faces, this kind of set membership classification is difficult and it requires significant computation. Since every entity is interconnected with other entities, changing the topology is very complicated in the BRep model approach. Ex) BODY Ex)T Fl LUMP Lumpl S1 SHELL S1 F1, F2 ....... F10 SURFACE FACE next F1 L1, L2 L1 "L2 LOOP next L11C1, C2, C3, C4 next V2 COEDGE previous C1E1 E El CURVE EDGE E1V1, V2 POINT VERTEX Figure 27. Example of typical BRep data structure 2.4 Hybrid System Creating BRep models directly by defining each vertex, edge, and surface is extremely cumbersome. Therefore, hybrid systems were developed where the solid is represented procedurally using a CSG tree but the primitives are represented using B Rep. The BRep model of the solid represented by the CSG tree is evaluated automatically using "Boundary Evaluator" algorithms [Requicha and Voelcker, 1985]. For each regularized Boolean operation, the boundary evaluator algorithm, detects intersections between participating solids, computes intersection geometries (intersection points and curves as well as subdivided faces) and classifies them using set membership classification algorithms to determine whether the geometry is in, on, or outside the final solid defined by the Boolean operation. While set membership classification is easy when the solid is represented as a combination of half spaces (where the surfaces are implicit equations, f(x,y,z) = 0), it is more difficult to do for BReps. Furthermore, constructing the topology of the resultant solid automatically is also difficult. As a result it is very expensive to build robust and reliable software that can handle every special case. However, over the years many commercial systems have been developed that have very reliable boundary evaluator algorithms that are robust and can handle almost all special and degenerate cases including nonmanifold topologies. To cope with the high cost of implementing these algorithms, many companies in the CAD industry buy "geometric modeling kernels" from other companies that have already implemented them [Spatial Technology Inc., 1995]. 2.5 Sweep Features A sweep feature is defined by sweeping a planar shape along an arbitrary space curve referred to as a sweep trajectory, where the cross section of the sweep solid can be either constant or varying. This is a very popular and useful method due to the fact that the solid represented by sweeping is simple to understand and execute. If the sweep trajectory is a straight line, it is called as translational sweep (or extruded solid). When the sweep trajectory is a circular arc, it is termed a rotational sweep (or revolved solid). When the sweep trajectory is an arbitrary parametric curve, it is referred to as a general sweep. Recent research related to sweeping includes threedimensional object sweeping and sweep surface representation using coordinate transforms and blending [Martin and Stephenson, 1990, Choi and Lee, 1990]. 2.6 Implicit Surfaces or Level Set Surfaces Traditionally, implicit curves and surfaces are represented as f(x) = c where x e R2 for planar curves and x e R3 for surfaces. They are sometimes referred to as level sets or isocurve/surface since the curve or surface corresponds to a constant value of the function f(x). If c = 0 then the curve or surface is called the zero set of f(x). An implicit surface divides space into regions where f(x) > 0 and f(x) < 0. Therefore, if the boundaries of the solid are represented implicitly as halfspaces one can use the sign of f(x) to perform set membership classification that is to determine whether a given point is inside, outside, or on the solid. Despite this advantage, implicit representation for curves and surfaces has traditionally been considered inferior to parametric representation. The reasons suggested for this include axis dependence of implicit curves, difficulty in tracing or generating graphics, as well as difficulty in fitting and manipulating freeform shapes. Considerable progress has been made to solve some of these problems due to which implicit curves and surfaces now have numerous applications in graphics and animation [Bloomenthal et al., 1997]. To enable graphical display a variety of polygonization, tessellation, or tracing algorithms have been developed [Wyvill and Overveld, 1997., Lorensen and Cline, 1987]. Ray tracing algorithms have also been used for visualization of implicit surfaces [Glassener, 1989]. When the implicit function f(x) is a polynomial, the surface is called an algebraic surface. Most common primitive shapes such as sphere, ellipse, cone, and cylinders can be expressed as algebraic surfaces using quadratic polynomials. For more complex shapes, implicit algebraic surface patches (or Asplines) have been developed [Bajaj et al., 1995]. These patches can be used for C1 and C2 interpolations or approximations and also for interactive freeform modeling schemes. Implicit curves and surfaces have also been used for visualization problems such as shape reconstruction from unorganized data sets [Zhao et al., 2000] and dynamic fluid flow [Osher and Redkiw, 2003]. Recently, Rfunctions [Shapiro, 1998] have been used to define implicit solids. The sign of an Rfunction depends only on the sign of its arguments and not its magnitude. This property of Rfunctions can be used to construct implicit functions for representing solids created by a Boolean combination of implicit surfaces. Furthermore, the advantage using geometry represented using implicit curves and surfaces in solving boundary and initial value problems with time varying geometries and boundary conditions has also been illustrated [Shapiro and Tsukanov, 1999]. Implicit surfaces are often used in computer graphics for representing soft or deformable objects such as humans, animals, and amorphous blobs. Sometimes, an implicit surface can be represented by the distance relationship between the surface and a given basic structure such as point, line, and circle. This kind of method is called distance metrics or the skeleton method [Tigges and Wyvill, 1999]. CHAPTER 3 IMPLICIT SOLID ELEMENTS 3.1 Definition of Implicit Solid Elements The implicit curves and surfaces are represented here as the level set of an implicit surface function 4(r,s) = kb for planar faces or 4(r,s,t) = kb for solids. The implicit surface function, 4, has been referred to in this study as the shape density function (or simply density function) [Kumar and Gossard, 1996]. The density function has a value greater than a threshold or level set value, )b, inside the solid and less than kb outside the solid. Unlike the traditional approach, where the implicit surface function is defined directly in terms of the x, y, z or Cartesian coordinates, the density function used here is a parametric function whose arguments are the parametric coordinates of an implicit solid element. This is illustrated using a two dimensional example in Figure 31 where the element has nine nodes and its geometry in the parametric space is shown in Figure 31A while its real geometry is shown in Figure 31B. In the parametric space the element is a square whereas in the real space the element can be a distorted quadrilateral. The mapping between the parametric coordinates and the real coordinates x, y and z is defined as, n x(r,s,t) = x, M,(r,s, t), 1=1 n y(rs,t)= y1M1(r,s,t) and 1=1 n z(r,s, t) = zM (r,s, t) 1=1 (31) In Eq. 31. (x,, y,, z,) are the coordinates of the node i, M,(r,s,t) are mapping basis functions that define the mapping between the parametric space (r,s,t) and the real space (x,y,z) and n is the total number of nodes per element. s 51 2 5 2 21 = b 8 8 r Y 4 3 7 4 x3 (A) (B) Figure 31. Quadrilateral 9node element in two different coordinate systems A) Parametric space (r, s coordinates) B) Real space (x, y : Global coordinates) The density functions are defined within the elements by specifying the values of the functions at the nodes of these elements. The value of the function within each element is obtained by interpolating the values at the nodes using appropriate basis functions or interpolation functions. A parametric interpolation scheme is used as shown below where parameters (r, s, t) vary between 1 and 1. n q(r,s) = N, (r, s) for 2D elements (32) 1=1 n q((r,s,t)= 0q,N, (r,s,t) for 3D elements (33) Where, I, is the density at the node i, Ni is the interpolation basis function at the node i used to interpolate the density, and n is the total number of nodes in the element. Each element is a cube (or square in 2D) of side length equal to 2 in the parametric space since the parameters r, s and t vary from 1 to 1 within each element. If the mapping basis functions Mi (r, s, t) are identical to the density interpolation basis functions Ni(r,s,t) then the element can be referred to as "isoparametric element". However, it is often beneficial to use simpler basis functions for the mapping. In this formulation, even though the boundary of the solid is represented in the implicit form 4(x,y,z) = 4b, the density function itself is represented in a parametric form, 4(r, s, t) with a mapping defined between the parameters (r,s,t) and the global coordinates (x,y,z). Therefore, many of the advantages traditionally associated with parametric curves and surfaces are also applicable to the implicit solid element approach including axes independence and the ease in tracing. The parametric form of the density function enables the development of simple algorithms to polygonize the surface for graphical display. The detailed description for one way of graphical display used in this system is explained in Chapter 9. The following table shows the basis functions for the 9 node quadrilateral element where the numbering system is as shown in Figure 31. Table 31 Basis functions for the 9 node quadrilateral element N1 = 0.25(r2+r)(s2+s) N2 = 0.25(r2r)(s2+s) N3 = 0.25(r2r)(s2s) N4 = 0.25(r2+r)(2s) N5 = 0.5(1r2)(2+s) N6 = 0.5(r2r)(1s2) N7 = 0.5(1r2)(2s) N8 =0.5(r2+r)(s2) N9 = (1r2)(1s2) These shape functions are derived by Lagrange interpolation such that Ni is, equal to 1 at node i and is zero at other nodes. For instance, N1 = 0 at node 2 to 9 is equivalent to requiring that N1 = 0 along edges r = 0, r = 1, s = 0 and s = 1. Therefore N1 can be represented by N = c(r2+r)(s2+s) where c is some constant that is determined from the condition N1 = 1 at node 1. Since r = 1 and s =1 at node 1, yields 1 = c(12+1)(12+1)= 4c Which yields c = 0.25. Similarly other shape functions at nodes 2 to 9 are derived as shown in Table 31. Figure 32 shows the density distribution within a 9node element when the density at the corer nodes are set equal to 0, the density at midedge nodes are set to 0.5 and the density is 1 at the center node. :/ (A) (B) (C) Figure 32 Density distribution within a 9 node quadratic element A) Density fringes B) Density contours C) Density Plot In Figure 32B each contour line corresponds to constant shape density values. Therefore the boundary of the solid in this system is one of the contours whose value is equal to the boundary density value (b ). For instance if 0.5 is set to Ob, the boundary of the solid would be a circular shape as highlighted in Figure 32A. 3.2 Definition of the Solid within an Implicit Solid Element In brief, the definition of the solid used here can be represented as # > Ob where q is a density value defined at the isoparametric coordinates namely, 1 < r < 1 and 1 < s < 1 in 2D (and 1 < t < 1 in 3D). Therefore, the solid in this system may now be defined as the set of points S such that S= X _= ,NJ(r,s)>b, X X,M,(r,s) for2Delements S for 2D elements where  S= X= ,N r's, t) b X= XM (r,s,t) for 3D elements (34) 1i 1=1 where 1 Since the boundary of the geometry is very critical in some cases, clear definition of the boundary of the solid is required in any solid modeling system. In this system there are two criterions defining the boundary of the solid. Therefore, the boundary of the solid represented by an element can be defined as the set of points B such that X~ =ZN,(r,s)=b, X= XM,(r,s) 1=1 1=1 where l 1=1 1=1 where r = +1 ors = +1 n n = SN,(r,s,t) =4b, X = XM, (r,s,t) 1 1 1=1 where  X. = 0N, (r, s, t) >b, X= X,M, (r, s, t) z=1 1z= where r= lors =l ort =+ 3.3 3D Hexahedral Solid Elements Threedimensional primitives can be defined using hexahedral elements such as hexahedral 8node or 18node elements. Figure 33 shows these two 3D elements and the node numbering scheme used. The basis functions of a hexahedral 8node element and the interpolation within each element are trilinear. Therefore, the higher order 18node element is required to create cylindrical and conical shapes. The basis functions of the 8 node and 18node hexahedral element are listed in the following tables. Table 32 Hexahedral 8node basis functions N1 = 0.125(1+r)(1+s)(1+t) N2 = 0.125(1r)(1+s)(l+t) N3 = 0.125(1r)(1s)(l+t) N4 = 0.125(l+r)(1s)(l+t) N5 = 0.125(1+r)(1+s)(1t) N6 = 0.125(1r)(1+s)(1t) N7 = 0.125(1r)(1s)(1t) N8 = 0.125(1+r)(1s)(1t) Table 33 Hexahedral 18node basis functions N1= 0.125(l+r)(l+s)(l+t)rs N2= 0.125(1r)(l+s)(l+t)rs N3= 0.125(1r)(1s)(l+t)rs N4= 0.125(1+r)(1s)(l+t)rs N5= 0.125(1+r)(l+s)(1t)rs N6= 0.125(1r)(l+s)(1t)rs N7= 0.125(1r)(1s)(1t)rs N8= 0.125(1+r)(1s)(1t)rs N9= 0.25(1r2)(1+s)(1+t)s N10= 0.25(1r)(1s2)(l+t)r N1= 0.25(1r2)(1s)(1+t)s N12= 0.25(1+r)(1s2)(l+t)r N13= 0.5(1r2)(1s2)(l+t) N14= 0.25(1r2)(1+s)(1t)s N15= 0.25(1r)(1s2)(lt)r N16= 0.25(1r2)(1s)(1t)s N17= 0.25(1+r)(1s2)(1t) N18= 0.5(1r2)(1s2)(lt) Figure 33 shows two solids defined using these hexahedral elements with the boundary density value 4b = 0.5. In Figure 33A, an 8node element is used with the following values of the nodal densities: 1=0.4 Q 2 =1.0 4 3 =0.2 4 4 = 1.0 5= 0.4 46 = 0.9 0 7 = 0.3 8s = 1.0. Figure 33B shows a cylindrical solid with the elliptical cross section created using the 18node element. The density values at the nodes were set as follows to create this geometry: 1= 2= 3 =4 =5 =6= 7 = 8=0.0, 9 =010=o 11 = 12 = 14 =15= 16 =17=0.5, and 13 =18 1. 3 t 10 3 t 11 13 2 2 1 s 412 o I 86  1 6 6 18 14 0 r 8 17 5 (A) (B) Figure 33 Solids defined using 3D hexahedral elements A) 8 Node element B) 18 Node element In the following section, the method to define and edit primitives using implicit solid elements is described. 3.4 Defining and Editing Primitives The geometry defined within each element can be edited by modifying the density values at each node, the shape of the element. or level set value of density. This diversity in editing methods enables the creation of a variety of primitives using a single element. Figure 34 shows how the solid geometry is changed in response to the change in such parameters as density value at each node, nodal coordinates of the element, and boundary density value. In Figure 34A, the density value at the nodes of the 9node element is set such that the density at all nodes is set to 4b = 0.5, except the central node where density is set equal to 1. The geometry is therefore identical to that of the element since every point within has density greater than 4b. The geometry in Fig. 34B is obtained by changing the density values at nodes to 1 =0.2, 0 2=0.3, 0 3 =0.4, 0 4 =5= 6 = 7 =08 = 0.5 and 9=1. Changing the shape of the element as shown in Figure 34C where the element nodes are moved to stretch the element into a rectangle can also modify the geometry. Note that the element shape should be a parallelogram in this system. This method of editing the geometry enables a variety of quadrilateral primitives, such as rectangles, trapezoids and parallelograms, to be constructed by deforming the element in Figure 34A. Em (A) (B) (C) (D) Figure 34 Editing the face represented using 2D element Yet another way to modify the geometry is by changing the level set value, 4b, so that a different level set or contour of the density function becomes the boundary of the solid. This is illustrated in Figure 34, where the solid in Figure 34D is obtained from the solid in Figure 34C by changing the level set value from 0.5 to 0.6. Figure 35 shows the above three methods of editing for a 3D element. The solid in Figure 35B is obtained by just changing the density values of the solid in Figure 35A and it is further modified by changing the shape of the element to obtain the solid in Figure 35C. Finally, the solid in Figure 35D is obtained by modifying the level set value 0b. (A) (B) (C) (D) Figure 35 Three ways of editing solids represented using 3D element 3.5 Defining Complex Geometries using Implicit Solid Elements Simple solid primitives may be defined using a single implicit solid element. Using a grid of elements as illustrated in Figure 36, it is possible to create more complex primitives. Figure 36A shows the twodimensional mesh or grid used to represent the shape and Figure 36B shows the density values using gray scale such that white is ) = 1 and black is 4 = 0. The boundary of the geometry is represented partly by the contours of the density function ) = 0.5 (which is highlighted) and partly by the boundaries of the mesh where ) > 0.5. When the primitive is modeled using a mesh that has many elements as in Figure 36, the solid model is the union of the solids defined by the individual elements in the mesh. (A) (B) Figure 36 Implicit representation of planar face using shape density function A) Density Grid B) Contours of density function A variety of elements and basis functions can be defined and used to represent the solids in 2D and 3D. Higher degree polynomials can be used as basis functions for elements with a larger number of nodes per element. If the geometry to be represented is simple (e.g. rectangle, circle or ellipse) then it is often possible to define the required shape density function using just one element. Primitives thus defined using one or more elements can be combined using various Boolean operations to create a procedural definition of more complex solids, expressed as a CSG tree. Refer to Chapter 7 for the detailed description about CSG representation scheme used in this system. 3.6 Heterogeneous Solid Model Capability Conventional solid modeling systems have been developed based on the assumption that the solid is perfectly homogeneous. Thus they cannot represent internal properties or offer ways of representing internal behavior. In this solid representation using implicit solid elements, material composition can be defined within each element by interpolating nodal values of composition. Many biomechanical structures such as bones, shells, and muscular tissues are heterogeneous. Once heterogeneous objects are modeled as the solid models, they can be manufactured by recently developed manufacturing methods such as layered manufacturing technique, also known as rapid prototyping or solid freeform fabrication. The following examples illustrate this idea where material composition distributions are represented within solids by defining composition values at each node and using the same interpolation scheme used in defining geometries. (A) (B) Figure 37 3D Composition Destribution A) 8node element B) 18node element In this case, two materials termed A, B respectively are used for composing the heterogeneous objects. The A material is shown as red in Figure 37 and the material B is shown as blue. Let be the volume percentage of material A at a point. Then 1 is the volume percentage of B at the same point. The nodal density values are larger than the boundary density value (0 b) for both examples in Figure 37. The material compositions (volume percentage of material A) at the nodes for creating Figure 37 were defined as follows: (A) 1= 2= 5= 6=1.0 53= 4= 7 =8=0.0 (B) 1=52=3 = 4 =5 =6= 7 =8=0.0, S9 =10= 11= 12= 14= 15= 16= 17=0.5, and < 13= 18= 1 (36) CHAPTER 4 TWO DIMENSIONAL PRIMITIVES As mentioned in the proceeding chapter, simple primitives are combined using Boolean operations to create more complex solids. In this chapter, 2D implicit elements used for constructing 2D primitives are presented. 4.1 2D Primitives by 9Node Quadrilateral Elements A quadrilateral primitive can be represented directly using quadrilateral elements by setting the nodal values of density to be greater than or equal to the level set value. While it is possible to create a variety of implicit solid elements, the 9node quadrilateral element for twodimensional primitives such as quadrilaterals, circles and ellipses has been used primarily. A variety of elements and interpolation functions can be used for defining primitives however for brevity and consistency a 9node element was chosen among lots of capable elements to create all primitives in this system. The following figures show examples of 2D primitives defined by the quadratic 9 node element. N ' (A) (B) (C) Figure 41 2D primitive examples A) Rectangle B) Circle C) Ellipse Rectangular primitives as shown in Figure 41A can be defined by giving density values larger than the boundary density value (4b) at each node. Then any rectangular shapes can be created by modifying the size of the element. A primitive circle can be defined using a single 9node quadrilateral element. The boundary is defined as 9 4(r,s)= N, (r,s)b, = =0.5 (41) Expanding the above equation by substituting N, listed in Table 31, yields 0.5= N,11 +N2 2+N3 3+N4 4+N55 +N6 6+N707+ N88+ N9 9 (42) = 9 + (0.56 0.5 8)r + (0.5 5+0.5 7)s+ (0.5 6 +0.5 8 9)r2 + (0.5 5 +0.5 7 9)s2 + (0.25 3 0.25 2 0.25 4 0.25 41 )rs + (0.25 2+0.55 +0.2504+0.2503 0.25 10.5 7 )r2 s + (0.25 1+0.25 2 +0.25 30.25 4 0.5 6 +0.5 8s )r s2 + ( 9 +0.25 1 0.5 5 0.5 6 + 0.25 4+0.25 3+0.25 20.5 7 0.5 8)r2 s2 To be an equation of circle, the coefficients of r, s, rs, r2s, rs2 and r2s2 should be equal to zero and the coefficients of r2 and s2 must be same. In other words, the following conditions should be satisfied. (0.506 0.58) = 0 (0.5 5+0.57) = 0 (0.25 3 0.25 02 0.25 4 0.25 1 ) = 0 (0.25 2+0.55 +0.2504+0.2503 0.25 10.5 7)= 0 (0.25 1+0.25 2 +0.25 30.25 4 0.5 6 +0.5 s ) = 0 ( 9 +0.25 1 0.5 5 0.5 6 +0.25 4 +0.25 3+0.25 20.5 7 0.5 8) = 0 (0.506+0.50809) = (0.505+0.50709) (43) From the above equations, the following conditions are derived. 1= 42 =3 =4 45= 6 =7 =08 49=205 01 4 9 45 (44) This results in a circle of unit radius within the element in the parametric space whose equation is r2 + s2 = 1. The geometry in the real space will also be a circle if the shape of the element is square and diameter of the circle will be equal to the size of the square as shown in Figure 41B. If the element shape is a rectangle in real space, then the circle in the parametric space maps into an ellipse in the real space with the major and minor diameters equal to the length and height of the rectangle as shown in Figure 41C. Clearly there is no unique representation for any given primitive. In the following examples quadrilateral 9node elements are used for all primitives. Table 41: Samples of 2D primitive design 4b Element 4 i (Nodal densities) shape Rectangle 0.5 Square 1= 2 = 3 = 4 = 5= 6 = 7 = 8 = 0.5 and 9=1 Circle 0.5 Square ( 1= 2= 3 =4 =0.0, 45=0 6 =07 =8 = 0.5 and 4 9=1 Ellipse 0.5 Rectangle 1 =02= 3 =4=0.0, 05= 06 =07 =8 = 0.5 and 49=1 Figure 42 shows more 2D primitive examples created using the 9node elements. The value of density at the node is displayed near each node. The density values at each node can be found using the same approach that was used for computing the nodal density for the circle. Alternatively, one can make use of the property of Lagrange interpolation that the interpolation obtained is unique. Therefore if the implicit equation of a curve is known then the value of the function evaluated at the nodal coordinates can be assigned as the nodal values. 2 = 0 0= 0.5 = 0 =0.5" = 0.5 6 = S=0 0= 1 3 =o0 =0.5 #4 =o 2 = #(0,1) = #(0.5,1) A = (1,1) :0,0.5) = # = (0.5,0.5) 0) A = (0.5,0) 04 = (1,0) Figure 42 Constructing a 2D primitive by the part of an existing shape Figure 42 shows how to compute nodal density values for a quarter circle primitive from the primitive circle where the density function used is as follows: 9 1 (r,s)= N,(r,s)O =1r s 11 2 2 06 0 =2 0.5 ,= 0.375 .875,, = =9 0.75 S=1 7= 0.875 4 =0.5 ^ = 0.25 ,5 =05 0.375 6 = 0 875 , =05 06 =0.125 =0 S=05 1=1 0 = 0.625 = 1 0, =0.75 4, =0.5 (C) (D) Figure 43. 2D primitives and its nodal density distribution A) Quarter circle B) Semi circle C) Triangle D) Wedge shape 0, = 0 875 0, = 0 375 0( (1,0.5) 6 3 = O(0, 4.2 Mapping in 2D Solid Elements The 9node quadrilateral element has biquadratic basis functions as shown in Table 31. The same basis functions could be used to define the mapping between the parametric space and the real space. However, it can be shown that the same mapping is obtained when the bilinear basis functions are used if the element is a parallelogram with straight edges in the real space and the mid nodes are at the center of each edge. In addition the center node should be located at the center of the element. Using the bilinear basis function for mapping simplifies inverse mapping from real space to the parametric space. If the biquadratic basis functions are used, the mapping equations are nonlinear simultaneous equations having multiple solutions in general. The following equations show the 4node mapping basis functions. 1 1 M =(1+ r)(1+ s),M, =(1r)(1+s) 4 4 (45) 1 1 M3= 4(1r)(1s),M4 =(1+r)(1s) 4 4 A simple proof is given below to show that the mapping from the real space to the parametric space using biquadratic basis functions of 9 node quadrilateral elements is identical to the mapping using bilinear 4 node basis functions if the element has straight edges with mid nodes at mid points of each edge and the center node at the center of the element. The mapping equations using biquadratic basis functions are as follows 9 X = M,(r,s)X, i=1 1 1 1 = (r +r)(s2 +s)X1 + (r2 r)(s2 +s)X2 + (r2 r)(s2 s)X3 4 4 4 1 1 1 + (r2 +r)(s2 s)X4 + (1r2)(s2 +s)X5 + (r r)( s2)X6 (46) 4 2 2 1 1 + (1r2)(s2 s)X7 + (r2 + r)(1 s2)X, + (1r2)(1 s2)X9 2 2 where Xi is the nodal coordinates at node i and the numbering scheme used corresponds to Figure 21. The condition that midedge nodes are at the mid points of each edge and the center node is at the centroid of the parallelogram can be stated as follows. X, + X2 X2 +X3 X3 + X4 X4 + X, X,5= X6= X,7= X, = 2 2 2 2 X + X2 + X3 + X4 (4 4 Substituting Eq. 47 into Eq.46 and rearranging yields 1 1 1 X= ZM,(r,s)X = (+ r)(l+s)X + (1 r)(l+s)X2+ (1r)(1s)X3 4 4 (48) 1 4 + (1+r)(1s)X4 =ZM (r,s)X1 4 i The above equation shows that the mapping for the 9 node element is identical to mapping for the 4 node element when the 9 node element is a parallelogram satisfying the conditions in Eq. 47. Parametric coordinates corresponding to a given global coordinates are unique for a 4node quadrilateral element when it is a parallelogram. To make the calculation simple and fast, an analytical solution for the quadratic 4node element has been used. But in general there is no analytical solution for higher order elements such as quadratic 8 or 9 node elements. For such elements, in general, it is necessary to use iterative methods such as the NewtonRaphson method to find a solution for inverse mapping. However such numerical computation can be avoided when the higher order elements are parallelograms because, as shown above, the mapping is identical to that of bilinear elements when the mid nodes are centered. The analytic solution for the inverse mapping for 4 node quadratic elements can be obtained as follows. The mapping equations are: 4 x(r, s)= N, (r,s)x, (49) = 0.25(1+r)(1+s)xl + 0.25(1r)(+s)x2 + 0.25(1r)(1s)x3 + 0.25(1+r)(1s)x4 4 y(r, s)= N, (r,s)y, (410) =0.25(l+r)(l+s)yl + 0.25(1r)(l+s)y2 + 0.25(1r)(1s)y3 + 0.25(l+r)(1s)y4 Expanding and rearranging the above equations are be expressed as follows. 4 x(r, s)= N,(r, s)x, = al + b r + C + dirs (411) a, = 0.25(x + x2 + X3 + X4) where b =0.25(x x2 x3 +x4) c, =0.25(x + x2 X3 x4) d, = 0.25(x, x2 +X3 4) 4 y(r, s)= N, (r, s)y, =a2+ b2 r + 2+ d2rs (412) a2 =0.25(y, +y2 +y3 +y4) where b2 =0.25(y, y2 3 + 4) where c2 =0.25(y + y2 3 4) d2 =0.25(y y2 + 3 4) If the element is a parallelogram in real space, its two diagonals bisect each other. Therefore, di = 0 and d2 = 0. Then the following simple analytical solution as shown in Table 42 can be found. Table 42. Analytical solutions for the 4 node quadratic element mapping (parallelogram) bl 0 and c2 0 bl =0,b20 andcijl0 ya x a cbsy 2 x a, blr y a2 b2 ( 2 2x a S xa, cs X a br c, r s s r b1 c2 C1 b2 Even if the element is not a parallelogram, an analytical solution for the mapping from global coordinates to parametric coordinates can be found even though the solution to the mapping equations is not necessarily unique. Therefore, in this case, the validity of (r, s) should be performed by checking if the obtained r and s satisfy Eq. 46. As shown in Table 43, the mapping for a nonparallelogram element can have multiple solutions including imaginary solutions. Therefore the 2D element shape in this system is restricted to parallelogram to avoid such ambiguity in mapping. Table 43. Analytical solutions for the 4 node quadratic element mapping (non parallelogram) A O0 A= 0 and B :0 CBs C Ar r=7 s= A B B 0 B=0 A 0 A=0 m+ m2 4nl s n m im2 4nl r n s= r= 21 m 21 m where m2 4nl > 0 where m2 4nl > 0 A = b2 2 b A = b2 2 b dB dh Where < B = c2 2c1 where < B = c2 c, d, d, C=y xa2 1 2 a, = .. + 7 = 7 + l d, ad, ad, d, l=d,B l = d,A Where m = bB Ac, dC where m = cAA bA dC n = Ax Aa1 bC n = Bx Ba1 cC CHAPTER 5 CONSTANT CROSSSECTION SWEEP It is possible to create commonly used primitive solids such as spheres, cylinders and cones using 3D implicit solid elements. However, the current solid modeling practice involves creating design features by sweep operations such as extrude, revolve and sweep along arbitrary curves. While implementing such operations are easy using BRep models, it has not been attempted using implicit surfaces models. In BRep models, 2D profiles are defined as a loop of edges and swept along a curve to create sweep features. Surfaces generated by sweeping these edges along any curve are easy to define as parametric surfaces. To accomplish the same using implicit solid elements, the 2D profiles that are swept to create 3D features can be defined by Boolean combination of simple 2D primitives defined as described in the previous chapter. To define a 3D sweep feature using this 2D profile, it is necessary to define 3D implicit solid elements for sweep operations that are derived from any 2D implicit solid element that has been used to define the 2D profile. If the profile is defined using Boolean combination of multiple 2D primitives, then a corresponding 3D primitive is created for each 2D primitive. The 3D sweep feature is then obtained by a similar Boolean combination of the 3D primitives. In the following sections, 3D implicit solid elements are defined for representing solids obtained by extruding, revolving and sweeping a given 2D primitive where constant crosssections along the parametric t direction are obtained. A more general sweep operation is discussed in the next chapter where variable crosssections are allowed. 5.1 Extrude Elements The extrude element is used to represent the solid obtained by extruding (or sweeping along a straight line) a given 2D primitive defined using an implicit solid element. The direction of extrusion is assumed to be normal to the plane of the 2D primitive. By definition, every section of the extruded solid normal to the direction of extrusion should have a crosssection identical to the 2D primitive being extruded. Assuming that the 2D primitive to be extruded is defined by an implicit solid element with n nodes, the density function within the element can be expressed as follows n 2D (, S)N2(r, s) (51) i=1 The nodal values of density "2D are interpolated within the element using polynomial basis functions ND (r,s). Figure 51 shows the 2D element being extruded and its corresponding extrude element that has twice the number of nodes and its depth D in the parametric direction t is the desired depth of extrusion. Each node "i" on the front face (t=) of the element and the corresponding node (i+n) on the back face (t=l) are set to have equal values of density to ensure that both faces represent the same crosssection geometry. Extrusion Figure 51. 2D primitive element and the corresponding extrude element The density distribution within the extrude element is interpolated as 2n xt (r, s, t)= ~i3D (52) l=1 The basis functions for interpolating the density within the extrude element are derived such that the cross sectional shape at any t is identical. The basis function N3D at the node i for this element can be defined as follows. N 3D(r,s, t) = (1+ t)N2D for i =.....n (53) 2 3D1 It)NZD N3 (r,s, t)= (1t)N1 for j=n+i 2 The above basis functions ensures that the density distribution within the element is independent of t as shown below ZEx (r,, ,t) = N3DExt = 1 ( + t)j D Ext + 1 t)y N2D Ext =2 1 2 151 (54) =Z N2D D = 2D (r S) 1=1 where, the condition used is Ext = fExt = 20D This ensures that every cross section from the front to the back face of the extrude element is identical to the geometry represented by the 2D primitive element regardless of the type of the 2D element and the geometry represented by it. The mapping from parametric space to real space can be defined as follows for the extrude element. 2n X(r,s, t) = 'MExt (rst)X3D (55) i=1 The mapping has to be linear in t to ensure that the solid represented by the element is not distorted in the extrusion direction. In general, it is possible to use the basis functions used for interpolation for mapping also to create an isoparametric element. However, if the edges of the element are straight lines, the midedge nodes are at the center of the edges and the center node is at the centroid, then regardless of the number of nodes in the 2D element it is possible to use the following trilinear interpolation functions Mi (r, s, t) for extrusion. 1 1 1 M1 = (1+r)(l+s)(1+t),M2 =(1r)(1+s)(1+t),M3 (1r)(1 s)(1+t) 1 1 1 M4 = (I+r)(1s)(1+t),M5= (I(+r)(1+s)(lt),M6= (Ir)(1+s)(lt) (56) M7 = (r)(1s)(1t),M, = (1+r)(1s)(1t) 8 8 An examples of a solid created by extrusion are shown in Figure 52 where an ellipse represented using a single 9node element is extruded to create the solid in Figure 52B. Ir (A) (B) Figure 52 Solid created by extruding ellipse The profile to be extruded can be created using multiple elements as shown in Figure 53 where four elements are used. The first primitive was a rectangle from which an ellipse was subtracted at the bottom. A circle was added to this geometry by union at the top and another smaller concentric circle was subtracted. Upon extrusion, a 3D primitive is created for each of the 2D primitive used to define the profile. These primitives are then combined using the same Boolean operations that were used in the 2D profile to create the solid in Figure 53B. Figure 53 Extrusion of profile defined using multiple elements 5.2 Revolve Elements The revolve element is an implicit solid element used to represent the solid obtained by revolving (or sweeping along an arc) a given profile defined using a 2D implicit solid element. The revolved solid element is defined by specifying the 2D element, an axis of revolution and an angle of revolution. It is convenient to use a cylindrical coordinate system to define the nodal coordinates of the element as C, = {R, 0, Z, }. The cylindrical coordinate system is chosen such that its zaxis is along the axis of revolution of the element. The radial coordinates of the centroid of 2D primitive element is R, as shown in Figure 54. R r R0 Figure 54. Cylindrical coordinate system for revolving As in the extrude element, the density distribution at the front and back element faces as well as any crosssection in between should be identical. Therefore, the interpolation functions used in the extrude element is also used here to interpolate the density within the revolve element as 2n Rev (rS,t) = NDRe (57) 1i=1 where, ORev are the densities at the nodes of the revolved element and N3D are the basis functions defined in Eq 53. The mapping between the parametric space and the real space can be expressed as: 2n C(r, s, t)= C,M, (r, s, t) (58) z=1 In the above equation, C = (R, Z) is the coordinates of an arbitrary point in the element and Ci are the nodal coordinates both with respect to a cylindrical coordinate system. The mapping basis functions M, could be the same as the interpolation basis functions or when the 2D element's edges are straight lines, one could use the trilinear interpolations functions given in Table 32. To express the geometry with respect to a Cartesian coordinate system yet another mapping is required as illustrated in Figure 55. Let C = (R,0,Z) be the coordinates of a point in the cylindrical coordinate system and X = (X, Y, Z) be the coordinates of this point in the global coordinate system. c 0, Z) Sx^Xo (ax b Figure 55 Mapping from cylindrical to Cartesian coordinates The global coordinates with respect to the Cartesian coordinates can be expressed as: X(r, s, t) = X +R(r, s, t) cos(G(r,s, t))a R(r, s, t) sin(9(r,s,t))(a x b) + Z(r,s, t)b (59) In the above equation, Xo is the position vector of the origin of the cylindrical coordinate system while a and b are vectors along the radial and axial directions respectively of the cylindrical coordinate system. Figure 56. Examples for revolved solids Two examples of solids created by revolved elements are shown in Figure 56, where a sphere is constructed by revolving a semicircle. The second solid is created by revolving a profile defined using three elements. Two circles are subtracted from a square to create the profile which is revolved 2100 about an axis that is parallel to the edges of the square. 5.3 Sweep Elements The sweep element is used to represent a solid obtained by sweeping a profile represented by a 2D implicit solid element along an arbitrary parametric curve. Therefore, the sweep element is defined by specifying the 2D element, a sweep trajectory R(t) as well as an orientation vector d(t) that controls the orientation of the swept profile. The sweep trajectories can be any kind of parametric curves including composite curves. If the trajectory is a composite curve, the number of the 3D elements required to define the swept solid is equal to the number of curves used in the composite curve. The basis functions, NA,, defined in Eq. 53 can be used for this element also to ensure that the density distribution within the element is independent of the parameter t, so that the crosssections will be identical at any value of t. Therefore, the density distribution in a sweep element can be expressed as 2n ,s" (r, s, t) = N3D (510) v d E> R(t) Sweep trajectory z Ro u x Figure 57 Relationship between the global and local coordinate systems For the sweep element also it is convenient to use an intermediate (or local) coordinate system as shown in Fig. 47. The local coordinate system is defined using three unit vectors i, ii and fn. The vector i is tangent to the sweep trajectory can be computed as the derivative of the parametric curve equation R(t). = where tdR(t) Rt dt Ixd n  li_ lxd (511) m =nxl If d is invariant along the sweep trajectory, the sweep will be not be twisted. On the other hand, when d is a function of t and varies along the sweep trajectory, a twisted sweep will be obtained. In order to create a twisted sweep the user must specify d(t). It is important to ensure that d is not parallel to the curve anywhere along the trajectory. The nodal coordinates of the sweep element is represented with respect to the local coordinate system as L(r,s,t)= {u(r,s) v(r,s) t}T The mapping between the parametric space and the local coordinates u and v can be expressed as n u(r,s)= u,ND (r, s) I=1 (512) v(r,s) = vN2D (r, s) 1=1 where, ui, vi are nodal coordinates of the 2D element with respect to the local coordinate system. The mapping between parametric and the global coordinates can therefore be expressed as: X(r,s,t) =R(t)+ fu + iiv or X(r,s,t) =R(t) + fi uND (r,s) + m 'N2D (r,s) (513) i=1 i=1 Figure 58 shows two examples created using sweep elements. In the first example, a circle is swept along a cubic spline composed of three Hermite curves. Three sweep elements are therefore used, one for each curve of this composite curve. In the second example a more complex profile defined using nine 2D element is swept along an arbitrary composite curve. The resultant solid is obtained by Boolean combination of the solids represented by individual elements. rf~= 'p Figure 58 Examples of solids created using sweep elements CHAPTER 6 VARIABLE CROSS SECTION SWEEP As mentioned in Chapter 5, a more general sweep operation can have variable crosssections. Therefore the variable crosssection sweep using blend solid elements are described in this chapter. Blend elements are used to represent solids created by blending between a pair of 2D primitives (or crosssections) represented by 2D implicit solid elements. The 2D implicit solid elements used for representing the 2D primitives to be blended are referred to as "2D profile elements" in the following. Since a blended solid can be generated from two or more 2D profile elements, the total number of blend elements used for generating a blended solid depends upon the number of 2D profile elements. In other words, ifm 2D profile elements are given then (m1) 3D blend elements are required to create a solid primitive that blends between these 2D profiles. Unlike extrude, revolve and sweep elements, the shape of the crosssection can vary from one profile to another profile along the t direction in the parametric coordinates. Therefore the intermediate shape from one profile to the next has been studied to obtain a clear understanding of the nature of the blended solid obtained. Two different types of blended solid primitives have been defined in this chapter, namely, straight blend and smooth blend. This classification is based on the surface continuity between the solids defined in adjacent elements. Straight blend is Co continuous while smooth blend defines a C1 continuous blend so that the surface of the primitive defined by these elements is tangent continuous at the interface between neighboring elements. Blend elements also can be classified based on the sweep trajectory along which the 2D profiles are swept. If the sweep trajectory is a straight line, it is called "extrude blend element" simply denoted by "blend element". If the sweep trajectory is a general parametric curve, it is called "sweep blend element". To define blend elements, all 2D profile elements used for representing 2D profiles should be the same type of element. In other words, all 2D profile elements should have the same number of nodes per element and the same shape function for each node but they may or may not have the same size and nodal density distributions. In the following section, the detailed description of the blend elements is described. 6.1 Straight Blend Element Two 2D profile elements and the distance between them are required to define a straight blend element. Let the shape density functions of front and back 2D profile elements be "F2D and "B2D respectively. F2D = 2D (r, )F =N2DF + NDF + ..... (61) 1=1 ~B2D =YN,2DrS)OB 1 = N,2D D + NDA +. + ND (62) N2D is the 2D basis function at the node i and n is the number of nodes per element in the 2D profile element. Now, density distribution within the straight blend element can be defined by the following shape density function. STBIend (r, t) = Y N3D, (63) 1=1 The basis functions for interpolating the nodal densities are designed to give linear interpolation in the parametric direction t that is the desired direction of depth. The following equation shows the basis function N3D at the node i. N3D (r, s, t) = (1 + t)N,2D (r, s) for i = 1.... n at the front face of the element 2 ND (r,s, t) = (1 t)N2D (r, ) forj= n +i at the back face of the element (64) The mapping from the parametric space to the real space for the straight blend element can be defined as 2n X(r,s,t) = M (r,t) (65) =1 XD and M,3 are the nodal coordinates and the mapping basis function at the node i respectively. As in the previous chapter, it is assumed that the midedge nodes are at the mid point of the edges and that the center node is at the centroid so that the trilinear mapping functions defined in Eq. 56 can be used. The crosssectional shape at the common face between elements is identical to the 2D primitive used for creating the straight blend element. Therefore the blended solid defined by the straight blend element has the following properties. Property 6.11: The blended solid represented using the straight blend elements satisfies Co continuity at the interface between each neighboring element. t = 1 at Element B t = 1 at Neighboring face Element A [t= 1 at Element A, t= 1 at Element B] Figure 61. Two neighboring straight blend elements having quadrateral 9 node elements as 2D profile Proof: It can be verified by showing that the density distributions at t = 1 at the element A and t = 1 at the element B are identical to the density distribution of the 2D profile element used for the common face. Therefore the shape of interest at the common face between two neighboring elements is same as the 2D profile used. nd (r, ) N2D (r, S)B 2D at the element A i=1 mTBlend (, s,) N2D (rs)F= F 2D at the element B (66) '=\ B2D = F2D because the same profile element is used for representing the back face of the element A and the front face of the element B. As mentioned earlier, the 2D profile elements may or may not have the same density distribution. If the density distributions of the front and back 2D profile elements are identical, the surfaces connecting the front and back 2D profiles have the following property. Property 6.12. The surface connecting the front and the back 2D profiles in the straight blend element is composed of straight lines that connect points having the same r and s but different t value (i.e. t = and t 1 respectively) only ifF = eB. X(r*, s*, 1 . X(r*, s*, 1) Back face where t = 1 Front face where t=1 X(r*, s*, t) Figure 62. A straight blend element having quadratic 9 node elements as 2D profiles Proof: If the density distribution for the front and the back 2D profile elements are the same, the shape density function for the straight blend element can be obtained by applying the condition = ,F _= B as follows. STBlend N2 (r, s)O, (1 + t) + (1 t) = N2 (r, s)q, (67) 12 2 1 Eq. 67 shows that the crosssectional shapes along the parametric direction t are invariant with respect to the t in the parametric space. Suppose (r*,s*) is the parametric coordinates of a point on the boundary so that 2D (r*, s) = b (boundary density) then X(r*, s t) is the position vector of a point on the curve along the surface of the solid connecting points on the front and back faces that share the same parametric coordinates (r*,s*). It would now be shown that this curve is a straight line. 1 r1 ,s2 1z 1 2,s) (1t) N 2D F 2Dz NBr 1=1 1 In the above equation, (x[, y, z[) and (xS, yB, z ) are the nodal coordinates at 1 1 the front and the back face of the straight blend element respectively and XF and XB are defined as 1 1 N2D *T S + t)z *\2D S)( t)zT 2 2 N rs )x., N7(r ,s )y, 1i 1i ( (+ t)XF +  ( t)XB (68) points having the same r and s and different t 1 and t 1 respectively. Such a surface clear that in general when the 2D profile elements defining the blend element have N,2D*S)F YN'2D S 1=1 (=1 s x diretion, the following property can b e obtain the point Xd.and X From Eq. 67 the density values at XF and XB are same and the densities through the line is also same. Therefore it is verified that the surface is composed of straight lines connecting two points having the same r and s and different t = 1 and t = 1 respectively. Such a surface is known as a lofted surface (or ruled surface) [Filip and Ball, 1989]. Intuitively, it is clear that in general when the 2D profile elements defining the blend element have different density distributions the blending surfaces are not guaranteed to be lofted surfaces. Investigating cross section shapes of the blend element along the parametric t direction, the following property can be obtained. Property 6.13. The crosssectional shape of the straight blend element at a certain parameter t* is a parallelogram if the midedge nodes are at the center of each edge and midface node is at the centroid of the face. s=1 6 r=1\ X(1,1, t*) s=l X(1,1, t*) 5 X r= 1 r r= 3 X(1,1, t*) s = 1 X(1,1, t*) t=1 4 t=t* t=I s = 1 r = 1 Figure 63: Cross section at a certain t in the straight blend element Proof: To prove that the crosssection is a parallelogram it is first shown that the edges of the crosssection are straight lines. It can be assumed that the mapping basis functions are trilinear regardless of the number of nodes in the element if the midedge nodes are at midpoint of the edges and mid face nodes are at the centroid of the face. Therefore the mapping equation can be expressed as 8 X(r, s, t) = [ M,(r, s, t)X, (610) 1=i In the above equations Mi are the trilinear basis functions and X, are the nodal coordinate points in the global coordinate system. Expanding the above equation by substituting the trilinear basis functions for Mi(r,s,t), yields, 1 1 1 X= (1 + r)(1 + s)(1 + t)X, + (1 r)(1 + s)(1 + t)X2 + (1 r)(1 )(1 +t)X3 8 8 8 1 1 1 + (1 + r)(1 s)(1 + t)X4 +l(l+ r)( + s)(1 t)X, + (1 r)( +s)(1 t)X6 (611) 8 8 8 1 1 + (1 r)( s)( t)X, + (1 + r)(1 s)(1 t)X, 8 8 At any crosssection of the element t is constant so it will be denote as t*. The equation of the boundaries of the element at this crosssection can be obtained by setting parametric coordinates r and s to 1 or 1. Consider the edge where r = 1, the equation of the edge, X(1,s,t*), can be expressed as 1 1 1 X(1,s, t*) = (1+ s)(1+ t*)Xl + (1 s)(1+ t*)X4 + (1 + )(1 t*)X, (612) 1 + (1 s)(1 t*)X, 4 Rearranging, X(1,s,t*)= (I+s) ((1+t*)X, +(1t*)X +(1Is){ (1+t*)X4 +(1t*)X, Since t*, X1,X5,X4 and X8 are constants, it is clear that the equation of X is that of a straight line where only s is a variable. Similarly it can be verified that other three edges defined by r = 1, s = 1 and s = 1 are also straight lines. Now to show that the quadrilateral defined by these four straight lines is a parallelogram it needs to be verified that the diagonal of this quadrilateral bisect each other. Let four vertices of the crosssection of the element at a given t* be X1, X2, X3 and X4 respectively. 1 1 X(1,1,t*) X = (1+ t*)X, + (1 t)X, x2 2+ 1 1 X( 1,1,t*)= X2 = (1+t*)X2 +(1 t*)X6 2 2 X(1, 1,)= X (l+t )X3 +(lt )X 2 2 1 1 X(1, ,t*) = X4 =(1+ t*)X4 +(1 t*)X, (613) 2 2 The mid point of each diagonal can be represented by X +X3 (t(1+*)(X,+X3)+ (1t)(X,+X,) 2 212 2 X +X 1 1 1 2 4 (1+ t*)(X2 + X4) + (1 t*)(X6 + X) (614) 2 2L2 2 From the fact that 2D profile elements are parallelograms, the following equations can be obtained. X, + X34 X + X X + X X +8 (615) 2 2 2 2 Applying the above conditions to Eq.614, the following relationship can be obtained. X* +X X +X 1 3 2 4 (616) 2 2 Therefore the midpoints of the two diagonals are the same thus proving that the crosssection is a parallelogram. This is a very important property because it can be used for the mapping from the global coordinates to the parametric coordinates. Once it is verified that the crosssection shape of the straight blended element at a certain parametric coordinate t* is a parallelogram, then twodimensional mapping techniques can be used for finding the parametric coordinates r and s. Examples of solids created by blending 2D profiles are shown in the following figure where four 2D profiles are used for both examples. Figure 64A shows the blending between circular shapes and figure 64B shows the blending between circular and rectangular shapes. (A) (B) Figure 64. Examples of straight blend using blend elements 6.2 Smooth Blend Element Smooth blend elements construct a C continuous blended solid between 2D profile elements defined along a straight line. The shape density function for the smooth blend element can be defined by 2n end (r, s,t) = (N, + ) (617) q and are the nodal density and its corresponding tangent component at the node i respectively. The basis functions for interpolating the nodal densities are designed to give Hermite interpolation in the parametric direction t. The following shows the basis function N3D and N3D at the node i. 2 2= D H 22DH for i =1.....n N,3D N,2D +1 t1 =2DH2 for i= .....n (618) 2 ) 3D N 2D 13 t 2 2 3 2DH3 for j=n+i N 3D 2N2D t 2 +l2 + 2DH 4 O 1 3 VN = 2t + =ND H4 for j = n +i A composite Hermite curve is guaranteed to be C1 continuous regardless of the tangent at the nodes. However, to set the tangent components at each node automatically, the following two additional conditions are used. First, the second derivative at the end each element should be equal to that at the beginning of the adjacent element. Second, the secondorder derivatives are set to zero at both ends of the primitive. According to these conditions, the following linear equations are obtained, by which an automatic method for setting the tangent components can be achieved. The following equation is a matrix form for N simultaneous linear equations. Therefore, the tangent components can be computed by solving the following equation. 2 1 0 0 ........ 0 R 3R2 3R1 1 4 1 0 : R' 3R 3R1 0 1 4 1 : R3 3R4 3R2 0 *= (619) 1 4 10 0 1 4 1 RN1 3RN 3RN2 0 0 0 1 2 RN 3R, 3RN In the above equation, R1 = 4 and R' = In the smooth blend element, the mapping from the parametric space to the real space can be performed as 2n X(r, s, t)= (MD (r, s,t)X3D + MAD (r, ,t)X3D) (620) i=1 XD and XtD are nodal coordinates and its tangent components at the node i. M,3D and M2D are mapping basis functions that are identical to N,3D and N3D respectively for this element. X3D is computed from Eq. 619 setting R1 = X3D and R' = XD The following property is proved to show that the solid created using the smooth blend elements has C1 continuity along the parametric coordinate t. Property 6.21. The blended solid using the smooth blend elements satisfies C1 continuity at the interface between adjacent elements. VO (r, s, 1) = V, (r, s,1) Element SEl n Element B Element A . t = 1 at Common face Element A [t= 1 at Element A, t= 1 at Element B] Figure 65. Two neighboring smooth blend elements having quadratic 9 node elements as 2D profile Proof: This property can be verified by showing that the surface normal vector is continuous at the interface between each neighboring element. Suppose the face of interest is the back face (i.e. t = 1) in the element A denoted by EA and the front face (i.e. t = 1) in the element B denoted by EB as shown in figure 65. The surface normal vector is computed by gradient of the shape density function or normal to the element surface in this system. The following is the formula for computing the gradient of the shape density function with respect to the global coordinates x, y, z. 00 00 9ax ay az ax ar dr dr dr a [ a ax (62z V4 = < = [j] > Where, the Jacobian matrix [J]= x az (621) ay as as as as 9 00 9ax ay az z, at a 9t at at Let the shape density function at the element A and the element B be EA and 4EB respectively, then (r, s, t) = ND (r, s)[H (t)q, +H2 (t)Ah + H3 (t) A, + H4 (t)q4 ] 1=1 EB (r, s, t) = N,2D (r, s)[H (t), + H2 (t) + H3 (t) + H4 (tB] (622) i=1 Since both element A and element B are sharing the 2D profile element at the common face, the density distributions at the back face of the element A and the front face of the element B are identical. Therefore, S= = and = = (623) Differentiating 4EA and 4EB with respect to r, s and t and thereafter substituting 1 for the parameter t at the element A and 1 for the parameter t at the element B into Eq. 6 22 and applying Eq. 621. S(r, ,1)2D (rs) EB (r, s,1) ar a dr dr S(, 1) (r, s) 0 EB (r, s,1) 0_EA, (r, 1) 1 0EB (r, s,,1) )= N2D (rs = (624) at 2 ,=7 at Similarly, the above procedure for x, y and z instead of 4 can be applied. Now, let x, y and z be xEA y z, and xEB EB ZEB with respect to the corresponding elements. Then =1 EB (r, s, t)= N2D (r, s)[H (t)xB + H2 (t)B + H3 (t)x + H4 (t)xB] (625) I=1 Where x = xB = xF and x,= xB, = xF, Differentiating xA and xEB with respect to r, s and t and then substituting 1 for the parameter t at the element A and 1 for the parameter t at the element B into Eq. 625. xEA (r, s, 1) n aN2D (r, s) XEB (r, s,1) Or 1 = r r xEA (rs, s1) N2) (r, s) xEB (r, s,) as i=1 s s axEA (r, S,) n 2DEB (r, S,1) N,2D (r s)x, B( 1) (626) at 2 at Following the same procedure for y and z, the similar relation to Eq. 626 for y and z can be found. From Eq.s 624 and 626, yields, VE1(r, S,1)= V0E2, (r,,1) (627) Therefore Eq. 627 proves the property 6.21. If the density distributions between the front and the back 2D profile elements are identical, the surfaces connecting the front and back 2D profiles have the following property. Property 6.22. The surfaces connecting the front and the back 2D profiles in the smooth blend element are composed ofHermite curves that connect points having the same r and s but different t value (i.e. t = 1 and t =1 respectively) only ifF = B . r Back face where t = 1 Front face where t=1 X(r*, s*, t) Figure 66. A smooth blend element having quadratic 9 node elements as 2D profile Proof: If the density distributions for the front and the back 2D profile elements are same (i.e. OF = 0B ), it implies that all tangential components, are zeros according to Eq.622. Therefore the density function can be simplified as follows. ~SMBlend n 2D + 1)2 2D t + 1 2 t + 1 )3 Ze N, =(r,s)r 3t 2 t+ J + N,2D (r,s) 1 3 + 2 1]B 1=1 2 =1 2 Applying the condition = 0F = 0B, then SMsBIen = N2D (r, S) (628) i=l The above equation shows that the crosssections along the direction of t in the parametric coordinate system are invariant. Let (r*, s*) be the parametric coordinate of a point on the boundary of the solid so that 2D (r*, s*) = b (boundary density), then density value at every point on a straight line connecting (r*, s*, 1) and (r*, s*, 1) in the parametric coordinate system is Ob because Eq. 628 shows that density is invariant with respect to t. Therefore, this line is guaranteed to be on the surface of the solid. The parametric equation of the line mentioned above in the global coordinate system is S I=1 X(r*, s*, t) =y IN N2D*,S')H(t) yF + H2(tytF+H3 ( + H4 h N,2D(r *, s*)[H(t)z7 + H2(t)zF + H3(t)zf + H4(t)z] I=1 =H,(t)XF + H2()XF +H3(t)XB + H4(t)X This is a Hermite curve equation where N7 D(r ,., ), c N, (r ). n n X F and IN ( ) D i, ND(r*,s*)z[ XF__ F __ 2D *S)y > and XF tB >2D S(* *)tF F f =1 B 1=1 z n (rZ t n (r, XB Nz2D *,s)y and X F S Z ND *, S )yF S 1N2 D(r,s)z (r,s)z 1 1 n n Sc i 2D *,t s s te f 2D l*,g e tiB Xt IX X t = n n XWhe = re = < N2 *,S) and XX = Fy = h 2D *,SXF T B e2 D=1 B 2=1 N,2D *, a S b1 wt a This curve is also a cardinal spline if it satisfies the following equation. XF +4X, +X,, =3(X XF) Where X, = X E = XF This equation can be written as follows. N (r ,s )'tEA +4xh + XEB 2=1 S N r2D *\i1F A B N2Dr ,s ) zEA 4 +4yz +, EB 2=1 N 2D *,S F +4z, +zB, ZN72D BS XB N D *,S ) Bz =1 =1 i1 Or N x2D + 4X, +X = 3 N2D *r, )( X XF) 2=1 2=1 (629) (630) (631) (632) F} ZEA ZF } Z EA, (633) + t,= 3 B (XB F) Since the solid element is defined such that X h + 4X1 + X (B = 3(XB XEA (see Eq. 619), the above equation is automatically correct. Therefore when density distribution is identical for front and back faces the smooth blend primitives have C2 continuity along the t direction at the common face between neighboring solid elements because curves on its surface in the parametric direction t are Cardinal splines. However, in general when 2D profile elements defining the smooth blend element have different density distributions, the resulting blended solid's boundary is not composed of cardinal splines. Investigating crosssectional shapes of the smooth blend element along the parametric direction t, the following property can be obtained. Property 6.23. The crosssection shape of the smooth blend element at a certain parameter t* is a parallelogram if the midedge nodes are at the center of each edge and midface node is at the centroid of the face. 6 10 t = 1 at element B I 9 X(1,1, t*) s = 1 X(1,1, t*) 12 r=1 r= 3X(1,1, t8) s = 1 X(1,1, t*) A) t=t* t = 1 at 1 Common face element A [t= 1 at element A, t= 1 at element B] Figure 67. Cross section at a certain t* in smooth blend elements Proof: To prove this property, it is first verified that it is true in the smooth blend element. Initially it is assumed that 4 node quadrilateral elements are used for the 2D profile elements. The mapping equation as shown in figure 67 is 8 X(r, s, t) = (N, (r,s, t)X, + N,(r, s,t)X,) (634) '=1 Consider the edge where r = 1, for any crosssection t=t*. The points on this edge, X, can be written as 1 1 X(1, s, t)= (1 + s)H, (t)X + (1 s)H (t)X4 2 2 1 1 + (1+ s)H3(t)X, + (1 s)H3 ()X 2 2 (635) 1 1 + (1+ s)H2(t)X,, + (1 s)H2 ()X,4 2 2 1 1 + (1 + s)H4(t)X, + (1 s)H4(t)X, 2 2 From Eq. 619, it is known that, 2Xt, + X,5 = 3X5 3X, 2Xt4 + X,, = 3X, 3X4 Xt + 4X5, + Xt9 =3X9 3X1 Xt4 +4X8, + Xt2 = 3X12 3X4 According to the above relationships, X(1,s,t) can be simplified as X(1, s, t)= (1+ s)(H, (t)X, + H2 (t)X, + H3 (t)X + H4 ()X,,5 2 (636) + 1(1 s){H1 (t)X4 + H2(t)X,4 + H3 ()X, + H4(t)X,, } 2 Since t, Xi, X5, X4, Xs, Xtl, Xts, Xt4 and Xts are constants, therefore the final form of X(1,s,t) is a line equation where the variable is s. Similarly it can be verified that other three edges defined by r = 1, s = 1 and s = 1 are also straight lines. This proves that the cross sectional shape of the blend element at a certain t* is a quadrilateral. This quadrilateral is a parallelogram if its diagonals bisect each other as shown below. Let four vertices of the crosssectional shape be X,1, X X and X4 respectively. X(11, t) = x = H, (t)X, + H (t)X,, + H3 (t)X, + H (t)X, X(1,1,*) = X = H(t)X2 + H2(t)Xt2 + H3(t)X + H(t)Xt6 X(l, 1, t) = X* = H,(t)X3 + H2(t)Xt3 + H3(t)X, + H4(t)X,, X(1, 1,t) = X4 = H (t)X4 + H2 (t)X4 + H3 ()X, + H4 ()X,, (637) The midpoints of the two diagonals are 1 +3 1 [H,(t)(X + X3) + H2(t)(X,, + X3) 2 2 + H3 (t)(X, + X7) + H4 (t)(Xt5 + X,7) X 2 4 _1 [H(t)(X2 + X4)+ H2(t)(Xt2 + Xt4) 2 2 (638) + H3(t)(X6 + X,) + H4(t)(Xt6 + Xt) Again from Eq. 619, the followings can be obtained. 2Xt, + X5, = 3X, 3X, 2Xt2 + Xt6 = 3X6 3X2 2Xt3 + X,7 = 3X7 3X3 2Xt4 + Xt = 3X, 3X4 The above equations can be combined to yield the following equations. 2(X,, + Xt3) + (X5, + X,7) = 3(X, + X) 3(X, + X3) 2(Xt2 + Xt4) + (Xt6 + X8,) = 3(X6 + X,) 3(X2 + X4) (639) From the fact that the 2D profile elements used to define the smooth blend are parallelograms, X + X3 X2 +X4 and X + X X6 + X(640) and (640) 2 2 2 2 Therefore, the following equation can be obtained from Eq. 639. 2(X,, + X,3) + (X5, + X,7)= 2(Xt2 + Xt4) + (Xt6 + X,8) (641) The following is also satisfied. X,, + 4Xt + Xt9 = 3X9 3X, Xt2 + 4Xt6 + Xto = 3X10 3X2 Xt3 + 4X7, + Xt = 3X, 3X3 Xt4 + 4X8, + Xt2 = 3X2 3X4 The above equations can be combined and yield the following equations. (X, + Xt3) + 4(Xt, + X7,)+ (Xt9 + Xt,) = 3(X9 + X,) 3(X + X3) (Xt2 + X4) + 4(Xt6 + X,,) + (Xo + Xtl2) = 3(X,1 + X12) 3(X2 + X4) (642) From the fact that 2D profile elements are parallelograms, X, + X3 X2 + X4 and X9 + X1 X1 + X12 (643) 2 2 2 2 Therefore, the following equation from Eq. 642 and 643 can be obtained. (Xt, + Xt3) + 4(X,, + X7,) + (Xt9 + X,,t) = (Xt2 + Xt4) + 4(Xt6 + X,,) + (Xt0o + Xt12) Applying Eq. 641 and Eq. 644 to the Eq. 638, yields X* + X* X2 +X* 1 3 2 4 (645) 2 2 Therefore the crosssection is a parallelogram since Eq. 647 shows that the midpoints of the two diagonals are coincident. So far, it is assumed that 4 node elements are used as 2D profile elements to verify property 6.23. This is also true when 9 node elements or others are used if their mapping equations are equal to the mapping equation at 4 node elements as explained below. Let the mapping equation of the smooth blend element having 4 node profile elements be X4. 4 X4 (r, ,t)= (HN, (r, s)X, + HN, (r, s)X,) 1=1 (646) + Z(HN (r, s)X+4 + H4N (r, s)Xt(,+4)) 1=1 The following shows the mapping function at the smooth blend element where quadratic elements having n nodes are used for 2D profile elements. X" (r, s, t)= (H1N, (r, s)X, + HN, (r, s)X,) 1 (647) + (H,(N, (r, )X + H)X,,, n)) If the mapping equation in the 2D profile element having n nodes is same as the mapping equation in the 4 node quadrilateral element, i.e., if n 4 N, (r, s)X, = N (r, s)X, (as proved in Chapter 4 for 9 node elements, Eq. 48), the 1=1 1=1 following is also true. X4(r,s,t)=X"(r,s,t) (648) This property can be used for the mapping from the global coordinates to the parametric coordinates. Once it is verified that the crosssection shape of the smooth blend element at a certain parametric coordinate t* is a parallelogram, then two dimensional mapping techniques can be used for finding the parametric coordinates r and s. Examples of solids created by blending 2D profiles are shown in the following figure where four 2D profiles are used for both examples. Figure 68A shows the blending between circular shapes and figure 68B shows the blending between circular and rectangular shapes. (A) (B) Figure 68. Examples of Smooth blend using blend elements 6.3 Sweep Blend The sweep blend element is used to represent a solid obtained by sweeping 2D profiles represented by 2D implicit solid elements along an arbitrary parametric curve. Therefore, the sweep blend element is defined by specifying the 2D profile elements, a sweep trajectory R(t) as well as an orientation vector d(t) that controls the orientation of the swept profile. The detailed description regarding sweep trajectories is explained in Chapter 5. Two different types of blending functions, straight and smooth blending can be applied to sweep blend too. Therefore all properties illustrated already in the previous sections are also applicable to sweep blend. Since the nodal coordinates of the sweep blend elements are represented with respect to the local coordinate system as L(r,s,t) ={u(r,s,t) v(r,s,t) t}T, the mapping between the parametric coordinates and the local coordinates u and v can be expressed as n u(r,s,t)= u,N,(r,s,t) t1= v(r,s, t)= vN,(r, s, t) (649) where, ui, vi are nodal coordinates of the sweep solid element with respect to the local coordinate system. Ni(r,s,t) are basis functions for both the mapping from the parametric coordinates r, s and t and interpolating nodal densities. Therefore the basis functions are different with respect to the blend types such as straight blend and smooth blend. Examples of solids created using sweep blend element are shown in the following figure where four 2D profiles are used for both examples. Figure 69A shows the sweep straight blending between rectangular shapes and figure 69B shows the sweep smooth blending between circular shapes. (A) (B) Figure 69. Examples of Sweep Blending A) Sweep straight blend B) Sweep smooth blend CHAPTER 7 CSG REPRESENTATION USING IMPLICIT ELEMENTS CSG representation scheme is used for representing a solid in this solid modeling system where implicit solid elements are used for representing primitives instead of half spaces. The final solid is constructed by combining simple primitives using regularized Boolean operations to define a solid as a closed region in space. It is necessary to compute points and surface normal vectors on the boundary of the solid for graphically displaying it. The following sections, describe the CSG tree structure used in this system, how to compute surface normal vectors, and how to perform setmembership classification. 7.1 Surface Normal Vectors To graphically display primitives defined using implicit solid elements, it is necessary to evaluate points on the surface and to compute surface normal vectors at these points. The method for evaluating points on the surface is explained in chapter 9. Here, the method for computing the surface normal vector at a given point on a primitive represented by an implicit solid element is described. To compute the surface normal vector at a given point on the boundary of a solid represented using an implicit solid element, the point has to be first classified as inside the element (4 = k1b,1 < r < 1, 1 < s <1,1 < t < 1) or on the boundary of the element (r = +1 or s= 1 or t= 1). If the point is inside the implicit solid element, the gradient of the density function is computed since it is a vector normal to the surface at the point of interest. The gradient of 4 with respect to the global coordinates (x, y, z) can be computed as: Ox Or V = , [J] 1(71) ay ds az at W r l) COz ox ay az Or Or Or Where [J]= C Oz (72) as as as x ay aoz at at at The [J] matrix or the Jacobian matrix can be easily obtained since the mapping expresses x, y and z as functions of r, s and t. For instance, the first component of the n Jacobian matrix can be expressed as where x = xN, (r, s, t). t=1 S_ rst)_ (xN,(r,s,t)) + a(x2N(r,s,t)) 8a(xnN (r,s,t)) (7 + ++ (73) Or Or Or Or Or Similarly, the other components of the first column are x N (r, s,t) (xN,(r,s,t)) 8(x2N2,(r, s,t)) O (x N (r,s,t)) as as as as as x x, (r, s, t) (xN,(r,s,t)) 8(xN2 (r,s,t)) 8(xN (r,s,t)) + ++ (74) at at at at at The second and third columns of the Jacobian matrix can be computed by replacing x with y and z in Eq. (73) to (74) respectively. Note that the gradient points towards the direction of increasing density 4 that is towards the inside of the solid. Therefore, the surface normal is set in the opposite direction as n = V4 . The actual equations for finding each component of the Jacobian matrix depend upon the mapping functions of r, s and t. Therefore, the solid elements having different mapping functions need to be treated accordingly. Since extrude, revolve and sweep elements have their own mapping functions that are different from each other, they have their own corresponding equations for finding the components of the Jacobian matrix as follows. In extrude elements including extrude blend elements, Eq. 73 and Eq. 74 can be used directly because the global coordinates (x, y, z) are just functions of the parametric coordinates (r, s, t). Therefore each component of the Jacobian matrix can be computed by just differentiating the mapping function with respect to the parametric coordinates (r, s, t). However revolve elements use the cylindrical coordinate system whereas the extrude elements use the Cartesian coordinates system. Therefore one more step is required to find the surface normal vectors for revolve elements. The following is an example where the first components of the Jacobian matrix is computed. cx cx cR Ox cO 8x 8Z = ++  (75) Or OR Or Oc Or OZ Or Here , and can be derived from Eq. 59 explicitly. OR 00 OZ Ox Ox Ox =a cosOc sin = aRsinOc RcosO and b (76) OR 0o0 OZ Since R, 0 and Z are represented by the interpolation using the nodal basis functions, their differentiations are Or Or Z a Z,N,(r,s,t) Or Or In sweep elements, the following equations are used for computing the each component of the Jacobian matrix where the notations used in Eq. 78 are followed from chapter 5. dx dr dP(r, s,t) dy n dN, (r,s) M dN,2D (r, ) dr dr Y dr ~ dr dz dr dx ds dP(r, s,t) dy a y dN,2D(r, ) M dN,2D(r, s) = n u + mv, (78) ds ds ds ds dz ds dx dt dP(r, s, t) dy dR(t) dt dt dt dz dt If the point of interest is on the boundary of the element, the surface normal vector is equal to the vector normal to the element face on which the point is located. The position vector R(r, s, t) of an arbitrary point within the element is expressed as follows n x M, (r,s, t) R(r,s,t)= y = yMl(r,s,t) (79) 1=1 nzZM l(r,s,t) 1=1 The six faces of a hexahedral element are represented as R(1, s, t), R(1, s, t), R(r,l,t), R(r,1, t), R(r, s,1), R(r, s,1) respectively. Since these are parametric equations of surfaces, the normal vector for any point on these faces can be easy computed as the cross product of the tangent vectors along the parametric directions. For example, normal vector to the face R(1, s, t) is aR(1, s, t) aR(1, s, t) n x (710) as at Similarly, the normal vectors can be computed on the other five faces. Table 71 shows the normal vectors on all six faces of the element. Table 71 Surface normal vectors on the boundary of the element Element Face Normal Vector Element Face Normal Vector R(1, s, t) cR(1, s, t) R(1, s, t) R(1, s, t) OR(1, s, t) X R(1, s, t) x x as at at as R(r,1, t) aR(r,l, t) R(r,lt) R(, t) t) 8R(r,1, t) X R(r,1,t) at dr dr at R(r, s,1) aR(r, s,1) XR(r, s,1) R(r,s,1) 8R(r, s,1) XR(r, s,1) x x _r as _s Or Surface normal is ambiguous for points along the edges and vertices of the implicit solid element unless a face of the element is also specified whose normal is to be computed at the point. 7.2 Set membership classification within an element An important requirement for any unambiguous solid model representation is that one should be able to classify a given point as being inside, on, or outside the solid. Algorithms for such point set member classification are nontrivial for BReps. For traditional implicit surfaces, one can use the value of the implicit surface function to determine which side of the surface a point lies on. However, for primitives defined using implicit solid elements, the density function is expressed as a function of the parametric coordinates and therefore it is necessary to first map a point from the real space into the parametric space to evaluate the density. The mapping between those two spaces is typically nonlinear. If the given point is X, then the following equations for the parameters rp, s, and t, that corresponds to this point need to be solved. Xp = XM,(rp,Sp,tp) (711) If the mapping basis functions, M,(rp,sp,tp), are nonlinear three simultaneous non linear equations need to be solved. Since it is not always possible to obtain analytical solution for such equations it is necessary to use numerical methods such as Newton Raphson method to find a solution. Clearly, these equations will be easier to solve if simple basis functions for the mapping are used. For example, when a 9node element is used, the interpolation basis function is bicubic, but one could use a simpler bilinear (4 node) basis functions for the mapping if the element edges are not distorted into curves and midnodes are mid points of each edge. Moreover the mapping function can be solved analytically to find the parametric coordinates from the given global coordinates as shown in Chapter 4. An analogous set of mapping equations for (x, y, z) can be derived for the 8node hexahedral element where trilinear basis functions are used. Even though for the general case these equations are nonlinear, they reduce to linear simultaneous equations for elements whose opposing faces are parallel. Therefore, if the shape of the element in the real space is a parallelogram in 2D or a parallelepiped in 3D then the mapping is linear and easy to perform in either direction. However, in general, three nonlinear simultaneous equations need to be solved numerically to compute the parametric coordinate. To avoid such numerical computation 3D problems are reduced to 2D problems that can be solved analytically. This is based on the idea that the crosssections of the implicit solid element along the sweep direction are parallelograms and the mapping from the real space to the parametric coordinates of this parallelogram is bilinear. All predefined 2D primitives are parallelograms so that the mapping equations can be solved analytically. Therefore the first step in mapping is to find the parametric value t for the given point. When the sweep trajectory is a straight line, the parameter t* can be easily computed by comparing the distance from the given point and the element front face and the depth of the element. Similarly, when the sweep trajectory is an arc, the parameter t* can be computed by comparing the angle between the given point and the element front face and the total angle of revolution of the element. In the case of sweep elements including sweep blend elements where the sweep trajectories are arbitrary parametric curve equations, the nonlinearity in the mapping is introduced by the sweep trajectory. The parameter t* can be computed as the optimal solutions obtained by minimizing R(t) X that is by finding the closest point on the trajectory R(t) from the given point Xp where the R(t) should satisfy the following equation. OR(t*) R( (R(t*) X) = 0 (712) at Now, from the parameter t* obtained from the above procedure, a parallelogram having the four vertices such as X(1, 1, t*), X(1, 1, t*), X(1, 1, t*) and X(1, 1, t*) can be built. Thereafter analytical method can be used to find the parametric coordinate r and s. By using this technique, setmembership classification is fast and efficient in this system. After finding the parametric coordinates (r, s, t) from the given global coordinates (x, y, z), the given point can be easily classified as inside, outside and on the solid with respect to primitive by computing the shape density value at the point. Figure 71 shows the procedure for setmembership classification with respect to an element as a flow chart. Figure 71 Flow chart for setmembership classification in an individual solid element 7.3 Constructive Solid Geometry using Implicit Solid Elements As mentioned earlier, CSG representation is a wellestablished technique for representing solid models and is used to construct solid models by Boolean combination of primitives that are represented either as BRep or using implicit half spaces. The same approach can be used with primitives represented by the implicit solid elements. An advantage of using the implicit surfaces is that set membership classification is computationally less expensive than with BRep. Furthermore, there is no need for expensive boundary evaluation algorithm, which is needed in the hybrid approach to automatically construct the BRep model of the solid represented by the CSG tree. This step is necessary in the hybrid approach because the BRep model of the Boolean result is needed for creating the graphical display and also for subsequent operations such as set membership classification. However, if the primitives used in the CSG tree are represented using implicit solid elements, it is possible to directly compute the solid's properties, generate graphical display and perform set membership classification based on the procedural description of the solid embodied in a CSG tree. The following figure shows the CSG tree data structure used in this system. O Boolean Node O Primitive Node (a) 2D CSG tree (b) 3D CSG tree Figure 72 CSG tree data structure The CSG tree shown in Figure 72 illustrates how a solid is represented in this system. Every leaf node represents a primitive defined by implicit solid elements and the branch node represents a Regularized Boolean type such as union, intersection and subtraction (U /n / respectively). Before performing Boolean operations the two participating solids need to be positioned correctly with respect to each other. This could be achieved by translations and rotations specified by the user but for dimension driven editing the required transformation must be computed based on specified positioning constraints. In this implementation, a sequential constraint imposition method [Kumar, 2000] was used to compute the transformation matrix required to impose position constraints between solids. Typically, position constraints are specified between vertices, edges and faces of a solid if the solid is represented using a BRep model. Even though such entities are not available in implicit solid models, the nodes, edges and faces of the implicit element itself serve as useful datum that can be used for specifying constraints. Figure 73 is a simple example where the 2D profile is obtained by the union of a rectangle and a circle followed by the subtraction of an ellipse. Figure 74 shows a 3D example. i I LI Figure 73 2D Boolean operation in CSG Figure 74 3D Constructive Solid Geometry Tree For a primitive solid defined using a single element, the shape density value at a point can be computed as used to classify the point as inside the solid, on the boundary of the solid or outside the solid. When many primitives have been combined using Boolean operations, a procedure for classifying points with respect to the Boolean results are required. In order to apply the same procedure for the Boolean result the shape density at every point within the solid including regions where multiple primitives may intersect needs to be defined. This can be accomplished by using the following definition that is commonly used in the literature on level set methods. AUB = max(oA> B) Union A B = min(A Bq) Intersection (713) b g= min((^A, b) Intersection (713) AB =min(A ,~B) Subtraction In the above definitions, QACB is the density at any given point within the solid defined as the union between two solids A and B whose shape density values are 0A and B respectively. It can be easily verified that QA4B will be greater than the level set value at every point within the solid defined by the union. It is equal to the level set value at the boundary and less than equal to outside the solid. Similar definitions are given above for the intersection and difference between solids. Another way to define density at every point within a solid is by using Rfunctions [Shapiro, 1998], [Shapiro, Tsukanov, 1999] which can be used to define the density for the solid defined using Boolean operations. The sign of such a function depends only on the sign of its arguments and not their magnitude. This property can be used to define density values at points where two or more primitives intersect. However, to use R functions it is necessary that every point on the boundary of the solid have value equal to the level set value bb. In implicit solid elements, the solids boundary can be the same as element boundary where the density need not be the level set value. Therefore, to use R function method the definition of the implicit solid element will have to be modified accordingly. In this implementation, Rfunctions to define density for Boolean solids were not used. As mentioned Chapter 2, when the given point is on both the base and the dependent solids, it is difficult to determine its set membership with respect to the regularized Boolean result by simply comparing its set membership with respect to base and dependent solids. In order to apply the rules of regularized Boolean operations, it is necessary to study the neighborhood of the given point to check whether it is on the boundary or the interior of the solid. Alternately, one can compare the direction of surface normal of the solids between which the regularized set operation is being applied [Mantyla, 1988]. This approach can be applied recursively to perform set membership classification for arbitrarily large CSG trees. By applying this procedure the density functions only at the primitive level are used. As mentioned in Chapter 2, the neighborhood model enables us to classify points with respect to the regularized Boolean when multiple normal vectors are involved. From a theoretical point of view, the neighborhood model at a given point is easy to understand but it is very difficult to construct an algorithm based on this model since there are infinite points in a neighborhood that needs to be checked. In this system, a graphical method for constructing the neighborhood model is proposed and implemented. This method is based on the assumption that the maximum number of normal vectors involved at a given point is three in the level of solid elements and it is convex not concave. Therefore triangles from the normal vectors that represent half spaces can be constructed. The detailed description for constructing triangles from the surface normal vectors is explained in the following. In a solid element, triangles can be constructed from the surface normal vectors as shown where a face of the solid has one normal vector, an edge of the solid has two normal vectors and a vertex of the solid has three normal vectors respectively. Figure 75. surface normal vectors and corresponding triangles When there is only one surface normal vector at a given point, a triangle normal to this vector can be constructed by the following procedure. Figure 76: Constructing a triangle from one normal vector In the Figure 76, n is the unit surface normal vector ( n 1). a, b and c are unit vectors perpendicular to the surface normal vector n. a can be chosen from any arbitrary vector perpendicular to the surface normal n. Therefore, a should satisfy the following condition. an = and a= 1 Then point A can be computed as A = P + sa (714) The scalar s is the distance from the given point P to the point A. Therefore it defines the size of the triangle. Since the size of the triangle does not matter while constructing neighborhood model, any value can be used for s. In this implementation 0.5 is used for s. After computing a, the vectors b can be computed by rotating a 120 degree about axis n and similarly c can be computed by rotating b 120 degrees. Then points B and C can be computed as. B = P + sb C = P + sc (715) When the number of surface normal vectors is two, the corresponding two triangles can be obtained by the following procedure. Let nl and n2 be the two unit surface normal vectors at the point of interest. n = 1 and n2 =1 ni Edge b \ b d B \ n2 BX\ D Figure 77. Constructing two triangles from two normal vectors a is computed as the cross product of ni and n2. a = n x n2 (716) b=a c and d can be computed by cross product. c= n xa d= n2 xb To use c and d vectors for constructing triangles, their direction should be verified. Since it is assumed that each solid primitive is the intersection of half spaces that are normal to nl and n2 respectively, the following equations show its validity. If n2 c < 0, c = c. if not c = c. If ni d I O, d d. if not d =d. After finding vectors a, b, c and d, the points composing vertices of the triangles can be computed as A=P+sa, B=P+sb, C= P+scand D=P+sd (717) Finally, when the number of surface normal vectors is three, the corresponding three triangles can be obtained by the following procedure. In Figure 78, ni, n2 and n3 are unit normal vectors at the point of interest. ni =1, n2 =1 and n, =1 Edge E EdgeEdge Figure 78. Constructing three triangles from three normal vectors a is computed as the cross product between ni and n3. a = n1 xn, (718) If n2 a < O, a = a. if not a = a. Similarly, b= n2 xn1 If n3 *b < 0, b =b. if not b =b. c = n3 x n2 If ni c < 0, c = c. if not c = c. After finding vectors a, b, c and d, the points composing the vertices of the triangles can be computed as A=P+sa, B=P+sband C= P+sc (719) After constructing the triangles for all the primitives whose boundaries pass through the point of interest, the neighborhood at the point is constructed by performing the Boolean operations between the triangles treating each triangle as a half space, which divides the space into two regions inside and outside. At first, intersections between triangles from the base and dependent solids are computed for each Boolean operation, and then the triangles will be subdivided at the intersections. Thereafter set membership classification of the triangles with respect to the half spaces (instead of the actual solid) is performed to collect the valid triangles. To classify the triangles, first the centroid Q of the triangle is computed and then this point is classified with respect to Boolean result recursively starting from the bottom of the CSG tree. It is assumed that the classification of the centroid is identical to the classification of the triangle. In addition, subdivided triangles that do not contain the point of interest are removed from the valid triangles because the neighborhood model can be constructed without those triangles. If there are triangles at the final node, it means that the set membership is on the solid. If there are no triangles, then it implies that the set membership is in or out. The above algorithm can be used for 2D or 3D CSG tree with the difference that lines are used to represent half spaces in 2D. Figure 79 shows an example that shows how to construct the neighborhood at a given point. As shown in Figure 79, the point of interest from A and B has multiple normal vectors. Two triangles and three triangles are derived from the solid A and B respectively. A union operation between those triangles is performed to get the valid triangles at the union node where four triangles are obtained after union. Therefore the point of interest can be classified as on the solid after union. B AB Figure 79. Neighborhood model using graphical method Figure 710 shows examples of solids created by Boolean operations using this software implementation a' ' 