Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
PbRegularCartesianGrid3D.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PB_REGULARCARTESIANGRID3D_
25#define _PB_REGULARCARTESIANGRID3D_
26
27#include <MeshViz/3Ddata/PbGrid3D.h>
28
29class PbVoxelCell;
51
52 public:
53
57 PbRegularCartesianGrid3D(SbBool isDataDuplicate=TRUE);
58
63
68 PbRegularCartesianGrid3D(int num_x, int num_y, int num_z,
69 float x_min, float y_min, float z_min,
70 float x_max, float y_max, float z_max,
71 SbBool isDataDuplicate = TRUE);
72
77
82
87 const PbRegularCartesianGrid3D &m2);
88
94 { return !(m1 == m2); }
95
99 void setGeometry(int num_x, int num_y, int num_z,
100 float x_min, float y_min, float z_min,
101 float x_max, float y_max, float z_max);
102
107 void getGeometry(int &num_x, int &num_y, int &num_z,
108 float &x_min, float &y_min, float &z_min,
109 float &x_max, float &y_max, float &z_max) const;
110
111 virtual const PbCell* findContainingCell(const SbVec3f &point,
112 float tolerance,
113 SbVec3f &pcoord,
114 const PbCell *adjacent_cell) const;
115
129 virtual const PbCell* findContainingCell(const SbVec3f &point,
130 float tolerance,
131 SbVec3f &pcoord) const;
132
139 virtual const PbCell *getCell(int cell_index) const;
140
144 virtual SbVec3f getNodeCoord(int nod_index) const;
145
149 virtual SbVec3f getNodeCoord(int i, int j, int k) const
150 { return SbVec3f(m_xmin+i*m_dx, m_ymin+j*m_dy, m_zmin+k*m_dz); };
151
155 virtual float getVolume() const
156 { return fabs((m_xmax-m_xmin)*(m_ymax-m_ymin)*(m_zmax-m_zmin)); }
157
167 void setCoordinates(const float *xnod, const float *ynod, const float *znod);
168
178 void getCoordinates(const float* &xnod, const float* &ynod, const float* &znod,
179 int &size_xnod, int &size_ynod, int &size_znod) const {
180 xnod = m_x;
181 ynod = m_y;
182 znod = m_z;
183 size_xnod = size_ynod = size_znod = 2;
184 }
185
186 /*----------------------------------------------------------------------------*/
187 private:
188 void setBounds(float x_min, float y_min, float z_min,
189 float x_max, float y_max, float z_max);
190
191 float getLongestEdgeLength();
192 // get the length of the longest edge of the mesh
193
194 void meshCrossSection(PoMeshCrossSection *cross_section) const;
195 void meshCrossContour(PoMeshCrossContour *cross_contour) const;
196 void meshSkeleton(PoMeshSkeleton *skeleton,
197 const float *nod_values,
198 float *x_cont,
199 float *y_cont,
200 float *z_cont) const;
201 void mesh3DVec(PoMesh3DVec *mesh_vec) const;
202 SbBool isCrossSectionOptimal() const { return TRUE; }
203
204 void print(FILE *fp) const;
205
206 // get a cell, but this cell has'nt coordinate specified
207 virtual const PbCell *getTopoCell(int cell_index) const;
208
209 private:
210 void constructXYGeometry(float x_min, float y_min,
211 float x_max, float y_max,
212 SbBool is_data_duplicate);
213 void setXYZGeometry(int num_x, int num_y, int num_z,
214 const float *x, const float *y, const float *z);
215 void getXYZGeometry(const float* &x, const float* &y, const float* &z) const;
216 virtual void grid3DSkin(PoMeshSkin *_PoMeshSkin) const;
217
218 private:
219 float m_x[2], m_y[2], m_z[2];
220 float m_xmin, m_xmax, m_dx;
221 float m_ymin, m_ymax, m_dy;
222 float m_zmin, m_zmax, m_dz;
223
224 void updateBoundingBox() const;
225 void copy(const PbRegularCartesianGrid3D &mesh);
226 void destroy();
227
228 mutable PbVoxelCell *m_voxel;
229};
230
231/*---------------------------------------------------------------------------*/
232
233inline void
234PbRegularCartesianGrid3D::getGeometry(int &num_x, int &num_y, int &num_z,
235 float &x_min, float &y_min, float &z_min,
236 float &x_max, float &y_max, float &z_max) const
237{
238 num_x = numX; x_min = m_xmin; x_max = m_xmax;
239 num_y = numY; y_min = m_ymin; y_max = m_ymax;
240 num_z = numZ; z_min = m_zmin; z_max = m_zmax;
241}
242
243#endif /* _PB_REGULARCARTESIANGRID3D_ */
244
245
246
247
248
249
250
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract cell...
Definition PbCell.h:49
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines an abstract grid...
Definition PbGrid3D.h:44
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines a regular cartes...
virtual const PbCell * getCell(int cell_index) const
Gets the cell which index is cell_index.
void setGeometry(int num_x, int num_y, int num_z, float x_min, float y_min, float z_min, float x_max, float y_max, float z_max)
Defines a new geometry.
void getCoordinates(const float *&xnod, const float *&ynod, const float *&znod, int &size_xnod, int &size_ynod, int &size_znod) const
Get the current coordinates of the nodes of this mesh.
virtual SbVec3f getNodeCoord(int nod_index) const
Gets the coordinates of a node defined by its index.
~PbRegularCartesianGrid3D()
Destructor.
void getGeometry(int &num_x, int &num_y, int &num_z, float &x_min, float &y_min, float &z_min, float &x_max, float &y_max, float &z_max) const
Gets the mesh geometry.
PbRegularCartesianGrid3D(const PbRegularCartesianGrid3D &mesh)
Copy constructor.
PbRegularCartesianGrid3D(int num_x, int num_y, int num_z, float x_min, float y_min, float z_min, float x_max, float y_max, float z_max, SbBool isDataDuplicate=TRUE)
Constructor of a 3D regular grid mesh.
virtual const PbCell * findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord, const PbCell *adjacent_cell) const
PbRegularCartesianGrid3D(SbBool isDataDuplicate=TRUE)
Constructor of a default simple mesh.
friend int operator==(const PbRegularCartesianGrid3D &m1, const PbRegularCartesianGrid3D &m2)
Equality comparison operator.
virtual float getVolume() const
Gets the volume of the mesh.
void setCoordinates(const float *xnod, const float *ynod, const float *znod)
Set new node coordinates without modifying the mesh topology.
virtual const PbCell * findContainingCell(const SbVec3f &point, float tolerance, SbVec3f &pcoord) const
Find the mesh's cell that contains the point.
friend int operator!=(const PbRegularCartesianGrid3D &m1, const PbRegularCartesianGrid3D &m2)
Inequality comparison operator.
PbRegularCartesianGrid3D & operator=(const PbRegularCartesianGrid3D &mesh)
Assignment operator.
virtual SbVec3f getNodeCoord(int i, int j, int k) const
Gets the coordinates of a node defined by its i, j, k indices on the grid.
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Defines a voxel cell of ...
Definition PbVoxelCell.h:63
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Representation of vector...
Definition PoMesh3DVec.h:95
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Representation of cross-...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Representation of cross ...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Representation of the sk...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Representation of the me...
Definition PoMeshSkin.h:61
3D vector class.
Definition SbVec.h:932
int SbBool
Boolean type.
Definition SbBase.h:87