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 MarchingCubesT 00029 // 00030 //============================================================================= 00031 00032 #ifndef ISOEX_MARCHINGCUBEST_HH 00033 #define ISOEX_MARCHINGCUBEST_HH 00034 00035 //== INCLUDES ================================================================= 00036 00037 #include <IsoEx/Extractors/Edge2VertexMapT.hh> 00038 #include <IsoEx/Grids/Grid.hh> 00039 #include <map> 00040 00041 //== NAMESPACES =============================================================== 00042 00043 namespace IsoEx { 00044 00045 //== CLASS DEFINITION ========================================================= 00046 00047 00055 template <class Mesh> 00056 class MarchingCubesT 00057 { 00058 public: 00059 00060 MarchingCubesT(const Grid& _grid, Mesh& _mesh); 00061 00062 00063 private: 00064 00065 typedef Grid::PointIdx PointIdx; 00066 typedef Grid::CubeIdx CubeIdx; 00067 typedef Grid::CubeIterator CubeIterator; 00068 00069 typedef typename Mesh::Point Point; 00070 typedef typename Mesh::VertexHandle VertexHandle; 00071 typedef typename Mesh::FaceHandle FaceHandle; 00072 00073 00074 void process_cube(CubeIdx _idx); 00075 VertexHandle add_vertex(PointIdx _p0, PointIdx _p1); 00076 00077 00078 const Grid& grid_; 00079 Mesh& mesh_; 00080 00081 // maps an edge to the sample vertex generated on it 00082 Edge2VertexMapT<PointIdx, VertexHandle> edge2vertex_; 00083 }; 00084 00085 00086 //----------------------------------------------------------------------------- 00087 00088 00093 template <class Mesh> 00094 void marching_cubes(const Grid& _grid, Mesh& _mesh) 00095 { 00096 MarchingCubesT<Mesh> mc(_grid, _mesh); 00097 } 00098 00099 00100 //============================================================================= 00101 } // namespace IsoEx 00102 //============================================================================= 00103 #if defined(INCLUDE_TEMPLATES) && !defined(ISOEX_MARCHINGCUBEST_C) 00104 #define ISOEX_MARCHINGCUBEST_TEMPLATES 00105 #include "MarchingCubesT.cc" 00106 #endif 00107 //============================================================================= 00108 #endif // ISOEX_MARCHINGCUBEST_HH defined 00109 //=============================================================================