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_INDEXEDMESH2D_
00025 #define _PB_INDEXEDMESH2D_
00026
00027 #include <Inventor/STL/vector>
00028
00029 #include <MeshViz/3Ddata/PbMesh2D.h>
00030 class PiContouring;
00031 class PiEdgeList;
00032 class PiEdge;
00033 class PbQuadrangleCell;
00034 class PbTriangleCell;
00035
00064 class PbIndexedMesh2D : public PbMesh2D {
00065
00066
00067 public:
00068
00069
00070
00074 PbIndexedMesh2D(SbBool is_data_duplicate=TRUE);
00075
00079 PbIndexedMesh2D(const PbIndexedMesh2D &mesh);
00080
00085 PbIndexedMesh2D(int num_nodes, const float *x_nod, const float *y_nod,
00086 int num_cells, const int *cell_index, const int *cell_type,
00087 SbBool is_data_duplicate=TRUE) ;
00088
00093 PbIndexedMesh2D(int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod,
00094 int num_cells, const int *cell_index, const int *cell_type,
00095 SbBool is_data_duplicate=TRUE) ;
00096
00100 ~PbIndexedMesh2D() ;
00101
00105 PbIndexedMesh2D& operator=(const PbIndexedMesh2D &mesh) ;
00106
00110 friend int operator ==(const PbIndexedMesh2D &m1, const PbIndexedMesh2D &m2);
00111
00115 friend int operator !=(const PbIndexedMesh2D &m1, const PbIndexedMesh2D &m2)
00116 { return !(m1 == m2); }
00117
00121 void setGeometry(int num_nodes, const float *x_nod, const float *y_nod,
00122 int num_cells, const int *cell_index, const int *cell_type);
00123
00127 void setGeometry(int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod,
00128 int num_cells, const int *cell_index, const int *cell_type);
00129
00135 void getGeometry(int &numNode, const float* &x_nod, const float* &y_nod, const float* &z_nod,
00136 int &num_cells, const int32_t *&cell_index, const int32_t *&cell_type) const ;
00137
00143 void getGeometry(int &numNode, const float* &x_nod, const float* &y_nod,
00144 int &num_cells, const int32_t *&cell_index, const int32_t *&cell_type) const ;
00145
00151 void getNodes(int &num_nodes, const float* &x_nod, const float* &y_nod, const float* &z_nod) const;
00152
00158 void getNodes(int &num_nodes, const float* &x_nod, const float* &y_nod) const;
00159
00163 virtual SbVec3f getNodeCoord(int nod_index) const;
00164
00168 virtual void getNodeOwnerCellsInd(int nod_index, PbArrayOfInt &owner_cells) const;
00169
00175 virtual const PbCell *getCell(int cell_index) const;
00176
00180 enum ElemOrientation {
00184 ORIENTATION_AS_IS,
00188 ORIENTATION_ZPOS,
00192 ORIENTATION_ZNEG
00193 } ;
00194
00195
00196
00205 virtual void setElemOrientation(ElemOrientation cell_orient);
00206
00207
00208
00209
00210 private:
00211
00212 void meshLines(PoMeshLines *_PoMeshLines) const;
00213 void meshFilled(PoMeshFilled *_PoMeshFilled) const;
00214 void meshContouring(PiContouring *_PiContouring, const float *z) const;
00215 void mesh2DVec(PoMesh2DVec *mesh_vec) const ;
00216 SbBool isEmpty() const;
00217
00218 void print(FILE *fp) const;
00219
00220 ElemOrientation getElemOrientation() const;
00221 const SbBool * getOrientFlags() const;
00222 virtual SbVec3f getFirstCellNormal() const;
00223
00224 void getNodesCoord(const float *z, SoMFVec3f &vertices) const;
00225
00226 virtual void getLimitIndices(PbArrayOfInt &nodesIndex, PbArrayOfInt &limitSizes) const;
00227
00228 private:
00229 PbIndexedMesh2D(int num_z, const float *z, SbBool is_data_duplicate=TRUE);
00230
00231 virtual const PbCell* findContainingCellProtected(const SbVec3f &point, float tolerance, SbVec3f &pcoord, PbArrayOfInt &test_cell) const;
00232 void updateCellBoundingBox() const;
00233 virtual void updateOwnerCellsList() const;
00234 virtual void deleteOwnerCellsList() const;
00235 void updateBoundingBox() const;
00236
00237 ElemOrientation elemOrientation;
00238 SbBool *elemOrientFlags;
00239 int allocNodes;
00240 float *xNodes, *yNodes;
00241 int32_t allocElemIndex, *elemIndex, elemIndexSize;
00242 int32_t allocElem, *elemType;
00243
00244 void setVertices(int num_nodes, const float *x_nod, const float *y_nod);
00245
00246 mutable std::vector<PbArrayOfInt> m_ownerCellsList;
00247
00248 private:
00249
00250 void constructDefaultMesh();
00251 void constructXYGeometry(int num_nodes, const float *x_nod, const float *y_nod,
00252 int num_cells, const int *cell_index, const int *cell_type,
00253 SbBool is_data_duplicate);
00254 void setXYGeometry(int num_nodes, const float *xNode, const float *yNode,
00255 int num_cells, const int *cell_index, const int *cell_type);
00256
00257 void copy(const PbIndexedMesh2D &mesh) ;
00258 void destroy();
00259
00260 PbQuadrangleCell *m_quadrangle;
00261 PbTriangleCell *m_triangle;
00262 } ;
00263
00264
00265
00266 #endif
00267
00268
00269
00270
00271
00272
00273
00274