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
00114 void getGeometry(int &num_x, int &num_y, const float* &xa, const float* &ya) const {
00115 PbGrid2D::getGeometry(num_x,num_y,xa,ya);
00116 };
00117
00124 void getGeometry(int &num_x, int &num_y, const float* &xa, const float* &ya, const float* &za) const {
00125 PbGrid2D::getGeometry(num_x,num_y,xa,ya,za);
00126 };
00127
00134 virtual const PbCell *getCell(int cell_index) const;
00135
00139 virtual SbVec3f getNodeCoord(int nod_index) const;
00140
00144 virtual SbVec3f getNodeCoord(int i, int j) const;
00145
00146
00147
00148
00149 private:
00150
00151 void meshLines(PoMeshLines *_PoMeshLines) const;
00152 void meshFilled(PoMeshFilled *_PoMeshFilled) const;
00153 void meshContouring(PiContouring *_PiContouring, const float *z) const;
00154 void mesh2DVec(PoMesh2DVec *mesh_vec) const ;
00155
00156 void getNodesCoord(const float *z, SoMFVec3f &vertices) const;
00157
00158 void print(FILE *fp) const;
00159 void printInfo() const {print(stdout);};
00160
00161 private:
00162 virtual const PbCell* findContainingCellProtected(const SbVec3f &point, float tolerance, SbVec3f &pcoord, PbArrayOfInt &test_cell) const;
00163 PbCartesianGrid2D(int num_x, int num_y, SbBool is_data_duplicate=TRUE) ;
00164 PbCartesianGrid2D(int num_x, int num_y, const float *z, SbBool is_data_duplicate=TRUE) ;
00165 void constructXYGeometry(const float *xn, const float *yn, SbBool is_data_duplicate);
00166 void setXYGeometry(int num_x, int num_y, const float *x, const float *y);
00167 void getXYGeometry(const float* &x, const float* &y) const;
00168
00169 private:
00170 float **x, **y;
00171
00172 void updateBoundingBox() const;
00173 void copy(const PbCartesianGrid2D &mesh) ;
00174 void destroy();
00175
00176 mutable PbQuadrangleCell *m_quadrangle;
00177 } ;
00178
00179
00180
00181 #endif
00182
00183
00184
00185
00186
00187
00188
00189