IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
MeshWithHoles3d.h
1 // MeshWithHoles3d.h:
3 // ------------------
4 //
14 
15 #ifndef __IPSDKGEOMETRY_MESHWITHHOLES3D_H__
16 #define __IPSDKGEOMETRY_MESHWITHHOLES3D_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::geom::MeshWithHoles3d<T>::_pParent' : class 'boost::weak_ptr<ipsdk::geom::MeshWithHoles3d<T>>' needs to have dll-interface to be used by clients of class 'ipsdk::geom::MeshWithHoles3d<T>'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKGeometry/Entity/3d/BaseTypedGeometryEntity3d.h>
24 #include <IPSDKGeometry/Entity/3d/Mesh/Mesh3d.h>
27 #include <boost/enable_shared_from_this.hpp>
28 #include <boost/shared_ptr.hpp>
29 #include <boost/weak_ptr.hpp>
30 #include <vector>
31 
32 namespace ipsdk {
33 namespace geom {
34 
37 
38 template <typename T>
40  public boost::enable_shared_from_this<MeshWithHoles3d<T> >
41 {
42  // declare 3d geometry entity
44 
45 // predefined public types
46 public:
48  static const eCoordinateSystem3dType::domain g_coordinateSystem3dType = eCoordinateSystem3dType::eCS3DT_Cartesian;
49 
51  static const eEntity3dType::domain g_entity3dType = eEntity3dType::eE3DT_MeshWithHoles;
52 
55 
58 
60  typedef boost::shared_ptr<MeshWithHolesType> MeshWithHolesPtr;
61 
63  typedef boost::shared_ptr<const MeshWithHolesType> MeshWithHolesConstPtr;
64 
66  typedef boost::weak_ptr<const MeshWithHolesType> MeshWithHolesConstWeakPtr;
67 
69  typedef std::vector<MeshWithHolesConstPtr> MeshConstColl;
70 
72  typedef std::vector<MeshWithHolesPtr> MeshColl;
73 
75  typedef typename MeshColl::iterator HoleIterator;
76 
77 public:
81  ~MeshWithHoles3d();
83 
84 // methods
85 public:
87  inline eCoordinateSystem3dType getCoordinateSystem3dType() const;
88 
90  inline eEntity3dType getEntity3dType() const;
91 
93  inline const eMesh3dType& getMesh3dType() const;
94 
98  inline MeshWithHolesConstPtr getParent() const;
99 
101  inline void setParent(const MeshWithHolesConstPtr& pParent);
102 
105  ipUInt64 getNbTotMesh() const;
106 
109  ipUInt64 getNbTotVertices() const;
110 
113  ipUInt64 getNbTotEdges() const;
114 
117  ipUInt64 getNbTotTriangles() const;
118 
120  inline bool isEmpty() const;
121 
123  ipUInt64 getNbExteriorVertices() const;
124 
126  ipUInt64 getNbExteriorEdges() const;
127 
129  ipUInt64 getNbExteriorTriangles() const;
130 
132  inline const MeshType& getExteriorMesh() const;
133 
135  inline MeshType& getExteriorMesh();
136 
138  inline bool hasHoles() const;
139 
141  inline ipUInt64 getNbHoles() const;
142 
144  inline const MeshConstColl& getMeshHoles() const;
145 
147  inline MeshColl& getMeshHoles();
148 
151  inline HoleIterator beginHole();
152  inline HoleIterator endHole();
154 
156  void clearMeshHoles();
157 
159  void clear();
160 
161 // attributes
162 protected:
165 
168 
171 };
172 
175 
176 template <typename T>
179 {
180  return g_coordinateSystem3dType;
181 }
182 
183 template <typename T>
184 inline eEntity3dType
186 {
187  return g_entity3dType;
188 }
189 
190 template <typename T>
191 inline const eMesh3dType&
193 {
194  return _exteriorMesh.getMesh3dType();
195 }
196 
197 template <typename T>
200 {
201  return _pParent.lock();
202 }
203 
204 template <typename T>
205 inline void
207 {
208  _pParent = pParent;
209 }
210 
211 template <typename T>
212 IPSDK_FORCEINLINE bool
214 {
215  return _exteriorMesh.isEmpty();
216 }
217 
218 //template <typename T>
219 //IPSDK_FORCEINLINE const typename MeshWithHoles3d<T>::MeshType&
220 //MeshWithHoles3d<T>::getExteriorMesh() const
221 //{
222 // return _exteriorMesh;
223 //}
224 //
225 //template <typename T>
226 //IPSDK_FORCEINLINE typename MeshWithHoles3d<T>::MeshType&
227 //MeshWithHoles3d<T>::getExteriorMesh()
228 //{
229 // return _exteriorMesh;
230 //}
231 
232 template <typename T>
233 IPSDK_FORCEINLINE ipUInt64
235 {
236  return static_cast<ipUInt64>(_meshHoles.size());
237 }
238 
239 template <typename T>
240 IPSDK_FORCEINLINE bool
242 {
243  return _meshHoles.empty() == false;
244 }
245 
246 //template <typename T>
247 //IPSDK_FORCEINLINE const typename MeshWithHoles3d<T>::MeshConstColl&
248 //MeshWithHoles3d<T>::getMeshHoles() const
249 //{
250 // return reinterpret_cast<const MeshConstColl&>(_meshHoles);
251 //}
252 //
253 //template <typename T>
254 //IPSDK_FORCEINLINE typename MeshWithHoles3d<T>::MeshColl&
255 //MeshWithHoles3d<T>::getMeshHoles()
256 //{
257 // return _meshHoles;
258 //}
259 
260 template <typename T>
261 IPSDK_FORCEINLINE typename MeshWithHoles3d<T>::HoleIterator
263 {
264  return _meshHoles.begin();
265 }
266 
267 template <typename T>
268 IPSDK_FORCEINLINE typename MeshWithHoles3d<T>::HoleIterator
270 {
271  return _meshHoles.end();
272 }
273 
276 
277 } // end of namespace geom
278 } // end of namespace ipsdk
279 
280 #pragma warning (pop)
281 
282 #endif // __IPSDKGEOMETRY_MESHWITHHOLES3D_H__
eCoordinateSystem3dType getCoordinateSystem3dType() const
method allowing to retrieve coordinate system 3d type
Definition: MeshWithHoles3d.h:178
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
eCoordinateSystem3dType
Enumerate describing coordinate system 3d type.
Definition: GeometryEntity3dTypes.h:74
MeshColl::iterator HoleIterator
iterator to collection of polygons
Definition: MeshWithHoles3d.h:75
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
HoleIterator endHole()
iterator used to parse mesh holes
Definition: MeshWithHoles3d.h:269
MeshType _exteriorMesh
exterior mesh
Definition: MeshWithHoles3d.h:167
Basic operators used for mesh with holes 3d management.
boost::shared_ptr< MeshWithHolesType > MeshWithHolesPtr
shared pointer to mesh with holes
Definition: MeshWithHoles3d.h:60
MeshWithHoles3d< T > MeshWithHolesType
mesh with holes type associated to object
Definition: MeshWithHoles3d.h:57
void setParent(const MeshWithHolesConstPtr &pParent)
set parent mesh of instance
Definition: MeshWithHoles3d.h:206
HoleIterator beginHole()
iterator used to parse mesh holes
Definition: MeshWithHoles3d.h:262
#define IPSDKGEOMETRY_API
Import/Export macro for library IPSDKGeometry.
Definition: IPSDKGeometryExports.h:25
std::vector< MeshWithHolesConstPtr > MeshConstColl
collection of const mesh
Definition: MeshWithHoles3d.h:69
eEntity3dType
Enumerate describing entity 3d type.
Definition: GeometryEntity3dTypes.h:38
ipUInt64 getNbHoles() const
method allowing to retrieve number of holes associated to mesh
Definition: MeshWithHoles3d.h:234
const eMesh3dType & getMesh3dType() const
retrieve mesh 3d type
Definition: MeshWithHoles3d.h:192
boost::shared_ptr< const MeshWithHolesType > MeshWithHolesConstPtr
shared pointer to const mesh with holes
Definition: MeshWithHoles3d.h:63
eEntity3dType getEntity3dType() const
method allowing to retrieve entity 3d type
Definition: MeshWithHoles3d.h:185
Mesh.
Definition: GeometryEntity3dTypes.h:58
bool hasHoles() const
method allowing to check whether mesh has holes
Definition: MeshWithHoles3d.h:241
Closed mesh associated to a triangulated boundary.
Definition: Mesh3d.h:43
bool isEmpty() const
method allowing to check whether mesh is empty
Definition: MeshWithHoles3d.h:213
Utility functions associated to mesh with holes 3d management.
Base class for typed 3d geometry entities.
Definition: BaseTypedGeometryEntity3d.h:27
Closed mesh potentially associated to interior mesh holes.
Definition: MeshWithHoles3d.h:39
eMesh3dType
Enumerate describing mesh type.
Definition: Mesh3dTypes.h:35
Cartesian coordinate system.
Definition: GeometryEntity3dTypes.h:76
boost::weak_ptr< const MeshWithHolesType > MeshWithHolesConstWeakPtr
weak pointer to mesh with holes
Definition: MeshWithHoles3d.h:66
MeshWithHolesConstWeakPtr _pParent
parent mesh associated to instance
Definition: MeshWithHoles3d.h:164
Mesh3d< T > MeshType
mesh type associated to object
Definition: MeshWithHoles3d.h:54
MeshWithHolesConstPtr getParent() const
retrieve parent mesh of instance
Definition: MeshWithHoles3d.h:199
MeshColl _meshHoles
collection of interior mesh holes
Definition: MeshWithHoles3d.h:170
boost::enable_if< typename boost::mpl::and_< typename boost::is_same< boost::mpl::int_< AttributeType::g_attributeType >, boost::mpl::int_< eAttributeType::eAT_DataItem > >::type, typename boost::is_same< boost::mpl::int_< LeafCollType::g_itemType >, boost::mpl::int_< eDataItemType::eDIT_LeafColl > >::type >::type, RulePtr >::type isEmpty(const boost::shared_ptr< AttributeType > &pAttribute)
functions allowing to check that a leaf collection is empty
Definition: LeafCollSizeRuleOperators.h:65
std::vector< MeshWithHolesPtr > MeshColl
collection of mesh
Definition: MeshWithHoles3d.h:72