Transformation.hpp
1 #ifndef DM_TRANSFORMATION_HPP_INCLUDED
2 #define DM_TRANSFORMATION_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5 #pragma once
6 #endif
7 
8 #include "DM/config.hpp"
9 #include "DM/Handle.hpp"
10 #include "DM/IGeometry.hpp"
11 
12 DM_NAMESPACE_BEGIN
13 
14 /// Interface for generic geometry object coordiante transformation
15 class DM_API ITrafo
16 {
17 protected:
18  virtual ~ITrafo() {}
19 
20 public:
21  /// \brief retuns the dimension of transformation.
22  /// This info helps to optimize the actual transformation process of the geometry objects
23  ///
24  /// \return 1 if only z values are changed
25  /// \return 2 for 2d transformations
26  /// \return 3 if all coordinate values may be changed
27  virtual int trafoDim() const = 0;
28 
29  /// \brief performs coordiante transformation
30  /// please note that coordinates must not be changed if not effected by the transformation
31  ///
32  /// \param[in,out] x x-coordinates
33  /// \param[in,out] y y-coordinates
34  /// \param[in,out] z z-coordinates
35  /// \param[in] inv inversion flag if transformation should be inverted
36  virtual void transform(double &x, double &y, double &z, bool inv = false) const = 0;
37 };
38 
39 /// \brief provides a generic framework for transforming geometry objects
40 void DM_API transform(const ITrafo &trafo, IGeometry &geom, bool inv = false);
41 
42 DM_NAMESPACE_END
43 
44 #endif //DM_TRANSFORMATION_HPP_INCLUDED