BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
Direction.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Base/Vector/Direction.h
6 //! @brief Defines class Direction.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_BASE_VECTOR_DIRECTION_H
16 #define BORNAGAIN_BASE_VECTOR_DIRECTION_H
17 
18 #include <heinz/Vectors3D.h>
19 
20 R3 vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi);
21 
22 //! A direction in three-dimensional space.
23 
24 class Direction {
25 public:
26  Direction(double alpha, double phi)
27  : m_alpha(alpha)
28  , m_phi(phi)
29  {
30  }
32  : Direction(0, 0)
33  {
34  } // needed by Swig
35 
36  double alpha() const { return m_alpha; }
37  double phi() const { return m_phi; }
38 
39  //! Returns Cartesian 3D vector
40  R3 vector() const;
41 
42  Direction zReflected() const { return {-m_alpha, m_phi}; }
43 
44 private:
45  double m_alpha;
46  double m_phi;
47 };
48 
49 #endif // BORNAGAIN_BASE_VECTOR_DIRECTION_H
R3 vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Definition: Direction.cpp:19
A direction in three-dimensional space.
Definition: Direction.h:24
double phi() const
Definition: Direction.h:37
Direction zReflected() const
Definition: Direction.h:42
double alpha() const
Definition: Direction.h:36
R3 vector() const
Returns Cartesian 3D vector.
Definition: Direction.cpp:24
Direction()
Definition: Direction.h:31
Direction(double alpha, double phi)
Definition: Direction.h:26
double m_phi
Definition: Direction.h:46
double m_alpha
Definition: Direction.h:45