IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BoundingBox3d.h
1 // BoundingBox3d.h:
3 // ----------------
4 //
16 
17 #ifndef __IPSDKGEOMETRY_BOUNDINGBOX3D_H__
18 #define __IPSDKGEOMETRY_BOUNDINGBOX3D_H__
19 
20 // suppression warnings
21 // warning C4251: 'ipsdk::geom::BoundingBox3d<T>::_minCornerPt' : class 'ipsdk::geom::Point3dData<TIn>' needs to have dll-interface to be used by clients of class 'ipsdk::geom::BoundingBox3d<T>'
22 #pragma warning (push)
23 #pragma warning (disable : 4251)
24 
25 #include <IPSDKGeometry/Entity/3d/BaseTypedGeometryEntity3d.h>
26 #include <IPSDKGeometry/Entity/3d/Point/Point3d.h>
29 
30 namespace ipsdk {
31 namespace geom {
32 
35 
36 template <typename T>
38 {
39  // declare 3d geometry entity
41 
42 // predefined public types
43 public:
45  static const eCoordinateSystem3dType::domain g_coordinateSystem3dType = eCoordinateSystem3dType::eCS3DT_Cartesian;
46 
48  static const eEntity3dType::domain g_entity3dType = eEntity3dType::eE3DT_BoundingBox;
49 
50 public:
53  BoundingBox3d();
54  BoundingBox3d(const Point3dData<T>& minCornerPt, const Point3dData<T>& maxCornerPt);
55  BoundingBox3d(const Point3d<T>& minCornerPt, const Point3d<T>& maxCornerPt);
56  BoundingBox3d(const T xMin, const T yMin, const T zMin, const T xMax, const T yMax, const T zMax);
57  ~BoundingBox3d();
59 
60 // methods
61 public:
63  inline eCoordinateSystem3dType getCoordinateSystem3dType() const;
64 
66  inline eEntity3dType getEntity3dType() const;
67 
70  inline void setCoords(const Point3dData<T>& minCornerPt, const Point3dData<T>& maxCornerPt);
71  inline void setCoords(const Point3d<T>& minCornerPt, const Point3d<T>& maxCornerPt);
72  inline void setCoords(const T xMin, const T yMin, const T zMin, const T xMax, const T yMax, const T zMax);
73  inline void setXMin(const T xMin);
74  inline void setXMax(const T xMax);
75  inline void setYMin(const T yMin);
76  inline void setYMax(const T yMax);
77  inline void setZMin(const T zMin);
78  inline void setZMax(const T zMax);
79  inline void setMinCornerPt(const Point3dData<T>& minCornerPt);
80  inline void setMinCornerPt(const Point3d<T>& minCornerPt);
81  inline void setMaxCornerPt(const Point3dData<T>& maxCornerPt);
82  inline void setMaxCornerPt(const Point3d<T>& maxCornerPt);
83  inline T getXMin() const;
84  inline T getXMax() const;
85  inline T getYMin() const;
86  inline T getYMax() const;
87  inline T getZMin() const;
88  inline T getZMax() const;
89  inline T& getXMin();
90  inline T& getXMax();
91  inline T& getYMin();
92  inline T& getYMax();
93  inline T& getZMin();
94  inline T& getZMax();
95  inline const Point3dData<T>& getMinCornerPt() const;
96  inline const Point3dData<T>& getMaxCornerPt() const;
97  inline Point3dData<T>& getMinCornerPt();
98  inline Point3dData<T>& getMaxCornerPt();
100 
103  inline T sizeX() const;
104  inline T sizeY() const;
105  inline T sizeZ() const;
107 
110  inline ipReal64 centerX() const;
111  inline ipReal64 centerY() const;
112  inline ipReal64 centerZ() const;
113  inline Point3dData<ipReal64> center() const;
115 
116 // attributes
117 protected:
120 
123 };
124 
127 
128 template <typename T>
131 {
132  return g_coordinateSystem3dType;
133 }
134 
135 template <typename T>
136 inline eEntity3dType
138 {
139  return g_entity3dType;
140 }
141 
142 template <typename T>
143 inline void
144 BoundingBox3d<T>::setCoords(const Point3dData<T>& minCornerPt, const Point3dData<T>& maxCornerPt)
145 {
146  _minCornerPt = minCornerPt;
147  _maxCornerPt = maxCornerPt;
148 }
149 
150 template <typename T>
151 inline void
152 BoundingBox3d<T>::setCoords(const Point3d<T>& minCornerPt, const Point3d<T>& maxCornerPt)
153 {
154  _minCornerPt = minCornerPt.getCoords();
155  _maxCornerPt = maxCornerPt.getCoords();
156 }
157 
158 template <typename T>
159 inline void
160 BoundingBox3d<T>::setCoords(const T xMin, const T yMin, const T zMin, const T xMax, const T yMax, const T zMax)
161 {
162  _minCornerPt.setCoords(xMin, yMin, zMin);
163  _maxCornerPt.setCoords(xMax, yMax, zMax);
164 }
165 
166 template <typename T>
167 inline void
169 {
170  _minCornerPt._x = xMin;
171 }
172 
173 template <typename T>
174 inline void
176 {
177  _maxCornerPt._x = xMax;
178 }
179 
180 template <typename T>
181 inline void
183 {
184  _minCornerPt._y = yMin;
185 }
186 
187 template <typename T>
188 inline void
190 {
191  _maxCornerPt._y = yMax;
192 }
193 
194 template <typename T>
195 inline void
197 {
198  _minCornerPt._z = zMin;
199 }
200 
201 template <typename T>
202 inline void
204 {
205  _maxCornerPt._z = zMax;
206 }
207 
208 template <typename T>
209 inline void
211 {
212  _minCornerPt = minCornerPt;
213 }
214 
215 template <typename T>
216 inline void
218 {
219  _minCornerPt = minCornerPt.getCoords();
220 }
221 
222 template <typename T>
223 inline void
225 {
226  _maxCornerPt = maxCornerPt;
227 }
228 
229 template <typename T>
230 inline void
232 {
233  _maxCornerPt = maxCornerPt.getCoords();
234 }
235 
236 template <typename T>
237 inline T
239 {
240  return _minCornerPt._x;
241 }
242 
243 template <typename T>
244 inline T
246 {
247  return _maxCornerPt._x;
248 }
249 
250 template <typename T>
251 inline T
253 {
254  return _minCornerPt._y;
255 }
256 
257 template <typename T>
258 inline T
260 {
261  return _maxCornerPt._y;
262 }
263 
264 template <typename T>
265 inline T
267 {
268  return _minCornerPt._z;
269 }
270 
271 template <typename T>
272 inline T
274 {
275  return _maxCornerPt._z;
276 }
277 
278 template <typename T>
279 inline T&
281 {
282  return _minCornerPt._x;
283 }
284 
285 template <typename T>
286 inline T&
288 {
289  return _maxCornerPt._x;
290 }
291 
292 template <typename T>
293 inline T&
295 {
296  return _minCornerPt._y;
297 }
298 
299 template <typename T>
300 inline T&
302 {
303  return _maxCornerPt._y;
304 }
305 
306 template <typename T>
307 inline T&
309 {
310  return _minCornerPt._z;
311 }
312 
313 template <typename T>
314 inline T&
316 {
317  return _maxCornerPt._z;
318 }
319 
320 template <typename T>
321 inline const Point3dData<T>&
323 {
324  return _minCornerPt;
325 }
326 
327 template <typename T>
328 inline const Point3dData<T>&
330 {
331  return _maxCornerPt;
332 }
333 
334 template <typename T>
335 inline Point3dData<T>&
337 {
338  return _minCornerPt;
339 }
340 
341 template <typename T>
342 inline Point3dData<T>&
344 {
345  return _maxCornerPt;
346 }
347 
348 template <typename T>
349 inline T
351 {
352  return _maxCornerPt._x - _minCornerPt._x;
353 }
354 
355 template <typename T>
356 inline T
358 {
359  return _maxCornerPt._y - _minCornerPt._y;
360 }
361 
362 template <typename T>
363 inline T
365 {
366  return _maxCornerPt._z - _minCornerPt._z;
367 }
368 
369 template <typename T>
370 inline ipReal64
372 {
373  return (_maxCornerPt._x + _minCornerPt._x) / 2.0;
374 }
375 
376 template <typename T>
377 inline ipReal64
379 {
380  return (_maxCornerPt._y + _minCornerPt._y) / 2.0;
381 }
382 
383 template <typename T>
384 inline ipReal64
386 {
387  return (_maxCornerPt._z + _minCornerPt._z) / 2.0;
388 }
389 
390 template <typename T>
393 {
394  return Point3dData<ipReal64>(centerX(), centerY(), centerZ());
395 }
396 
399 
400 } // end of namespace geom
401 } // end of namespace ipsdk
402 
403 #pragma warning (pop)
404 
405 #endif // __IPSDKGEOMETRY_BOUNDINGBOX3D_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
eEntity3dType getEntity3dType() const
method allowing to retrieve entity 3d type
Definition: BoundingBox3d.h:137
eCoordinateSystem3dType
Enumerate describing coordinate system 3d type.
Definition: GeometryEntity3dTypes.h:74
void setYMin(const T yMin)
access to point coordinates
Definition: BoundingBox3d.h:182
Point class associated to cartesian 3d coordinates.
Definition: GeometryEntity3dTypes.h:29
#define IPSDK_DECLARE_GEOMETRY_ENTITY_3D(libraryName, className)
Macro allowing to declare a geometry entity 3d.
Definition: GeometryEntity3dHdrMacros.h:131
void setZMin(const T zMin)
access to point coordinates
Definition: BoundingBox3d.h:196
void setMaxCornerPt(const Point3dData< T > &maxCornerPt)
access to point coordinates
Definition: BoundingBox3d.h:224
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
void setXMax(const T xMax)
access to point coordinates
Definition: BoundingBox3d.h:175
Utility functions for bounding box 3d management.
const Point3dData< T > & getCoords() const
access to point coordinates
Definition: Point3d.h:142
T getYMax() const
access to point coordinates
Definition: BoundingBox3d.h:259
Point3dData< T > _maxCornerPt
maximum coordinates point associated to bounding box
Definition: BoundingBox3d.h:122
void setMinCornerPt(const Point3dData< T > &minCornerPt)
access to point coordinates
Definition: BoundingBox3d.h:210
const Point3dData< T > & getMaxCornerPt() const
access to point coordinates
Definition: BoundingBox3d.h:329
T getZMax() const
access to point coordinates
Definition: BoundingBox3d.h:273
void setXMin(const T xMin)
access to point coordinates
Definition: BoundingBox3d.h:168
T sizeZ() const
compute bounding box dimensions
Definition: BoundingBox3d.h:364
#define IPSDKGEOMETRY_API
Import/Export macro for library IPSDKGeometry.
Definition: IPSDKGeometryExports.h:25
void setYMax(const T yMax)
access to point coordinates
Definition: BoundingBox3d.h:189
Rectangular 3d bounding box class associated to cartesian 3d coordinates.
Definition: BoundingBox3d.h:37
T getXMax() const
access to point coordinates
Definition: BoundingBox3d.h:245
T getZMin() const
access to point coordinates
Definition: BoundingBox3d.h:266
ipReal64 centerZ() const
compute bounding box center point
Definition: BoundingBox3d.h:385
T sizeY() const
compute bounding box dimensions
Definition: BoundingBox3d.h:357
Point3dData< ipReal64 > center() const
compute bounding box center point
Definition: BoundingBox3d.h:392
Point3dData< T > _minCornerPt
minimum coordinates point associated to bounding box
Definition: BoundingBox3d.h:119
eEntity3dType
Enumerate describing entity 3d type.
Definition: GeometryEntity3dTypes.h:38
ipReal64 centerY() const
compute bounding box center point
Definition: BoundingBox3d.h:378
eCoordinateSystem3dType getCoordinateSystem3dType() const
method allowing to retrieve coordinate system 3d type
Definition: BoundingBox3d.h:130
ipReal64 centerX() const
compute bounding box center point
Definition: BoundingBox3d.h:371
Base class for typed 3d geometry entities.
Definition: BaseTypedGeometryEntity3d.h:27
Cartesian coordinate system.
Definition: GeometryEntity3dTypes.h:76
T sizeX() const
compute bounding box dimensions
Definition: BoundingBox3d.h:350
T getXMin() const
access to point coordinates
Definition: BoundingBox3d.h:238
Lightweight structure used to store Point3d data.
Definition: GeometryEntity3dTypes.h:27
T getYMin() const
access to point coordinates
Definition: BoundingBox3d.h:252
void setZMax(const T zMax)
access to point coordinates
Definition: BoundingBox3d.h:203
Basic operators used for bounding box 3d management.
BoundingBox.
Definition: GeometryEntity3dTypes.h:44
const Point3dData< T > & getMinCornerPt() const
access to point coordinates
Definition: BoundingBox3d.h:322
void setCoords(const Point3dData< T > &minCornerPt, const Point3dData< T > &maxCornerPt)
access to point coordinates
Definition: BoundingBox3d.h:144