Sun, 19 Jan 2020 02:54:48 +0200
commit work on GL rendering
20 | 1 | #pragma once |
2 | #include <cmath> | |
3 | ||
4 | namespace math | |
5 | { | |
6 | using std::abs; | |
7 | using std::sqrt; | |
8 | using std::sin; | |
9 | using std::cos; | |
10 | using std::tan; | |
11 | using std::atan; | |
12 | using std::atan2; | |
13 | using std::acos; | |
14 | using std::asin; | |
15 | using std::exp; | |
16 | using std::log; | |
17 | using std::log10; | |
18 | using std::hypot; | |
19 | using std::floor; | |
20 | using std::ceil; | |
21 | using std::trunc; | |
22 | using std::round; | |
23 | template<typename T, typename... Rest> | |
24 | inline auto hypot(T&& x, Rest&&... rest) | |
25 | { | |
26 | return math::hypot(x, math::hypot(rest...)); | |
27 | } | |
28 | template<typename T, typename... Rest> | |
29 | const T& max(const T& x, const T& y) | |
30 | { | |
31 | if (x > y) | |
32 | return x; | |
33 | else | |
34 | return y; | |
35 | } | |
36 | template<typename T, typename... Rest> | |
37 | const T& max(const T& x, const T& y, Rest&&... rest) | |
38 | { | |
39 | return math::max(x, math::max(y, rest...)); | |
40 | } | |
41 | template<typename T, typename... Rest> | |
42 | const T& min(const T& x, const T& y) | |
43 | { | |
44 | if (x < y) | |
45 | return x; | |
46 | else | |
47 | return y; | |
48 | } | |
49 | template<typename T, typename... Rest> | |
50 | const T& min(const T& x, const T& y, Rest&&... rest) | |
51 | { | |
52 | return math::min(x, math::min(y, rest...)); | |
53 | } | |
54 | constexpr double infinity = std::numeric_limits<double>::infinity(); | |
55 | constexpr long double pi = M_PIl; | |
56 | } |