OpenMesh
OpenMesh/Core/Mesh/TriMeshT.hh
00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                               OpenMesh                                    *
00004  *      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openmesh.org                                *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------* 
00008  *  This file is part of OpenMesh.                                           *
00009  *                                                                           *
00010  *  OpenMesh is free software: you can redistribute it and/or modify         * 
00011  *  it under the terms of the GNU Lesser General Public License as           *
00012  *  published by the Free Software Foundation, either version 3 of           *
00013  *  the License, or (at your option) any later version with the              *
00014  *  following exceptions:                                                    *
00015  *                                                                           *
00016  *  If other files instantiate templates or use macros                       *
00017  *  or inline functions from this file, or you compile this file and         *
00018  *  link it with other files to produce an executable, this file does        *
00019  *  not by itself cause the resulting executable to be covered by the        *
00020  *  GNU Lesser General Public License. This exception does not however       *
00021  *  invalidate any other reasons why the executable file might be            *
00022  *  covered by the GNU Lesser General Public License.                        *
00023  *                                                                           *
00024  *  OpenMesh is distributed in the hope that it will be useful,              *
00025  *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00026  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            *
00027  *  GNU Lesser General Public License for more details.                      *
00028  *                                                                           *
00029  *  You should have received a copy of the GNU LesserGeneral Public          *
00030  *  License along with OpenMesh.  If not,                                    *
00031  *  see <http://www.gnu.org/licenses/>.                                      *
00032  *                                                                           *
00033 \*===========================================================================*/ 
00034 
00035 /*===========================================================================*\
00036  *                                                                           *             
00037  *   $Revision: 362 $                                                         *
00038  *   $Date: 2011-01-26 10:21:12 +0100 (Mi, 26 Jan 2011) $                   *
00039  *                                                                           *
00040 \*===========================================================================*/
00041 
00042 
00043 //=============================================================================
00044 //
00045 //  CLASS TriMeshT
00046 //
00047 //=============================================================================
00048 
00049 
00050 #ifndef OPENMESH_TRIMESH_HH
00051 #define OPENMESH_TRIMESH_HH
00052 
00053 
00054 //== INCLUDES =================================================================
00055 
00056 
00057 #include <OpenMesh/Core/System/config.h>
00058 #include <OpenMesh/Core/Mesh/PolyMeshT.hh>
00059 #include <vector>
00060 
00061 
00062 //== NAMESPACES ===============================================================
00063 
00064 
00065 namespace OpenMesh {
00066 
00067 
00068 //== CLASS DEFINITION =========================================================
00069 
00070 
00087 template <class Kernel>
00088 class TriMeshT : public PolyMeshT<Kernel>
00089 {
00090 
00091 public:
00092 
00093 
00094   // self
00095   typedef TriMeshT<Kernel>                      This;
00096   typedef PolyMeshT<Kernel>                     PolyMesh;
00097 
00099 
00100   enum { IsPolyMesh = 0 };
00101   enum { IsTriMesh  = 1 };
00102   static bool is_polymesh() { return false; }
00103   static bool is_trimesh()  { return  true; }
00105 
00106   //--- items ---
00107 
00108   typedef typename PolyMesh::Scalar             Scalar;
00109   typedef typename PolyMesh::Point              Point;
00110   typedef typename PolyMesh::Normal             Normal;
00111   typedef typename PolyMesh::Color              Color;
00112   typedef typename PolyMesh::TexCoord1D         TexCoord1D;
00113   typedef typename PolyMesh::TexCoord2D         TexCoord2D;
00114   typedef typename PolyMesh::TexCoord3D         TexCoord3D;
00115   typedef typename PolyMesh::Vertex             Vertex;
00116   typedef typename PolyMesh::Halfedge           Halfedge;
00117   typedef typename PolyMesh::Edge               Edge;
00118   typedef typename PolyMesh::Face               Face;
00119 
00120 
00121   //--- handles ---
00122 
00123   typedef typename PolyMesh::VertexHandle       VertexHandle;
00124   typedef typename PolyMesh::HalfedgeHandle     HalfedgeHandle;
00125   typedef typename PolyMesh::EdgeHandle         EdgeHandle;
00126   typedef typename PolyMesh::FaceHandle         FaceHandle;
00127 
00128 
00129   //--- iterators ---
00130 
00131   typedef typename PolyMesh::VertexIter         VertexIter;
00132   typedef typename PolyMesh::ConstVertexIter    ConstVertexIter;
00133   typedef typename PolyMesh::EdgeIter           EdgeIter;
00134   typedef typename PolyMesh::ConstEdgeIter      ConstEdgeIter;
00135   typedef typename PolyMesh::FaceIter           FaceIter;
00136   typedef typename PolyMesh::ConstFaceIter      ConstFaceIter;
00137 
00138 
00139 
00140   //--- circulators ---
00141 
00142   typedef typename PolyMesh::VertexVertexIter         VertexVertexIter;
00143   typedef typename PolyMesh::VertexOHalfedgeIter      VertexOHalfedgeIter;
00144   typedef typename PolyMesh::VertexIHalfedgeIter      VertexIHalfedgeIter;
00145   typedef typename PolyMesh::VertexEdgeIter           VertexEdgeIter;
00146   typedef typename PolyMesh::VertexFaceIter           VertexFaceIter;
00147   typedef typename PolyMesh::FaceVertexIter           FaceVertexIter;
00148   typedef typename PolyMesh::FaceHalfedgeIter         FaceHalfedgeIter;
00149   typedef typename PolyMesh::FaceEdgeIter             FaceEdgeIter;
00150   typedef typename PolyMesh::FaceFaceIter             FaceFaceIter;
00151   typedef typename PolyMesh::ConstVertexVertexIter    ConstVertexVertexIter;
00152   typedef typename PolyMesh::ConstVertexOHalfedgeIter ConstVertexOHalfedgeIter;
00153   typedef typename PolyMesh::ConstVertexIHalfedgeIter ConstVertexIHalfedgeIter;
00154   typedef typename PolyMesh::ConstVertexEdgeIter      ConstVertexEdgeIter;
00155   typedef typename PolyMesh::ConstVertexFaceIter      ConstVertexFaceIter;
00156   typedef typename PolyMesh::ConstFaceVertexIter      ConstFaceVertexIter;
00157   typedef typename PolyMesh::ConstFaceHalfedgeIter    ConstFaceHalfedgeIter;
00158   typedef typename PolyMesh::ConstFaceEdgeIter        ConstFaceEdgeIter;
00159   typedef typename PolyMesh::ConstFaceFaceIter        ConstFaceFaceIter;
00160 
00161   // --- constructor/destructor
00162 
00164   TriMeshT() : PolyMesh() {}
00166   virtual ~TriMeshT() {}
00167 
00168   //--- halfedge collapse / vertex split ---
00169 
00171   inline HalfedgeHandle vertex_split(Point _v0_point,  VertexHandle _v1,
00172                                      VertexHandle _vl, VertexHandle _vr)
00173   { return PolyMesh::vertex_split(add_vertex(_v0_point), _v1, _vl, _vr); }
00174 
00175   inline HalfedgeHandle vertex_split(VertexHandle _v0, VertexHandle _v1,
00176                                      VertexHandle _vl, VertexHandle _vr)
00177   { return PolyMesh::vertex_split(_v0, _v1, _vl, _vr); }
00178 
00180   inline void split(EdgeHandle _eh, const Point& _p)
00181   { PolyMesh::split(_eh, add_vertex(_p)); }
00182 
00183   inline void split(EdgeHandle _eh, VertexHandle _vh)
00184   { PolyMesh::split(_eh, _vh); }
00185 
00187   inline void split(FaceHandle _fh, const Point& _p)
00188   { PolyMesh::split(_fh, _p); }
00189 
00190   inline void split(FaceHandle _fh, VertexHandle _vh)
00191   { PolyMesh::split(_fh, _vh); }
00192   
00196 
00198   Normal calc_face_normal(FaceHandle _fh) const;
00199 
00201 };
00202 
00203 
00204 //=============================================================================
00205 } // namespace OpenMesh
00206 //=============================================================================
00207 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_TRIMESH_C)
00208 #define OPENMESH_TRIMESH_TEMPLATES
00209 #include "TriMeshT.cc"
00210 #endif
00211 //=============================================================================
00212 #endif // OPENMESH_TRIMESH_HH defined
00213 //=============================================================================