$search
00001 #ifndef VERT_HH 00002 #define VERT_HH 00003 00004 /* 00005 James R. Diebel 00006 Stanford University 00007 00008 Started: 27 August 2004 00009 00010 vert.hh - class definition for a vertex in a 3d surface mesh as defined 00011 in the header file mesh.hh. 00012 00013 Depends on: 00014 - Vec3d class (vec3d.hh) 00015 - Edge class (edge.hh) 00016 - Face class (face.hh) 00017 00018 Used almost exclusively by Mesh class (mesh.hh) 00019 */ 00020 00021 #include <iostream> 00022 #include "vec3d.hh" 00023 #include "mat3x3.hh" 00024 #include "mesh.hh" 00025 #include "edge.hh" 00026 #include "face.hh" 00027 00028 namespace bmtk { 00029 00030 using namespace std; 00031 00032 class Vert { 00033 public: 00034 // Data 00035 int nf,ne; // number of adjacent faces, edges 00036 int i; // index of self within global vertex list 00037 float l; // average length of connected edges 00038 bool bound; // whether the vertex is on the mesh boundary 00039 int flag; // used to mark vertices for region boundary tracing 00040 int marker; // the same by a different name 00041 float depth; // depth from some specified origin 00042 float psi; // source potential to original vertex position 00043 float psiEdge; // sum of edge potential in vertex neighborhood 00044 float psiLocal; // psi + psiEdge 00045 float psiLocal0; // old value 00046 Vec3d gradPsi; // gradient of psi WRT x 00047 Vec3d gradPsi0; // old value of gradient 00048 float normGradPsi; // 2-norm of the gradient 00049 float normGradPsi0; // old value of the 2-norm of the gradient 00050 float step; // local step size 00051 Vec3d dir; // search direction for CG steps 00052 Vec3d dir0; // search direction of previous iteration 00053 Vec3d x0; // original position of vertex in 3-space 00054 Vec3d x; // position of vertex in 3-space 00055 Vec3d xr; // reference vector used in CG optimization 00056 Vec3d* xs; // array of the (m->nd) different positions 00057 Vec3d n; // normal vector assigned to vertex 00058 Vec3d c; // color in RGB-space 00059 Mat3x3 iCov; // inverse variance/covariance matrix 00060 00061 class Mesh *m; // Link to parent mesh 00062 class Face **f; // list of faces that include this vertex 00063 class Edge **e; // list of edges that include this vertex 00064 class Vert **v; // list of vertices that share an edge with this vertex 00065 00066 // Constructor/Destructor 00067 Vert(); 00068 ~Vert(); 00069 00070 // Member functions 00071 void findNormal(); 00072 void findLength(); 00073 void findPotential(); 00074 void findDepth(); 00075 void refreshLocale(); 00076 void findLocalEdgePotential(); 00077 void findGradient(); 00078 void findSearchDir(float beta); 00079 void move(float globalStep); 00080 void move(); 00081 void flatten(); 00082 00083 // Equality tests 00084 inline bool operator == (const Vert &vp) const; 00085 inline bool operator != (const Vert &vp) const; 00086 }; 00087 00088 // Define << operator to handle output to screen 00089 ostream& operator << (ostream& os, const Vert &v); 00090 00091 } // namespace bmtk 00092 00093 #endif