Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TArithmeticArray.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <cstddef>
6#include <array>
7
8namespace ph::math
9{
10
11template<typename T, std::size_t N>
12class TArithmeticArray final : public TArithmeticArrayBase<TArithmeticArray<T, N>, T, N>
13{
14private:
16
17protected:
18 using Base::m;
19
20public:
21 inline TArithmeticArray() = default;
22 inline TArithmeticArray(const TArithmeticArray& other) = default;
23 inline TArithmeticArray(TArithmeticArray&& other) = default;
24 inline TArithmeticArray& operator = (const TArithmeticArray& rhs) = default;
26 inline ~TArithmeticArray() = default;
27
28 using Base::Base;
29
30 template<typename U>
31 explicit TArithmeticArray(const TArithmeticArray<U, N>& other);
32
34 using Base::size;
35
36 using Base::add;
37 using Base::addLocal;
38
39 using Base::sub;
40 using Base::subLocal;
41
42 using Base::mul;
43 using Base::mulLocal;
44
45 using Base::div;
46 using Base::divLocal;
47
48 using Base::pow;
49 using Base::powLocal;
50
51 using Base::exp;
52 using Base::expLocal;
53
54 using Base::sqrt;
55 using Base::sqrtLocal;
56
57 using Base::clamp;
58 using Base::clampLocal;
59 using Base::safeClamp;
61
62 using Base::abs;
63 using Base::absLocal;
64
65 using Base::rcp;
66 using Base::rcpLocal;
67
68 using Base::complement;
70
71 using Base::sum;
72 using Base::avg;
73 using Base::min;
74 using Base::max;
75 using Base::ceil;
76 using Base::floor;
77 using Base::product;
78 using Base::lerp;
79 using Base::isZero;
81 using Base::isFinite;
82 using Base::set;
83 using Base::begin;
84 using Base::end;
85 using Base::isEqual;
86 using Base::isNear;
87 using Base::toString;
88 using Base::toVector;
89 using Base::toArray;
90
91 using Base::operator [];
92 using Base::operator ==;
93 using Base::operator !=;
94
95 using Base::operator +;
96 using Base::operator +=;
97 using Base::operator -;
98 using Base::operator -=;
99 using Base::operator *;
100 using Base::operator *=;
101 using Base::operator /;
102 using Base::operator /=;
103};
104
105}// end namespace ph::math
106
Definition TArithmeticArrayBase.h:20
auto begin() noexcept -> typename std::array< T, N >::iterator
Definition TArithmeticArrayBase.ipp:797
TArithmeticArray< T, N > exp(U exponent) const
bool isZero() const
Definition TArithmeticArrayBase.ipp:549
T sum() const
Definition TArithmeticArrayBase.ipp:336
TArithmeticArray< T, N > mul(const TArithmeticArray< T, N > &rhs) const
Definition TArithmeticArrayBase.ipp:98
TArithmeticArray< T, N > pow(U exponent) const
std::array< T, N > m
Definition TArithmeticArrayBase.h:217
TArithmeticArray< T, N > sqrt() const
Definition TArithmeticArrayBase.ipp:246
std::vector< T > toVector() const
Definition TArithmeticArrayBase.ipp:842
T avg() const
Definition TArithmeticArrayBase.ipp:342
TArithmeticArray< T, N > complement() const
Definition TArithmeticArrayBase.ipp:502
TArithmeticArray< T, N > floor() const
Definition TArithmeticArrayBase.ipp:447
std::array< T, N > toArray() const
Definition TArithmeticArrayBase.ipp:855
T product() const
Definition TArithmeticArrayBase.ipp:358
TArithmeticArray< T, N > & sqrtLocal()
Definition TArithmeticArrayBase.ipp:253
TArithmeticArray< T, N > & safeClampLocal(T lowerBound, T upperBound)
Definition TArithmeticArrayBase.ipp:307
TArithmeticArray< T, N > safeClamp(T lowerBound, T upperBound) const
Definition TArithmeticArrayBase.ipp:300
TArithmeticArray< T, N > & divLocal(const TArithmeticArray< T, N > &rhs)
Definition TArithmeticArrayBase.ipp:148
TArithmeticArray< T, N > & set(T value)
Definition TArithmeticArrayBase.ipp:604
auto end() noexcept -> typename std::array< T, N >::iterator
Definition TArithmeticArrayBase.ipp:811
TArithmeticArray< T, N > & absLocal()
Definition TArithmeticArrayBase.ipp:473
TArithmeticArray< T, N > clamp(T lowerBound, T upperBound) const
Definition TArithmeticArrayBase.ipp:264
TArithmeticArray< T, N > & addLocal(const TArithmeticArray< T, N > &rhs)
Definition TArithmeticArrayBase.ipp:40
TArithmeticArray< T, N > lerp(const TArithmeticArray< T, N > &rhs, U factor) const
TArithmeticArray< T, N > sub(const TArithmeticArray< T, N > &rhs) const
Definition TArithmeticArrayBase.ipp:62
TArithmeticArray< T, N > div(const TArithmeticArray< T, N > &rhs) const
Definition TArithmeticArrayBase.ipp:134
std::string toString() const
Definition TArithmeticArrayBase.ipp:825
TArithmeticArray< T, N > & rcpLocal()
Definition TArithmeticArrayBase.ipp:491
T min() const
Definition TArithmeticArrayBase.ipp:364
TArithmeticArray< T, N > abs() const
Definition TArithmeticArrayBase.ipp:466
bool isFinite() const
Definition TArithmeticArrayBase.ipp:585
TArithmeticArray< T, N > & mulLocal(const TArithmeticArray< T, N > &rhs)
Definition TArithmeticArrayBase.ipp:112
bool isNear(const TArithmeticArray< T, N > &other, T margin) const
Definition TArithmeticArrayBase.ipp:652
T max() const
Definition TArithmeticArrayBase.ipp:396
bool isNonNegative() const
Definition TArithmeticArrayBase.ipp:565
static constexpr auto NUM_ELEMENTS
Definition TArithmeticArrayBase.h:36
TArithmeticArray< T, N > & clampLocal(T lowerBound, T upperBound)
Definition TArithmeticArrayBase.ipp:271
TArithmeticArray< T, N > add(const TArithmeticArray< T, N > &rhs) const
Definition TArithmeticArrayBase.ipp:26
TArithmeticArray< T, N > & subLocal(const TArithmeticArray< T, N > &rhs)
Definition TArithmeticArrayBase.ipp:76
constexpr std::size_t size() const noexcept
Definition TArithmeticArrayBase.ipp:598
bool isEqual(const TArithmeticArray< T, N > &other) const
Definition TArithmeticArrayBase.ipp:646
TArithmeticArray< T, N > ceil() const
Definition TArithmeticArrayBase.ipp:428
TArithmeticArray< T, N > & complementLocal()
Definition TArithmeticArrayBase.ipp:509
TArithmeticArray< T, N > rcp() const
Definition TArithmeticArrayBase.ipp:484
Definition TArithmeticArray.h:13
TArithmeticArray(const TArithmeticArray &other)=default
TArithmeticArray & operator=(const TArithmeticArray &rhs)=default
TArithmeticArray(TArithmeticArray &&other)=default
Math functions and utilities.
Definition TransformInfo.h:10