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 _PO_MESH3D_
00025 #define _PO_MESH3D_
00026
00027 #include <Inventor/fields/SoSFShort.h>
00028 #include <Inventor/nodes/SoIndexedLineSet.h>
00029
00030 #include <MeshViz/3Ddata/PoMesh.h>
00031 #include <MeshViz/3Ddata/PbCell.h>
00032
00033 class SoMFVec3f;
00034
00035 class PiMeshSkin;
00036 class PbMesh3D;
00037 class PbParalCartesianGrid3D;
00038 class PbRegularCartesianGrid3D;
00039 class PbIndexedMesh3D;
00040 class PbTetrahedronMesh3D;
00041 class PbHexahedronMesh3D;
00042 class PbGrid3D;
00043 class SoNormal;
00044
00053 class PoMesh3D : public PoMesh {
00054
00055 SO_KIT_HEADER(PoMesh3D) ;
00056
00057
00058 public:
00059
00060
00061
00065 void setMesh(PbMesh3D *mesh);
00066
00070 const PbMesh3D * getMesh() const;
00071
00072
00073 private:
00074 static void initClass() ;
00075 static void exitClass() ;
00076
00077 void indexedMeshLevelSurfShapeIndices(PbIndexedMesh3D *mesh, int surfOrientation=1,
00078 const float *per_cell_value=NULL);
00079 void tetrahedronMeshLevelSurfShapeIndices(PbTetrahedronMesh3D *mesh, int surfOrientation=1,
00080 const float *per_cell_value=NULL) ;
00081 void hexahedronMeshLevelSurfShapeIndices(PbHexahedronMesh3D *mesh, int surfOrientation=1,
00082 const float *percell_value=NULL) ;
00083 virtual void addOptQuadrangle(int num_quad, int *quad_nodes, int cell_index);
00084
00085 virtual const float *getIsosurfDataSet() { return NULL; }
00086 virtual float getIsosurfValue() const { return 0; }
00087 virtual int getSurfOrientation() { return 1; }
00088
00089 int addSurfPoint (int nod_ind1, int nod_ind2, int32_t &point_index);
00090 void computeCrossPointCoord(int index, const float *x, const float *y, const float *z, const float *v,
00091 int n0, int n1, float d0, float d1);
00092
00096 virtual size_t getMemorySize();
00097 size_t getHashTableMemorySize();
00098
00102 int getNumIsoCells() {
00103 return m_numIsoCells;
00104 }
00105
00106 void newIsoCell() {
00107 m_numIsoCells++;
00108 }
00109 void clearIsoCells() {
00110 m_numIsoCells = 0;
00111 }
00112
00113 private:
00114 PoMesh3D() ;
00115
00116
00117 virtual ~PoMesh3D() ;
00118
00119
00120 virtual void basicObjectChange(PbBase *basicObj);
00121 virtual void preRebuild();
00122
00123 void crossPlaneAndQuadrangle(const float *x, const float *y, const float *z, const float *v,
00124 const int32_t *quad_nodes, const int32_t *quad_ind, float xn,float yn,float zn,
00125 float dist_plane_orig, SbBool &intersect,int32_t *point_ind);
00126 void getParalCartGrid3DCrossContour(PbParalCartesianGrid3D *mesh, const float *nod_values,
00127 float xn, float yn, float zn, float dist_to_origin,
00128 SoIndexedLineSet *indexed_line_set, SoCoordinate3 *coordinate);
00129 void getRegularGrid3DCrossContour(PbRegularCartesianGrid3D *mesh, const float *nod_values,
00130 float xn, float yn, float zn, float dist_to_origin,
00131 SoIndexedLineSet *indexed_line_set, SoCoordinate3 *coordinate);
00132
00133 virtual void initOptQuadrangleList();
00134 virtual void addLevelSurfOptQuadrangle();
00135
00136
00137 void makeCrossContour(float dist_to_origin, float xn, float yn, float zn,
00138 const float *x, const float *y, const float *z, const float *nod_values,
00139 SoGroup *local_group);
00140 void initSurfPointList();
00141
00142
00143 void updateSurfaceShapeBindings(SbBool strip_set_used=FALSE);
00144
00145 void meshLevelSurf(const PbMesh3D *mesh);
00146
00147 void updateLevelSurfTopology(const float *values, float &isovalue);
00148 void updateLevelSurfCoord(const float *values, float isovalue);
00149 void updateLevelSurfColors(const float *values, float isovalue);
00150 void updateLevelSurfTextures();
00151 void updateLevelSurfContouring();
00152 void updateLevelSurfPointValues(std::vector< float > &point_values);
00153
00154 virtual int getIsosurfDataSetId() const { return -1; }
00155 virtual int getIsosurfDataSetIndex() const { return -1; }
00156 virtual SbVec3f getOverallNormal() const { return SbVec3f(0,0,0); }
00157
00158 const PbMesh3D *m_mesh3D;
00159
00160 mutable PiMeshSkin *m_skin;
00161
00162 SbBool m_useStripSet;
00163
00164 mutable int m_numIsoCells;
00165
00166
00167 private:
00168 SbBoolVector *m_nodeSign;
00169
00170 PbMesh3D *m_mesh3DSet;
00171 void checkOrientation(SoMFVec3f *coords, SoMFInt32 *coordIndex, SbVec3f *normal);
00172
00173 {
00174 int index;
00175 int alloc_indirect;
00176 int num_indirect;
00177 int *indirect_index;
00178 } Tdirect;
00179
00180 {
00181 int n1,n2;
00182 float r;
00183 } Tedge_interpol;
00184
00185 Tedge_interpol *TTabEdgeInterpol;
00186 int TAllocEdgeInterpol;
00187 int TNumEdgeInterpol;
00188
00189 int TAllocTabDirect;
00190 Tdirect *TabDirect;
00191
00192 } ;
00193
00194
00195
00196 #endif
00197
00198