IsoEx
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
ExtendedMarchingCubesT.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 ExtendedMarchingCubesT
29 //
30 //=============================================================================
31 
32 
33 #ifndef ISOEX_EXTMARCHINGCUBEST_HH
34 #define ISOEX_EXTMARCHINGCUBEST_HH
35 
36 
37 //== INCLUDES =================================================================
38 
39 #include <IsoEx/Extractors/Edge2VertexMapT.hh>
40 #include <IsoEx/Grids/Grid.hh>
41 #include <vector>
42 
43 //== NAMESPACES ===============================================================
44 
45 namespace IsoEx {
46 
47 //== CLASS DEFINITION =========================================================
48 
49 
61 template <class Mesh, class Grid>
63 {
64 public:
65 
66  ExtendedMarchingCubesT(const Grid& _grid,
67  Mesh& _mesh,
68  double _feature_angle);
69 
70 
71 private:
72 
73  typedef typename Grid::PointIdx PointIdx;
74  typedef typename Grid::CubeIdx CubeIdx;
75  typedef typename Grid::CubeIterator CubeIterator;
76  typedef typename Mesh::VertexHandle VertexHandle;
77  typedef std::vector<VertexHandle> VertexHandleVector;
78 
79 
80  void process_cube(CubeIdx _idx);
81 
82  VertexHandle add_vertex(PointIdx _p0, PointIdx _p1);
83  VertexHandle find_feature(const VertexHandleVector& _vhandles);
84 
85  void flip_edges();
86 
87 
88 
89  const Grid& grid_;
90  Mesh& mesh_;
91 
92  float feature_angle_;
93  unsigned int n_edges_, n_corners_;
94 
95  // maps an edge to the sample vertex generated on it
97 };
98 
99 
100 //-----------------------------------------------------------------------------
101 
102 
107 template <class Mesh, class Grid>
108 void extended_marching_cubes(const Grid& _grid,
109  Mesh& _mesh,
110  double _feature_angle)
111 {
112  ExtendedMarchingCubesT<Mesh,Grid> emc(_grid, _mesh, _feature_angle);
113 }
114 
115 
116 //=============================================================================
117 } // namespace IsoEx
118 //=============================================================================
119 #if defined(INCLUDE_TEMPLATES) && !defined(ISOEX_EXTMARCHINGCUBEST_C)
120 #define ISOEX_EXTMARCHINGCUBEST_TEMPLATES
121 #include "ExtendedMarchingCubesT.cc"
122 #endif
123 //=============================================================================
124 #endif // ISOEX_EXTMARCHINGCUBEST_HH defined
125 //=============================================================================
unsigned int PointIdx
The grid points can be referred to by PointIdx.
Definition: Grid.hh:72
Definition: ExtendedMarchingCubesT.hh:62
Definition: Edge2VertexMapT.hh:58
Definition: Grid.hh:79
A type for volume images, or 3D textures.
unsigned int CubeIdx
CubeIdx can be used to refer to cubes.
Definition: Grid.hh:69
void extended_marching_cubes(const Grid &_grid, Mesh &_mesh, double _feature_angle)
Definition: ExtendedMarchingCubesT.hh:108
Definition: Grid.hh:58