00001 /* 00002 @file ClusterMesh.h 00003 @author wensu 00004 @date 2003-11-23 00005 This is for maintain clusters on a mesh. 00006 */ 00007 00008 #ifndef CLUSTERMESH_H 00009 #define CLUSTERMESH_H 00010 00011 #include "Surface.h" 00012 #include "OpenMesh/ClusterMeshTraits.h" 00013 00014 class ClusterMesh: public Surface 00015 { 00016 public: 00017 00018 ClusterOpenMesh mesh; 00019 00020 /// bounding box corners 00021 ClusterOpenMesh::Point bbox_min , bbox_max; 00022 00023 /// default constructor 00024 ClusterMesh(); 00025 00026 /// open a file and precomputer all attributes 00027 bool readFile(const char* filename); 00028 00029 void assignRandomCluster(int n); 00030 00031 // set cluster to -1 reassign the cost of each face 00032 void removeCluster(); 00033 00034 void computeBoundingBox(); 00035 00036 void computeFaceCenter(); 00037 00038 void computeDualEdgeLength(); 00039 00040 void computeEdgeAngle(); 00041 00042 void computeEdgeCost(); 00043 00044 /// naming convention 00045 static std::string registry_name; 00046 virtual const std::string name() 00047 { 00048 return registry_name; 00049 } 00050 virtual void resetObjectName() 00051 { 00052 std::ostringstream objectNumberName; 00053 objectNumberName << ":" << ++objectNumber; 00054 objectName = name() + objectNumberName.str(); 00055 } 00056 00057 }; 00058 00059 #endif
1.3.4