IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Point3dData.h
1 // Point3dData.h:
3 // --------------
4 //
14 
15 #ifndef __IPSDKGEOMETRY_POINT3DDATA_H__
16 #define __IPSDKGEOMETRY_POINT3DDATA_H__
17 
18 #include <IPSDKUtil/BaseTypes.h>
19 
20 namespace ipsdk {
21 namespace geom {
22 
25 
26 template <typename T>
27 struct Point3dData
28 {
29 public:
32  Point3dData() {}
33  Point3dData(const T x, const T y, const T z) :
34  _x(x), _y(y), _z(z) {}
35  Point3dData(const Point3dData& pt) :
36  _x(pt._x), _y(pt._y), _z(pt._z) {}
37  ~Point3dData() {}
39 
40 // methods
41 public:
43  inline void setCoords(const T x, const T y, const T z);
44 
48  inline Point3dData& operator+=(const Point3dData& pt);
49  inline Point3dData operator+(const Point3dData& pt) const;
50  inline Point3dData& operator+=(const T value);
51  inline Point3dData operator+(const T value) const;
52  inline Point3dData& operator-=(const Point3dData& pt);
53  inline Point3dData operator-(const Point3dData& pt) const;
54  inline Point3dData& operator-=(const T value);
55  inline Point3dData operator-(const T value) const;
56  inline Point3dData& operator*=(const Point3dData& pt);
57  inline Point3dData operator*(const Point3dData& pt) const;
58  inline Point3dData& operator*=(const ipReal64 value);
59  inline Point3dData operator*(const ipReal64 value) const;
60  inline Point3dData& operator/=(const Point3dData& pt);
61  inline Point3dData operator/(const Point3dData& pt) const;
62  inline Point3dData& operator/=(const ipReal64 value);
63  inline Point3dData operator/(const ipReal64 value) const;
65 
66 // attributes
67 public:
69  T _x;
70 
72  T _y;
73 
75  T _z;
76 };
77 
80 
81 template <typename T>
82 inline void
83 Point3dData<T>::setCoords(const T x, const T y, const T z)
84 {
85  _x = x;
86  _y = y;
87  _z = z;
88 }
89 
90 template <typename T>
91 inline Point3dData<T>&
93 {
94  _x += pt._x;
95  _y += pt._y;
96  _z += pt._z;
97 
98  return *this;
99 }
100 
101 template <typename T>
102 inline Point3dData<T>
104 {
105  Point3dData<T> ptRes(*this);
106  ptRes += pt;
107 
108  return ptRes;
109 }
110 
111 template <typename T>
112 inline Point3dData<T>&
114 {
115  _x += value;
116  _y += value;
117  _z += value;
118 
119  return *this;
120 }
121 
122 template <typename T>
123 inline Point3dData<T>
124 Point3dData<T>::operator+(const T value) const
125 {
126  Point3dData<T> ptRes(*this);
127  ptRes += value;
128 
129  return ptRes;
130 }
131 
132 template <typename T>
133 inline Point3dData<T>&
135 {
136  _x -= pt._x;
137  _y -= pt._y;
138  _z -= pt._z;
139 
140  return *this;
141 }
142 
143 template <typename T>
144 inline Point3dData<T>
146 {
147  Point3dData<T> ptRes(*this);
148  ptRes -= pt;
149 
150  return ptRes;
151 }
152 
153 template <typename T>
154 inline Point3dData<T>&
156 {
157  _x -= value;
158  _y -= value;
159  _z -= value;
160 
161  return *this;
162 }
163 
164 template <typename T>
165 inline Point3dData<T>
166 Point3dData<T>::operator-(const T value) const
167 {
168  Point3dData<T> ptRes(*this);
169  ptRes -= value;
170 
171  return ptRes;
172 }
173 
174 template <typename T>
175 inline Point3dData<T>&
177 {
178  _x *= pt._x;
179  _y *= pt._y;
180  _z *= pt._z;
181 
182  return *this;
183 }
184 
185 template <typename T>
186 inline Point3dData<T>
188 {
189  Point3dData<T> ptRes(*this);
190  ptRes *= pt;
191 
192  return ptRes;
193 }
194 
195 template <typename T>
196 inline Point3dData<T>&
198 {
199  _x = static_cast<T>(_x * value);
200  _y = static_cast<T>(_y * value);
201  _z = static_cast<T>(_z * value);
202 
203  return *this;
204 }
205 
206 template <typename T>
207 inline Point3dData<T>
209 {
210  Point3dData<T> ptRes(*this);
211  ptRes *= value;
212 
213  return ptRes;
214 }
215 
216 template <typename T>
217 inline Point3dData<T>&
219 {
220  _x /= pt._x;
221  _y /= pt._y;
222  _z /= pt._z;
223 
224  return *this;
225 }
226 
227 template <typename T>
228 inline Point3dData<T>
230 {
231  Point3dData<T> ptRes(*this);
232  ptRes += pt;
233 
234  return ptRes;
235 }
236 
237 template <typename T>
238 inline Point3dData<T>&
240 {
241  _x = static_cast<T>(_x / value);
242  _y = static_cast<T>(_y / value);
243  _z = static_cast<T>(_z / value);
244 
245  return *this;
246 }
247 
248 template <typename T>
249 inline Point3dData<T>
251 {
252  Point3dData<T> ptRes(*this);
253  ptRes /= value;
254 
255  return ptRes;
256 }
257 
260 
261 } // end of namespace geom
262 } // end of namespace ipsdk
263 
264 #endif // __IPSDKGEOMETRY_POINT3DDATA_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Point3dData & operator*=(const Point3dData &pt)
arithmetic operators on point
Definition: Point3dData.h:176
Point3dData operator+(const Point3dData &pt) const
arithmetic operators on point
Definition: Point3dData.h:103
Point3dData & operator/=(const Point3dData &pt)
arithmetic operators on point
Definition: Point3dData.h:218
T _x
x coordinate of point
Definition: Point3dData.h:69
Point3dData & operator-=(const Point3dData &pt)
arithmetic operators on point
Definition: Point3dData.h:134
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
Point3dData & operator+=(const Point3dData &pt)
arithmetic operators on point
Definition: Point3dData.h:92
Point3dData operator*(const Point3dData &pt) const
arithmetic operators on point
Definition: Point3dData.h:187
Base types for multiplatform compatibility.
Point3dData operator-(const Point3dData &pt) const
arithmetic operators on point
Definition: Point3dData.h:145
T _y
y coordinate of point
Definition: Point3dData.h:72
void setCoords(const T x, const T y, const T z)
set coordinates associated to point 3d
Definition: Point3dData.h:83
Point3dData operator/(const Point3dData &pt) const
arithmetic operators on point
Definition: Point3dData.h:229
T _z
z coordinate of point
Definition: Point3dData.h:75
Lightweight structure used to store Point3d data.
Definition: GeometryEntity3dTypes.h:27