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

CollapseInfoT.hh

Go to the documentation of this file.
00001 //=============================================================================
00002 //                                                                            
00003 //                               OpenMesh                                     
00004 //        Copyright (C) 2003 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.7 $
00027 //   $Date: 2004/01/12 17:36:30 $
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 
00049 //== NAMESPACE ================================================================
00050 
00051 namespace OpenMesh  { 
00052 namespace Decimater {
00053 
00054 
00055 //== CLASS DEFINITION =========================================================
00056 
00065 template <class Mesh>
00066 struct CollapseInfoT
00067 {
00068 public:
00078    CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh);
00079 
00080   Mesh&                          mesh;
00081 
00082   typename Mesh::HalfedgeHandle  v0v1; 
00083   typename Mesh::HalfedgeHandle  v1v0; 
00084   typename Mesh::VertexHandle    v0;   
00085   typename Mesh::VertexHandle    v1;   
00086   typename Mesh::Point           p0;   
00087   typename Mesh::Point           p1;   
00088   typename Mesh::FaceHandle      fl;   
00089   typename Mesh::FaceHandle      fr;   
00090   typename Mesh::VertexHandle    vl;   
00091   typename Mesh::VertexHandle    vr;   
00092 
00093 
00096   typename Mesh::HalfedgeHandle  vlv1, v0vl, vrv0, v1vr;
00098 };
00099 
00100 
00101 //-----------------------------------------------------------------------------
00102 
00103 
00104 // CollapseInfoT::CollapseInfoT( _mesh, _heh )
00105 //
00106 //   Local configuration of halfedge collapse to be stored in CollapseInfoT:
00107 /* 
00108            vl
00109            * 
00110           / \
00111          /   \
00112         / fl  \
00113     v0 *------>* v1
00114         \ fr  /
00115          \   /
00116           \ /
00117            * 
00118            vr
00119 */
00120 // Parameters:
00121 //   _mesh               Reference to mesh
00122 //   _heh                The halfedge (v0 -> v1) defining the collapse
00123 //
00124 template <class Mesh>
00125 inline
00126 CollapseInfoT<Mesh>::
00127 CollapseInfoT(Mesh& _mesh, typename Mesh::HalfedgeHandle _heh) :
00128 
00129   mesh(_mesh),
00130   v0v1(_heh),
00131   v1v0(_mesh.opposite_halfedge_handle(v0v1)),
00132   v0(_mesh.to_vertex_handle(v1v0)),
00133   v1(_mesh.to_vertex_handle(v0v1)),
00134   p0(_mesh.point(v0)),
00135   p1(_mesh.point(v1)),
00136   fl(_mesh.face_handle(v0v1)),
00137   fr(_mesh.face_handle(v1v0))
00138 
00139 {
00140   // get vl
00141   if (fl.is_valid())
00142   {
00143     vlv1 = mesh.next_halfedge_handle(v0v1);
00144     v0vl = mesh.next_halfedge_handle(vlv1);
00145     vl   = mesh.to_vertex_handle(vlv1);
00146     vlv1 = mesh.opposite_halfedge_handle(vlv1);
00147     v0vl = mesh.opposite_halfedge_handle(v0vl);
00148   }
00149 
00150 
00151   // get vr
00152   if (fr.is_valid())
00153   {
00154     vrv0 = mesh.next_halfedge_handle(v1v0);
00155     v1vr = mesh.next_halfedge_handle(vrv0);
00156     vr   = mesh.to_vertex_handle(vrv0);
00157     vrv0 = mesh.opposite_halfedge_handle(vrv0);
00158     v1vr = mesh.opposite_halfedge_handle(v1vr);
00159   }
00160 }  
00161 
00162 //=============================================================================
00163 } // END_NS_DECIMATER
00164 } // END_NS_OPENMESH
00165 //=============================================================================
00166 #endif // OPENMESH_DECIMATER_COLLAPSEINFOT_HH defined
00167 //=============================================================================
00168 

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