IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Scale3d.h
1 // Scale3d.h:
3 // ----------
4 //
14 
15 #ifndef __IPSDKMATH_SCALE3D_H__
16 #define __IPSDKMATH_SCALE3D_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::math::transform::Scale3d::g_registrator' : struct 'ipsdk::math::transform::Registrator<ipsdk::math::transform::Scale3d>' needs to have dll-interface to be used by clients of class 'ipsdk::math::transform::Scale3d'
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_Scale)
40  );
41 
42  // declare geometric transformation 3d
44 
45 public:
48  Scale3d()
49  {
50  setParams(1);
51  }
52  Scale3d(const ipReal64 scale)
53  {
54  setParams(scale);
55  }
56  ~Scale3d() {}
58 
59 // methods
60 public:
63  static void transform(const ipReal64 scale,
64  ipReal64& x, ipReal64& y, ipReal64& z)
65  {
66  x *= scale;
67  y *= scale;
68  z *= scale;
69  }
71 
74  static Matrix4d getHomogenousMatrix(const ipReal64 scale)
75  {
76  Matrix4d transform;
77  transform(0, 0) = scale; transform(0, 1) = 0; transform(0, 2) = 0; transform(0, 3) = 0;
78  transform(1, 0) = 0; transform(1, 1) = scale; transform(1, 2) = 0; transform(1, 3) = 0;
79  transform(2, 0) = 0; transform(2, 1) = 0; transform(2, 2) = scale; transform(2, 3) = 0;
80  transform(3, 0) = 0; transform(3, 1) = 0; transform(3, 2) = 0; transform(3, 3) = 1;
81 
82  return transform;
83  }
85 
87  static Matrix4d getInvHomogenousMatrix(const ipReal64 scale)
88  {
89  ipReal64 invScale = 0;
90  if (scale != 0)
91  invScale = 1 / scale;
92  return getHomogenousMatrix(invScale);
93  }
94 
96  static void getInvParams(ipReal64& scale)
97  {
98  if (scale != 0)
99  scale = 1 / scale;
100  else
101  scale = 0;
102  }
103 
105  static Vector getIdentityParams();
106 
108  void setParams(const ipReal64 scale)
109  {
110  _scale = scale;
111  }
112 
116  void setParams(const Vector& params);
117 
119  void setIdentity();
120 
122  void apply(ipReal64& x, ipReal64& y, ipReal64& z) const;
123 
125  Matrix4d getHomogenousMatrix() const;
126 
128  Vector getParams() const;
129 
132  ipReal64 getScale() const;
134 
136  Matrix4d getInvHomogenousMatrix() const;
137 
139  Vector getInvParams() const;
140 
141 // attributes
142 protected:
144  ipReal64 _scale;
145 };
146 
149 
150 inline ipReal64
151 Scale3d::getScale() const
152 {
153  return _scale;
154 }
155 
156 inline void
158 {
160 }
161 
164 
165 } // end of namespace transform
166 } // end of namespace math
167 } // end of namespace ipsdk
168 
169 #pragma warning (pop)
170 
171 #endif // __IPSDKMATH_SCALE3D_H__
ipReal64 _scale
transformation scale
Definition: Scale3d.h:147
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
void setParams(const ipReal64 scale)
select parameters associated to transformation
Definition: Scale3d.h:111
eTransformParams
Definition: Scale3d.h:39
Base class for linear geometric transformation 3d management.
Definition: BaseLinearGeometricTransform3d.h:27
static Vector getIdentityParams()
retrieve identity parameters for transformation
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
ipReal64 getScale() const
retrieve parameters associated to transformation
Definition: Scale3d.h:154
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
boost::numeric::ublas::vector< ipReal64 > Vector
vector type associated to library
Definition: LinearAlgebraTypes.h:36
#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
Transformation class allowing to manage 3d scale transformations.
Definition: Scale3d.h:32
void setIdentity()
set transformation parameters to identity
Definition: Scale3d.h:160
#define IPSDK_ENUM(enumTypeStr, enumSeq)
macro allowing to declare an enumerate for library
Definition: EnumMacros.h:26