BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Direction.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Base/Vector/Direction.cpp
6 //! @brief Implements 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 #include "Base/Vector/Direction.h"
16 #include "Base/Math/Constants.h"
17 #include <cmath>
18 
19 kvector_t vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
20 {
21  return M_TWOPI / _lambda * Direction(_alpha, _phi).vector();
22 }
23 
25 {
26  return {std::cos(m_alpha) * std::cos(m_phi), -std::cos(m_alpha) * std::sin(m_phi),
27  std::sin(m_alpha)};
28 }
Defines M_PI and some more mathematical constants.
#define M_TWOPI
Definition: Constants.h:54
kvector_t vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Definition: Direction.cpp:19
Defines class Direction.
A direction in three-dimensional space.
Definition: Direction.h:24
kvector_t vector() const
Returns Cartesian 3D vector.
Definition: Direction.cpp:24
double m_phi
Definition: Direction.h:37
double m_alpha
Definition: Direction.h:36