00001 /*===========================================================================*\ 00002 * * 00003 * IsoEx * 00004 * Copyright (C) 2002 by Computer Graphics Group, RWTH Aachen * 00005 * www.rwth-graphics.de * 00006 * * 00007 *---------------------------------------------------------------------------* 00008 * * 00009 * License * 00010 * * 00011 * This library is free software; you can redistribute it and/or modify it * 00012 * under the terms of the GNU Library General Public License as published * 00013 * by the Free Software Foundation, version 2. * 00014 * * 00015 * This library is distributed in the hope that it will be useful, but * 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00018 * Library General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU Library General Public * 00021 * License along with this library; if not, write to the Free Software * 00022 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00023 * * 00024 \*===========================================================================*/ 00025 00026 //============================================================================= 00027 // 00028 // CLASS ExtendedMarchingCubesT 00029 // 00030 //============================================================================= 00031 00032 00033 #ifndef ISOEX_EXTMARCHINGCUBEST_HH 00034 #define ISOEX_EXTMARCHINGCUBEST_HH 00035 00036 00037 //== INCLUDES ================================================================= 00038 00039 #include <IsoEx/Extractors/Edge2VertexMapT.hh> 00040 #include <IsoEx/Grids/Grid.hh> 00041 #include <vector> 00042 00043 //== NAMESPACES =============================================================== 00044 00045 namespace IsoEx { 00046 00047 //== CLASS DEFINITION ========================================================= 00048 00049 00061 template <class Mesh> 00062 class ExtendedMarchingCubesT 00063 { 00064 public: 00065 00066 ExtendedMarchingCubesT(const Grid& _grid, 00067 Mesh& _mesh, 00068 double _feature_angle); 00069 00070 00071 private: 00072 00073 typedef typename Grid::PointIdx PointIdx; 00074 typedef typename Grid::CubeIdx CubeIdx; 00075 typedef typename Grid::CubeIterator CubeIterator; 00076 typedef typename Mesh::VertexHandle VertexHandle; 00077 typedef std::vector<VertexHandle> VertexHandleVector; 00078 00079 00080 void process_cube(CubeIdx _idx); 00081 00082 VertexHandle add_vertex(PointIdx _p0, PointIdx _p1); 00083 VertexHandle find_feature(const VertexHandleVector& _vhandles); 00084 00085 void flip_edges(); 00086 00087 00088 00089 const Grid& grid_; 00090 Mesh& mesh_; 00091 00092 float feature_angle_; 00093 unsigned int n_edges_, n_corners_; 00094 00095 // maps an edge to the sample vertex generated on it 00096 Edge2VertexMapT<PointIdx, VertexHandle> edge2vertex_; 00097 }; 00098 00099 00100 //----------------------------------------------------------------------------- 00101 00102 00107 template <class Mesh> 00108 void extended_marching_cubes(const Grid& _grid, 00109 Mesh& _mesh, 00110 double _feature_angle) 00111 { 00112 ExtendedMarchingCubesT<Mesh> emc(_grid, _mesh, _feature_angle); 00113 } 00114 00115 00116 //============================================================================= 00117 } // namespace IsoEx 00118 //============================================================================= 00119 #if defined(INCLUDE_TEMPLATES) && !defined(ISOEX_EXTMARCHINGCUBEST_C) 00120 #define ISOEX_EXTMARCHINGCUBEST_TEMPLATES 00121 #include "ExtendedMarchingCubesT.cc" 00122 #endif 00123 //============================================================================= 00124 #endif // ISOEX_EXTMARCHINGCUBEST_HH defined 00125 //=============================================================================