$search
00001 #ifndef FACE_HH 00002 #define FACE_HH 00003 00004 /* 00005 James R. Diebel 00006 Stanford University 00007 00008 Started: 27 August 2004 00009 Last revised: 27 Sugust 2004 00010 00011 face.hh - class definition for a face in a 3d surface mesh as defined 00012 in the header file mesh.hh. 00013 00014 Depends on: 00015 - Vec3d class (vec3d.hh) 00016 - Mesh class (mesh.hh) 00017 - Vert class (vert.hh) 00018 - Edge class (edge.hh) 00019 00020 Used almost exclusively by Mesh class (mesh.hh) 00021 */ 00022 00023 #include <iostream> 00024 #include "vec3d.hh" 00025 #include "mesh.hh" 00026 #include "vert.hh" 00027 #include "edge.hh" 00028 00029 using namespace std; 00030 00031 namespace bmtk { 00032 00033 class Face { 00034 public: 00035 // Data 00036 int nf,ne; // number of neighboring faces, defined edges 00037 int i; // index of self within global face list 00038 int flag; // flag used in flood-fill operations 00039 Vec3d n; // normal vector of face 00040 Vec3d* ns; // array of the (m->nd) different normal vectors 00041 Vec3d n0; // original normal vector of face 00042 Vec3d nr; // reference vector, used temporarily in some routines 00043 Vec3d x; // geometric center of triangular face 00044 bool bound; // whether the face is on the mesh boundary 00045 float d; // projected distace to the origin along normal vector 00046 float dr; // projected distance to origin along region normal vector 00047 float s; // area of face 00048 class Mesh *m; // link to parent mesh 00049 class Vert *v[3]; // list of vertices of face 00050 class Edge *e[3]; // list of edges of face 00051 class Face *f[3]; // list of neighboring faces 00052 class Region *r; // pointer to current face region 00053 00054 // Constructor/Destructor 00055 Face(); 00056 ~Face(); 00057 00058 // Member functions 00059 void findNormal(); 00060 void findCenter(); 00061 void findDistance(); 00062 void findArea(); 00063 void blur(); 00064 int indexOf(Vert& vp); 00065 }; 00066 00067 // Membership tests 00068 bool operator < (Vert &vp, Face &fp); 00069 bool operator < (Edge &ep, Face &fp); 00070 00071 // Define << operator to handle output to screen 00072 ostream& operator << (ostream& os, const Face &f); 00073 00074 } // namespace bmtk 00075 00076 #endif