vtf-logo

topology.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00008 #if !defined(__geom_mesh_simplex_topology_h__)
00009 #define __geom_mesh_simplex_topology_h__
00010 
00011 #include "Simplex.h"
00012 
00013 BEGIN_NAMESPACE_GEOM
00014 
00015 //---------------------------------------------------------------------------
00016 // Simplex indices.
00017 //---------------------------------------------------------------------------
00018 
00019 
00021 
00024 void
00025 computeOtherIndices(int i, int j, int* a, int* b);
00026 
00027 
00029 
00032 int
00033 computeOtherIndex(int i, int j, int k);
00034 
00035 
00037 
00042 template<int N, typename V, typename T>
00043 inline
00044 bool
00045 hasFace(const Simplex<N,V,T>& simplex, 
00046         const typename Simplex<N,V,T>::Face& face,
00047         int* faceIndex) {
00048   for (int n = 0; n != face.size(); ++n) {
00049     if (! simplex.hasVertex(face[n])) {
00050       *faceIndex = n;
00051       return false;
00052     }
00053   }
00054   return true;
00055 }
00056 
00057 
00059 
00062 template<int N, typename V, typename T>
00063 inline
00064 bool
00065 hasFace(const Simplex<N,V,T>& simplex, 
00066         const typename Simplex<N,V,T>::Face& face) {
00067   int faceIndex;
00068   return hasFace(simplex, face, &faceIndex);
00069 }
00070 
00071 
00073 
00076 template<typename V, typename T>
00077 inline
00078 bool
00079 hasFace(const Simplex<3,V,T>& simplex, const V& x, const V& y, const V& z) {
00080   return simplex.hasVertex(x) && simplex.hasVertex(y) && simplex.hasVertex(z);
00081 }
00082 
00083 
00085 
00090 template<typename V, typename T>
00091 inline
00092 bool
00093 hasFace(const Simplex<3,V,T>& simplex, const V& x, const V& y, const V& z,
00094         int* faceIndex) {
00095   if (hasFace(simplex, x, y, z)) {
00096     *faceIndex = computeOtherIndex(simplex.getVertexIndex(x),
00097                                    simplex.getVertexIndex(y),
00098                                    simplex.getVertexIndex(z));
00099     return true;
00100   }
00101   return false;
00102 }
00103 
00104 END_NAMESPACE_GEOM
00105 
00106 #define __geom_mesh_simplex_topology_ipp__
00107 #include "topology.ipp"
00108 #undef __geom_mesh_simplex_topology_ipp__
00109 
00110 #endif

Generated on Fri Aug 24 12:55:59 2007 for Computational Geometry Package by  doxygen 1.4.7