26template<
typename Derived, EColorSpace COLOR_SPACE,
typename T, std::
size_t N>
164 using
Base::operator [];
165 using
Base::operator ==;
166 using
Base::operator !=;
168 using
Base::operator +;
169 using
Base::operator +=;
170 using
Base::operator -;
171 using
Base::operator -=;
172 using
Base::operator *;
173 using
Base::operator *=;
174 using
Base::operator /;
175 using
Base::operator /=;
181 friend Derived operator + (const T rhs, const Derived& lhs)
188 return Derived{rhs}.sub(lhs);
198 return lhs.rcp().mul(rhs);
207 template<EColorSpace SRC_COLOR_SPACE>
208 void setTransformedIfCompatible(
const auto& srcColorValues,
EColorUsage usage);
214 template<EColorSpace DST_COLOR_SPACE>
215 void toTransformedIfCompatible(
auto* out_dstColorValues,
EColorUsage usage)
const;
Definition TArithmeticArrayBase.h:20
std::array< T, N > m
Definition TArithmeticArrayBase.h:217
static constexpr auto NUM_ELEMENTS
Definition TArithmeticArrayBase.h:36
Derived add(const Derived &rhs) const
Definition TArithmeticArrayBase.ipp:26
Base for spectrum implementations.
Definition TSpectrumBase.h:28
TRawColorValues< T, 3 > toLinearSRGB(EColorUsage usage) const
Helper for converting this spectrum to linear-sRGB color.
Definition TSpectrumBase.ipp:245
Derived & setTransformed(const auto &srcColorValues, EColorUsage usage)
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
TSpectrumBase(const TRawColorValues< U, N > &values)
Set color values directly. Calling setColorValues() has the same effect. This is the most general for...
Definition TSpectrumBase.ipp:17
Derived mul(const Derived &rhs) const
Definition TArithmeticArrayBase.ipp:98
friend Derived operator*(const T rhs, const Derived &lhs)
Definition TSpectrumBase.h:191
void transformTo(auto *out_dstColorValues, EColorSpace dstColorSpace, EColorUsage usage) const
Definition TSpectrumBase.ipp:198
Derived pow(U exponent) const
friend Derived operator-(const T rhs, const Derived &lhs)
Definition TSpectrumBase.h:186
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
T product() const
Definition TArithmeticArrayBase.ipp:358
T relativeLuminance(EColorUsage usage=EColorUsage::EMR) const
Definition TSpectrumBase.ipp:124
const TRawColorValues< T, N > & getColorValues() const
Definition TSpectrumBase.ipp:62
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
void transformFrom(const auto &srcColorValues, EColorSpace srcColorSpace, EColorUsage usage)
Definition TSpectrumBase.ipp:166
static consteval EColorSpace getColorSpace() noexcept
Definition TSpectrumBase.ipp:26
std::size_t maxComponent() const
Definition TSpectrumBase.ipp:39
Derived & divLocal(const Derived &rhs)
Definition TArithmeticArrayBase.ipp:148
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 & putEnergy(T energyLevel)
Definition TSpectrumBase.ipp:255
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
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS(TSpectrumBase)
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
bool isNear(const Derived &other, T margin) const
Definition TArithmeticArrayBase.ipp:652
auto toTransformed(EColorUsage usage) const
Definition TSpectrumBase.ipp:110
TSpectralSampleValues< T > toSpectral(EColorUsage usage) const
Helper for getting spectral values from this spectrum.
Definition TSpectrumBase.ipp:118
T max() const
Definition TArithmeticArrayBase.ipp:396
bool isNonNegative() const
Definition TArithmeticArrayBase.ipp:565
Derived & setLinearSRGB(const TRawColorValues< T, 3 > &linearSRGB, EColorUsage usage)
Helper for setting linear-sRGB color to this spectrum.
Definition TSpectrumBase.ipp:232
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
bool isEqual(const Derived &other) const
Definition TArithmeticArrayBase.ipp:646
Derived & powLocal(U exponent)
Derived & setSpectral(const TSpectralSampleValues< T > &sampleValues, EColorUsage usage)
Helper for setting spectral values to this spectrum.
Derived ceil() const
Definition TArithmeticArrayBase.ipp:428
Derived & complementLocal()
Definition TArithmeticArrayBase.ipp:509
std::size_t minComponent() const
Definition TSpectrumBase.ipp:32
Derived & setColorValues(const TRawColorValues< T, N > &values)
Set and get raw color values directly.
Definition TSpectrumBase.ipp:46
friend Derived operator/(const T rhs, const Derived &lhs)
Definition TSpectrumBase.h:196
static constexpr auto NUM_VALUES
Definition TSpectrumBase.h:50
Derived rcp() const
Definition TArithmeticArrayBase.ipp:484
Satisfying this concept makes ImplType usable as color values.
Definition color_basics.h:75
Math functions and utilities.
Definition TransformInfo.h:10
std::array< T, N > TRawColorValues
Definition color_basics.h:45
TRawColorValues< T, SampleProps::NUM_SAMPLES > TSpectralSampleValues
Definition color_basics.h:54
EColorUsage
Definition color_enums.h:140
EColorSpace
Definition color_enums.h:7