00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _PB_TETRAHEDRONCELL_
00025 #define _PB_TETRAHEDRONCELL_
00026
00027 #include <MeshViz/3Ddata/PbCell.h>
00028
00029 #ifdef USE_IOSTREAM
00030 # include <iostream>
00031 #endif
00032
00033 class PiMatrix3;
00034 class PbMesh;
00035 class PiMarchingCase;
00036
00070 class PbTetrahedronCell : public PbCell {
00071
00072
00073 public:
00074
00078 PbTetrahedronCell(const PbMesh *owner_mesh) ;
00079
00083 PbTetrahedronCell(const PbTetrahedronCell &cell);
00084
00088 ~PbTetrahedronCell() ;
00089
00093 PbTetrahedronCell& operator=(const PbTetrahedronCell &cell) ;
00094
00098 virtual float getLongestEdgeLength() const;
00099
00103 virtual float getVolume() const;
00104
00108 virtual float getArea() const { return 0.0;}
00109
00114 virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00115
00120 virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00121
00127 virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00128
00134 virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00135
00140 virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const;
00141
00145 virtual void getWeight(const SbVec3f &pcoord, float *weight) const;
00146
00147
00148 private:
00154 SbBool set(int index, int *node_ids, float *x, float *y, float *z);
00155
00156 void print(FILE *fp) const;
00157
00158
00160 virtual int getOrdering() const;
00161
00162 virtual const int* getNodesLocalIndexOfEdge(int edge) const {
00163 return c_edgeNodes[edge];
00164 }
00165
00166 PiMarchingCase* getMCcase(unsigned char mc_case) const {
00167 return c_MarchingLookup[mc_case];
00168 }
00169
00170 #ifdef USE_IOSTREAM
00171 friend std::ostream& operator << (std::ostream& s, PbTetrahedronCell &cell);
00172 #endif
00173
00174 static SbBool init();
00175 static void finish();
00176
00177
00178 private:
00179 virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const;
00180
00181 private:
00182
00183 void copy(const PbTetrahedronCell &cell) ;
00184 void destroy();
00185
00186 static PiMarchingCase* addMC(PiMarchingCase *mcase);
00187 static PiMarchingCase* addMCBoth(PiMarchingCase *mcase);
00188
00189 mutable PiMatrix3 *m_coordToPcoordMatrix;
00190 mutable SbVec3f m_translatePcoord;
00191 mutable SbBool m_pcoordTransfoUpdated;
00192
00193 mutable SbBool m_isValid;
00194
00195 static int c_edgeNodes[6][2];
00196 static PiMarchingCase* c_MarchingLookup[16];
00197 static SbBool c_isInit;
00198 static int c_count;
00199 };
00200
00201
00202
00203 #endif
00204
00205
00206
00207
00208
00209
00210
00211