IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Plan3d.h
1 // Plan3d.h:
3 // ---------
4 //
27 
28 #ifndef __IPSDKGEOMETRY_PLAN3D_H__
29 #define __IPSDKGEOMETRY_PLAN3D_H__
30 
32 #include <IPSDKGeometry/Entity/3d/BaseTypedGeometryEntity3d.h>
35 
36 namespace ipsdk {
37 namespace geom {
38 
39 template <typename T>
40 struct Point3dData;
41 class Vector3d;
42 
45 
47 {
48  // declare 3d geometry entity
50 
51 // predefined public types
52 public:
54  static const eCoordinateSystem3dType::domain g_coordinateSystem3dType = eCoordinateSystem3dType::eCS3DT_Spherical;
55 
57  static const eEntity3dType::domain g_entity3dType = eEntity3dType::eE3DT_Plan;
58 
59 public:
62  Plan3d();
63  Plan3d(const ipReal64 rho, const ipReal64 theta, const ipReal64 phi);
64  template <typename T>
65  Plan3d(const Point3dData<T>& pt0, const Point3dData<T>& pt1, const Point3dData<T>& pt2);
66  template <typename T>
67  Plan3d(const Point3d<T>& pt0, const Point3d<T>& pt1, const Point3d<T>& pt2);
68  ~Plan3d();
69  template <typename T>
70  Plan3d(const Point3dData<T>& pt, const Vector3d& normal);
71  template <typename T>
72  Plan3d(const Point3d<T>& pt, const Vector3d& normal);
74 
75 // methods
76 public:
78  inline eCoordinateSystem3dType getCoordinateSystem3dType() const;
79 
81  inline eEntity3dType getEntity3dType() const;
82 
85  void setCoords(const ipReal64 rho, const ipReal64 theta, const ipReal64 phi);
86  template <typename T>
87  void setCoords(const Point3dData<T>& pt0, const Point3dData<T>& pt1, const Point3dData<T>& pt2);
88  template <typename T>
89  void setCoords(const Point3d<T>& pt0, const Point3d<T>& pt1, const Point3d<T>& pt2);
90  template <typename T>
91  void setCoords(const Point3dData<T>& pt, const Vector3d& normal);
92  template <typename T>
93  void setCoords(const Point3d<T>& pt, const Vector3d& normal);
94  inline void setRho(const ipReal64 rho);
95  inline void setTheta(const ipReal64 theta);
96  inline void setPhi(const ipReal64 phi);
97  inline ipReal64 getRho() const;
98  inline ipReal64 getTheta() const;
99  inline ipReal64 getPhi() const;
101 
103  Vector3d getNormal() const;
104 
106  Point3dData<ipReal64> getNearestPointFromOrigin() const;
107 
110  template <typename T>
111  inline ipReal64 distance(const Point3d<T>& pt) const;
112  template <typename T>
113  ipReal64 distance(const Point3dData<T>& pt) const;
115 
120  template <typename T>
121  inline ipReal64 signedDistance(const Point3d<T>& pt) const;
122  template <typename T>
123  ipReal64 signedDistance(const Point3dData<T>& pt) const;
125 
128  inline ipReal64 getCosTheta() const;
129  inline ipReal64 getSinTheta() const;
130  inline ipReal64 getCosPhi() const;
131  inline ipReal64 getSinPhi() const;
133 
136  Plan3d& operator+=(const Vector3d& vec);
137  Plan3d operator+(const Vector3d& vec) const;
138  Plan3d& operator-=(const Vector3d& vec);
139  Plan3d operator-(const Vector3d& vec) const;
141 
142 // attributes
143 protected:
146 
149 
152 
160 };
161 
164 
165 template <typename T>
166 inline
167 Plan3d::Plan3d(const Point3dData<T>& pt0, const Point3dData<T>& pt1, const Point3dData<T>& pt2)
168 {
169  setCoords(pt0, pt1, pt2);
170 }
171 
172 template <typename T>
173 inline
174 Plan3d::Plan3d(const Point3d<T>& pt0, const Point3d<T>& pt1, const Point3d<T>& pt2)
175 {
176  setCoords(pt0, pt1, pt2);
177 }
178 
179 template <typename T>
180 inline
181 Plan3d::Plan3d(const Point3dData<T>& pt, const Vector3d& normal)
182 {
183  setCoords(pt, normal);
184 }
185 
186 template <typename T>
187 inline
188 Plan3d::Plan3d(const Point3d<T>& pt, const Vector3d& normal)
189 {
190  setCoords(pt, normal);
191 }
192 
195 {
197 }
198 
199 inline eEntity3dType
201 {
202  return g_entity3dType;
203 }
204 
205 template <typename T>
206 inline void
207 Plan3d::setCoords(const Point3d<T>& pt0, const Point3d<T>& pt1, const Point3d<T>& pt2)
208 {
209  setCoords(pt0.getCoords(), pt1.getCoords(), pt2.getCoords());
210 }
211 
212 inline void
214 {
215  _rho = rho;
216 }
217 
218 inline void
220 {
221  _theta = math::centerModulo(theta, 2*M_PI);
222  _cosTheta = std::cos(_theta);
223  _sinTheta = std::sin(_theta);
224 }
225 
226 inline void
228 {
229  _phi = math::centerModulo(phi, 2*M_PI);
230  _cosPhi = std::cos(_phi);
231  _sinPhi = std::sin(_phi);
232 }
233 
234 inline ipReal64
236 {
237  return _rho;
238 }
239 
240 inline ipReal64
242 {
243  return _theta;
244 }
245 
246 inline ipReal64
248 {
249  return _phi;
250 }
251 
252 template <typename T>
253 inline ipReal64
254 Plan3d::distance(const Point3d<T>& pt) const
255 {
256  return distance(pt.getCoords());
257 }
258 
259 template <typename T>
260 inline ipReal64
262 {
263  return std::abs(signedDistance(pt));
264 }
265 
266 template <typename T>
267 inline ipReal64
269 {
270  return signedDistance(pt.getCoords());
271 }
272 
273 inline ipReal64
275 {
276  return _cosTheta;
277 }
278 
279 inline ipReal64
281 {
282  return _sinTheta;
283 }
284 
285 inline ipReal64
287 {
288  return _cosPhi;
289 }
290 
291 inline ipReal64
293 {
294  return _sinPhi;
295 }
296 
299 
300 } // end of namespace geom
301 } // end of namespace ipsdk
302 
303 #endif // __IPSDKGEOMETRY_PLAN3D_H__
ipReal64 getPhi() const
access to plan coordinates
Definition: Plan3d.h:247
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
eCoordinateSystem3dType
Enumerate describing coordinate system 3d type.
Definition: GeometryEntity3dTypes.h:74
static const eEntity3dType::domain g_entity3dType
type associated to entity
Definition: Plan3d.h:57
ipReal64 _sinTheta
computation intermediate
Definition: Plan3d.h:156
ipReal64 getSinPhi() const
access to computation intermediate
Definition: Plan3d.h:292
Point class associated to cartesian 3d coordinates.
Definition: GeometryEntity3dTypes.h:29
eCoordinateSystem3dType getCoordinateSystem3dType() const
method allowing to retrieve coordinate system 3d type
Definition: Plan3d.h:194
eEntity3dType getEntity3dType() const
method allowing to retrieve entity 3d type
Definition: Plan3d.h:200
#define IPSDK_DECLARE_GEOMETRY_ENTITY_3D(libraryName, className)
Macro allowing to declare a geometry entity 3d.
Definition: GeometryEntity3dHdrMacros.h:131
void setCoords(const ipReal64 rho, const ipReal64 theta, const ipReal64 phi)
access to plan coordinates
void setTheta(const ipReal64 theta)
access to plan coordinates
Definition: Plan3d.h:219
ipReal64 _cosPhi
computation intermediate
Definition: Plan3d.h:157
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
void setPhi(const ipReal64 phi)
access to plan coordinates
Definition: Plan3d.h:227
const Point3dData< T > & getCoords() const
access to point coordinates
Definition: Point3d.h:142
Vector class associated to spherical 3d coordinates.
Definition: Vector3d.h:32
IPSDKGEOMETRY_API ipReal64 distance(const Point2d< T > &pt1, const Point2d< T > &pt2)
compute euclidian distance between two points
ipReal64 distance(const Point3d< T > &pt) const
retrieve orthogonal distance between point and plan
Definition: Plan3d.h:254
Definition of import/export macro for library.
ipReal64 _phi
phi coordinate of point
Definition: Plan3d.h:151
#define IPSDKGEOMETRY_API
Import/Export macro for library IPSDKGeometry.
Definition: IPSDKGeometryExports.h:25
ipReal64 _rho
rho coordinate of point
Definition: Plan3d.h:145
Spherical coordinate system.
Definition: GeometryEntity3dTypes.h:78
static const eCoordinateSystem3dType::domain g_coordinateSystem3dType
coordinate system associated to entity
Definition: Plan3d.h:54
3d plan associated to spherical coordinates
Definition: Plan3d.h:46
void setRho(const ipReal64 rho)
access to plan coordinates
Definition: Plan3d.h:213
ipReal64 getCosTheta() const
access to computation intermediate
Definition: Plan3d.h:274
Plan.
Definition: GeometryEntity3dTypes.h:62
ipReal64 _theta
theta coordinate of point
Definition: Plan3d.h:148
ipReal64 _cosTheta
computation intermediate
Definition: Plan3d.h:155
eEntity3dType
Enumerate describing entity 3d type.
Definition: GeometryEntity3dTypes.h:38
ipReal64 getCosPhi() const
access to computation intermediate
Definition: Plan3d.h:286
Utility functions used to handle angles 3d.
Operators associated to plan 3d entities.
Base class for typed 3d geometry entities.
Definition: BaseTypedGeometryEntity3d.h:27
boost::numeric::ublas::bounded_vector< ipReal64, 3 > Vector3d
3d vector type associated to library
Definition: LinearAlgebraTypes.h:42
ipReal64 getTheta() const
access to plan coordinates
Definition: Plan3d.h:241
ipReal64 signedDistance(const Point3d< T > &pt) const
retrieve signed orthogonal distance between point and plan (positive value stands for points located ...
Definition: Plan3d.h:268
ipReal64 getSinTheta() const
access to computation intermediate
Definition: Plan3d.h:280
Lightweight structure used to store Point3d data.
Definition: GeometryEntity3dTypes.h:27
IPSDK_FORCEINLINE PackT abs(const PackT &in)
returns the absolute value of a pack
Definition: abs.h:41
ipReal64 getRho() const
access to plan coordinates
Definition: Plan3d.h:235
IPSDK_FORCEINLINE ipReal64 centerModulo(const ipReal64 angle, const ipReal64 modulo)
function allowing to compute centered modulo of an angle
Definition: Angles.h:57
ipReal64 _sinPhi
computation intermediate
Definition: Plan3d.h:158