opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
trigonometric_functions.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <cmath>
8#include <concepts>
9
10namespace osc
11{
12 template<std::floating_point GenType>
13 GenType sin(GenType v)
14 {
15 return std::sin(v);
16 }
17
18 template<std::floating_point Rep, AngularUnitTraits Units>
20 {
21 return sin(RadiansT<Rep>{v}.count());
22 }
23
24 template<std::floating_point T, size_t N>
26 {
27 return map(v, sin<T>);
28 }
29
30 template<std::floating_point Rep, AngularUnitTraits Units, size_t N>
32 {
33 return map(v, sin<Rep, Units>);
34 }
35
36 template<std::floating_point GenType>
37 GenType cos(GenType v)
38 {
39 return std::cos(v);
40 }
41
42 template<std::floating_point Rep, AngularUnitTraits Units>
44 {
45 return cos(RadiansT<Rep>{v}.count());
46 }
47
48 template<std::floating_point T, size_t N>
50 {
51 return map(v, cos<T>);
52 }
53
54 template<std::floating_point Rep, AngularUnitTraits Units, size_t N>
56 {
57 return map(v, cos<Rep, Units>);
58 }
59
60 template<std::floating_point GenType>
61 GenType tan(GenType v)
62 {
63 return std::tan(v);
64 }
65
66 template<std::floating_point Rep, AngularUnitTraits Units>
68 {
69 return tan(RadiansT<Rep>{v}.count());
70 }
71
72 template<std::floating_point T, size_t N>
74 {
75 return map(v, tan<T>);
76 }
77
78 template<std::floating_point Rep, AngularUnitTraits Units, size_t N>
80 {
81 return map(v, tan<Rep, Units>);
82 }
83
84 template<std::floating_point Rep>
86 {
87 return RadiansT<Rep>{std::atan(v)};
88 }
89
90 template<std::floating_point Rep>
92 {
93 return RadiansT<Rep>{std::acos(num)};
94 }
95
96 template<std::floating_point Rep>
98 {
99 return RadiansT<Rep>{std::asin(num)};
100 }
101
102 template<std::floating_point Rep>
103 RadiansT<Rep> atan2(Rep x, Rep y)
104 {
105 return RadiansT<Rep>{std::atan2(x, y)};
106 }
107}
Definition angle.h:26
constexpr Rep count() const
Definition angle.h:51
Definition vector.h:63
Definition custom_decoration_generator.h:5
GenType cos(GenType v)
Definition trigonometric_functions.h:37
constexpr auto map(const Rgba< T > &x, UnaryOperation op) -> Rgba< decltype(std::invoke(op, x[0]))>
Definition rgba.h:208
GenType sin(GenType v)
Definition trigonometric_functions.h:13
RadiansT< Rep > acos(Rep num)
Definition trigonometric_functions.h:91
RadiansT< Rep > atan2(Rep x, Rep y)
Definition trigonometric_functions.h:103
GenType tan(GenType v)
Definition trigonometric_functions.h:61
RadiansT< Rep > asin(Rep num)
Definition trigonometric_functions.h:97
RadiansT< Rep > atan(Rep v)
Definition trigonometric_functions.h:85