Files Classes Functions Hierarchy
00001 #ifndef D4TESS_H 00002 #define D4TESS_H 00003 00004 #include <cassert> 00005 #include <vector> 00006 #include <set> 00007 #include <iosfwd> 00008 using namespace std; 00009 00010 #include <point.h> 00011 00012 #include <d4tri.h> 00013 00014 #include <virtualtetrahedron.h> 00015 #include <d4minoperator.h> 00016 00017 #include <simplexface.h> 00018 00019 #include <d4fan.h> 00020 #include <typedefs.h> 00021 00022 typedef point4<double> pt4; 00023 00024 00025 00026 // 00027 // Brief: Tetrahedtron tessellation 00028 // 00029 class d4tess 00030 { 00031 public: 00032 00033 // For each point x y z are position and w is the field value. 00034 // Vector of points. pt[0] is a null or no point. 00035 vector<pt4> pt; 00036 00037 // Vector of simplexes, 00038 // Note: vi[0] is a null or no simplex. 00039 vector<d4tri> vi; 00040 00041 00042 00043 // Current Pointer. 00044 uint cp; 00045 // Current Orientation and is the virtual simplex(vs). 00046 virtualtetrahedron vs; 00047 00048 d4fan fan; 00049 00050 // Upon insertion of a new primitive shape, it is minimized 00051 // with the existing mesh. This is a pointer to the binary operator. 00052 d4minoperator* minimizer; 00053 00054 // Add a simplex 00055 void viadd 00056 ( 00057 uintc v0, uintc v1, uintc v2, uintc v3, 00058 uintc n0=0, uintc n1=0, uintc n2=0, uintc n3=0 00059 ); 00060 00061 // Deletes the previous minimizer. 00062 void minimizerSet( d4minoperator* m); 00063 00064 // The current virtual tetrahedron's points. 00065 // The first three points define the inner base in a clockwise ordering. 00066 // P3 is above the base. P2 is where the base triangle is pointing. 00067 void getpoints( pt4 & P0, pt4 & P1, pt4 & P2, pt4 & P3 ) const; 00068 00069 // Move to the neighbouring simplex relative to vs. 00070 boolc tetmoveleft(); 00071 // Move to the neighbouring simplex relative to vs. 00072 boolc tetmoveright(); 00073 // Move to the neighbouring simplex relative to vs. 00074 boolc tetmovedown(); 00075 00076 // Orient the base triangle of vs to the boundary. 00077 boolc boundaryorient(); 00078 // Assuming base of vs on the boundary, move down 00079 void surfacedown(); 00080 // Assuming base of vs on the boundary, move left 00081 void surfaceleft(); 00082 // Assuming base of vs on the boundary, move right 00083 void surfaceright(); 00084 // Assuming base of vs on the boundary, is the point k 00085 // viewable from the base face? 00086 boolc surfaceviewable(uintc k) const; 00087 00088 // Get the current cp orientation as a cp and face pair. 00089 simplexface const cpsimplexface() const; 00090 00091 // Get the current simplex. 00092 d4tri const & cpsimplex() const 00093 { assert((cp!=0) && (cp<vi.size())); return vi[cp]; } 00094 00095 // Greedy search minimizing towards point p in the mesh. 00096 boolc searchinsidemesh( uint & viewableface, uintc p ); 00097 00098 // One move - greedy. 00099 boolc move_terminated 00100 ( 00101 bool & insidesimplex, 00102 uint & viewableface, 00103 uintc p 00104 ); 00105 00106 // Can we rotate about the vs base? 00107 boolc rotateaboutaxis(uint & steps); 00108 00109 // Add an existing point to mesh creating new simplexes 00110 void addpoint(uintc k); 00111 00112 00113 ostream & print(ostream & os) const; 00114 00115 // Error checking code. 00116 boolc valid() const; 00117 boolc valid(uintc k) const; 00118 boolc debugcheck() const; 00119 00120 // Constructor - sets the maximum element size. 00121 d4tess( uintc arrayMax ); 00122 00123 // Destructor 00124 ~d4tess(); 00125 00126 // Reset the mesh. 00127 void reset(); 00128 00129 // Uses the first points build the first simplex, 00130 // assumes the points can form a simplex. 00131 void initialize(); 00132 00133 // Are the simplexes adjacent? 00134 boolc isconnected(uintc a, uintc b) const; 00135 // Are the simplexes adjacent and together convex? 00136 boolc isconvex(uintc a, uintc b) const; 00137 00138 00139 // Binary operation transforming two adjacent simplexes 00140 // to an arrangement of three if possible. 00141 boolc tet2to3(uintc a, uintc b); 00142 boolc tet2to3_(uintc k1, uintc k2); 00143 00144 00145 // Transform virtual tetrahedron and neighbour at base. 00146 boolc tet2to3(); 00147 // The base of the virtual triangle needs to be aligned to 00148 // the intersecting axis of the three tetrahedrons. 00149 boolc tet2to3Inverse(); 00150 00151 00152 private: 00153 00154 // Split the cp with the point k. 00155 void split( uintc k ); 00156 00157 void debugprinttet(uintc k) const; 00158 00159 void infiniteRecursion(); 00160 00161 }; 00162 00163 ostream & operator << (ostream& os, d4tess const & x); 00164 00165 00166 #endif 00167 00168
1.5.8