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_CELL_
00025 #define _PB_CELL_
00026
00027 #include <Inventor/SbBox.h>
00028 #include <Inventor/SbLinear.h>
00029 #include <MeshViz/graph/PbBase.h>
00030 #include <MeshViz/misc/PbArrayOfInt.h>
00031 #include <Inventor/STL/vector>
00032
00033 #ifdef __hpux
00034
00035
00036
00037 typedef std::vector<char> SbBoolVector;
00038 #else
00039 typedef std::vector<bool> SbBoolVector;
00040 #endif
00041
00042 class PbArrayOfFloat;
00043 class PoMesh3D;
00044 class PiMarchingCase;
00045
00056 class PbCell : public PbBase {
00057
00058
00059 public:
00060
00064 PbCell() ;
00065
00069 PbCell(const PbCell &cell);
00070
00074 ~PbCell() ;
00075
00079 PbCell& operator=(const PbCell &cell) ;
00080
00084 virtual float getLongestEdgeLength() const = 0;
00085
00089 virtual SbBox3f getBoundingBox() const;
00090
00095 virtual void getBounds(float &xmin,float &ymin, float &zmin,
00096 float &xmax,float &ymax, float &zmax) const;
00097
00101 virtual SbVec3f getCenter() const;
00102
00106 virtual float getVolume() const = 0;
00107
00111 virtual float getArea() const = 0;
00112
00116 int getNumFacets() const { return m_numFaces;};
00117
00121 int getNumEdges() const { return m_numEdges;};
00122
00126 int getNumNodes() const { return m_numNodes;};
00127
00131 int getIndex() const { return m_index;};
00132
00133
00134
00138 SbVec3f getNodeCoord(int nod) const { return m_nodeCoord[nod]; };
00139
00143 int getNodeIndex(int nod) const { return m_nodeIndices[nod]; };
00144
00148 void getNodesIndex(PbArrayOfInt &nodes_index) const;
00149
00154 virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const=0;
00155
00160 virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const=0;
00161
00167 virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const=0;
00168
00174 virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const=0;
00175
00181 virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const = 0;
00182
00187 virtual void getWeight(const SbVec3f &pcoord, float *weight) const = 0;
00188
00196 virtual float getValue(const SbVec3f &pcoord, const float *s) const;
00197
00205 virtual SbVec3f getValue(const SbVec3f &pcoord, const SbVec3f *v) const;
00206
00211 float getValue(const float *weight, const float *s) const;
00212
00217 SbVec3f getValue(const float *weight, const SbVec3f *v) const;
00218
00219
00220 private:
00221 virtual void print(FILE *fp) const;
00222
00223
00234 virtual int getOrdering() const { return 1;}
00235
00243 virtual void getEdgesCrossingPlane(SbPlane &plane,
00244 PbArrayOfInt &nodes_crossing,
00245 PbArrayOfInt &edges_crossing,
00246 PbArrayOfFloat *edges_ratio) const;
00247
00248 virtual const int* getNodesLocalIndexOfEdge(int edge) const = 0;
00249
00250 virtual PiMarchingCase* getMCcase(unsigned char mc_case) const;
00251
00252
00253 int addLevelSurfPart(PoMesh3D *mesh, SbBoolVector &nodes_sign, SbBool use_strip_set) const;
00254
00255
00256
00257 void setTopology(int index, int *node_indices) {
00258 m_nodeIndices = node_indices;
00259 m_index = index;
00260 }
00261
00262
00263 const int *getNodeIndexPtr() const { return m_nodeIndices; }
00264
00265 private:
00266 virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const = 0;
00267 int m_numFaces;
00268 int m_numEdges;
00269 int m_numNodes;
00270 int m_index;
00271 int *m_nodeIndices;
00272 SbVec3f m_nodeCoord[8];
00273
00274 mutable SbBox3f m_bbox;
00275
00276 private:
00277 void copy(const PbCell &cell) ;
00278 void destroy();
00279 };
00280
00281
00282 inline PiMarchingCase*
00283 PbCell::getMCcase(unsigned char) const
00284 {
00285 return NULL;
00286 }
00287
00288
00289
00290 #endif
00291
00292
00293
00294
00295
00296
00297
00298