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_CARTESIANGRID2D_
00025 #define _PB_CARTESIANGRID2D_
00026
00027 #include <MeshViz/3Ddata/PbGrid2D.h>
00028
00029 class PiContouring;
00030 class PbQuadrangleCell;
00031
00048 class PbCartesianGrid2D : public PbGrid2D {
00049
00050
00051 public:
00052
00056 PbCartesianGrid2D(SbBool is_data_duplicated=TRUE) ;
00057
00061 PbCartesianGrid2D(const PbCartesianGrid2D &);
00062
00067 PbCartesianGrid2D(int num_x, int num_y, const float *x, const float *y, SbBool is_data_duplicated=TRUE) ;
00068
00073 PbCartesianGrid2D(int num_x, int num_y, const float *x, const float *y, const float *z, SbBool is_data_duplicated=TRUE) ;
00074
00078 ~PbCartesianGrid2D() ;
00079
00083 PbCartesianGrid2D& operator=(const PbCartesianGrid2D &mesh) ;
00084
00088 friend int operator ==(const PbCartesianGrid2D &m1, const PbCartesianGrid2D &m2);
00089
00093 friend int operator !=(const PbCartesianGrid2D &m1, const PbCartesianGrid2D &m2)
00094 { return !(m1 == m2); }
00095
00100 void getGeometry(int &num_x, int &num_y, const float** &xa, const float** &ya) const;
00101
00107 void getGeometry(int &num_x, int &num_y, const float** &xa, const float** &ya, const float**&za) const;
00108
00109 using PbGrid2D::getGeometry;
00110
00117 virtual const PbCell *getCell(int cell_index) const;
00118
00122 virtual SbVec3f getNodeCoord(int nod_index) const;
00123
00127 virtual SbVec3f getNodeCoord(int i, int j) const;
00128
00129
00130
00131
00132 private:
00133
00134 void meshLines(PoMeshLines *_PoMeshLines) const;
00135 void meshFilled(PoMeshFilled *_PoMeshFilled) const;
00136 void meshContouring(PiContouring *_PiContouring, const float *z) const;
00137 void mesh2DVec(PoMesh2DVec *mesh_vec) const ;
00138
00139 void getNodesCoord(const float *z, SoMFVec3f &vertices) const;
00140
00141 void print(FILE *fp) const;
00142
00143 private:
00144 virtual const PbCell* findContainingCellProtected(const SbVec3f &point, float tolerance, SbVec3f &pcoord, PbArrayOfInt &test_cell) const;
00145 PbCartesianGrid2D(int num_x, int num_y, SbBool is_data_duplicate=TRUE) ;
00146 PbCartesianGrid2D(int num_x, int num_y, const float *z, SbBool is_data_duplicate=TRUE) ;
00147 void setXYGeometry(int num_x, int num_y, const float *x, const float *y);
00148 void getXYGeometry(const float* &x, const float* &y) const;
00149
00150 private:
00151 float **x, **y;
00152
00153 void updateBoundingBox() const;
00154 void copy(const PbCartesianGrid2D &mesh) ;
00155 void destroy();
00156 void constructXYGeometry(const float *xn, const float *yn, SbBool is_data_duplicate);
00157
00158 mutable PbQuadrangleCell *m_quadrangle;
00159 } ;
00160
00161
00162
00163 #endif
00164
00165
00166
00167
00168
00169
00170
00171