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_MESH1D_
00025 #define  _PB_MESH1D_
00026 
00027 #include <MeshViz/3Ddata/PbMesh.h>
00028 
00029 class PoChart ;
00030 class SoMaterial ;
00031 class SoState ;
00032 
00042 class  PbMesh1D : public PbMesh {
00043 
00044 
00045  public:
00046 
00050   virtual float getVolume() const { return 0.0;}
00051 
00055   virtual float getArea() const { return 0.0 ;}
00056 
00060   virtual const PbCell* findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const;
00061 
00065   virtual const PbCell* findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord) const;
00066 
00070   virtual const PbCell *getCell(int cell_index) const;
00071 
00072   virtual void getAdjacentCellsIndByNode(int cell_index, PbArrayOfInt &adjacent_cells) const;
00073 
00074   virtual void getAdjacentCellsIndByFacet(int cell_index, PbArrayOfInt &adjacent_cells) const;
00075 
00076   virtual void getNodeOwnerCellsInd(int nod_index, PbArrayOfInt &owner_cells) const;
00077 
00081   virtual void getNodesOwnerCellsInd(const PbArrayOfInt &nod_indices, PbArrayOfInt &owner_cells) const;
00082 
00086   PbMesh1D& operator=(const PbMesh1D &mesh) ;
00087 
00088   
00089  private:
00090   virtual void print(FILE *fp) const;
00091   
00092   
00093   
00094   
00095   
00096   virtual void getXYGeometry(const PoChart *chartRep,
00097                              const SoState *state,
00098                              int &size,
00099                              float* &x,
00100                              float* &y,
00101                              SoMaterial* &matPerVertex,
00102                              SbBool isIndexSourceNeeded,
00103                              int*   &indexSource) const;
00104 
00105   
00106   
00107   
00108   
00109   virtual void getFilteredXYGeometry(const PoChart *chartRep,
00110                                      const SoState *state,
00111                                      int &size,
00112                                      float* &x,
00113                                      float* &y,
00114                                      SoMaterial* &matPerVertex) const ;
00115   
00116   virtual void getFilteredXYGeometry(const PoChart *chartRep,
00117                                      const SoState *state,
00118                                      int &size,
00119                                      float* &x,
00120                                      float* &y,
00121                                      SoMaterial* &matPerVertex,
00122                                      float *&vset1) const ;
00123   
00124   virtual void getFilteredXYGeometry(const PoChart *chartRep,
00125                                      const SoState *state,
00126                                      int &size,
00127                                      float* &x,
00128                                      float* &y,
00129                                      SoMaterial* &matPerVertex,
00130                                      float *&vset1,
00131                                      float *&vset2) const ;
00132   
00133   
00134   
00135   
00136   
00137   
00138   
00139   void getGeometryInterThreshold(const PoChart *chartRep,
00140                                  const SoState *state,
00141                                  SbBool isVertOrient, float threshold,
00142                                  int &sizeTmp, float* &xTmp, float* &yTmp, 
00143                                  SoMaterial* &matTmp, SbBool isIndexSourceNeeded, 
00144                                  int* &indexSource, int &numInters, int* &indexInters) const ;
00145 
00146   virtual float getXCoord(int nodeIndex) const=0 ;
00147 
00148  private:
00149   PbMesh1D() ;
00150   
00151 
00152   PbMesh1D(const PbMesh1D &_mesh) ;
00153   
00154 
00155   virtual void updateCellBoundingBox() const;
00156   virtual const PbCell* findContainingCellProtected(const SbVec3f &point, float tolerance, 
00157                                                     SbVec3f &pcoord, PbArrayOfInt &test_cell) const;
00158 
00159   int   m_size ;
00160 
00161  private:
00162   void copy(const PbMesh1D &other_mesh) ;
00163 
00164   static void setMaterialInterVertex(const float *x, const float *y, int startIndex,
00165                                      int num, SoMaterial *matPerVertex) ;
00166   
00167   static void setMaterialAtVertex(const SoMaterial *matSrc, const float *colValSet, 
00168                                   int srcIndex, int index, SoMaterial *matPerVertex) ;
00169   
00170   static void interpolateMaterial(SoMaterial *srcMat, int startIndexSrc, int endIndexSrc,
00171                                   float value, SoMaterial *dstMat, int indexDst) ;
00172 
00173   static SbBool isBBoxCurveThresholdInter(const SbBox2f &bboxCurve, SbBool isVertOrient,
00174                                           float threshold) ;
00175 } ;
00176 
00177 inline const PbCell* 
00178 PbMesh1D::findContainingCell(const SbVec3f &, float , SbVec3f &, const PbCell *) const
00179 { return NULL ; }
00180 
00181 inline const PbCell*
00182 PbMesh1D::findContainingCell(const SbVec3f &, float , SbVec3f &) const
00183 { return NULL ; }
00184 
00185 inline const PbCell *
00186 PbMesh1D::getCell(int) const
00187 { return NULL ; }
00188 
00189 inline const PbCell* 
00190 PbMesh1D::findContainingCellProtected(const SbVec3f &, float, SbVec3f &, PbArrayOfInt &) const
00191 { return NULL ; }
00192 
00193 
00194 
00195 
00196 #endif 
00197 
00198