IsoEx
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
MarchingCubesT.hh
1 /*===========================================================================*\
2  * *
3  * IsoEx *
4  * Copyright (C) 2002 by Computer Graphics Group, RWTH Aachen *
5  * www.rwth-graphics.de *
6  * *
7  *---------------------------------------------------------------------------*
8  * *
9  * License *
10  * *
11  * This library is free software; you can redistribute it and/or modify it *
12  * under the terms of the GNU Library General Public License as published *
13  * by the Free Software Foundation, version 2. *
14  * *
15  * This library is distributed in the hope that it will be useful, but *
16  * WITHOUT ANY WARRANTY; without even the implied warranty of *
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
18  * Library General Public License for more details. *
19  * *
20  * You should have received a copy of the GNU Library General Public *
21  * License along with this library; if not, write to the Free Software *
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
23  * *
24 \*===========================================================================*/
25 
26 //=============================================================================
27 //
28 // CLASS MarchingCubesT
29 //
30 //=============================================================================
31 
32 #ifndef ISOEX_MARCHINGCUBEST_HH
33 #define ISOEX_MARCHINGCUBEST_HH
34 
35 //== INCLUDES =================================================================
36 
37 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
38 
39 #include "Edge2VertexMapT.hh"
40 #include "EdgeKey.hh"
41 
42 #include "../Grids/Grid.hh"
43 
44 #include <map>
45 #include <string>
46 
47 //== NAMESPACES ===============================================================
48 
49 namespace IsoEx {
50 
51 //== CLASS DEFINITION =========================================================
52 
53 
61 template <class Mesh, class Grid>
63 {
64 public:
65 
66  MarchingCubesT(const Grid& _grid, Mesh& _mesh, float _iso = 0.0, const std::string &_vprop_v2edge = "");
67 
68 private:
69 
70  typedef typename Grid::PointIdx PointIdx;
71  typedef typename Grid::CubeIdx CubeIdx;
72  typedef typename Grid::CubeIterator CubeIterator;
73 
74  typedef typename Mesh::Point Point;
75  typedef typename Mesh::VertexHandle VertexHandle;
76  typedef typename Mesh::FaceHandle FaceHandle;
77 
78 
79 
80  void process_cube(CubeIdx _idx);
81  VertexHandle add_vertex(PointIdx _p0, PointIdx _p1);
82 
83 
84  const Grid& grid_;
85  Mesh& mesh_;
86  float iso_;
87  OpenMesh::VPropHandleT< EdgeKey<PointIdx> > vprop_v2edge_;
88  bool use_prop_v2edge_;
89 
90  // maps an edge to the sample vertex generated on it
92 
93 };
94 
95 
96 //-----------------------------------------------------------------------------
97 
98 
103 template <class Mesh, class Grid>
104 void marching_cubes(const Grid& _grid, Mesh& _mesh, float _iso = 0.0)
105 {
106  MarchingCubesT<Mesh,Grid> mc(_grid, _mesh, _iso);
107 }
108 
109 
110 //=============================================================================
111 } // namespace IsoEx
112 //=============================================================================
113 #if defined(INCLUDE_TEMPLATES) && !defined(ISOEX_MARCHINGCUBEST_C)
114 #define ISOEX_MARCHINGCUBEST_TEMPLATES
115 #include "MarchingCubesT.cc"
116 #endif
117 //=============================================================================
118 #endif // ISOEX_MARCHINGCUBEST_HH defined
119 //=============================================================================
unsigned int PointIdx
The grid points can be referred to by PointIdx.
Definition: Grid.hh:72
Definition: Edge2VertexMapT.hh:58
void marching_cubes(const Grid &_grid, Mesh &_mesh, float _iso=0.0)
Definition: MarchingCubesT.hh:104
Definition: Grid.hh:79
A type for volume images, or 3D textures.
Definition: MarchingCubesT.hh:62
unsigned int CubeIdx
CubeIdx can be used to refer to cubes.
Definition: Grid.hh:69
Definition: Grid.hh:58