• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

/home/hauberg/Dokumenter/Capture/humim-tracker-0.1/src/OpenTissue/OpenTissue/core/containers/mesh/polymesh/util/polymesh_is_neighbor.h

Go to the documentation of this file.
00001 #ifndef OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_UTIL_POLYMESH_IS_NEIGHBOR_H
00002 #define OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_UTIL_POLYMESH_IS_NEIGHBOR_H
00003 //
00004 // OpenTissue Template Library
00005 // - A generic toolbox for physics-based modeling and simulation.
00006 // Copyright (C) 2008 Department of Computer Science, University of Copenhagen.
00007 //
00008 // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php
00009 //
00010 #include <OpenTissue/configuration.h>
00011 
00012 #include <OpenTissue/core/containers/mesh/polymesh/polymesh_edge.h>
00013 #include <OpenTissue/core/containers/mesh/polymesh/polymesh_halfedge.h>
00014 #include <OpenTissue/core/containers/mesh/polymesh/polymesh_vertex.h>
00015 #include <OpenTissue/core/containers/mesh/polymesh/polymesh_face.h>
00016 
00017 namespace OpenTissue
00018 {
00019   namespace polymesh
00020   {
00021 
00022     template<typename mesh_type>
00023     bool is_neighbor(PolyMeshFace<mesh_type> const & f, PolyMeshVertex<mesh_type> const & vertex)
00024     {
00025       typedef typename mesh_type::const_face_vertex_circulator       const_face_vertex_circulator;
00026       const_face_vertex_circulator v(f),end;
00027       for(; v!=end; ++v)
00028         if( v->get_handle().get_idx() == vertex.get_handle().get_idx())
00029           return true;
00030       return false;
00031     }
00032 
00033     template<typename mesh_type>
00034     bool is_neighbor(PolyMeshFace<mesh_type> const & f,PolyMeshHalfEdge<mesh_type> const & h)
00035     {
00036       if(h.get_face_handle().get_idx() == f.get_handle().get_idx())
00037         return true;
00038       return false;
00039     }
00040 
00041     template<typename mesh_type>
00042     bool is_neighbor(PolyMeshFace<mesh_type> const & face,PolyMeshEdge<mesh_type> const & e)
00043     {
00044       typedef typename mesh_type::halfedge_iterator halfedge_iterator;
00045       halfedge_iterator h0 = e.get_halfedge0_iterator();
00046       halfedge_iterator h1 = e.get_halfedge1_iterator();
00047       if(is_neighbor(face,*h0) || is_neighbor(face,*h1))
00048         return true;
00049       return false;
00050     }
00051 
00052     template<typename mesh_type>
00053     bool is_neighbor(PolyMeshFace<mesh_type> const & f0,PolyMeshFace<mesh_type> const & f1)
00054     {
00055       typedef typename mesh_type::const_face_edge_circulator       const_face_edge_circulator;
00056       const_face_edge_circulator e(f0),end;
00057       for(;e!=end;++e)
00058         if( is_neighbor(f1,*e))
00059           return true;
00060       return false;
00061     }
00062 
00063   } // namespace polymesh
00064 } // namespace OpenTissue
00065 
00066 //OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_UTIL_POLYMESH_IS_NEIGHBOR_H
00067 #endif

Generated on Thu Dec 1 2011 12:51:19 for HUMIM Tracker by  doxygen 1.7.1