IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
array_operators.hxx
Go to the documentation of this file.
1
3
4#pragma once
6
7namespace ice::math
8{
9
10 template<u32 Size, typename T>
11 constexpr auto operator-(arr_t<Size, T> left) noexcept -> arr_t<Size, T>;
12
13 template<u32 Size, typename T, typename U = T>
14 constexpr auto operator+(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>;
15
16 template<u32 Size, typename T, typename U = T>
17 constexpr auto operator+(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>;
18
19 template<u32 Size, typename T, typename U = T>
20 constexpr auto operator-(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>;
21
22 template<u32 Size, typename T, typename U = T>
23 constexpr auto operator-(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>;
24
25 template<u32 Size, typename T, typename U = T>
26 constexpr auto operator*(arr_t<Size, T> left, U right) noexcept -> arr_t<Size, T>;
27
28 template<u32 Size, typename T, typename U = T>
29 constexpr auto operator*(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>;
30
31 template<u32 Size, typename T, typename U = T>
32 constexpr auto operator*(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>;
33
34 template<u32 Size, typename T, typename U = T>
35 constexpr auto operator/(arr_t<Size, T> left, U right) noexcept -> arr_t<Size, T>;
36
37 template<u32 Size, typename T, typename U = T>
38 constexpr auto operator/(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>;
39
40 template<u32 Size, typename T, typename U = T>
41 constexpr auto operator/(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>;
42
43
44 template<u32 Size, typename T>
45 constexpr auto operator-(arr_t<Size, T> left) noexcept -> arr_t<Size, T>
46 {
47 arr_t<Size, T> result{ };
48 for (u32 i = 0; i < Size; ++i)
49 {
50 result.v[i] = -left.v[i];
51 }
52 return result;
53 }
54
55 template<u32 Size, typename T, typename U>
56 constexpr auto operator+(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>
57 {
58 return ice::math::add(left, right);
59 }
60
61 template<u32 Size, typename T, typename U>
62 constexpr auto operator+(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>
63 {
64 return ice::math::add(left, right);
65 }
66
67 template<u32 Size, typename T, typename U>
68 constexpr auto operator-(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>
69 {
70 return ice::math::sub(left, right);
71 }
72
73 template<u32 Size, typename T, typename U>
74 constexpr auto operator-(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>
75 {
76 return ice::math::sub(left, right);
77 }
78
79 template<u32 Size, typename T, typename U>
80 constexpr auto operator*(arr_t<Size, T> left, U right) noexcept -> arr_t<Size, T>
81 {
82 return ice::math::mul(left, right);
83 }
84
85 template<u32 Size, typename T, typename U>
86 constexpr auto operator*(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>
87 {
88 return ice::math::mul(left, right);
89 }
90
91 template<u32 Size, typename T, typename U>
92 constexpr auto operator*(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>
93 {
94 return ice::math::mul(left, right);
95 }
96
97 template<u32 Size, typename T, typename U>
98 constexpr auto operator/(arr_t<Size, T> left, U right) noexcept -> arr_t<Size, T>
99 {
100 return ice::math::div(left, right);
101 }
102
103 template<u32 Size, typename T, typename U>
104 constexpr auto operator/(arr_t<Size, T> left, arr_t<Size, U> right) noexcept -> arr_t<Size, T>
105 {
106 return ice::math::div(left, right);
107 }
108
109 template<u32 Size, typename T, typename U>
110 constexpr auto operator/(vec<Size, T> left, arr_t<Size, U> right) noexcept -> vec<Size, T>
111 {
112 return ice::math::div(left, right);
113 }
114
115} // namespace ice::math
Definition algorithm.hxx:8
constexpr auto mul(U first, Args... args) noexcept
Definition algorithm.hxx:38
constexpr auto div(U first, Args... args) noexcept
Definition algorithm.hxx:46
constexpr auto operator-(arr_t< Size, T > left) noexcept -> arr_t< Size, T >
Definition array_operators.hxx:45
mat< Size, 1, T > vec
Definition vector.hxx:172
constexpr auto operator*(ScalarType left, NumberType right) noexcept -> ScalarType
Definition angles.hxx:158
constexpr auto operator/(ScalarType left, NumberType right) noexcept -> ScalarType
Definition angles.hxx:164
constexpr auto add(arr_t< Size, T > left, arr_t< Size, U > right) noexcept -> arr_t< Size, T >
Definition array_operations.hxx:71
constexpr auto operator+(arr_t< Size, T > left, arr_t< Size, U > right) noexcept -> arr_t< Size, T >
Definition array_operators.hxx:56
constexpr auto sub(U first, Args... args) noexcept
Definition algorithm.hxx:30
std::uint32_t u32
Definition types.hxx:26
Definition array.hxx:27