- Timestamp:
- 02/05/07 13:29:55 (18 years ago)
- Location:
- GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/bheap.h
r983 r2090 15 15 */ 16 16 typedef struct { 17 int item; /* vertex number is used for the item. */ 17 int dirty; /* dirty flag if used for the lazy evaluation */ 18 int item; /* edge number is used for the item. */ 18 19 double key; /* distance is used as the key. */ 19 20 } bheap_item_t; 20 21 21 22 /* Binary heap structure for frontier set in Dijkstra's algorithm. 22 * a[] - stores (distance, vertex) pairs of the binary heap.23 * a[] - stores (distance, edge) pairs of the binary heap. 23 24 * p[] - stores the positions of vertices in the binary heap a[]. 24 25 * n - is the size of the binary heap. … … 58 59 */ 59 60 void bh_delete(bheap_t *h, int item); 61 /* bh_mark() marks an item from the binary heap pointed to by h. 62 */ 63 void bh_mark(bheap_t *h, int item, int flag); 64 65 /* bh_get_key() returns the key value of an item from the binary heap pointed 66 * to by h. 67 */ 68 double bh_get_key(bheap_t *h, int item); 69 70 /* bh_is_dirty() returns the dirty value of an item from the binary heap pointed 71 * to by h. 72 */ 73 int bh_is_dirty(bheap_t *h, int item); 60 74 61 75 /* bh_decrease_key() decreases the value of 'item's key and then performs -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/camera.h
r983 r2090 5 5 6 6 #define OCTAHEDRON 6 // number of vertices 7 #define CUBE 8 7 8 #define ICOSAHEDRON 12 8 9 #define DODECAHEDRON 20 … … 26 27 extern void drawSphere(Camera *cameras, GLdouble radius, int slices, int stacks); 27 28 extern void drawOctahedron(Camera *cameras, GLdouble r); 29 extern void drawCube(Camera *cameras, GLdouble r); 28 30 extern void drawIcosahedron(Camera *cameras, GLdouble r); 29 31 extern void drawDodecahedron(Camera *cameras, GLdouble r); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/change.h
r1024 r2090 5 5 #include <vector> 6 6 #include <map> 7 #include <GeoMeshSimpSequence.h> 7 8 8 9 namespace VMI … … 20 21 } Change; 21 22 23 /* 22 24 // Represents a simplification step in the sequence. 23 25 struct vmiStep … … 41 43 extern std::vector<vmiStep> mVMISteps; 42 44 45 // Vertex info. 46 struct GeoVertex 47 { 48 Index id; 49 Index bonefrom; 50 Vector3 position; 51 Vector2 texcoord; 52 Vector3 normal; 53 }; 54 55 // Vertices added in simplification. 56 std::vector<GeoVertex> mNewVertices; 57 */ 58 59 // Stores all the simplification steps. 60 extern Geometry::MeshSimplificationSequence *mSequence; 61 43 62 extern Change *createChange (Mesh *mesh, int e); 63 extern Change *newChange (Mesh *mesh, int u, int v); 44 64 extern void writeChange(FILE* file, Change *c); 45 65 extern void deleteChange(Change *c); … … 47 67 48 68 extern void modifyTriangle(Triangle *t, int c, int p); 49 extern int isATriangleToModify(Triangle *t, int c , int p);50 extern int getTrianglesToModify(Mesh *mesh, int c, int p, Triangle *modified);69 extern int isATriangleToModify(Triangle *t, int c); 70 extern Triangle *getTrianglesToModify(Mesh *mesh, Change *c, GLuint *numMod); 51 71 extern int isATriangleToDelete(Triangle *t, int c, int p); 52 extern int getTrianglesToDelete(Mesh *mesh, int numMod, Triangle *modified, Triangle *deleted, int c, int p);72 extern Triangle *getTrianglesToDelete(Mesh *mesh, Change *c, GLuint *numDel); 53 73 54 74 extern void modifyTriangles(Mesh *mesh, Change *c); … … 62 82 extern void doChange(Mesh *mesh, Change *c); 63 83 extern void undoChange(Mesh *mesh, Change *c); 64 extern void computeChanges(Mesh *mesh, Change *c); 84 extern void computeChange(Mesh *mesh, Change *c); 85 86 extern void modifyEdges(Mesh *mesh, Change *c); 87 extern void deleteEdges(Mesh *mesh, Change *c); 65 88 66 89 // Save simplification sequence in Geometry Game Tools format. 67 extern void saveSimplificationSequence(Change *c );90 extern void saveSimplificationSequence(Change *c, int obligatory); 68 91 69 extern std::map<int, INTVECTOR> inversemap; 92 //extern std::map<int, INTVECTOR> inversemap; 93 extern void swap(int *i, int *j); 94 extern int hasEdge(Triangle *t, int e); 95 extern void getEdges(Triangle *t, Change *c, int *d, int *a); 70 96 } 71 72 97 #endif -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/color.h
r983 r2090 14 14 } Color; 15 15 16 extern Color *initColors(GLuint num Triangles);17 extern void fillAllColors(Color *colors, GLuint num Triangles, GLuint begin, GLuint end, GLubyte color);16 extern Color *initColors(GLuint numColors); 17 extern void fillAllColors(Color *colors, GLuint numColors, GLuint begin, GLuint end, GLubyte color); 18 18 extern void setColors(Color *colors, GLuint numPasses, GLuint begin, GLuint end); 19 extern void setColors2(Color *colors, GLuint num Triangles, GLuint begin, GLuint end);20 extern void setColors3(Color *colors, GLuint num Triangles, GLubyte color);21 extern void setColors4(Color *colors, GLuint num Triangles);22 extern void viewColors(Color *colors, GLuint num Triangles);19 extern void setColors2(Color *colors, GLuint numColors, GLuint begin, GLuint end); 20 extern void setColors3(Color *colors, GLuint numColors, GLubyte color); 21 extern void setColors4(Color *colors, GLuint numColors); 22 extern void viewColors(Color *colors, GLuint numColors); 23 23 24 24 } -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/global.h
r983 r2090 8 8 #include "mesh.h" 9 9 #include "color.h" 10 #include "change.h" 10 11 11 12 // For progress update. … … 58 59 59 60 //#define SALIENCY 61 62 // Extension added into the filename 63 #ifdef KL // Kullback-Leibler 64 #define EXT "VKL" 65 #endif 66 #ifdef MI // Mutual Information 67 #define EXT "VMI" 68 #endif 69 #ifdef HE // Hellinger 70 #define EXT "VHE" 71 #endif 72 #ifdef CS // Chi-Square 73 #define EXT "VCS" 74 #endif 75 76 //#define USE_EDGE_ADJACENCY 60 77 61 78 #define CHECK_OPENGL_ERROR( cmd ) \ … … 110 127 bEnableOffScreen, 111 128 bSaveLog, 112 bLoadCamerasFromFile; 129 bLoadCamerasFromFile, 130 bRemoveRedundantVertices; 113 131 114 132 extern GLsizei width, height; … … 121 139 122 140 extern void renderScene(GLuint **histogram, GLuint numCameras); 141 extern void renderSceneWin(GLuint **histogram, GLuint numCameras, Change *c); 123 142 124 143 extern void renderGeometry(void); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/histogram.h
r983 r2090 20 20 extern void printFullHistogram(GLuint **histogram, GLuint numCameras, GLuint numTriangles); 21 21 extern void getSWHistogram(GLuint *histogram, GLubyte *pixels); 22 extern void getSWHistogramWin(GLuint *histogram, GLubyte *pixels, GLfloat min[3], GLfloat max[3], Change *c); 22 23 extern void getSWHistoByOcclusionQuery(Mesh *mesh, Color *colors, GLuint *histogram); 23 24 24 25 extern void resetSWHistogram(GLuint *histogram, GLuint numTriangles); 25 26 extern void getBoundingBox(Change *c, GLfloat min[3], GLfloat max[3]); 27 extern void getWindow(GLfloat min[3], GLfloat max[3], int minw[2], int maxw[2]); 26 28 } 27 29 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/interleave.h
r983 r2090 20 20 GLfloat x, y, z; // position 21 21 } Vertex_; 22 extern GLuint vertex_buf, color_buf; 22 23 23 24 extern void setupInterleave(Mesh *mesh, Color *colors); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/mesh.h
r983 r2090 11 11 GLuint *triangles; // List of triangles 12 12 int enable; 13 int movable; // If vertex is part of a border. 13 14 } Vertex; 14 15 … … 22 23 typedef struct _Triangle { 23 24 GLuint id; // Triangle id 25 GLuint group; // Triangle group 24 26 GLuint submesh; // Triangle submesh 25 27 GLuint indices[3]; // Triangle vertices … … 45 47 extern void computeTriangleNormal(Vertex *vertices, Triangle *t); 46 48 49 extern Vertex *addVertex(Vertex *list, int *n, float x, float y, float z, int *pos); 47 50 extern int findEdge(Edge *e, GLuint num, GLuint _u, GLuint _v); 51 extern Edge *addEdge(Edge *list, int *n, int u, int v, int *pos); 48 52 extern GLboolean findVertex(GLfloat *vertices, GLuint num, GLfloat x, GLfloat y, GLfloat z, int *pos); 49 53 … … 55 59 56 60 extern int *trianglesAdjToEdge(Mesh *mesh, int e, int *n); 57 extern int *trianglesAdjToVertex(Mesh *mesh, int v, int *n);58 61 extern int *verticesAdjToVertex(Mesh *mesh, int v, int *n); 59 62 extern int *edgesAdjToVertex(Mesh *mesh, int v, int *n); 60 63 extern int *edgesAdjToVertices(Mesh *mesh, int *vertices, int numVertices, int *n); 61 64 65 // list of integers 62 66 extern void printItemList(int *list, int n); 63 67 extern int findItem(int *list, int n, int item); 64 68 extern void addItem(int *list, int *n, int item); 69 extern void delItem(int *list, int *n, int item); 65 70 66 71 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/metrics.h
r983 r2090 8 8 namespace VMI 9 9 { 10 extern GLuint computeBackgroundArea(Mesh *mesh, GLuint *histogram);11 extern GLdouble computeMeanProjArea(GLuint **histogram, GLuint numCameras, int t);12 10 extern GLdouble computeMI(Mesh *mesh, GLuint **histogram, GLuint numCameras, GLuint cam); 11 extern GLdouble decMI(GLdouble I, GLuint **histogram, GLuint numCameras, GLuint cam, Change *c); 12 extern GLdouble incMI(GLdouble I, GLuint **histogram, GLuint numCameras, GLuint cam, Change *c); 13 13 14 extern GLdouble computeHE(Mesh *mesh, GLuint *histogram); 14 15 extern GLdouble computeKL(Mesh *mesh, GLuint *histogram); 15 16 extern GLdouble computeCS(Mesh *mesh, GLuint *histogram); 16 17 18 extern GLdouble computeMeanProjArea(GLuint **histogram, GLuint numCameras, int t); 17 19 extern GLdouble computeJS(GLuint **histogram, GLuint numCameras, GLuint j, GLuint k); 18 20 extern GLdouble computeEntropy(GLuint **histogram, GLuint numCameras, GLuint k); … … 21 23 22 24 extern void getProjectedAreas(GLuint **histogram, GLuint numCameras); 25 extern void getProjectedAreasWin(GLuint **histogram, GLuint numCameras, Change *c); 23 26 extern void resetProjectedAreas(GLuint **histogram, GLuint numCameras); 24 27 -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/saliency.h
r983 r2090 14 14 15 15 extern void computeSaliency(Mesh *mesh, GLuint **histogram, GLuint numCameras); 16 extern void updateTriangleSaliency(Mesh *mesh, GLuint **histogram, GLuint numCameras, int v); 16 17 17 18 extern double computeTriangleSaliency(Mesh *mesh, GLuint **histogram, GLuint numCameras, GLuint k); -
GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/simplify.h
r1007 r2090 7 7 #include "bheap.h" 8 8 9 #include <map> 10 11 using namespace std; 12 9 13 namespace VMI 10 14 { 11 extern GLdouble computeEdgeCost(Mesh *mesh, int e);15 extern GLdouble computeEdgeCost(Mesh *mesh, int e); 12 16 13 extern bheap_t *initHeap(Mesh *mesh);17 extern bheap_t *initHeap(Mesh *mesh); 14 18 15 extern bheap_t *updateHeap(bheap_t *h, Mesh *mesh, Change *c);19 extern bheap_t *updateHeap(bheap_t *h, Mesh *mesh, Change *c); 16 20 17 extern void simplifyModel(Mesh *mesh, GLuint numDemandedTri);21 extern void simplifyModel(Mesh *mesh, GLuint numDemandedTri); 18 22 19 23 20 extern void bh_mydump(Mesh *mesh, bheap_t *h);21 extern GLdouble computeEdgeLength(Vertex *vertices, int u, int v);24 extern void bh_mydump(Mesh *mesh, bheap_t *h); 25 extern GLdouble computeEdgeLength(Vertex *vertices, int u, int v); 22 26 23 extern void swap(unsigned int *i, unsigned int *j); 24 extern void chooseBestEndPoints(Mesh *mesh, int e); 27 extern void chooseBestEndPoints(Mesh *mesh, int e); 25 28 29 extern void initVertexMultimap( Mesh *mesh, 30 multimap<int,int> &vertexMultimap); 31 ///////////////////////////////////////////////////////////////////////////// 32 // Coordinates class. 33 ///////////////////////////////////////////////////////////////////////////// 34 class _float3_ 35 { 36 public: 37 38 float x,y,z; 39 40 _float3_(float x=0.0f, float y=0.0f, float z=0.0f) 41 { 42 this->x = x; this->y = y; this->z = z; 43 } 44 45 _float3_(const _float3_ &f) 46 { 47 x=f.x; y=f.y; z=f.z; 48 } 49 50 _float3_ & operator=(const _float3_ &f) 51 { 52 x=f.x; y=f.y; z=f.z; return *this; 53 } 54 55 bool operator<(const _float3_ &f) const 56 { 57 if (x<f.x) return true; 58 if (x>f.x) return false; 59 if (y<f.y) return true; 60 if (y>f.y) return false; 61 if (z<f.z) return true; 62 if (z>f.z) return false; 63 return false; 64 } 65 }; 66 67 extern int extractValidEdge(Mesh *mesh, bheap_t *h); 68 69 extern int isValidEdge(Mesh *mesh, int edge); 70 71 void deleteVertexOfMap(Mesh *mesh, int u); 72 bool compareVertices(Vertex *vertices,int u, int v); 73 void contractInitialMesh(Mesh *mesh); 74 void contractTwinVertices(Mesh *mesh, int u, int v); 75 76 // Vectors of positions, normals and texture coordinates. 77 extern vector<Geometry::Vector3> vPositions; 78 extern vector<Geometry::Vector3> vNormals; 79 extern vector<Geometry::Vector2> vTexCoords; 26 80 } 27 81
Note: See TracChangeset
for help on using the changeset viewer.