⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tetgen.h

📁 网格划分的源程序
💻 H
📖 第 1 页 / 共 5 页
字号:
    enum objecttype {NONE, NODES, POLY, OFF, PLY, STL, MEDIT, MESH};    // Variables of command line switches. Each variable corresponds to a    //   switch and will be initialized.  The meanings of these switches    //   are explained in the user's manul.    int plc;                                              // '-p' switch, 0.    int quality;                                          // '-q' switch, 0.    int refine;                                           // '-r' switch, 0.    int coarse;                                           // '-R' switch, 0.    int metric;                                           // '-m' switch, 0.    int varvolume;                         // '-a' switch without number, 0.    int fixedvolume;                          // '-a' switch with number, 0.    int insertaddpoints;                                  // '-i' switch, 0.    int regionattrib;                                     // '-A' switch, 0.    int conformdel;                                       // '-D' switch, 0.    int diagnose;                                         // '-d' switch, 0.    int zeroindex;                                        // '-z' switch, 0.    int optlevel;                  // number specified after '-s' switch, 3.    int optpasses;                // number specified after '-ss' switch, 5.    int order;             // element order, specified after '-o' switch, 1.    int facesout;                                         // '-f' switch, 0.    int edgesout;                                         // '-e' switch, 0.    int neighout;                                         // '-n' switch, 0.    int voroout;                                          // '-v',switch, 0.    int meditview;                                        // '-g' switch, 0.    int gidview;                                          // '-G' switch, 0.    int geomview;                                         // '-O' switch, 0.    int nobound;                                          // '-B' switch, 0.    int nonodewritten;                                    // '-N' switch, 0.    int noelewritten;                                     // '-E' switch, 0.    int nofacewritten;                                    // '-F' switch, 0.    int noiterationnum;                                   // '-I' switch, 0.    int nomerge;                                          // '-M',switch, 0.    int nobisect;          // count of how often '-Y' switch is selected, 0.    int noflip;                     // do not perform flips. '-X' switch. 0.    int nojettison;     // do not jettison redundants nodes. '-J' switch. 0.    int steiner;                             // number after '-S' switch. 0.    int fliprepair;                                       // '-X' switch, 1.    int offcenter;                                        // '-R' switch, 0.    int docheck;                                          // '-C' switch, 0.    int quiet;                                            // '-Q' switch, 0.    int verbose;           // count of how often '-V' switch is selected, 0.    int useshelles;            // '-p', '-r', '-q', '-d', or '-R' switch, 0.    REAL minratio;                         // number after '-q' switch, 2.0.    REAL goodratio;               // number calculated from 'minratio', 0.0.     REAL minangle;                             // minimum angle bound, 20.0.    REAL goodangle;                      // cosine squared of minangle, 0.0.    REAL maxvolume;                       // number after '-a' switch, -1.0.    REAL mindihedral;                     // number after '-qq' switch, 5.0.    REAL maxdihedral;                  // number after '-qqq' switch, 165.0.    REAL alpha1;                       // number after '-m' switch, sqrt(2).    REAL alpha2;                          // number after '-mm' switch, 1.0.    REAL alpha3;                         // number after '-mmm' switch, 0.6.    REAL epsilon;                       // number after '-T' switch, 1.0e-8.    REAL epsilon2;                     // number after '-TT' switch, 1.0e-5.    enum objecttype object;         // determined by -p, or -r switch. NONE.    // Variables used to save command line switches and in/out file names.    char commandline[1024];    char infilename[1024];    char outfilename[1024];    char addinfilename[1024];    char bgmeshfilename[1024];    tetgenbehavior();    ~tetgenbehavior() {}    void versioninfo();    void syntax();    void usage();    // Command line parse routine.    bool parse_commandline(int argc, char **argv);    bool parse_commandline(char *switches) {      return parse_commandline(0, &switches);    }};/////////////////////////////////////////////////////////////////////////////////                                                                           //// Geometric predicates                                                      ////                                                                           //// Return one of the values +1, 0, and -1 on basic geometric questions such  //// as the orientation of point sets, in-circle, and in-sphere tests.  They   //// are basic units for implmenting geometric algorithms.  TetGen uses two 3D //// geometric predicates: the orientation and in-sphere tests.                ////                                                                           //// Orientation test:  let a, b, c be a sequence of 3 non-collinear points in //// R^3.  They defines a unique hypeplane H.  Let H+ and H- be the two spaces //// separated by H, which are defined as follows (using the left-hand rule):  //// make a fist using your left hand in such a way that your fingers follow   //// the order of a, b and c, then your thumb is pointing to H+.  Given any    //// point d in R^3, the orientation test returns +1 if d lies in H+, -1 if d  //// lies in H-, or 0 if d lies on H.                                          ////                                                                           //// In-sphere test:  let a, b, c, d be 4 non-coplanar points in R^3.  They    //// defines a unique circumsphere S.  Given any point e in R^3, the in-sphere //// test returns +1 if e lies inside S, or -1 if e lies outside S, or 0 if e  //// lies on S.                                                                ////                                                                           //// The correctness of geometric predicates is crucial for the control flow   //// and hence for the correctness and robustness of an implementation of a    //// geometric algorithm.  The following routines use arbitrary precision      //// floating-point arithmetic. They are fast and robust. It is provided by J. //// Schewchuk in public domain (http://www.cs.cmu.edu/~quake/robust.html).    //// The source code are found in a separate file "predicates.cxx".            ////                                                                           /////////////////////////////////////////////////////////////////////////////////REAL exactinit();REAL orient3d(REAL *pa, REAL *pb, REAL *pc, REAL *pd);REAL insphere(REAL *pa, REAL *pb, REAL *pc, REAL *pd, REAL *pe);/////////////////////////////////////////////////////////////////////////////////                                                                           //// The tetgenmesh data type                                                  ////                                                                           //// Includes data types and mesh routines for creating tetrahedral meshes and //// Delaunay tetrahedralizations, mesh input & output, and so on.             ////                                                                           //// An object of tetgenmesh can be used to store a triangular or tetrahedral  //// mesh and its settings. TetGen's functions operates on one mesh each time. //// This type allows reusing of the same function for different meshes.       ////                                                                           //// The mesh data structure (tetrahedron-based and triangle-edge data struct- //// ures) are declared. There are other accessary data type defined as well,  //// for efficient memory management and link list operations, etc.            ////                                                                           //// All algorithms TetGen used are implemented in this data type as member    //// functions. References of these algorithms can be found in user's manual.  ////                                                                           //// It's not necessary to understand this type. There is a global function    //// "tetrahedralize()" (defined at the end of this file) implicitly creates   //// the object and calls its member functions according to the command line   //// switches you specified.                                                   ////                                                                           /////////////////////////////////////////////////////////////////////////////////class tetgenmesh {  public:    // Maximum number of characters in a file name (including the null).    enum {FILENAMESIZE = 1024};    // For efficiency, a variety of data structures are allocated in bulk.    //   The following constants determine how many of each structure is    //   allocated at once.    enum {VERPERBLOCK = 4092, SUBPERBLOCK = 4092, ELEPERBLOCK = 8188};    // Used for the point location scheme of Mucke, Saias, and Zhu, to    //   decide how large a random sample of tetrahedra to inspect.    enum {SAMPLEFACTOR = 11};    // Labels that signify two edge rings of a triangle defined in Muecke's    //   triangle-edge data structure, one (CCW) traversing edges in count-    //   erclockwise direction and one (CW) in clockwise direction.    enum {CCW = 0, CW = 1};    // Labels that signify whether a record consists primarily of pointers    //   or of floating-point words.  Used to make decisions about data    //   alignment.    enum wordtype {POINTER, FLOATINGPOINT};    // Labels that signify the type of a vertex. An UNUSEDVERTEX is a vertex    //   read from input (.node file or tetgenio structure) or an isolated    //   vertex (outside the mesh).  It is the default type for a newpoint.    enum verttype {UNUSEDVERTEX, DUPLICATEDVERTEX, NACUTEVERTEX, ACUTEVERTEX,           FREESEGVERTEX, FREESUBVERTEX, FREEVOLVERTEX, DEADVERTEX = -32768};     // Labels that signify the type of a subface/subsegment.    enum shestype {NSHARP, SHARP};    // Labels that signify the type of flips can be applied on a face.    //   A flipable face has the one of the types T23, T32, T22, and T44.    //   Types N32, N40 are unflipable.    enum fliptype {T23, T32, T22, T44, N32, N40, FORBIDDENFACE, FORBIDDENEDGE};    // Labels that signify the result of triangle-triangle intersection test.    //   Two triangles are DISJOINT, or adjoint at a vertex SHAREVERTEX, or    //   adjoint at an edge SHAREEDGE, or coincident SHAREFACE or INTERSECT.    enum interresult {DISJOINT, SHAREVERTEX, SHAREEDGE, SHAREFACE, INTERSECT};    // Labels that signify the result of point location.  The result of a    //   search indicates that the point falls inside a tetrahedron, inside    //   a triangle, on an edge, on a vertex, or outside the mesh.     enum locateresult {INTETRAHEDRON, ONFACE, ONEDGE, ONVERTEX, OUTSIDE};    // Labels that signify the result of vertex insertion.  The result    //   indicates that the vertex was inserted with complete success, was    //   inserted but encroaches upon a subsegment, was not inserted because    //   it lies on a segment, or was not inserted because another vertex    //   occupies the same location.    enum insertsiteresult {SUCCESSINTET, SUCCESSONFACE, SUCCESSONEDGE,                           DUPLICATEPOINT, OUTSIDEPOINT};    // Labels that signify the result of direction finding.  The result    //   indicates that a segment connecting the two query points accross    //   an edge of the direction triangle/tetrahedron, across a face of    //   the direction tetrahedron, along the left edge of the direction    //   triangle/tetrahedron, along the right edge of the direction    //   triangle/tetrahedron, or along the top edge of the tetrahedron.    enum finddirectionresult {ACROSSEDGE, ACROSSFACE, LEFTCOLLINEAR,                              RIGHTCOLLINEAR, TOPCOLLINEAR, BELOWHULL};/////////////////////////////////////////////////////////////////////////////////                                                                           //// The basic mesh element data structures                                    ////                                                                           //// There are four types of mesh elements: tetrahedra, subfaces, subsegments, //// and points,  where subfaces and subsegments are triangles and edges which //// appear on boundaries.  A tetrahedralization of a 3D point set comprises   //// tetrahedra and points;  a surface mesh of a 3D domain comprises subfaces  //// subsegments and points.  The elements of all the four types consist of a  //// tetrahedral mesh of a 3D domain.  However, TetGen uses three data types:  //// 'tetrahedron', 'shellface', and 'point'. A 'tetrahedron' is a tetrahedron;//// while a 'shellface' can be either a subface or a subsegment; and a 'point'//// is a point.  These three data types, linked by pointers comprise a mesh.  ////                                                                           //// A tetrahedron primarily consists of a list of 4 pointers to its corners,  //// a list of 4 pointers to its adjoining tetrahedra, a list of 4 pointers to //// its adjoining subfaces (when subfaces are needed). Optinoally, (depending //// on the selected switches), it may contain an arbitrary number of user-    //// defined floating-point attributes,  an optional maximum volume constraint //// (for -a switch), and a pointer to a list of high-order nodes (-o2 switch).//// Since the size of a tetrahedron is not determined until running time, it  //// is not simply declared as a structure.                                    //

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -