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_WEDGECELL_
00025 #define _PB_WEDGECELL_
00026
00027 #include <MeshViz/3Ddata/PbCell.h>
00028
00029 #ifdef USE_IOSTREAM
00030 # include <iostream>
00031 #endif
00032
00033 class PbMesh;
00034 class PiMarchingCase;
00035
00069 class PbWedgeCell : public PbCell {
00070
00071
00072 public:
00073
00077 PbWedgeCell(const PbMesh *owner_mesh) ;
00078
00082 PbWedgeCell(const PbWedgeCell &cell);
00083
00087 ~PbWedgeCell() ;
00088
00092 PbWedgeCell& operator=(const PbWedgeCell &cell) ;
00093
00097 virtual float getLongestEdgeLength() const;
00098
00102 virtual float getVolume() const;
00103
00107 virtual float getArea() const { return 0.0;}
00108
00113 virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00114
00119 virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00120
00126 virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00127
00133 virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00134
00139 virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const;
00140
00144 virtual void getWeight(const SbVec3f &pcoord, float *weight) const;
00145
00150 void getDerivs(const SbVec3f &pcoord, float *weight) const;
00151
00152
00153 private:
00157 SbBool set(int index, int *node_ids, float *x, float *y, float *z);
00158
00159 void print(FILE *fp) const;
00160
00161
00163 virtual int getOrdering() const;
00164
00165 virtual const int* getNodesLocalIndexOfEdge(int edge) const {
00166 return c_edgeNodes[edge];
00167 }
00168
00169 PiMarchingCase* getMCcase(unsigned char mc_case) const {
00170 return c_MarchingLookup[mc_case];
00171 }
00172
00173 #ifdef USE_IOSTREAM
00174 friend std::ostream& operator << (std::ostream& s, PbWedgeCell &cell);
00175 #endif
00176
00177 static SbBool init();
00178 static void finish();
00179
00180
00181 private:
00182 virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const;
00183
00184 private:
00185
00186 void copy(const PbWedgeCell &cell) ;
00187 void destroy();
00188
00189 static PiMarchingCase* addMC(PiMarchingCase *mcase);
00190 static PiMarchingCase* addMCBoth(PiMarchingCase *mcase);
00191
00192 static int c_edgeNodes[9][2];
00193 static PiMarchingCase* c_MarchingLookup[64];
00194 static SbBool c_isInit;
00195 static int c_count;
00196 };
00197
00198
00199
00200 #endif
00201
00202
00203
00204
00205
00206
00207
00208