IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Point2d.h
1 // Point2d.h:
3 // ----------
4 //
14 
15 #ifndef __IPSDKGEOMETRY_POINT2D_H__
16 #define __IPSDKGEOMETRY_POINT2D_H__
17 
18 // suppression warnings
19 // warning C4251: 'ipsdk::geom::Point2d<T>::_ptData' : struct 'ipsdk::geom::Point2dData<T>' needs to have dll-interface to be used by clients of class 'ipsdk::geom::Point2d<T>'
20 #pragma warning (push)
21 #pragma warning (disable : 4251)
22 
23 #include <IPSDKGeometry/Entity/2d/BaseTypedGeometryEntity2d.h>
24 #include <IPSDKGeometry/Entity/2d/Point/Point2dData.h>
27 
28 namespace ipsdk {
29 namespace geom {
30 
31 class Vector2d;
32 
35 
36 template <typename T>
37 class IPSDKGEOMETRY_API Point2d : public BaseTypedGeometryEntity2d<T>
38 {
39  // declare 2d geometry entity
40  IPSDK_DECLARE_GEOMETRY_ENTITY_2D(IPSDKGeometry, Point2d);
41 
42 // predefined public types
43 public:
45  static const eCoordinateSystem2dType::domain g_coordinateSystem2dType = eCoordinateSystem2dType::eCS2DT_Cartesian;
46 
48  static const eEntity2dType::domain g_entity2dType = eEntity2dType::eE2DT_Point;
49 
50 public:
53  Point2d();
54  Point2d(const Point2dData<T>& ptData);
55  Point2d(const T x, const T y);
56  ~Point2d();
58 
59 // methods
60 public:
62  inline eCoordinateSystem2dType getCoordinateSystem2dType() const;
63 
65  inline eEntity2dType getEntity2dType() const;
66 
69  inline const Point2dData<T>& getCoords() const;
70  inline Point2dData<T>& getCoords();
71  inline operator Point2dData<T>() const;
72  inline void setCoords(const Point2dData<T>& ptData);
73  inline void setCoords(const T x, const T y);
74  inline void setX(const T x);
75  inline void setY(const T y);
76  inline T getX() const;
77  inline T getY() const;
78  inline T& getX();
79  inline T& getY();
81 
83  ipReal64 normL2() const;
84 
88  Point2d<T>& operator+=(const Point2d<T>& pt);
89  Point2d<T> operator+(const Point2d<T>& pt) const;
90  Point2d<T>& operator+=(const Vector2d& vec);
91  Point2d<T> operator+(const Vector2d& vec) const;
92  Point2d<T>& operator+=(const T value);
93  Point2d<T> operator+(const T value) const;
94  Point2d<T>& operator-=(const Point2d<T>& pt);
95  Point2d<T> operator-(const Point2d<T>& pt) const;
96  Point2d<T>& operator-=(const Vector2d& vec);
97  Point2d<T> operator-(const Vector2d& vec) const;
98  Point2d<T>& operator-=(const T value);
99  Point2d<T> operator-(const T value) const;
100  Point2d<T>& operator*=(const Point2d<T>& pt);
101  Point2d<T> operator*(const Point2d<T>& pt) const;
102  Point2d<T>& operator*=(const Vector2d& vec);
103  Point2d<T> operator*(const Vector2d& vec) const;
104  Point2d<T>& operator*=(const ipReal64 value);
105  Point2d<T> operator*(const ipReal64 value) const;
106  Point2d<T>& operator/=(const Point2d<T>& pt);
107  Point2d<T> operator/(const Point2d<T>& pt) const;
108  Point2d<T>& operator/=(const Vector2d& vec);
109  Point2d<T> operator/(const Vector2d& vec) const;
110  Point2d<T>& operator/=(const ipReal64 value);
111  Point2d<T> operator/(const ipReal64 value) const;
113 
114 // attributes
115 protected:
118 };
119 
122 
123 template <typename T>
126 {
127  return g_coordinateSystem2dType;
128 }
129 
130 template <typename T>
131 inline eEntity2dType
133 {
134  return g_entity2dType;
135 }
136 
137 template <typename T>
138 inline const Point2dData<T>&
140 {
141  return _ptData;
142 }
143 
144 template <typename T>
145 inline Point2dData<T>&
147 {
148  return _ptData;
149 }
150 
151 template <typename T>
152 inline
154 {
155  return _ptData;
156 }
157 
158 template <typename T>
159 inline void
161 {
162  _ptData = ptData;
163 }
164 
165 template <typename T>
166 inline void
167 Point2d<T>::setCoords(const T x, const T y)
168 {
169  _ptData._x = x;
170  _ptData._y = y;
171 }
172 
173 template <typename T>
174 inline void
176 {
177  _ptData._x = x;
178 }
179 
180 template <typename T>
181 inline void
183 {
184  _ptData._y = y;
185 }
186 
187 template <typename T>
188 inline T
190 {
191  return _ptData._x;
192 }
193 
194 template <typename T>
195 inline T
197 {
198  return _ptData._y;
199 }
200 
201 template <typename T>
202 inline T&
204 {
205  return _ptData._x;
206 }
207 
208 template <typename T>
209 inline T&
211 {
212  return _ptData._y;
213 }
214 
217 
218 } // end of namespace geom
219 } // end of namespace ipsdk
220 
221 #pragma warning (pop)
222 
223 #endif // __IPSDKGEOMETRY_POINT2D_H__
Point2dData< T > _ptData
coordinates of point
Definition: Point2d.h:117
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Point class associated to cartesian 2d coordinates.
Definition: GeometryEntity2dTypes.h:28
void setX(const T x)
access to point coordinates
Definition: Point2d.h:175
T getX() const
access to point coordinates
Definition: Point2d.h:189
IPSDKGEOMETRY_API Point2d< T > operator*(const ipReal64 value, const Point2d< T > &pt)
arithmetic operators on point
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
eCoordinateSystem2dType
Enumerate describing coordinate system 2d type.
Definition: GeometryEntity2dTypes.h:76
Point.
Definition: GeometryEntity2dTypes.h:40
#define IPSDKGEOMETRY_API
Import/Export macro for library IPSDKGeometry.
Definition: IPSDKGeometryExports.h:25
Utility functions for points 2d management.
eCoordinateSystem2dType getCoordinateSystem2dType() const
method allowing to retrieve coordinate system 2d type
Definition: Point2d.h:125
T getY() const
access to point coordinates
Definition: Point2d.h:196
void setY(const T y)
access to point coordinates
Definition: Point2d.h:182
#define IPSDK_DECLARE_GEOMETRY_ENTITY_2D(libraryName, className)
Macro allowing to declare a geometry entity 2d.
Definition: GeometryEntity2dHdrMacros.h:131
eEntity2dType getEntity2dType() const
method allowing to retrieve entity 2d type
Definition: Point2d.h:132
void setCoords(const Point2dData< T > &ptData)
access to point coordinates
Definition: Point2d.h:160
Vector class associated to polar 2d coordinates.
Definition: Vector2d.h:32
const Point2dData< T > & getCoords() const
access to point coordinates
Definition: Point2d.h:139
Basic operators used for point 2d management.
boost::numeric::ublas::bounded_vector< ipReal64, 2 > Vector2d
2d vector type associated to library
Definition: LinearAlgebraTypes.h:39
eEntity2dType
Enumerate describing entity 2d type.
Definition: GeometryEntity2dTypes.h:38
IPSDKGEOMETRY_API ipReal64 normL2(const Point2d< T > &pt)
compute point norm
Lightweight structure used to store Point2d data.
Definition: GeometryEntity2dTypes.h:26
Cartesian coordinate system.
Definition: GeometryEntity2dTypes.h:78