00001 #ifdef CH_LANG_CC 00002 /* 00003 * _______ __ 00004 * / ___/ / ___ __ _ / / ___ 00005 * / /__/ _ \/ _ \/ V \/ _ \/ _ \ 00006 * \___/_//_/\___/_/_/_/_.__/\___/ 00007 * Please refer to Copyright.txt, in Chombo's root directory. 00008 */ 00009 #endif 00010 00011 #ifndef _STLMESH_H_ 00012 #define _STLMESH_H_ 00013 00014 #include "RealVect.H" 00015 00016 #include "NamespaceHeader.H" 00017 00018 /* 00019 * This data structure class holds all of the data 00020 * pertaining to the STL surface mesh, including the 00021 * connectivity data generated while reading. It also 00022 * has functions to print and perform affine transformations 00023 * on the mesh. 00024 * The data here is all public and filled in by an STLReader 00025 */ 00026 00027 /// The whole mesh 00028 class STLMesh 00029 { 00030 public: 00031 00032 /// Vertices 00033 struct vertlist { 00034 00035 // master list of vertices 00036 Vector<RealVect> vertex; 00037 00038 }; 00039 00040 /// Edges 00041 struct edgelist { 00042 00043 // list of edges (indices into list of vertices) 00044 // each edge has 2 vertices 00045 Vector<Vector<int> > edge; 00046 00047 }; 00048 00049 /// Triangles 00050 struct trilist { 00051 00052 // list of triangles 00053 // each triangle has 3 vertices 00054 Vector<Vector<int> > corners; 00055 // and a normal vector 00056 Vector<RealVect> normal; 00057 00058 }; 00059 00060 /// Connectivity 00061 struct conninfo { 00062 00063 // triangles connected to each vertex (indices) 00064 // vertexToTriangle.length()==vertex.length() (first index into vertices, then triangles) 00065 Vector<Vector<int> > vertexToTriangle; 00066 // each edge has a left and right triangle 00067 // (left as you go from vertex[0] to vertex[1] 00068 // edgeToTriangle.length()==edge.length() (first index into edges, then triangles) 00069 Vector<Vector<int> > edgeToTriangle; 00070 00071 }; 00072 00073 // vertices 00074 vertlist vertices; 00075 // edges 00076 edgelist edges; 00077 // triangles 00078 trilist triangles; 00079 // connectivity 00080 conninfo connect; 00081 00082 // tolerance for collapsing nodes and such 00083 Real tol; 00084 00085 void PrintMesh(); // print info about the mesh 00086 00087 // transform stuff 00088 void Transform(const Real scale, 00089 const RealVect translate, 00090 const Real theta, 00091 RealVect axis); 00092 00093 }; 00094 00095 #include "NamespaceFooter.H" 00096 #endif 00097