IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Shape3d.h
1 // Shape3d.h:
3 // ----------
4 //
14 
15 #ifndef __IPSDKGEOMETRY_SHAPE3D_H__
16 #define __IPSDKGEOMETRY_SHAPE3D_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::geom::Shape3d::_meshWithHolesColl' : class 'std::vector<ipsdk::geom::Shape3d::MeshWithHolesPtr,std::allocator<_Ty>>' needs to have dll-interface to be used by clients of class 'ipsdk::geom::Shape3d'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKGeometry/Entity/3d/BaseTypedGeometryEntity3d.h>
27 
28 namespace ipsdk {
29 namespace geom {
30 
33 
34 class IPSDKGEOMETRY_API Shape3d : public BaseTypedGeometryEntity3d<Shape3dDataType>
35 {
36  // declare serial class
38 
39 // predefined public types
40 public:
42  static const eCoordinateSystem3dType::domain g_coordinateSystem3dType = eCoordinateSystem3dType::eCS3DT_Cartesian;
43 
45  static const eEntity3dType::domain g_entity3dType = eEntity3dType::eE3DT_Shape;
46 
49 
52 
55 
58 
61 
63  typedef boost::shared_ptr<MeshWithHolesColl> MeshWithHolesCollPtr;
64 
66  typedef Shape3dMeshWithHolesColl::iterator MeshWithHolesIterator;
67 
68 public:
71  Shape3d();
72  ~Shape3d();
74 
75 // methods
76 public:
78  inline eCoordinateSystem3dType getCoordinateSystem3dType() const;
79 
81  inline eEntity3dType getEntity3dType() const;
82 
83  //------------------------------------------------
86  //------------------------------------------------
87 
89  inline bool hasRowIntersections() const;
90 
92  inline const RowIntersections3d& getRowIntersections() const;
93 
95  inline RowIntersections3d& getRowIntersections();
96 
98  inline bool hasRowIntersections(const ipUInt64 planIdx) const;
99 
101  inline bool hasRowIntersection(const ipUInt64 rowIdx,
102  const ipUInt64 planIdx) const;
103 
106  inline ipUInt64 getStartZ() const;
107  inline ipUInt64 getEndZ() const;
109 
114  ipUInt64 getStartY(const ipUInt64 planIdx) const;
115  ipUInt64 getEndY(const ipUInt64 planIdx) const;
117 
121  const RowSegments& getRowIntersections(const ipUInt64 rowIdx,
122  const ipUInt64 planIdx) const;
123 
125  const ipUInt64 getNbVoxels() const;
126 
128  void clearRowIntersections();
130 
131  //----------------------------------------------------------
134  //----------------------------------------------------------
135 
137  inline bool isMeshWithHolesCollSet() const;
138 
140  inline const MeshWithHolesConstColl& getMeshWithHolesColl() const;
141 
143  inline MeshWithHolesColl& getMeshWithHolesColl();
144 
147  ipUInt64 getNbTotVertices() const;
148 
151  ipUInt64 getNbTotEdges() const;
152 
155  ipUInt64 getNbTotTriangles() const;
156 
158  ipUInt64 getNbExteriorVertices() const;
159 
161  ipUInt64 getNbExteriorEdges() const;
162 
164  ipUInt64 getNbExteriorTriangles() const;
165 
167  inline MeshWithHolesIterator beginMeshWithHoles();
168 
170  inline MeshWithHolesIterator endMeshWithHoles();
171 
173  void clearMeshWithHolesColl();
175 
177  void clear();
178 
179 // attributes
180 protected:
183 
186 };
187 
190 
193 {
195 }
196 
197 inline eEntity3dType
199 {
200  return g_entity3dType;
201 }
202 
203 IPSDK_FORCEINLINE bool
205 {
206  return _rowIntersections._rowIntersectionsColl.empty() == false;
207 }
208 
209 IPSDK_FORCEINLINE const RowIntersections3d&
211 {
212  return _rowIntersections;
213 }
214 
215 IPSDK_FORCEINLINE RowIntersections3d&
217 {
218  return _rowIntersections;
219 }
220 
221 IPSDK_FORCEINLINE bool
223 {
224  return planIdx >= getStartZ() && planIdx < getEndZ();
225 }
226 
227 IPSDK_FORCEINLINE bool
229  const ipUInt64 planIdx) const
230 {
231  if (hasRowIntersections(planIdx) == false)
232  return false;
233  const RowIntersections& rowIntersections = _rowIntersections._rowIntersectionsColl[planIdx-getStartZ()];
234  return rowIdx >= rowIntersections._yOffset &&
235  rowIdx < rowIntersections._yOffset + static_cast<ipUInt64>(rowIntersections._rowSegColl.size());
236 }
237 
238 IPSDK_FORCEINLINE ipUInt64
240 {
242 }
243 
244 IPSDK_FORCEINLINE ipUInt64
246 {
248 }
249 
250 IPSDK_FORCEINLINE bool
252 {
253  return _meshWithHolesColl.empty() == false;
254 }
255 
256 IPSDK_FORCEINLINE const Shape3d::MeshWithHolesConstColl&
258 {
259  return reinterpret_cast<const Shape3d::MeshWithHolesConstColl&>(_meshWithHolesColl);
260 }
261 
262 IPSDK_FORCEINLINE Shape3d::MeshWithHolesColl&
264 {
265  return _meshWithHolesColl;
266 }
267 
268 IPSDK_FORCEINLINE Shape3d::MeshWithHolesIterator
270 {
271  return _meshWithHolesColl.begin();
272 }
273 
274 IPSDK_FORCEINLINE Shape3d::MeshWithHolesIterator
276 {
277  return _meshWithHolesColl.end();
278 }
279 
282 
283 } // end of namespace geom
284 } // end of namespace ipsdk
285 
286 #pragma warning (pop)
287 
288 #endif // __IPSDKGEOMETRY_SHAPE3D_H__
const RowIntersections3d & getRowIntersections() const
get row intersections collection
Definition: Shape3d.h:210
Basic operators used for shape 3d management.
MeshWithHolesIterator beginMeshWithHoles()
iterator used to parse mesh
Definition: Shape3d.h:269
std::vector< Shape3dMeshWithHolesConstPtr > Shape3dMeshWithHolesConstColl
collection of const mesh with holes
Definition: Shape3dTypes.h:73
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
boost::shared_ptr< const Shape3dMeshWithHoles > Shape3dMeshWithHolesConstPtr
shared pointer to const mesh with holes associated to shape
Definition: Shape3dTypes.h:70
eCoordinateSystem3dType
Enumerate describing coordinate system 3d type.
Definition: GeometryEntity3dTypes.h:74
bool hasRowIntersections() const
check whether row intersections have been set
Definition: Shape3d.h:204
Shape3dMeshWithHoles MeshWithHolesType
msh with holes type associated to object
Definition: Shape3d.h:48
boost::shared_ptr< Shape3dMeshWithHoles > Shape3dMeshWithHolesPtr
shared pointer to mesh with holes associated to shape
Definition: Shape3dTypes.h:67
ipUInt64 getStartZ() const
retrieve starting and ending z index for shape
Definition: Shape3d.h:239
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
#define IPSDK_DECLARE_GEOMETRY_ENTITY_3D(libraryName, className)
Macro allowing to declare a geometry entity 3d.
Definition: GeometryEntity3dHdrMacros.h:131
RowSegmentsColl _rowSegColl
row intersections collections
Definition: GeometryEntityTypes.h:77
Shape3dMeshWithHolesConstColl MeshWithHolesConstColl
collection of const mesh with holes
Definition: Shape3d.h:57
Definition: GeometryEntityTypes.h:71
eCoordinateSystem3dType getCoordinateSystem3dType() const
method allowing to retrieve coordinate system 2d type
Definition: Shape3d.h:192
ipUInt64 _zOffset
z coordinate of first row intersections
Definition: GeometryEntity3dTypes.h:93
Shape.
Definition: GeometryEntity3dTypes.h:60
Shape3dMeshWithHolesConstPtr MeshWithHolesConstPtr
shared pointer to mesh with holes
Definition: Shape3d.h:54
static const eEntity3dType::domain g_entity3dType
type associated to entity
Definition: Shape3d.h:45
#define IPSDKGEOMETRY_API
Import/Export macro for library IPSDKGeometry.
Definition: IPSDKGeometryExports.h:25
Predefined types for shape 3d management.
Shape3dMeshWithHolesColl::iterator MeshWithHolesIterator
iterator to collection of mes with holes
Definition: Shape3d.h:66
Definition: GeometryEntity3dTypes.h:90
std::vector< RowSegment > RowSegments
collection of row segments
Definition: GeometryEntityTypes.h:63
Shape3dMeshWithHolesColl MeshWithHolesColl
collection of mesh with holes
Definition: Shape3d.h:60
eEntity3dType
Enumerate describing entity 3d type.
Definition: GeometryEntity3dTypes.h:38
MeshWithHolesColl _meshWithHolesColl
collection of mesh holes associated to shape 2d
Definition: Shape3d.h:185
RowIntersections3d _rowIntersections
structure describing shape/row intersections
Definition: Shape3d.h:182
std::vector< Shape3dMeshWithHolesPtr > Shape3dMeshWithHolesColl
collection of mesh with holes
Definition: Shape3dTypes.h:76
Shape3dMeshWithHolesPtr MeshWithHolesPtr
shared pointer to mesh with holes
Definition: Shape3d.h:51
bool hasRowIntersection(const ipUInt64 rowIdx, const ipUInt64 planIdx) const
check whether shape has an intersection with a given row
Definition: Shape3d.h:228
eEntity3dType getEntity3dType() const
method allowing to retrieve entity 3d type
Definition: Shape3d.h:198
RowIntersectionsColl _rowIntersectionsColl
row intersections collections
Definition: GeometryEntity3dTypes.h:96
Base class for typed 3d geometry entities.
Definition: BaseTypedGeometryEntity3d.h:27
Closed mesh potentially associated to interior mesh holes.
Definition: MeshWithHoles3d.h:39
Cartesian coordinate system.
Definition: GeometryEntity3dTypes.h:76
static const eCoordinateSystem3dType::domain g_coordinateSystem3dType
coordinate system associated to entity
Definition: Shape3d.h:42
ipUInt64 _yOffset
y coordinate of first row intersections
Definition: GeometryEntityTypes.h:74
MeshWithHolesIterator endMeshWithHoles()
iterator used to parse mesh
Definition: Shape3d.h:275
const MeshWithHolesConstColl & getMeshWithHolesColl() const
get mesh with holes collection
Definition: Shape3d.h:257
Shape 3d associated to one or more closed mesh 3d.
Definition: Shape3d.h:34
ipUInt64 getEndZ() const
check whether row intersections have been set
Definition: Shape3d.h:245
boost::shared_ptr< MeshWithHolesColl > MeshWithHolesCollPtr
shared pointer to collection of mesh with holes
Definition: Shape3d.h:63
bool isMeshWithHolesCollSet() const
check whether surface mesh has been initialized
Definition: Shape3d.h:251