#ifndef __DUAL_H__ #define __DUAL_H__ #include #include #include #include #include "geometry.h" #include "PLY.h" /* Data Structure for the dual graph */ /* Allow graph to grow */ typedef struct dualnode; typedef struct dualedge; typedef struct avertex; typedef struct dualnode { /* A vertex in the dual graph */ /* indices into the initial vertex array */ /* this ordering is important for culling calculation */ int v1; int v2; int v3; /* pointers to the neighbouring edges atmost 3 */ /* This ordering is not particularly important */ int e1; int e2; int e3; /* The face normal */ float fnx; float fny; float fnz; }; typedef struct dualedge { /* An edge in the dual graph */ /* Ordering unimportant */ int v1; int v2; /* The weight */ double wt; }; typedef struct avertex { /* 3D coordinates of the vertex */ float x; float y; float z; /* The normals of the vertex */ float nx; float ny; float nz; /* Color of the vertex */ unsigned char cr; unsigned char cg; unsigned char cb; /* Texture coordinates */ float u; float v; }; /* The Dual graph */ class dual { public: dual(PLYObject& ply); ~dual(); PLYObject& _ply; std::vector _vertices; std::vector _nodes; std::vector _edges; void constructDualGraph(); int boundaryEdges(int n); int boundaryNeighbors(int n); int addSteinerVertex(int v1, int v2); int nonBoundaryNeighborEdge(int n); int neighbor(int n, int e); int commonVertex(int n1, int n2, int n3); bool vertexInNode(int v, int n); int otherVertex(int n, int v1, int v2); int otherEdge(int n, int e); int otherEdge(int n, int e1, int e2); int otherNode(int e, int n); void replace(dualnode& n, int vold, int vnew); void replace(int n, int edgeold, int edgenew); void orient(dualnode& n); void assignEdges(int n, int e1, int e2, int e3); int commonEdge(int n1, int n2); void swap(int& n1, int& n2); int hascolor, hastexture; }; #endif