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 typedef std::vector<bool> SbBoolVector;
00034
00035 class PbArrayOfFloat;
00036 class PoMesh3D;
00037 class PiMarchingCase;
00038
00049 class PbCell : public PbBase {
00050
00051
00052 public:
00053
00057 PbCell() ;
00058
00062 PbCell(const PbCell &cell);
00063
00067 ~PbCell() ;
00068
00072 PbCell& operator=(const PbCell &cell) ;
00073
00077 virtual float getLongestEdgeLength() const = 0;
00078
00082 virtual SbBox3f getBoundingBox() const;
00083
00088 virtual void getBounds(float &xmin,float &ymin, float &zmin,
00089 float &xmax,float &ymax, float &zmax) const;
00090
00094 virtual SbVec3f getCenter() const;
00095
00099 virtual float getVolume() const = 0;
00100
00104 virtual float getArea() const = 0;
00105
00109 int getNumFacets() const { return m_numFaces;};
00110
00114 int getNumEdges() const { return m_numEdges;};
00115
00119 int getNumNodes() const { return m_numNodes;};
00120
00124 int getIndex() const { return m_index;};
00125
00126
00127
00131 SbVec3f getNodeCoord(int nod) const { return m_nodeCoord[nod]; };
00132
00136 int getNodeIndex(int nod) const { return m_nodeIndices[nod]; };
00137
00141 void getNodesIndex(PbArrayOfInt &nodes_index) const;
00142
00147 virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const=0;
00148
00153 virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const=0;
00154
00160 virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const=0;
00161
00167 virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const=0;
00168
00174 virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const = 0;
00175
00180 virtual void getWeight(const SbVec3f &pcoord, float *weight) const = 0;
00181
00189 virtual float getValue(const SbVec3f &pcoord, const float *s) const;
00190
00198 virtual SbVec3f getValue(const SbVec3f &pcoord, const SbVec3f *v) const;
00199
00204 float getValue(const float *weight, const float *s) const;
00205
00210 SbVec3f getValue(const float *weight, const SbVec3f *v) const;
00211
00212
00213 private:
00214 virtual void print(FILE *fp) const;
00215
00216
00227 virtual int getOrdering() const { return 1;}
00228
00236 virtual void getEdgesCrossingPlane(SbPlane &plane,
00237 PbArrayOfInt &nodes_crossing,
00238 PbArrayOfInt &edges_crossing,
00239 PbArrayOfFloat *edges_ratio) const;
00240
00241 virtual const int* getNodesLocalIndexOfEdge(int edge) const = 0;
00242
00243 virtual PiMarchingCase* getMCcase(unsigned char mc_case) const;
00244
00245
00246 int addLevelSurfPart(PoMesh3D *mesh, SbBoolVector &nodes_sign, SbBool use_strip_set) const;
00247
00248
00249
00250 void setTopology(int index, int *node_indices) {
00251 m_nodeIndices = node_indices;
00252 m_index = index;
00253 }
00254
00255
00256 const int *getNodeIndexPtr() const { return m_nodeIndices; }
00257
00258 private:
00259 virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const = 0;
00260 int m_numFaces;
00261 int m_numEdges;
00262 int m_numNodes;
00263 int m_index;
00264 int *m_nodeIndices;
00265 SbVec3f m_nodeCoord[8];
00266
00267 mutable SbBox3f m_bbox;
00268
00269 private:
00270 void copy(const PbCell &cell) ;
00271 void destroy();
00272 };
00273
00274
00275 inline PiMarchingCase*
00276 PbCell::getMCcase(unsigned char) const
00277 {
00278 return NULL;
00279 }
00280
00281
00282
00283 #endif
00284
00285
00286
00287
00288
00289
00290
00291