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
24
kvector_t
Direction::vector
()
const
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
}
Constants.h
Defines M_PI and some more mathematical constants.
M_TWOPI
#define M_TWOPI
Definition:
Constants.h:54
vecOfLambdaAlphaPhi
kvector_t vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Definition:
Direction.cpp:19
Direction.h
Defines class Direction.
BasicVector3D< double >
Direction
A direction in three-dimensional space.
Definition:
Direction.h:24
Direction::vector
kvector_t vector() const
Returns Cartesian 3D vector.
Definition:
Direction.cpp:24
Direction::m_phi
double m_phi
Definition:
Direction.h:37
Direction::m_alpha
double m_alpha
Definition:
Direction.h:36
Base
Vector
Direction.cpp
Generated by
1.9.1