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_TRIANGLECELL_
00025 #define _PB_TRIANGLECELL_
00026
00027 #include <MeshViz/3Ddata/PbCell.h>
00028
00029 class PbMesh;
00030
00051 class PbTriangleCell : public PbCell {
00052
00053 public:
00054
00058 PbTriangleCell(const PbMesh *owner_mesh);
00059
00063 PbTriangleCell(const PbTriangleCell &cell);
00064
00068 ~PbTriangleCell();
00069
00073 PbTriangleCell& operator=(const PbTriangleCell &cell);
00074
00078 virtual float getLongestEdgeLength() const;
00079
00083 virtual float getVolume() const { return 0.0; }
00084
00088 virtual float getArea() const;
00089
00094 virtual void getNodesIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00095
00100 virtual void getNodesIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00101
00107 virtual void getNodesLocalIndexOfEdge (int edge, PbArrayOfInt &nodes_index) const;
00108
00114 virtual void getNodesLocalIndexOfFacet (int facet, PbArrayOfInt &nodes_index) const;
00115
00120 virtual int locatePoint(const SbVec3f &coord, float tolerance, SbVec3f &pcoord) const;
00121
00125 virtual void getWeight(const SbVec3f &pcoord, float *weight) const;
00126
00127
00128
00129 private:
00136 SbBool set(int index, int *node_ids, const float *x, const float *y);
00137
00144 SbBool set(int index, int *node_ids, const float *x, const float *y, const float *z);
00145
00146
00147 virtual const int* getNodesLocalIndexOfEdge(int edge) const {
00148 return c_edgeNodes[edge];
00149 }
00150
00151
00152 void print(FILE *fp) const;
00153
00154
00155
00156 private:
00157 virtual unsigned char getIsosurfCaseId(SbBoolVector &nodes_sign) const;
00158
00159 private:
00160
00161 void copy(const PbTriangleCell &cell);
00162 void destroy();
00163 SbBool set(
00164 const float *x, const float *y, const float *z,
00165 const float *xc, const float *yc);
00166 int locatePointOnXY(const SbVec3f &coord, float tolerance, SbVec3f &pcoord,
00167 int indx, int indy) const;
00168
00169 float m_translateXPcoord, m_translateYPcoord;
00170 float m_coordToPcoordMatrixMa, m_coordToPcoordMatrixMb,
00171 m_coordToPcoordMatrixMc, m_coordToPcoordMatrixMd;
00172
00173 SbVec3f m_normal;
00174 SbBool m_2DCell, m_isValid;
00175 int m_ignoredProjCoord;
00176 static int c_edgeNodes[3][2];
00177 };
00178
00179
00180 inline unsigned char
00181 PbTriangleCell::getIsosurfCaseId(SbBoolVector &) const
00182 {
00183 return 0;
00184 }
00185
00186
00187
00188 #endif
00189
00190
00191
00192
00193
00194
00195
00196