Files Classes Functions Hierarchy
00001 #ifndef D4FAN_H 00002 #define D4FAN_H 00003 00004 #include <set> 00005 #include <map> 00006 #include <vector> 00007 #include <iosfwd> 00008 using namespace std; 00009 00010 #include <d4tess.h> 00011 #include <simplexface.h> 00012 00013 typedef unsigned int uint; 00014 typedef unsigned int const uintc; 00015 00016 00017 00018 00019 // Brief: build a 3D fan from a point outside 00020 // the convex mesh. 00021 // Assumed tess's virtual tetrahedron's base 00022 // is orientated and viewable to point _w in eval. 00023 class d4fan 00024 { 00025 d4tess & tess; 00026 public: 00027 00028 // Tetrahedron face to tetrahedron. 00029 map<simplexface,uint> stot; 00030 00031 // Boundary or linked faces 00032 set< simplexface > dead; 00033 00034 // Constructor 00035 d4fan( d4tess & _tess ); 00036 00037 // Build the 3D fan from the point _w to the 00038 // surface of tess. Assume tess.cp on surface. 00039 void eval(uintc _w); 00040 00041 ostream & print(ostream & os) const; 00042 00043 private: 00044 00045 // The central point where all the points 00046 // of the fan converge to. 00047 uint w; 00048 00049 // These are associated with partially constructed 00050 // tetrahedrons which have been defined but not 00051 // fully linked with their neighbours. 00052 // The map stot connects the simplex with the tetrahedron. 00053 vector<simplexface> process; 00054 00055 00056 // Build a spike from the current surface to point w. 00057 void addspike(); 00058 00059 // Move on surface to neighbour. ktni is the pointer 00060 // of the tet siting on surface(call a fan tet) to its 00061 // neighbouring fan tet. kt is the central fan tet. 00062 // If the move can see point w, ktni and kt are possibly 00063 // constructed and they are linked. 00064 bool const link(uint & ktni, uintc kt); 00065 00066 // The current surface face. 00067 simplexface cp; 00068 }; 00069 00070 ostream & operator << (ostream & os, d4fan const & x); 00071 00072 // About: 00073 // 00074 // The class is intended to be constructed once and 00075 // reused. Because the STL containers are heavy and 00076 // preallocate their memory for efficiency puting this 00077 // class inside a loop and constructing it unnecessarily 00078 // allocates and deallocates memory. Having this class 00079 // defined outside the loop solves this. 00080 // 00081 // 00082 00083 00084 #endif 00085 00086
1.5.8