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_PIXELCELL_
00025 #define  _PB_PIXELCELL_
00026 
00027 #include <MeshViz/3Ddata/PbCell.h>
00028 
00029 class PbMesh;
00030 
00051 class  PbPixelCell : public PbCell {
00052 
00053 
00054  public:
00055 
00059   PbPixelCell(const PbMesh *owner_mesh) ;
00060 
00064   PbPixelCell(const PbPixelCell &cell);
00065 
00069   ~PbPixelCell() ;
00070 
00074   PbPixelCell& operator=(const PbPixelCell &cell) ;
00075 
00079   float getLongestEdgeLength() const;
00080 
00084   SbBox3f getBoundingBox() const;
00085 
00090   void getBounds(float &xmin,float &ymin, float &zmin, 
00091                  float &xmax,float &ymax, float &zmax) const;
00092 
00096   SbVec3f getCenter() const;
00097 
00101   float getVolume() const { return 0.0;}
00102 
00106   float getArea() const { return m_dx*m_dy;}
00107 
00112   virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00113 
00118   virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00119 
00125   virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00126 
00132   virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00133 
00138   virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const;
00139 
00143   virtual void getWeight(const SbVec3f &pcoord, float *weight) const;
00144 
00152   float getValue(const SbVec3f &pcoord, const float *s) const;
00153 
00161   SbVec3f getValue(const SbVec3f &pcoord, const SbVec3f *v) const;
00162 
00163   
00164  private:
00169   SbBool set(int index, int *node_ids, 
00170              float x_min, float y_min, 
00171              float x_max, float y_max);
00172 
00173   void print(FILE *fp) const;
00174   
00175 
00176   virtual const int* getNodesLocalIndexOfEdge(int edge) const {
00177     return c_edgeNodes[edge];
00178   }
00179 
00180   
00181 
00182  private:
00183    virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const;
00184 
00185  private:
00186 
00187   void copy(const PbPixelCell &cell) ;
00188   void destroy();
00189 
00190   float m_xmin,m_ymin, m_xmax,m_ymax, m_dx,m_dy;
00191 
00192   static int             c_edgeNodes[4][2]; 
00193 };
00194 
00195 
00196 inline unsigned char
00197 PbPixelCell::getIsosurfCaseId(SbBoolVector &) const 
00198 {
00199   return 0;
00200 }
00201 
00202 
00203 
00204 #endif 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212