Ignore:
Timestamp:
02/05/07 13:29:55 (18 years ago)
Author:
gumbau
Message:
 
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  
    1515 */ 
    1616typedef 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. */ 
    1819    double key;  /* distance is used as the key. */ 
    1920} bheap_item_t; 
    2021 
    2122/* 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. 
    2324 * p[] - stores the positions of vertices in the binary heap a[]. 
    2425 * n - is the size of the binary heap. 
     
    5859 */ 
    5960void bh_delete(bheap_t *h, int item); 
     61/* bh_mark() marks an item from the binary heap pointed to by h. 
     62 */ 
     63void 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 */ 
     68double 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 */ 
     73int bh_is_dirty(bheap_t *h, int item); 
    6074 
    6175/* 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  
    55 
    66#define OCTAHEDRON     6  // number of vertices 
     7#define CUBE           8 
    78#define ICOSAHEDRON   12 
    89#define DODECAHEDRON  20 
     
    2627extern void drawSphere(Camera *cameras, GLdouble radius, int slices, int stacks); 
    2728extern void drawOctahedron(Camera *cameras, GLdouble r); 
     29extern void drawCube(Camera *cameras, GLdouble r); 
    2830extern void drawIcosahedron(Camera *cameras, GLdouble r); 
    2931extern void drawDodecahedron(Camera *cameras, GLdouble r); 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/change.h

    r1024 r2090  
    55#include        <vector> 
    66#include        <map> 
     7#include        <GeoMeshSimpSequence.h> 
    78 
    89namespace       VMI 
     
    2021        } Change; 
    2122 
     23        /* 
    2224        // Represents a simplification step in the sequence. 
    2325        struct vmiStep 
     
    4143        extern  std::vector<vmiStep> mVMISteps; 
    4244 
     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 
    4362        extern Change *createChange (Mesh *mesh, int e); 
     63        extern Change *newChange (Mesh *mesh, int u, int v); 
    4464        extern void writeChange(FILE* file, Change *c); 
    4565        extern void deleteChange(Change *c); 
     
    4767 
    4868        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); 
    5171        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); 
    5373 
    5474        extern void modifyTriangles(Mesh *mesh, Change *c); 
     
    6282        extern void doChange(Mesh *mesh, Change *c); 
    6383        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); 
    6588 
    6689        //      Save simplification sequence in Geometry Game Tools format. 
    67         extern void     saveSimplificationSequence(Change       *c); 
     90        extern void     saveSimplificationSequence(Change       *c, int obligatory); 
    6891 
    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); 
    7096} 
    71  
    7297#endif 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/color.h

    r983 r2090  
    1414} Color; 
    1515 
    16 extern Color *initColors(GLuint numTriangles); 
    17 extern void fillAllColors(Color *colors, GLuint numTriangles, GLuint begin, GLuint end, GLubyte color); 
     16extern Color *initColors(GLuint numColors); 
     17extern void fillAllColors(Color *colors, GLuint numColors, GLuint begin, GLuint end, GLubyte color); 
    1818extern void setColors(Color *colors, GLuint numPasses, GLuint begin, GLuint end); 
    19 extern void setColors2(Color *colors, GLuint numTriangles, GLuint begin, GLuint end); 
    20 extern void setColors3(Color *colors, GLuint numTriangles, GLubyte color); 
    21 extern void setColors4(Color *colors, GLuint numTriangles); 
    22 extern void viewColors(Color *colors, GLuint numTriangles); 
     19extern void setColors2(Color *colors, GLuint numColors, GLuint begin, GLuint end); 
     20extern void setColors3(Color *colors, GLuint numColors, GLubyte color); 
     21extern void setColors4(Color *colors, GLuint numColors); 
     22extern void viewColors(Color *colors, GLuint numColors); 
    2323 
    2424} 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/global.h

    r983 r2090  
    88#include "mesh.h" 
    99#include "color.h" 
     10#include "change.h" 
    1011 
    1112//      For progress update. 
     
    5859 
    5960//#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 
    6077 
    6178#define CHECK_OPENGL_ERROR( cmd ) \ 
     
    110127                 bEnableOffScreen, 
    111128                 bSaveLog, 
    112                  bLoadCamerasFromFile; 
     129                 bLoadCamerasFromFile, 
     130                                                                 bRemoveRedundantVertices; 
    113131 
    114132extern GLsizei width, height; 
     
    121139 
    122140extern void renderScene(GLuint **histogram, GLuint numCameras); 
     141extern void renderSceneWin(GLuint **histogram, GLuint numCameras, Change *c); 
    123142 
    124143extern void renderGeometry(void); 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/histogram.h

    r983 r2090  
    2020extern void printFullHistogram(GLuint **histogram, GLuint numCameras, GLuint numTriangles); 
    2121extern void getSWHistogram(GLuint *histogram, GLubyte *pixels); 
     22extern void getSWHistogramWin(GLuint *histogram, GLubyte *pixels, GLfloat min[3], GLfloat max[3], Change *c); 
    2223extern void getSWHistoByOcclusionQuery(Mesh *mesh, Color *colors, GLuint *histogram); 
    2324 
    2425extern void resetSWHistogram(GLuint *histogram, GLuint numTriangles); 
    25  
     26extern void getBoundingBox(Change *c, GLfloat min[3], GLfloat max[3]); 
     27extern void getWindow(GLfloat min[3], GLfloat max[3], int minw[2], int maxw[2]); 
    2628} 
    2729 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/interleave.h

    r983 r2090  
    2020    GLfloat x, y, z;    // position 
    2121} Vertex_; 
     22extern GLuint vertex_buf, color_buf; 
    2223 
    2324extern void setupInterleave(Mesh *mesh, Color *colors); 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/mesh.h

    r983 r2090  
    1111    GLuint *triangles;   // List of triangles 
    1212    int enable; 
     13                int     movable;        //      If vertex is part of a border. 
    1314} Vertex; 
    1415 
     
    2223typedef struct _Triangle { 
    2324    GLuint              id;         // Triangle id 
     25    GLuint  group;        // Triangle group 
    2426                GLuint          submesh;                // Triangle submesh      
    2527    GLuint              indices[3]; // Triangle vertices 
     
    4547extern void computeTriangleNormal(Vertex *vertices, Triangle *t); 
    4648 
     49extern Vertex *addVertex(Vertex *list, int *n, float x, float y, float z, int *pos); 
    4750extern int findEdge(Edge *e, GLuint num, GLuint _u, GLuint _v); 
     51extern Edge *addEdge(Edge *list, int *n, int u, int v, int *pos); 
    4852extern GLboolean findVertex(GLfloat *vertices, GLuint num, GLfloat x, GLfloat y, GLfloat z, int *pos); 
    4953 
     
    5559 
    5660extern int *trianglesAdjToEdge(Mesh *mesh, int e, int *n); 
    57 extern int *trianglesAdjToVertex(Mesh *mesh, int v, int *n); 
    5861extern int *verticesAdjToVertex(Mesh *mesh, int v, int *n); 
    5962extern int *edgesAdjToVertex(Mesh *mesh, int v, int *n); 
    6063extern int *edgesAdjToVertices(Mesh *mesh, int *vertices, int numVertices, int *n); 
    6164 
     65// list of integers 
    6266extern void printItemList(int *list, int n); 
    6367extern int findItem(int *list, int n, int item); 
    6468extern void addItem(int *list, int *n, int item); 
     69extern void delItem(int *list, int *n, int item); 
    6570 
    6671 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/metrics.h

    r983 r2090  
    88namespace       VMI 
    99{ 
    10 extern GLuint computeBackgroundArea(Mesh *mesh, GLuint *histogram); 
    11 extern GLdouble computeMeanProjArea(GLuint **histogram, GLuint numCameras, int t); 
    1210extern GLdouble computeMI(Mesh *mesh, GLuint **histogram, GLuint numCameras, GLuint cam); 
     11extern GLdouble decMI(GLdouble I, GLuint **histogram, GLuint numCameras, GLuint cam, Change *c); 
     12extern GLdouble incMI(GLdouble I, GLuint **histogram, GLuint numCameras, GLuint cam, Change *c); 
     13 
    1314extern GLdouble computeHE(Mesh *mesh, GLuint *histogram); 
    1415extern GLdouble computeKL(Mesh *mesh, GLuint *histogram); 
    1516extern GLdouble computeCS(Mesh *mesh, GLuint *histogram); 
    1617 
     18extern GLdouble computeMeanProjArea(GLuint **histogram, GLuint numCameras, int t); 
    1719extern GLdouble computeJS(GLuint **histogram, GLuint numCameras, GLuint j, GLuint k); 
    1820extern GLdouble computeEntropy(GLuint **histogram, GLuint numCameras, GLuint k); 
     
    2123 
    2224extern void getProjectedAreas(GLuint **histogram, GLuint numCameras); 
     25extern void getProjectedAreasWin(GLuint **histogram, GLuint numCameras, Change *c); 
    2326extern void resetProjectedAreas(GLuint **histogram, GLuint numCameras); 
    2427 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/saliency.h

    r983 r2090  
    1414 
    1515extern void computeSaliency(Mesh *mesh, GLuint **histogram, GLuint numCameras); 
     16extern void updateTriangleSaliency(Mesh *mesh, GLuint **histogram, GLuint numCameras, int v); 
    1617 
    1718extern double computeTriangleSaliency(Mesh *mesh, GLuint **histogram, GLuint numCameras, GLuint k); 
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/vmi/include/simplify.h

    r1007 r2090  
    77#include "bheap.h" 
    88 
     9#include        <map> 
     10 
     11using   namespace       std; 
     12 
    913namespace       VMI 
    1014{ 
    11 extern GLdouble computeEdgeCost(Mesh *mesh, int e); 
     15        extern GLdouble computeEdgeCost(Mesh *mesh, int e); 
    1216 
    13 extern bheap_t *initHeap(Mesh *mesh); 
     17        extern bheap_t *initHeap(Mesh *mesh); 
    1418 
    15 extern bheap_t *updateHeap(bheap_t *h, Mesh *mesh, Change *c); 
     19        extern bheap_t *updateHeap(bheap_t *h, Mesh *mesh, Change *c); 
    1620 
    17 extern void simplifyModel(Mesh *mesh, GLuint numDemandedTri); 
     21        extern void simplifyModel(Mesh *mesh, GLuint numDemandedTri); 
    1822 
    1923 
    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); 
    2226 
    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); 
    2528 
     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; 
    2680} 
    2781 
Note: See TracChangeset for help on using the changeset viewer.