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

ClusterMeshTraits.h

Go to the documentation of this file.
00001 /*
00002 @file ClusterMeshTraits.h
00003 @author wensu
00004 @date 2003-11-14
00005 This is for maintain clusters on a mesh.
00006 */
00007 
00008 #ifndef CLUSTERMESHTRAITS_H
00009 #define CLUSTERMESHTRAITS_H
00010 
00011 // openmesh includes
00012 #include <OpenMesh/IO/BinaryHelper.hh>
00013 #include <OpenMesh/IO/MeshIO.hh>
00014 #include <OpenMesh/Mesh/Types/TriMesh_ArrayKernelT.hh>
00015 #ifdef _MSC_VER
00016 #  ifndef OM_STATIC_BUILD
00017 #  define OM_STATIC_BUILD
00018 #  endif
00019 #  define INCLUDE_TEMPLATES
00020 #  include <OpenMesh/IO/IOInstances.hh>
00021 #endif
00022 
00023 struct ClusterMeshTraits : public OpenMesh::DefaultTraits
00024 {
00025 
00026         FaceAttributes(OpenMesh::DefaultAttributer::Normal|OpenMesh::DefaultAttributer::Status);
00027         HalfedgeAttributes(OpenMesh::DefaultAttributer::Status);
00028         EdgeAttributes(OpenMesh::DefaultAttributer::Status);
00029         VertexAttributes(OpenMesh::DefaultAttributer::Normal|OpenMesh::DefaultAttributer::Status);
00030 
00031         FaceTraits
00032         {
00033                 Point center;
00034                 float cost; // cost from cluster center to this face
00035                 int cluster;
00036         };
00037 
00038         EdgeTraits
00039         {
00040                 float dualEdgeLength;
00041                 float angle;
00042                 float cost; // cost of walking between two neighboring faces
00043         };
00044 };
00045 
00046 typedef OpenMesh::TriMesh_ArrayKernelT<ClusterMeshTraits> ClusterOpenMesh;
00047 
00048 template< typename MeshT >
00049 class FaceCostLessThan
00050 {
00051 public:
00052     FaceCostLessThan(MeshT& m) : mesh(m) {}
00053         bool operator()(typename MeshT::FaceHandle &f1, typename MeshT::FaceHandle &f2)
00054         {
00055                 return mesh.face(f1).cost > mesh.face(f2).cost;
00056         }
00057 
00058 private:
00059     MeshT& mesh;
00060 };
00061 
00062 #endif

Generated on Mon Jun 28 14:58:13 2004 for Advanced Surface Library by doxygen 1.3.4