IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
TranslationTransform2d.h
1 // TranslationTransform2d.h:
3 // -------------------------
4 //
14 
15 #ifndef __IPSDKGEOMETRY_TRANSLATIONTRANSFORM2D_H__
16 #define __IPSDKGEOMETRY_TRANSLATIONTRANSFORM2D_H__
17 
18 #include <IPSDKGeometry/Transform/2d/BaseGeometryTransform2d.h>
19 #include <IPSDKGeometry/Entity/2d/Vector/Vector2d.h>
20 #include <IPSDKMath/Geometry/2d/Transform/Translation2d.h>
21 
22 namespace ipsdk {
23 namespace geom {
24 
27 
29 {
30  // declare geometry transform 2d
32 
33 // predefined public types
34 public:
36  static const eTransform2dType::domain g_transform2dType = eTransform2dType::eT2DT_Translation;
37 
38 public:
42  TranslationTransform2d(const ipReal64 xOffset, const ipReal64 yOffset);
43  TranslationTransform2d(const Vector2d& vec);
47 
48 // methods
49 public:
51  eTransform2dType getTransform2dType() const;
52 
55  void init(const ipReal64 xOffset,
56  const ipReal64 yOffset);
57  void init(const Vector2d& vec);
58  void init(const math::transform::Translation2d& transform);
60 
61 protected:
64  template <typename T>
65  void processPoint(Point2dData<T>& entity) const;
66  template <typename T>
67  bool processInSitu(Point2d<T>& entity) const;
68  bool processInSitu(Vector2d& entity) const;
69  template <typename T>
70  bool processInSitu(BoundingBox2d<T>& entity) const;
71  template <typename T>
72  bool processInSitu(PointCloud2d<T>& entity) const;
73  template <typename T>
74  bool processInSitu(Polygon2d<T>& entity) const;
75  template <typename T>
76  bool processInSitu(PolygonWithHoles2d<T>& entity) const;
77  bool processInSitu(Shape2d& entity) const;
78  template <typename T>
79  bool processInSitu(Circle2d<T>& entity) const;
80  template <typename T>
81  bool processInSitu(Ellipse2d<T>& entity) const;
82  template <typename T>
83  bool processInSitu(Square2d<T>& entity) const;
84  template <typename T>
85  bool processInSitu(Rectangle2d<T>& entity) const;
86  bool processInSitu(Line2d& entity) const;
87  bool processInSitu(Parabola2d& entity) const;
88  template <typename T>
89  bool processInSitu(Segment2d<T>& entity) const;
91 
92 // attributes
93 protected:
96 };
97 
100 
101 inline
102 TranslationTransform2d::TranslationTransform2d(const Vector2d& vec)
103 {
104  init(vec);
105 }
106 
107 inline eTransform2dType
109 {
110  return g_transform2dType;
111 }
112 
113 inline void
115  const ipReal64 yOffset)
116 {
117  _transform.setParams(xOffset, yOffset);
118 }
119 
120 inline void
122 {
123  _transform.setParams(vec.getX(), vec.getY());
124 }
125 
126 inline void
128 {
129  _transform = transform;
130 }
131 
134 
135 } // end of namespace geom
136 } // end of namespace ipsdk
137 
138 #endif // __IPSDKGEOMETRY_TRANSLATIONTRANSFORM2D_H__
2d ellipse class associated to cartesian 2d coordinates. For a non rotated ellipse, the major axis follows the x axis and the minor axis follows the y axis.
Definition: Ellipse2d.h:40
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
eTransform2dType getTransform2dType() const
method allowing to retrieve entity 2d transformation type
Definition: TranslationTransform2d.h:108
Transformation class allowing to manage 2d translations.
Definition: Translation2d.h:32
Point class associated to cartesian 2d coordinates.
Definition: GeometryEntity2dTypes.h:28
Translation 2d transformation.
Definition: TranslationTransform2d.h:28
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
ipReal64 getY() const
retrieve cartesian components of vector
Definition: Vector2d.h:240
Translation.
Definition: GeometryTransform2dTypes.h:35
#define IPSDK_DECLARE_GEOMETRY_TRANSFORM_2D(libraryName, className)
Macro allowing to declare a geometry transform 2d.
Definition: GeometryTransform2dHdrMacros.h:26
ipReal64 getX() const
retrieve cartesian components of vector
Definition: Vector2d.h:234
Closed polygon potentially associated to interior polygonal holes.
Definition: PolygonWithHoles2d.h:40
static const eTransform2dType::domain g_transform2dType
geometry transformation type
Definition: TranslationTransform2d.h:36
Parabola 2d class.
Definition: Parabola2d.h:47
#define IPSDKGEOMETRY_API
Import/Export macro for library IPSDKGeometry.
Definition: IPSDKGeometryExports.h:25
Unordered collection of 2d points.
Definition: PointCloud2d.h:35
2d line associated to polar coordinates
Definition: Line2d.h:42
2d segment associated to two points
Definition: Segment2d.h:38
Closed polygon associated to an ordered collection of 2d points.
Definition: Polygon2d.h:38
Vector class associated to polar 2d coordinates.
Definition: Vector2d.h:32
2d rectangle class associated to cartesian 2d coordinates
Definition: Rectangle2d.h:35
2d circle associated to cartesian 2d coordinates
Definition: Circle2d.h:36
Base class for geometry 2d transformations.
Definition: BaseGeometryTransform2d.h:34
2d square class associated to cartesian 2d coordinates
Definition: Square2d.h:35
Shape 2d associated to one or more closed polygon 2d.
Definition: Shape2d.h:35
void setParams(const ipReal64 tx, const ipReal64 ty)
select parameters associated to transformation
Definition: Translation2d.h:107
Lightweight structure used to store Point2d data.
Definition: GeometryEntity2dTypes.h:26
math::transform::Translation2d _transform
underlying transformation
Definition: TranslationTransform2d.h:95
Rectangular 2d bounding box class associated to cartesian 2d coordinates.
Definition: BoundingBox2d.h:37
void init(const ipReal64 xOffset, const ipReal64 yOffset)
initialization of transformation parameters
Definition: TranslationTransform2d.h:114
eTransform2dType
Enumerate describing geometry 2d transform type.
Definition: GeometryTransform2dTypes.h:33