YAP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Constants.h
Go to the documentation of this file.
1 /* YAP - Yet another PWA toolkit
2  Copyright 2015, Technische Universitaet Muenchen,
3  Authors: Daniel Greenwald, Johannes Rauch
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
20 
21 #ifndef yap_Constants_h
22 #define yap_Constants_h
23 
24 #include "CoordinateSystem.h"
25 #include "FourVector.h"
26 #include "ThreeVector.h"
27 
28 #include <complex>
29 
30 namespace yap {
31 
35 constexpr auto Complex_0 = std::complex<double>(0, 0);
36 
38 constexpr auto Complex_1 = std::complex<double>(1, 0);
39 
41 constexpr auto Complex_i = std::complex<double>(0, 1);
43 
46 
48 template <typename T = double>
49 constexpr T pi()
50 { return acos((T) - 1); }
51 
53 template <typename T = double>
54 constexpr T rad_per_deg()
55 { return pi<T>() / T(180); }
56 
58 template <typename T>
59 constexpr T rad(const T& d)
60 { return d * rad_per_deg<T>(); }
61 
63 template <typename T = double>
64 constexpr T deg_per_rad()
65 { return T(180) / pi<T>(); }
66 
68 template <typename T>
69 constexpr T deg(const T& r)
70 { return r * deg_per_rad<double>(); }
71 
73 
76 
78 constexpr auto ThreeAxis_X = ThreeVector<double>({1, 0, 0});
79 
81 constexpr auto ThreeAxis_Y = ThreeVector<double>({0, 1, 0});
82 
84 constexpr auto ThreeAxis_Z = ThreeVector<double>({0, 0, 1});
85 
87 constexpr auto ThreeAxes = CoordinateSystem<double, 3> {ThreeAxis_X, ThreeAxis_Y, ThreeAxis_Z};
88 
90 constexpr auto ThreeVector_0 = ThreeVector<double>({0, 0, 0});
91 
93 
96 
98 constexpr auto FourAxis_T = FourVector<double>({1, 0, 0, 0});
99 
101 constexpr auto FourAxis_X = FourVector<double>({0, 1, 0, 0});
102 
104 constexpr auto FourAxis_Y = FourVector<double>({0, 0, 1, 0});
105 
107 constexpr auto FourAxis_Z = FourVector<double>({0, 0, 0, 1});
108 
110 constexpr auto FourAxes = CoordinateSystem<double, 4>({FourAxis_T, FourAxis_X, FourAxis_Y, FourAxis_Z});
111 
113 constexpr auto FourVector_0 = FourVector<double>({0, 0, 0, 0});
114 
116 
117 }
118 
119 #endif
constexpr T pi()
pi
Definition: Constants.h:49
constexpr auto FourAxis_T
T axis (FourVector)
Definition: Constants.h:98
Four-Vector handling.
Definition: FourVector.h:41
constexpr auto ThreeAxes
Standard 3D coordinate system.
Definition: Constants.h:87
constexpr auto ThreeAxis_Z
Z axis (ThreeVector)
Definition: Constants.h:84
constexpr auto FourAxis_Y
Y axis (FourVector)
Definition: Constants.h:104
constexpr auto FourAxes
Standard 4D coordinate system.
Definition: Constants.h:110
constexpr auto Complex_i
complex i
Definition: Constants.h:41
constexpr T deg(const T &r)
convert radians to degrees
Definition: Constants.h:69
constexpr T rad_per_deg()
convert degrees to radians
Definition: Constants.h:54
constexpr T deg_per_rad()
convert radians to degrees
Definition: Constants.h:64
constexpr auto ThreeVector_0
0 as ThreeVector;
Definition: Constants.h:90
constexpr auto FourAxis_Z
Z axis (FourVector)
Definition: Constants.h:107
constexpr auto ThreeAxis_X
X axis (ThreeVector)
Definition: Constants.h:78
constexpr T rad(const T &d)
convert degrees to radians
Definition: Constants.h:59
constexpr auto ThreeAxis_Y
Y axis (ThreeVector)
Definition: Constants.h:81
constexpr auto FourAxis_X
X axis (FourVector)
Definition: Constants.h:101
constexpr auto FourVector_0
0 as FourVector;
Definition: Constants.h:113
constexpr auto Complex_1
complex one
Definition: Constants.h:38