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_TRIANGLEMESH2D_
00025 #define _PB_TRIANGLEMESH2D_
00026
00027 #include <MeshViz/3Ddata/PbIndexedMesh2D.h>
00028 class PiContouring;
00029 class PbTriangleCell;
00030
00058 class PbTriangleMesh2D : public PbIndexedMesh2D {
00059
00060
00061 public:
00062
00066 PbTriangleMesh2D(SbBool isDataDuplicate=TRUE) ;
00067
00071 PbTriangleMesh2D(const PbTriangleMesh2D &mesh);
00072
00077 PbTriangleMesh2D(int num_nodes, const float *x_nod, const float *y_nod,
00078 int num_triangles, const int32_t *triangle_index,
00079 SbBool is_data_duplicate=TRUE) ;
00080
00085 PbTriangleMesh2D(int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod,
00086 int num_triangles, const int32_t *triangle_index,
00087 SbBool is_data_duplicate=TRUE) ;
00088
00092 ~PbTriangleMesh2D();
00093
00097 PbTriangleMesh2D& operator=(const PbTriangleMesh2D &mesh) ;
00098
00102 friend int operator ==(const PbTriangleMesh2D &m1, const PbTriangleMesh2D &m2);
00103
00107 friend int operator !=(const PbTriangleMesh2D &m1, const PbTriangleMesh2D &m2)
00108 { return !(m1 == m2); }
00109
00113 void setGeometry(int num_nodes, const float *x_nod, const float *y_nod,
00114 int num_triangles, const int *triangle_index);
00115
00120 void setGeometry(int numPoints, const float *xPointsField, const float *yPointsField) ;
00121
00125 void setGeometry(int num_nodes, const float *x_nod, const float *y_nod, const float *z_nod,
00126 int num_triangles, const int *triangle_index);
00127
00133 void getGeometry(int &num_nodes, const float *&x_nod, const float *&y_nod,
00134 int &num_triangles, const int32_t *&triangle_index) const;
00135
00141 void getGeometry(int &num_nodes, const float *&x_nod, const float *&y_nod, const float* &z_nod,
00142 int &num_triangles, const int32_t *&triangle_index) const;
00143
00149 void getGeometry(int &num_nodes, const float *&x_nod, const float *&y_nod,
00150 int &num_triangles, const int32_t **&triangle_index) const;
00151
00157 void getGeometry(int &num_nodes, const float *&x_nod, const float *&y_nod, const float* &z_nod,
00158 int &num_triangles, const int32_t **&triangle_index) const;
00159
00163 virtual void getNodesOwnerCellsInd(const PbArrayOfInt &nod_indices, PbArrayOfInt &owner_cells) const;
00164
00171 virtual const PbCell *getCell(int cell_index) const;
00172
00181 void setElemOrientation(ElemOrientation elem_orient);
00182
00183
00184 private:
00185
00186 void meshLines(PoMeshLines *_PoMeshLines) const;
00187 void meshFilled(PoMeshFilled *_PoMeshFilled) const;
00188 void meshContouring(PiContouring *_PiContouring, const float *z) const;
00189 void mesh2DVec(PoMesh2DVec *mesh_vec) const ;
00190
00191 virtual void getLimitIndices(PbArrayOfInt &nodesIndex, PbArrayOfInt &limitSizes) const;
00192 virtual void getOneLimit(int, PbArrayOfInt&);
00193
00194 void evaluateFaultNode(int fault_node, const PbArrayOfInt &adjacent_nodes,
00195 int first_fault_node_id, int num_set, float **val);
00196 void evaluateFaultNodeWithDerivs(int fault_node, const PbArrayOfInt &adjacent_nodes,
00197 int first_fault_node_id, int num_set, float **val);
00198
00199 virtual int getAdjacentCellAround(int cellIndex, PbArrayOfInt &edge);
00200
00201 void print(FILE *fp) const;
00202 void printInfo() const {print(stdout);};
00203
00204 private:
00205 virtual const PbCell* findContainingCellProtected(const SbVec3f &point, float tolerance, SbVec3f &pcoord, PbArrayOfInt &test_cell) const;
00206 void updateCellBoundingBox() const;
00207 void updateOwnerCellsList() const;
00208
00209 private:
00210
00211 void constructXYGeometry(int num_nodes, const float *x_nod, const float *y_nod,
00212 int num_triangles, const int32_t *triangle_index,
00213 SbBool is_data_duplicate);
00214 void setXYGeometry(int num_nodes, const float *x_nod, const float *y_nod,
00215 int num_triangles, const int *triangle_index);
00216
00217 SbBool m_isVoronoiGeometry ;
00218 int32_t **triangleIndex;
00219
00220 void copy(const PbTriangleMesh2D &mesh) ;
00221 void destroy();
00222
00223 mutable PbTriangleCell *m_triangle;
00224 };
00225
00226
00227
00228 #endif
00229
00230
00231
00232
00233
00234
00235
00236