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_MESHCROSSSECTION_
00025 #define _PO_MESHCROSSSECTION_
00026
00027 #include <MeshViz/3Ddata/PoMesh3D.h>
00028 #include <Inventor/fields/SoSFPlane.h>
00029
00030 #include <Inventor/STL/vector>
00031
00032 #ifdef _WIN32
00033 #pragma warning(push)
00034 #pragma warning(disable:4251)
00035 #endif
00036
00037 class PbIndexedMesh3D;
00038 class PbTetrahedronMesh3D;
00039 class PbHexahedronMesh3D;
00040 class PbCartesianGrid3D;
00041 class PbParalCartesianGrid3D;
00042 class PbRegularCartesianGrid3D;
00043 class PbMesh;
00044
00045 class SoMFInt32;
00046 class SoMFVec3f;
00047 class SoCoordinate3;
00048 class SoMaterial;
00049
00087 class PoMeshCrossSection : public PoMesh3D {
00088
00089 SO_KIT_HEADER(PoMeshCrossSection) ;
00090
00091
00092 SO_KIT_CATALOG_ENTRY_HEADER(groupCrossSection) ;
00093
00094
00095 public:
00096
00100 PoMeshCrossSection() ;
00101
00105 virtual void rebuild() ;
00106
00110 SoSFPlane plane;
00111
00112
00117 enum CrossSectionMethod {
00124 DEFAULT,
00126 ISOSURFACE,
00131 INTERSECTION
00132 };
00133
00155 void setCrossSectionMethod(CrossSectionMethod method=DEFAULT)
00156 { m_crossMethod = method; }
00157
00158 private:
00159 static void initClass() ;
00160 static void exitClass() ;
00161
00162 void indexedMeshCrossSection(PbIndexedMesh3D *mesh) ;
00163 void tetrahedronMeshCrossSection(PbTetrahedronMesh3D *mesh) ;
00164 void hexahedronMeshCrossSection(PbHexahedronMesh3D *mesh) ;
00165 void cartGrid3DCrossSection(PbCartesianGrid3D *mesh);
00166 void paralCartGrid3DCrossSection(PbParalCartesianGrid3D *mesh);
00167 void regularGrid3DCrossSection(PbRegularCartesianGrid3D *mesh);
00168
00169 const float *getIsosurfDataSet();
00170 float getIsosurfValue() const;
00171
00175 virtual size_t getMemorySize();
00176
00177 private:
00178
00179 virtual ~PoMeshCrossSection() ;
00180 virtual void setDefaultOnNonWritingFields();
00181 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00182 virtual void addElementsAllCaches() ;
00183 virtual void preRebuild();
00184
00185 virtual int getIsosurfDataSetId() const;
00186 virtual SbVec3f getOverallNormal() const;
00187
00188
00189 private:
00190
00191 FieldSensorList m_fieldSensorList ;
00192
00193
00194 SoFieldList m_fieldList ;
00195
00196
00197 SoCoordinate3 *crossSectionCoord;
00198
00199 void orientPolygon(std::vector< int > &coordIndex, int start_ind, float xn, float yn, float zn);
00200
00201 void crossPlaneAndTetrahedron(int cell_index, const float *x,const float *y, const float *z, const float *v, const int *tetra_nodes,
00202 float xn,float yn,float zn, float dist_plane_orig,
00203 int &num_cross_pt, SbBool at_vertex=TRUE);
00204 void crossPlaneAndPyramid(int cell_index, const float *x,const float *y, const float *z, const float *v, const int *pyra_nodes,
00205 float xn,float yn,float zn, float dist_plane_orig,
00206 int &num_cross_pt, SbBool at_vertex=TRUE);
00207 void crossPlaneAndPentahedron(int cell_index, const float *x,const float *y, const float *z, const float *v, const int *penta_nodes,
00208 float xn,float yn,float zn, float dist_plane_orig,
00209 int &num_cross_pt, SbBool at_vertex=TRUE);
00210 void crossPlaneAndHexahedron(int cell_index, const float *x,const float *y, const float *z, const float *v,
00211 const int *hexa_nodes, const int *hexa_ind,
00212 float xn,float yn,float zn, float dist_plane_orig,
00213 int &num_cross_pt, SbBool at_vertex=TRUE);
00214 SbBool isFaceAlreadyFound(int num_new_points, int nb_pt_inters, int pt_inters_sorted[4]);
00215
00216 void tetrahedronMeshCrossSectionInhColr(PbTetrahedronMesh3D *mesh, const float *v, SbBool at_vertex=TRUE) ;
00217 void tetrahedronMeshCrossSectionMapColr(PbTetrahedronMesh3D *mesh, const float *v) ;
00218 void tetrahedronMeshCrossSectionContColr(PbTetrahedronMesh3D *mesh, const float *v) ;
00219 void tetrahedronMeshCrossSectionTexContColr(PbTetrahedronMesh3D *mesh, const float *v) ;
00220 void tetrahedronMeshCrossSectionPerCellColr(PbTetrahedronMesh3D *mesh, const float *v) ;
00221
00222 void hexahedronMeshCrossSectionInhColr(PbHexahedronMesh3D *mesh, const float *v, SbBool at_vertex=TRUE);
00223 void hexahedronMeshCrossSectionMapColr(PbHexahedronMesh3D *mesh, const float *v) ;
00224 void hexahedronMeshCrossSectionContColr(PbHexahedronMesh3D *mesh, const float *v) ;
00225 void hexahedronMeshCrossSectionTexContColr(PbHexahedronMesh3D *mesh, const float *v) ;
00226 void hexahedronMeshCrossSectionPerCellColr(PbHexahedronMesh3D *mesh, const float *v) ;
00227
00228 void indexedMeshCrossSectionInhColr(PbIndexedMesh3D *mesh, const float *v, SbBool at_vertex=TRUE) ;
00229 void indexedMeshCrossSectionMapColr(PbIndexedMesh3D *mesh, const float *v) ;
00230 void indexedMeshCrossSectionContColr(PbIndexedMesh3D *mesh, const float *v) ;
00231 void indexedMeshCrossSectionTexContColr(PbIndexedMesh3D *mesh, const float *v) ;
00232 void indexedMeshCrossSectionPerCellColr(PbIndexedMesh3D *mesh, const float *v) ;
00233
00234 void cartGrid3DCrossSectionInhColr(PbCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00235 void cartGrid3DCrossSectionMapColr(PbCartesianGrid3D *mesh, const float *v);
00236 void cartGrid3DCrossSectionContColr(PbCartesianGrid3D *mesh, const float *v);
00237 void cartGrid3DCrossSectionTexContColr(PbCartesianGrid3D *mesh, const float *v);
00238 void cartGrid3DCrossSectionPerCellColr(PbCartesianGrid3D *mesh, const float *v);
00239
00240 void paralCartGrid3DXCrossSectionInhColr(PbParalCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00241 void paralCartGrid3DYCrossSectionInhColr(PbParalCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00242 void paralCartGrid3DZCrossSectionInhColr(PbParalCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00243 void paralCartGrid3DCrossSectionInhColr(PbParalCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00244 void paralCartGrid3DCrossSectionMapColr(PbParalCartesianGrid3D *mesh, const float *v);
00245 void paralCartGrid3DCrossSectionContColr(PbParalCartesianGrid3D *mesh, const float *v);
00246 void paralCartGrid3DCrossSectionTexContColr(PbParalCartesianGrid3D *mesh, const float *v);
00247 void paralCartGrid3DCrossSectionPerCellColr(PbParalCartesianGrid3D *mesh, const float *v);
00248
00249 void regularGrid3DXCrossSectionInhColr(PbRegularCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00250 void regularGrid3DYCrossSectionInhColr(PbRegularCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00251 void regularGrid3DZCrossSectionInhColr(PbRegularCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00252 void regularGrid3DCrossSectionInhColr(PbRegularCartesianGrid3D *mesh, const float *v, SbBool at_vertex=TRUE);
00253 void regularGrid3DCrossSectionMapColr(PbRegularCartesianGrid3D *mesh, const float *v);
00254 void regularGrid3DCrossSectionContColr(PbRegularCartesianGrid3D *mesh, const float *v);
00255 void regularGrid3DCrossSectionTexContColr(PbRegularCartesianGrid3D *mesh, const float *v);
00256 void regularGrid3DCrossSectionPerCellColr(PbRegularCartesianGrid3D *mesh, const float *v);
00257
00258 int m_allocElementFaces,m_numElementFaces;
00259 int (*m_elementFaces)[5];
00260
00261 SbBool m_distNodes2PlaneUpdated;
00262 std::vector<float> m_distNodes2Plane;
00263 int m_distNodes2PlaneId;
00264 float m_crossValue;
00265
00266 SbVec3f m_lastPlaneNormal;
00267 SbBool m_crossMethod;
00268
00269 } ;
00270
00271
00272
00273 #define P_PLANE_EPS 0.0001
00274
00275 #ifdef _WIN32
00276 #pragma warning(pop)
00277 #endif
00278
00279 #endif
00280
00281
00282
00283