Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

CollapseInfoT.hh

Go to the documentation of this file.
00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen       
00005 //                           www.openmesh.org                                 
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 //   $Revision: 1.1.1.1 $
00027 //   $Date: 2004/09/06 12:36:44 $
00028 //                                                                            
00029 //=============================================================================
00030 
00036 //=============================================================================
00037 //
00038 //  STRUCT CollpaseInfoT
00039 //
00040 //=============================================================================
00041 
00042 #ifndef OPENMESH_DECIMATER_COLLAPSEINFOT_HH
00043 #define OPENMESH_DECIMATER_COLLAPSEINFOT_HH
00044 
00045 
00046 //== INCLUDES =================================================================
00047 
00048 #include <vector>
00049 
00050 
00051 //== NAMESPACE ================================================================
00052 
00053 namespace OpenMesh  { 
00054 namespace Decimater {
00055 
00056 
00057 //== CLASS DEFINITION =========================================================
00058 
00067 template <class Mesh>
00068 struct CollapseInfoT
00069 {
00070 public:
00080    CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh);
00081 
00082   Mesh&                          mesh;
00083 
00084   typename Mesh::HalfedgeHandle  v0v1; 
00085   typename Mesh::HalfedgeHandle  v1v0; 
00086   typename Mesh::VertexHandle    v0;   
00087   typename Mesh::VertexHandle    v1;   
00088   typename Mesh::Point           p0;   
00089   typename Mesh::Point           p1;   
00090   typename Mesh::FaceHandle      fl;   
00091   typename Mesh::FaceHandle      fr;   
00092   typename Mesh::VertexHandle    vl;   
00093   typename Mesh::VertexHandle    vr;   
00094 
00095 
00098   typename Mesh::HalfedgeHandle  vlv1, v0vl, vrv0, v1vr;
00100 
00101   std::vector<typename Mesh::VertexHandle>  one_ring;
00102 };
00103 
00104 
00105 //-----------------------------------------------------------------------------
00106 
00107 
00108 // CollapseInfoT::CollapseInfoT( _mesh, _heh )
00109 //
00110 //   Local configuration of halfedge collapse to be stored in CollapseInfoT:
00111 /* 
00112            vl
00113            * 
00114           / \
00115          /   \
00116         / fl  \
00117     v0 *------>* v1
00118         \ fr  /
00119          \   /
00120           \ /
00121            * 
00122            vr
00123 */
00124 // Parameters:
00125 //   _mesh               Reference to mesh
00126 //   _heh                The halfedge (v0 -> v1) defining the collapse
00127 //
00128 template <class Mesh>
00129 inline
00130 CollapseInfoT<Mesh>::
00131 CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh) :
00132 
00133   mesh(_mesh),
00134   v0v1(_heh),
00135   v1v0(_mesh.opposite_halfedge_handle(v0v1)),
00136   v0(_mesh.to_vertex_handle(v1v0)),
00137   v1(_mesh.to_vertex_handle(v0v1)),
00138   p0(_mesh.point(v0)),
00139   p1(_mesh.point(v1)),
00140   fl(_mesh.face_handle(v0v1)),
00141   fr(_mesh.face_handle(v1v0))
00142 
00143 {
00144   // get vl
00145   if (fl.is_valid())
00146   {
00147     vlv1 = mesh.next_halfedge_handle(v0v1);
00148     v0vl = mesh.next_halfedge_handle(vlv1);
00149     vl   = mesh.to_vertex_handle(vlv1);
00150     vlv1 = mesh.opposite_halfedge_handle(vlv1);
00151     v0vl = mesh.opposite_halfedge_handle(v0vl);
00152   }
00153 
00154 
00155   // get vr
00156   if (fr.is_valid())
00157   {
00158     vrv0 = mesh.next_halfedge_handle(v1v0);
00159     v1vr = mesh.next_halfedge_handle(vrv0);
00160     vr   = mesh.to_vertex_handle(vrv0);
00161     vrv0 = mesh.opposite_halfedge_handle(vrv0);
00162     v1vr = mesh.opposite_halfedge_handle(v1vr);
00163   }
00164 
00165 
00166   // store one-ring
00167   one_ring.clear();
00168   for (typename Mesh::VVIter vv_it=mesh.vv_iter(v0); vv_it; ++vv_it)
00169     one_ring.push_back(vv_it);
00170 }  
00171 
00172 //=============================================================================
00173 } // END_NS_DECIMATER
00174 } // END_NS_OPENMESH
00175 //=============================================================================
00176 #endif // OPENMESH_DECIMATER_COLLAPSEINFOT_HH defined
00177 //=============================================================================
00178 

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .