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_PARALCARTESIANGRID3D_
00025 #define _PB_PARALCARTESIANGRID3D_
00026
00027 #include <MeshViz/3Ddata/PbCartesianGrid3D.h>
00028 class PbVoxelCell;
00029
00049 class PbParalCartesianGrid3D : public PbCartesianGrid3D {
00050
00051
00052 public:
00053
00057 PbParalCartesianGrid3D(SbBool isDataDuplicate=TRUE) ;
00058
00062 PbParalCartesianGrid3D(const PbParalCartesianGrid3D &);
00063
00068 PbParalCartesianGrid3D(int num_x, int num_y, int num_z, const float *xnod, const float *ynod, const float *znod, SbBool isDataDuplicate=TRUE) ;
00069
00073 ~PbParalCartesianGrid3D() ;
00074
00078 PbParalCartesianGrid3D& operator=(const PbParalCartesianGrid3D &mesh) ;
00079
00083 friend int operator ==(const PbParalCartesianGrid3D &m1, const PbParalCartesianGrid3D &m2);
00084
00088 friend int operator !=(const PbParalCartesianGrid3D &m1, const PbParalCartesianGrid3D &m2)
00089 { return !(m1 == m2); }
00090
00091 virtual const PbCell* findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const;
00092
00106 virtual const PbCell* findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord) const;
00107
00114 virtual const PbCell *getCell(int cell_index) const;
00115
00119 virtual SbVec3f getNodeCoord(int nod_index) const;
00120
00124 virtual SbVec3f getNodeCoord(int i, int j, int k) const {return SbVec3f(x[i],y[j],z[k]);};
00125
00129 virtual float getVolume() const { return fabs((x[numX-1]-x[0])*(y[numY-1]-y[0])*(z[numZ-1]-z[0])); }
00130
00131
00138 void setCoordinates(const float *xnod, const float *ynod, const float *znod);
00139
00149 void getCoordinates(const float* &xnod, const float* &ynod, const float* &znod,
00150 int &num_x, int &num_y, int &num_z) const {
00151 xnod = x; num_x = numX;
00152 ynod = y; num_y = numY;
00153 znod = z; num_z = numZ;
00154 }
00155
00156 private:
00157
00158
00159 float getLongestEdgeLength();
00160
00161 void meshCrossSection(PoMeshCrossSection *cross_section) const;
00162 void meshCrossContour(PoMeshCrossContour *cross_contour) const ;
00163 void meshSkeleton(PoMeshSkeleton *skeleton, const float *nod_values,
00164 float *x_cont, float *y_cont,float *z_cont) const;
00165 void mesh3DVec(PoMesh3DVec *mesh_vec) const ;
00166 SbBool isCrossSectionOptimal() const { return TRUE; }
00167
00168 void print(FILE *fp) const;
00169 void printInfo() const {print(stdout);};
00170
00171
00172 virtual const PbCell *getTopoCell(int cell_index) const;
00173
00174 private:
00175 void updateCellBoundingBox() const;
00176 void setXYZGeometry(int num_x, int num_y, int num_z, const float *xa, const float *ya, const float *za);
00177 void getXYZGeometry(const float* &xa, const float* &ya, const float* &za) const;
00178 virtual void grid3DSkin(PoMeshSkin *_PoMeshSkin) const;
00179
00180 private:
00181 float *x, *y, *z;
00182
00183 void updateBoundingBox() const;
00184 void copy(const PbParalCartesianGrid3D &mesh) ;
00185 void destroy();
00186
00187 mutable PbVoxelCell *m_voxel;
00188 } ;
00189
00190
00191
00192 #endif
00193
00194
00195
00196
00197
00198
00199
00200