IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Translation3d.h
1 // Translation3d.h:
3 // ----------------
4 //
14 
15 #ifndef __IPSDKMATH_TRANSLATION3D_H__
16 #define __IPSDKMATH_TRANSLATION3D_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::math::transform::Translation3d::g_registrator' : struct 'ipsdk::math::transform::Registrator<ipsdk::math::transform::Translation3d>' needs to have dll-interface to be used by clients of class 'ipsdk::math::transform::Translation3d'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKMath/Geometry/3d/Transform/BaseLinearGeometricTransform3d.h>
24 
25 namespace ipsdk {
26 namespace math {
27 namespace transform {
28 
31 
33 {
34 // predefined public type
35 public:
38 
39  (eTP_Tx)
40  (eTP_Ty)
41  (eTP_Tz)
42  );
43 
44  // declare geometric transformation 3d
46 
47 public:
50  Translation3d() :
51  _tx(0), _ty(0), _tz(0)
52  {
53 
54  }
55  Translation3d(const ipReal64 tx, const ipReal64 ty, const ipReal64 tz) :
56  _tx(tx), _ty(ty), _tz(tz)
57  {
58 
59  }
60  ~Translation3d() {}
62 
63 // methods
64 public:
66  static void transform(const ipReal64 tx, const ipReal64 ty, const ipReal64 tz,
67  ipReal64& x, ipReal64& y, ipReal64& z)
68  {
69  x += tx;
70  y += ty;
71  z += tz;
72  }
73 
75  static Matrix3d getHomogenousMatrix(const ipReal64 tx, const ipReal64 ty, const ipReal64 tz)
76  {
77  Matrix3d transform;
78  transform(0, 0) = 1; transform(0, 1) = 0; transform(0, 2) = 0; transform(0, 3) = tx;
79  transform(1, 0) = 0; transform(1, 1) = 1; transform(1, 2) = 0; transform(1, 3) = ty;
80  transform(2, 0) = 0; transform(2, 1) = 0; transform(2, 2) = 1; transform(2, 3) = tz;
81  transform(3, 0) = 0; transform(3, 1) = 0; transform(3, 2) = 0; transform(3, 2) = 1;
82 
83  return transform;
84  }
85 
87  static Matrix3d getInvHomogenousMatrix(const ipReal64 tx, const ipReal64 ty, const ipReal64 tz)
88  {
89  Matrix3d invTransform;
90  invTransform(0, 0) = 1; invTransform(0, 1) = 0; invTransform(0, 2) = 0; invTransform(0, 3) = -tx;
91  invTransform(1, 0) = 0; invTransform(1, 1) = 1; invTransform(1, 2) = 0; invTransform(1, 3) = -ty;
92  invTransform(2, 0) = 0; invTransform(2, 1) = 0; invTransform(2, 2) = 1; invTransform(2, 3) = -tz;
93  invTransform(3, 0) = 0; invTransform(3, 1) = 0; invTransform(3, 2) = 0; invTransform(3, 2) = 1;
94 
95  return invTransform;
96  }
97 
99  static void getInvParams(ipReal64& tx, ipReal64& ty, ipReal64& tz)
100  {
101  tx = -tx;
102  ty = -ty;
103  tz = -tz;
104  }
105 
107  static Vector getIdentityParams();
108 
110  void setParams(const ipReal64 tx, const ipReal64 ty, const ipReal64 tz)
111  {
112  _tx = tx;
113  _ty = ty;
114  _tz = tz;
115  }
116 
120  void setParams(const Vector& params);
121 
123  void setIdentity();
124 
126  void apply(ipReal64& x, ipReal64& y, ipReal64& z) const;
127 
129  Matrix4d getHomogenousMatrix() const;
130 
132  Vector getParams() const;
133 
136  ipReal64 getTx() const;
137  ipReal64 getTy() const;
138  ipReal64 getTz() const;
140 
142  Matrix4d getInvHomogenousMatrix() const;
143 
145  Vector getInvParams() const;
146 
147 // attributes
148 protected:
150  ipReal64 _tx;
151 
153  ipReal64 _ty;
154 
156  ipReal64 _tz;
157 };
162 inline ipReal64
163 Translation3d::getTx() const
164 {
165  return _tx;
166 }
167 
168 inline ipReal64
169 Translation3d::getTy() const
170 {
171  return _ty;
172 }
173 
174 inline ipReal64
175 Translation3d::getTz() const
176 {
177  return _tz;
178 }
179 
180 inline void
182 {
184 }
185 
188 
189 } // end of namespace transform
190 } // end of namespace math
191 } // end of namespace ipsdk
192 
193 #pragma warning (pop)
194 
195 #endif // __IPSDKMATH_TRANSLATION3D_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
eTransformParams
Definition: Translation3d.h:39
void setParams(const ipReal64 tx, const ipReal64 ty, const ipReal64 tz)
select parameters associated to transformation
Definition: Translation3d.h:115
ipReal64 getTy() const
retrieve parameters associated to transformation
Definition: Translation3d.h:174
Base class for linear geometric transformation 3d management.
Definition: BaseLinearGeometricTransform3d.h:27
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
IPSDKGEOMETRY_API bool apply(const BaseGeometryTransform2d &transform, BaseGeometryEntity2d &entity)
function allowing to apply in situ a given transformation on an entity
#define IPSDK_DECLARE_TRANSFORM3D(className)
macro allowing to declare a geometric transformation 3d
Definition: Transform3dHdrMacros.h:54
void setIdentity()
set transformation parameters to identity
Definition: Translation3d.h:186
ipReal64 _tx
translation coordinate along x axis
Definition: Translation3d.h:155
boost::numeric::ublas::vector< ipReal64 > Vector
vector type associated to library
Definition: LinearAlgebraTypes.h:36
static Vector getIdentityParams()
retrieve identity parameters for transformation
#define IPSDKMATH_API
Import/Export macro for library IPSDKMath.
Definition: IPSDKMathExports.h:27
boost::numeric::ublas::bounded_matrix< ipReal64, 4, 4 > Matrix4d
4d matrix (4x4) type associated to library
Definition: LinearAlgebraTypes.h:57
ipReal64 _ty
translation coordinate along y axis
Definition: Translation3d.h:158
boost::numeric::ublas::bounded_matrix< ipReal64, 3, 3 > Matrix3d
3d matrix (3x3) type associated to library
Definition: LinearAlgebraTypes.h:54
ipReal64 getTx() const
retrieve parameters associated to transformation
Definition: Translation3d.h:168
ipReal64 getTz() const
retrieve parameters associated to transformation
Definition: Translation3d.h:180
ipReal64 _tz
translation coordinate along z axis
Definition: Translation3d.h:161
Transformation class allowing to manage 3d translations.
Definition: Translation3d.h:32
#define IPSDK_ENUM(enumTypeStr, enumSeq)
macro allowing to declare an enumerate for library
Definition: EnumMacros.h:26