00001 /** 00002 *\file euler.h 00003 * 00004 *\brief Include all head files defining node types in euler. 00005 * 00006 * They are solid, face, loop, edge, and vertex nodes. 00007 * 00008 * Some significant change from the original Geometric WorkBench as 00009 * presented by Martti Mantyla as in "An Introduction to Solid Modeling". 00010 * 00011 * 0. First, this is a C++ implementation. And as such, it comes with 00012 * many advantages; among them, most obviously, are the simpler and 00013 * cleaner codes for node creation and deletion, including the proper 00014 * link update. 00015 * 00016 * 1. From a *pure perspective* of topological plane model of a closed 00017 * 2-manifold, there are actually no such things as edges, instead, 00018 * there are only half edges, with the condition each is identified to 00019 * exactly another one. Therefore, there is no edge nodes in my 00020 * design. The identification is archived by storing the opposite half 00021 * edge in the half edge node (member o). 00022 * 00023 * 2. All half edges, including circular edge (end points coincident), have 00024 * their opposite halves, except singular half edge, i.e., of zero length, 00025 * which has nil as its opposite half edge link. 00026 * 00027 * 3. Because there are only half edges, we simple use edge_t to denote the 00028 * actually half edge type. 00029 * 00030 *\author Xianming Chen\n 00031 * Computer Science Department\n 00032 * University of Utah 00033 * 00034 *\date 14 Aug 2006\n 00035 * Copyright (c) 2006, University of Utah 00036 */ 00037 00038 00039 #ifndef _EULER_H 00040 #define _EULER_H 00041 00042 00043 #include "solid.h" 00044 #include "face.h" 00045 #include "loop.h" 00046 #include "edge.h" 00047 #include "vertex.h" 00048 00049 00050 00051 /*! \mainpage euler 00052 * 00053 * \section intro_sec Introduction 00054 * 00055 * This is a C++ reimplementation of the Euler operators 00056 * in the Geometric WorkBench as described in Martti Mantyla's book 00057 * 00058 * <em> An Introduction to Solid Modeling</em> 00059 * 00060 * The Euler operators implemented include 00061 * 00062 * <OL type = '1'> 00063 * <LI> \em mvfs (<small>make edge, face and shell</small>: generate skeletal topology of a genus 0 B-rep) 00064 * <LI> \em mev (<small>make edge and vertex</small>: vertex splitting) 00065 * <LI> \em mef (<small>make edge and face</small>: face cutting) 00066 * <LI> \em kemr (<small>kill edge and make ring</small>: converting a simple face to a face with hole), 00067 * <LI> \em kfmrh (<small>kill face, and make ring and hole</small>: connected sum) 00068 * <LI> \em kffmh (<small>kill face and face, and make hole</small>: connected sum) 00069 * </OL> 00070 * and their inverse operators. 00071 * 00072 * The high level operations include, 00073 * 00074 * <OL type = '1'> 00075 * <LI> arc and circle (a lamina disk) generation 00076 * <LI> translational sweep of a face 00077 * <LI> rotational sweep of a wire 00078 * <LI> rotational sweep of a face 00079 * </OL> 00080 * 00081 * An output routine is provided for saving the B-rep of the constructed solid model as an OFF file. 00082 * 00083 * Source code is downloadable at the end of this page after some background introduction of the Euler operators. 00084 * 00085 * \section kffmh_sec About kffmh 00086 * 00087 * The last Euler operator, \em kffmh, is my understanding of the topological connected sum (it could be in the Euler operator set 00088 * of some sources other than Mantyla's book). 00089 * The operator also allows simpler implementation of rotational sweeping of a \em lamina (instead of a \em wire). 00090 * Furthermore, gluing operation is straightforward using \em kffmh. 00091 * 00092 * \section tutorial_sec About Plane Models of Closed Orientable 2-Manifolds 00093 * <OL TYPE="1"> 00094 * <LI> Cells 00095 * <OL TYPE="a"> 00096 * <LI> 0-cell is a point 00097 * <LI> 1-cell is an arc 00098 * <LI> 2-cell is a disk 00099 * <LI> ... 00100 * </OL> 00101 * <LI> Cell complex: a set of various dimensional cells, with cells attached to boundaries of lower dimensional cells. 00102 * 00103 * <LI> Plane models are essentially cell complex with some restrictions, 00104 * <OL TYPE="a"> 00105 * <LI> only 0, 1 and 2 dimensional cells; they are called vertices, edges, and faces, respectively. 00106 * <LI> an annulus is acceptable as a valid building block, therefore the inner loops of faces. 00107 * <LI> closed manifold guarantee: 00108 * <UL type="i"> 00109 * <LI> one edge is identified exactly with another edge, therefore the neighborhood at any edge interior point is an open *disk* 00110 * <UL> 00111 * <LI> The pair of edges to be identified always belong to certain (possible the same) face, each of the pair is justifiably called half edge; further, each half edges 00112 * inherits the orientation from its hosting face. 00113 * </UL> 00114 * <LI> sectors adjacent to an identified vertex connect perfectly into a disk, therefore neighborhood of vertex is again an open *disk*. 00115 * </UL> 00116 * <LI> orientable manifold guarantee. 00117 * <UL> 00118 * <LI> every face interior is to the right (or to the left, so long as consistent) of the its boundary orientation; equivalently, the identified pair of (half) edges has to be 00119 * of opposite orientation. 00120 * </UL> 00121 * <LI> an implicit convention: 00122 * <UL> 00123 * <LI> sometimes it is assumed that there is another far away boundary polygon surrounding the outer boundary polygon, forming a topological annulus; however, it is really 00124 * considered to be an open disk as the imaginary boundary is assumed to be identified (collapsed into) to a point (see example below). 00125 * </UL> 00126 * </OL> 00127 * 00128 * In summary, a plane model in \em 2-space is homeomorphic to an orientable closed 2-manifold in \em 3-space, under the following 3 restrictions, 00129 * <OL type='a'> 00130 * <LI> edge identification 00131 * <LI> cyclical identification 00132 * <LI> orientability 00133 * </OL> 00134 * 00135 * 00136 * <LI> An example: plane model of a cube. 00137 * <UL type="a"> 00138 * <LI> Notice that faces are always to the right of their oriented boundaries. 00139 * <LI> Notice also that we do not merge pairs of edges, with opposite directions, into simple edges. It turns out that pairs of <em>oppositely oriented</em> (half) edges 00140 * are more natural than the usual (full) edges, in the topological sense of cell decomposition and boundary (of open cells) identification. Computationally, this translates 00141 * into the fact that half edge data structure is better than winged edge data structure. 00142 * </UL> 00143 * \image html plane-model-of-cube.jpg 00144 * 00145 * 00146 * 00147 * <LI> Another example: skeletal model of a sphere (or any genus 0 closed orientable 2-manifold) 00148 * <UL> 00149 * <LI> Notice that the dotted circle minus the vertex is topologically an open disk, under the assumption that the dotted circle is collapsed to one point. 00150 * </UL> 00151 * \image html skeletal.jpg 00152 * </OL> 00153 * 00154 * 00155 * 00156 * \section euler_operators_sec Euler Operators 00157 * <OL type='1'> 00158 * <LI> Initialize the skeletal topology of a genus 0 closed orientable 2-manifold (\em mvfs). See the above image for an illustration. 00159 * 00160 * <LI> Edge cycle subdivision (\em mev). 00161 * 00162 * \image html subdivide-cycle.jpg 00163 * Notice that [e1, e2) could be zero range (i.e., e1 = e2). 00164 * 00165 * 00166 * <LI> Edge loop subdivision (\em mef). 00167 * 00168 * \image html subdivide-edge-loop.jpg 00169 * Notice that [e1, e2) could be zero range (i.e., e1 = e2). 00170 * 00171 * 00172 * <LI> Face topological change: annulus to disk (\em kemr). 00173 * * \image html kemr.jpg 00174 * 00175 * <LI> Global topological change: connected sum. 00176 * <OL type = 'a'> 00177 * <LI>kill a simple face, make its boundary to be an inner loop of another face. 00178 * <LI>if both faces are from the same shell, the net effect is kill a face, make a ring and a hole, i.e., kfmrh. 00179 * <LI>if each face is from a different shell, the net effect is kill a face and a shell, make a ring, i.e., kfsmr. 00180 * </OL> 00181 * </OL> 00182 * 00183 * Notice that each operator above has its inverse. 00184 * 00185 * \section minimal_operations_sec Minimal Euler Operator Set and Minimal Euler Operations 00186 * 00187 * Edge cycle (at a vertex) subdivision and edge loop (at a face) subdivision are 2 fundamental manipulation on plane models of oriented closed 2-manifolds. As annulus 00188 * are allowed in the data structure (\em inner \em loops), one more essential operation is required to convert from a disk to an annulus. Finally, global topology 00189 * may be changed by connected sum. Of course, to start with all these operations, a skeletal topology has to be initialized. Putting all these together, we have 5 basic Euler 00190 * operators namely 00191 * 00192 * <em> mev, mef, kemr, kfmrh </em>, and \em mvfs, 00193 * 00194 * in the aforementioned order. 00195 * 00196 * Given any tuple (v, e, f, r, h, s=1), denoting the number of vertices, edges, faces, rings (inner loops), holes, and shells (connected components) of 00197 * a solid model (<em> with only one connected component </em>), the minimal (non-minimal situation could arise, because each operator has its inverse which 00198 * undoes the result) 00199 * operations needed to construct the solid can be derived as follow, 00200 * <OL type='1'> 00201 * <LI> (1) \em mvfs, as this is the only operator modifying shell number. 00202 * <LI> (h) \em kfmrh, as this is the only operator modifying hole number. 00203 * <LI> (f+h-1) \em mef, as \em mvfs, \em kfmrh, and \em mef are the only operators modifying face number, and the first two have already been done. 00204 * <LI> (v-1) \em mev, as \em mvfs (done already), and \em mev are the only operators modifying vertex number. 00205 * <LI> (r-h) \em kemr, as \em kfmrh (done already) and \em kemr are the only operators modifying ring number. 00206 * </OL> 00207 * 00208 * Notice that the edge number from the above optimal construction is automatically right by the euler equation 00209 * 00210 * <em> v - e + f = 2(s-h) + r. </em> 00211 * 00212 * 00213 * A more formal derivation can be given by considering all topologically valid solid models as a hyper plane in the 6-space of (v,e, f, r, h, s) and taking 00214 * the five essential Euler operators, plus the plane normal, as a basis of the 6-space. The coordinates, under this basis, of any 6-tuple, then gives the 00215 * minimal operations required to construct a solid model with the given 6-tuple as its topological specification. 00216 * 00217 * 00218 * 00219 * 00220 * \section download_sec Download 00221 * 00222 * <a href="euler.tar">download</a> 00223 * 00224 * 00225 * 00226 * \section install_sec Installation 00227 * 00228 * In unix environment, type 00229 * 00230 * \code make test-file-name \endcode 00231 * 00232 * to compile a test program named test-file-name (the name has to start with 'test') 00233 * 00234 * 00235 * 00236 * 00237 */ 00238 00239 00240 00241 #endif
1.4.6