7#include <Common/primitive_type.h>
18template<
typename Derived,
typename T, std::
size_t N>
40 constexpr std::size_t
size() const noexcept;
42 Derived
add(const Derived& rhs) const;
43 Derived
add(T rhs) const;
44 Derived&
addLocal(const Derived& rhs);
47 Derived
sub(const Derived& rhs) const;
48 Derived
sub(T rhs) const;
49 Derived&
subLocal(const Derived& rhs);
52 Derived
mul(const Derived& rhs) const;
53 Derived
mul(T rhs) const;
54 Derived&
mulLocal(const Derived& rhs);
57 Derived
div(const Derived& rhs) const;
58 Derived
div(T rhs) const;
59 Derived&
divLocal(const Derived& rhs);
63 Derived
pow(U exponent) const;
68 Derived
pow(const Derived& exponent) const;
75 Derived
exp(U exponent) const;
84 Derived
exp(const Derived& exponent) const;
85 Derived&
expLocal(const Derived& exponent);
97 Derived
clamp(T lowerBound, T upperBound) const;
98 Derived&
clampLocal(T lowerBound, T upperBound);
99 Derived
clamp(const Derived& lowerBound, const Derived& upperBound) const;
100 Derived&
clampLocal(const Derived& lowerBound, const Derived& upperBound);
108 Derived
safeClamp(T lowerBound, T upperBound) const;
110 Derived
safeClamp(const Derived& lowerBound, const Derived& upperBound) const;
111 Derived&
safeClampLocal(const Derived& lowerBound, const Derived& upperBound);
133 requires
std::is_signed_v<T>;
136 requires
std::is_signed_v<T>;
151 Derived
min(const Derived& other) const;
159 Derived
max(const Derived& other) const;
162 Derived
ceil() const;
163 Derived
floor() const;
166 Derived
lerp(const Derived& rhs, U factor) const;
172 Derived&
set(T value);
173 Derived&
set(
std::
size_t index, T value);
174 Derived&
set(const
std::array<T, N>& values);
176 T& operator [] (
std::
size_t index);
177 const T& operator [] (
std::
size_t index) const;
179 bool isEqual(const Derived& other) const;
180 bool isNear(const Derived& other, T margin) const;
181 bool operator == (const Derived& other) const;
182 bool operator != (const Derived& other) const;
184 Derived operator + (const Derived& rhs) const;
185 Derived operator + (T rhs) const;
186 Derived operator - (const Derived& rhs) const;
187 Derived operator - (T rhs) const;
188 Derived operator * (const Derived& rhs) const;
189 Derived operator * (T rhs) const;
190 Derived operator / (const Derived& rhs) const;
191 Derived operator / (T rhs) const;
193 Derived& operator += (const Derived& rhs);
194 Derived& operator += (T rhs);
195 Derived& operator -= (const Derived& rhs);
196 Derived& operator -= (T rhs);
197 Derived& operator *= (const Derived& rhs);
198 Derived& operator *= (T rhs);
199 Derived& operator /= (const Derived& rhs);
200 Derived& operator /= (T rhs);
202 Derived operator - () const
203 requires
std::is_signed_v<T>;
205 auto
begin() noexcept -> typename
std::array<T, N>::iterator;
206 auto
begin() const noexcept -> typename
std::array<T, N>::const_iterator;
207 auto
end() noexcept -> typename
std::array<T, N>::iterator;
208 auto
end() const noexcept -> typename
std::array<T, N>::const_iterator;
222#include "Math/General/TArithmeticArrayBase.ipp"
Definition TArithmeticArrayBase.h:20
auto begin() noexcept -> typename std::array< T, N >::iterator
Definition TArithmeticArrayBase.ipp:797
Derived exp(U exponent) const
Sets the array to .
bool isZero() const
Definition TArithmeticArrayBase.ipp:549
T sum() const
Definition TArithmeticArrayBase.ipp:336
Derived mul(const Derived &rhs) const
Definition TArithmeticArrayBase.ipp:98
Derived pow(U exponent) const
std::array< T, N > m
Definition TArithmeticArrayBase.h:217
Derived sqrt() const
Definition TArithmeticArrayBase.ipp:246
std::vector< T > toVector() const
Definition TArithmeticArrayBase.ipp:842
T avg() const
Definition TArithmeticArrayBase.ipp:342
Derived complement() const
Complements the array's elements. Effectively performing 1 - (*this)[i] for each element.
Definition TArithmeticArrayBase.ipp:502
Derived floor() const
Definition TArithmeticArrayBase.ipp:447
std::array< T, N > toArray() const
Definition TArithmeticArrayBase.ipp:855
T product() const
Definition TArithmeticArrayBase.ipp:358
Derived & sqrtLocal()
Definition TArithmeticArrayBase.ipp:253
Derived & safeClampLocal(T lowerBound, T upperBound)
Definition TArithmeticArrayBase.ipp:307
Derived & expLocal(U exponent)
Derived safeClamp(T lowerBound, T upperBound) const
Clamps current array's elements to specific range. If a floating-point value is non-finite (e....
Definition TArithmeticArrayBase.ipp:300
TSpanView< T, N > toView() const
Definition TArithmeticArrayBase.ipp:869
Derived & divLocal(const Derived &rhs)
Definition TArithmeticArrayBase.ipp:148
Derived & set(T value)
Definition TArithmeticArrayBase.ipp:604
auto end() noexcept -> typename std::array< T, N >::iterator
Definition TArithmeticArrayBase.ipp:811
Derived & absLocal()
Definition TArithmeticArrayBase.ipp:473
Derived clamp(T lowerBound, T upperBound) const
Clamps current array's elements to specific range. None of value, lowerBound and upperBound can be Na...
Definition TArithmeticArrayBase.ipp:264
Derived & addLocal(const Derived &rhs)
Definition TArithmeticArrayBase.ipp:40
Derived lerp(const Derived &rhs, U factor) const
Derived sub(const Derived &rhs) const
Definition TArithmeticArrayBase.ipp:62
Derived div(const Derived &rhs) const
Definition TArithmeticArrayBase.ipp:134
std::string toString() const
Definition TArithmeticArrayBase.ipp:825
Derived & negateLocal()
Definition TArithmeticArrayBase.ipp:528
Derived & rcpLocal()
Definition TArithmeticArrayBase.ipp:491
T min() const
Definition TArithmeticArrayBase.ipp:364
Derived abs() const
Definition TArithmeticArrayBase.ipp:466
bool isFinite() const
Definition TArithmeticArrayBase.ipp:585
std::size_t maxIndex() const
Definition TArithmeticArrayBase.ipp:414
Derived negate() const
Applies a negative sign to the array's elements. These methods is only defined for signed element typ...
Definition TArithmeticArrayBase.ipp:520
Derived & mulLocal(const Derived &rhs)
Definition TArithmeticArrayBase.ipp:112
TSpan< T, N > toSpan()
Definition TArithmeticArrayBase.ipp:862
bool isNear(const Derived &other, T margin) const
Definition TArithmeticArrayBase.ipp:652
std::size_t minIndex() const
Definition TArithmeticArrayBase.ipp:382
TArithmeticArrayBase(T value)
Definition TArithmeticArrayBase.ipp:15
T max() const
Definition TArithmeticArrayBase.ipp:396
bool isNonNegative() const
Definition TArithmeticArrayBase.ipp:565
static constexpr auto NUM_ELEMENTS
Definition TArithmeticArrayBase.h:36
Derived & clampLocal(T lowerBound, T upperBound)
Definition TArithmeticArrayBase.ipp:271
Derived add(const Derived &rhs) const
Definition TArithmeticArrayBase.ipp:26
Derived & subLocal(const Derived &rhs)
Definition TArithmeticArrayBase.ipp:76
constexpr std::size_t size() const noexcept
Number of elements of the array.
Definition TArithmeticArrayBase.ipp:598
bool isEqual(const Derived &other) const
Definition TArithmeticArrayBase.ipp:646
Derived & powLocal(U exponent)
std::array< T, N > Elements
Definition TArithmeticArrayBase.h:25
Derived ceil() const
Definition TArithmeticArrayBase.ipp:428
Derived & complementLocal()
Definition TArithmeticArrayBase.ipp:509
Derived rcp() const
Definition TArithmeticArrayBase.ipp:484
Definition TVectorNBase.h:14
Math functions and utilities.
Definition TransformInfo.h:10
std::span< const T, EXTENT > TSpanView
Same as TSpan, except that the objects are const-qualified. Note that for pointer types,...
Definition TSpan.h:19
std::span< T, EXTENT > TSpan
A contiguous sequence of objects of type T. Effectively the same as std::span.
Definition TSpan.h:12
#define PH_DEFINE_INLINE_RULE_OF_5_MEMBERS(ClassType)
Helper to define defaulted rule of 5 special class members (inlined).
Definition utility.h:64