Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N > Class Template Reference

Base for spectrum implementations. More...

#include <TSpectrumBase.h>

Inheritance diagram for ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >:
ph::math::TArithmeticArrayBase< Derived, T, N >

Public Member Functions

template<typename U >
 TSpectrumBase (const TRawColorValues< U, N > &values)
 Set color values directly. Calling setColorValues() has the same effect. This is the most general form that allows type conversion. Basically, all other overloads with value inputs is equivalent to calling setColorValues(), too (unless otherwise noted).
 
std::size_t minComponent () const
 
std::size_t maxComponent () const
 
template<EColorSpace SRC_COLOR_SPACE>
Derived & setTransformed (const auto &srcColorValues, EColorUsage usage)
 
template<CColorValuesInterface ImplType>
Derived & setTransformed (const ImplType &srcColorValues, EColorUsage usage)
 
template<EColorSpace DST_COLOR_SPACE>
auto toTransformed (EColorUsage usage) const
 
void transformFrom (const auto &srcColorValues, EColorSpace srcColorSpace, EColorUsage usage)
 
void transformTo (auto *out_dstColorValues, EColorSpace dstColorSpace, EColorUsage usage) const
 
template<EColorSpace SPECTRAL_COLOR_SPACE = EColorSpace::Spectral>
Derived & setSpectral (const TSpectralSampleValues< T > &sampleValues, EColorUsage usage)
 Helper for setting spectral values to this spectrum.
 
template<CColorValuesInterface ImplType>
Derived & setSpectral (const ImplType &sampleValues, EColorUsage usage)
 Helper for setting spectral values to this spectrum.
 
template<EColorSpace SPECTRAL_COLOR_SPACE = EColorSpace::Spectral>
TSpectralSampleValues< T > toSpectral (EColorUsage usage) const
 Helper for getting spectral values from this spectrum.
 
relativeLuminance (EColorUsage usage=EColorUsage::EMR) const
 
Derived & setLinearSRGB (const TRawColorValues< T, 3 > &linearSRGB, EColorUsage usage)
 Helper for setting linear-sRGB color to this spectrum.
 
TRawColorValues< T, 3 > toLinearSRGB (EColorUsage usage) const
 Helper for converting this spectrum to linear-sRGB color.
 
Derived & putEnergy (T energyLevel)
 
template<EColorSpace SRC_COLOR_SPACE>
auto setTransformed (const auto &srcColorValues, const EColorUsage usage) -> Derived &
 
template<CColorValuesInterface ImplType>
auto setTransformed (const ImplType &srcColorValues, const EColorUsage usage) -> Derived &
 
template<EColorSpace SPECTRAL_COLOR_SPACE>
auto setSpectral (const TSpectralSampleValues< T > &sampleValues, const EColorUsage usage) -> Derived &
 
template<CColorValuesInterface ImplType>
auto setSpectral (const ImplType &sampleValues, const EColorUsage usage) -> Derived &
 
Derived add (const Derived &rhs) const
 
Derived add (T rhs) const
 
Derived & addLocal (const Derived &rhs)
 
Derived & addLocal (T rhs)
 
Derived sub (const Derived &rhs) const
 
Derived sub (T rhs) const
 
Derived & subLocal (const Derived &rhs)
 
Derived & subLocal (T rhs)
 
Derived mul (const Derived &rhs) const
 
Derived mul (T rhs) const
 
Derived & mulLocal (const Derived &rhs)
 
Derived & mulLocal (T rhs)
 
Derived div (const Derived &rhs) const
 
Derived div (T rhs) const
 
Derived & divLocal (const Derived &rhs)
 
Derived & divLocal (T rhs)
 
template<typename U >
Derived pow (U exponent) const
 
Derived pow (const Derived &exponent) const
 
template<typename U >
Derived & powLocal (U exponent)
 
Derived & powLocal (const Derived &exponent)
 
template<typename U >
Derived exp (U exponent) const
 Sets the array to \( e^exponent \).
 
Derived exp (const Derived &exponent) const
 Sets the array to \( e^{exponent_i} \).
 
template<typename U >
Derived & expLocal (U exponent)
 
Derived & expLocal (const Derived &exponent)
 
Derived sqrt () const
 
Derived & sqrtLocal ()
 
Derived clamp (T lowerBound, T upperBound) const
 Clamps current array's elements to specific range. None of value, lowerBound and upperBound can be NaN, or the method's behavior is undefined.
 
Derived clamp (const Derived &lowerBound, const Derived &upperBound) const
 
Derived & clampLocal (T lowerBound, T upperBound)
 
Derived & clampLocal (const Derived &lowerBound, const Derived &upperBound)
 
Derived safeClamp (T lowerBound, T upperBound) const
 Clamps current array's elements to specific range. If a floating-point value is non-finite (e.g., being Inf, NaN), its value is clamped to lowerBound. Neither lowerBound nor upperBound can be NaN, or the method's behavior is undefined.
 
Derived safeClamp (const Derived &lowerBound, const Derived &upperBound) const
 
Derived & safeClampLocal (T lowerBound, T upperBound)
 
Derived & safeClampLocal (const Derived &lowerBound, const Derived &upperBound)
 
Derived abs () const
 
Derived & absLocal ()
 
Derived rcp () const
 
Derived & rcpLocal ()
 
Derived complement () const
 Complements the array's elements. Effectively performing 1 - (*this)[i] for each element.
 
Derived & complementLocal ()
 
Derived negate () const
 Applies a negative sign to the array's elements. These methods is only defined for signed element types.
 
Derived & negateLocal ()
 
sum () const
 
avg () const
 
min () const
 
Derived min (const Derived &other) const
 
max () const
 
Derived max (const Derived &other) const
 
Derived ceil () const
 
Derived floor () const
 
product () const
 
template<typename U >
Derived lerp (const Derived &rhs, U factor) const
 
bool isZero () const
 
bool isNonNegative () const
 
bool isFinite () const
 
auto begin () noexcept -> typename std::array< T, N >::iterator
 
auto begin () const noexcept -> typename std::array< T, N >::const_iterator
 
auto end () noexcept -> typename std::array< T, N >::iterator
 
auto end () const noexcept -> typename std::array< T, N >::const_iterator
 
bool isEqual (const Derived &other) const
 
bool isNear (const Derived &other, T margin) const
 
std::string toString () const
 
std::vector< T > toVector () const
 
Derived & setColorValues (const TRawColorValues< T, N > &values)
 Set and get raw color values directly.
 
Derived & setColorValues (T rawColorValue)
 
const TRawColorValues< T, N > & getColorValues () const
 
- Public Member Functions inherited from ph::math::TArithmeticArrayBase< Derived, T, N >
 TArithmeticArrayBase (T value)
 
 TArithmeticArrayBase (Elements values)
 
template<typename U >
auto pow (const U exponent) const -> Derived
 
template<typename U >
auto powLocal (const U exponent) -> Derived &
 
template<typename U >
auto exp (const U exponent) const -> Derived
 
template<typename U >
auto expLocal (const U exponent) -> Derived &
 
template<typename U >
auto lerp (const Derived &rhs, const U factor) const -> Derived
 

Static Public Member Functions

static consteval EColorSpace getColorSpace () noexcept
 

Static Public Attributes

static constexpr auto NUM_VALUES = Base::NUM_ELEMENTS
 

Protected Member Functions

 PH_DEFINE_INLINE_RULE_OF_5_MEMBERS (TSpectrumBase)
 
- Protected Member Functions inherited from ph::math::TArithmeticArrayBase< Derived, T, N >
 PH_DEFINE_INLINE_RULE_OF_5_MEMBERS (TArithmeticArrayBase)
 
constexpr std::size_t size () const noexcept
 Number of elements of the array.
 
Derived add (const Derived &rhs) const
 
Derived add (T rhs) const
 
Derived & addLocal (const Derived &rhs)
 
Derived & addLocal (T rhs)
 
Derived sub (const Derived &rhs) const
 
Derived sub (T rhs) const
 
Derived & subLocal (const Derived &rhs)
 
Derived & subLocal (T rhs)
 
Derived mul (const Derived &rhs) const
 
Derived mul (T rhs) const
 
Derived & mulLocal (const Derived &rhs)
 
Derived & mulLocal (T rhs)
 
Derived div (const Derived &rhs) const
 
Derived div (T rhs) const
 
Derived & divLocal (const Derived &rhs)
 
Derived & divLocal (T rhs)
 
template<typename U >
Derived pow (U exponent) const
 
template<typename U >
Derived & powLocal (U exponent)
 
Derived pow (const Derived &exponent) const
 
Derived & powLocal (const Derived &exponent)
 
Derived sqrt () const
 
Derived & sqrtLocal ()
 
Derived abs () const
 
Derived & absLocal ()
 
Derived rcp () const
 
Derived & rcpLocal ()
 
sum () const
 
avg () const
 
product () const
 
min () const
 
Derived min (const Derived &other) const
 
std::size_t minIndex () const
 
max () const
 
Derived max (const Derived &other) const
 
std::size_t maxIndex () const
 
Derived ceil () const
 
Derived floor () const
 
template<typename U >
Derived lerp (const Derived &rhs, U factor) const
 
bool isZero () const
 
bool isNonNegative () const
 
bool isFinite () const
 
Derived & set (T value)
 
Derived & set (std::size_t index, T value)
 
Derived & set (const std::array< T, N > &values)
 
T & operator[] (std::size_t index)
 
const T & operator[] (std::size_t index) const
 
bool isEqual (const Derived &other) const
 
bool isNear (const Derived &other, T margin) const
 
bool operator== (const Derived &other) const
 
bool operator!= (const Derived &other) const
 
Derived operator+ (const Derived &rhs) const
 
Derived operator+ (T rhs) const
 
Derived operator- (const Derived &rhs) const
 
Derived operator- (T rhs) const
 
Derived operator* (const Derived &rhs) const
 
Derived operator* (T rhs) const
 
Derived operator/ (const Derived &rhs) const
 
Derived operator/ (T rhs) const
 
Derived & operator+= (const Derived &rhs)
 
Derived & operator+= (T rhs)
 
Derived & operator-= (const Derived &rhs)
 
Derived & operator-= (T rhs)
 
Derived & operator*= (const Derived &rhs)
 
Derived & operator*= (T rhs)
 
Derived & operator/= (const Derived &rhs)
 
Derived & operator/= (T rhs)
 
Derived operator- () const
 
auto begin () noexcept -> typename std::array< T, N >::iterator
 
auto begin () const noexcept -> typename std::array< T, N >::const_iterator
 
auto end () noexcept -> typename std::array< T, N >::iterator
 
auto end () const noexcept -> typename std::array< T, N >::const_iterator
 
std::string toString () const
 
std::vector< T > toVector () const
 
std::array< T, N > toArray () const
 
TSpan< T, N > toSpan ()
 
TSpanView< T, N > toView () const
 
template<typename U >
Derived exp (U exponent) const
 Sets the array to \( e^exponent \).
 
template<typename U >
Derived & expLocal (U exponent)
 
Derived exp (const Derived &exponent) const
 Sets the array to \( e^{exponent_i} \).
 
Derived & expLocal (const Derived &exponent)
 
Derived clamp (T lowerBound, T upperBound) const
 Clamps current array's elements to specific range. None of value, lowerBound and upperBound can be NaN, or the method's behavior is undefined.
 
Derived & clampLocal (T lowerBound, T upperBound)
 
Derived clamp (const Derived &lowerBound, const Derived &upperBound) const
 
Derived & clampLocal (const Derived &lowerBound, const Derived &upperBound)
 
Derived safeClamp (T lowerBound, T upperBound) const
 Clamps current array's elements to specific range. If a floating-point value is non-finite (e.g., being Inf, NaN), its value is clamped to lowerBound. Neither lowerBound nor upperBound can be NaN, or the method's behavior is undefined.
 
Derived & safeClampLocal (T lowerBound, T upperBound)
 
Derived safeClamp (const Derived &lowerBound, const Derived &upperBound) const
 
Derived & safeClampLocal (const Derived &lowerBound, const Derived &upperBound)
 
Derived complement () const
 Complements the array's elements. Effectively performing 1 - (*this)[i] for each element.
 
Derived & complementLocal ()
 
Derived negate () const
 Applies a negative sign to the array's elements. These methods is only defined for signed element types.
 
Derived & negateLocal ()
 

Protected Attributes

std::array< T, N > m
 
- Protected Attributes inherited from ph::math::TArithmeticArrayBase< Derived, T, N >
std::array< T, N > m
 

Friends

Derived operator+ (const T rhs, const Derived &lhs)
 Non-member operators for expressions beginning with a single element value.
 
Derived operator- (const T rhs, const Derived &lhs)
 
Derived operator* (const T rhs, const Derived &lhs)
 
Derived operator/ (const T rhs, const Derived &lhs)
 

Additional Inherited Members

- Public Types inherited from ph::math::TArithmeticArrayBase< Derived, T, N >
using Elements = std::array<T, N>
 
- Static Protected Attributes inherited from ph::math::TArithmeticArrayBase< Derived, T, N >
static constexpr auto NUM_ELEMENTS = N
 

Detailed Description

template<typename Derived, EColorSpace COLOR_SPACE, typename T, std::size_t N>
class ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >

Base for spectrum implementations.

An important assumption is that spectrum implementations are all color samples that can be linearly combined. CColorValuesInterface can be used for directly access the raw sample values.

Note
It is not recommended to add your own field in your spectrum implementation. If you must, make sure there will not be inconsistent object state (slicing) when CColorTransformInterface is being used.

Constructor & Destructor Documentation

◆ TSpectrumBase()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<typename U >
ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::TSpectrumBase ( const TRawColorValues< U, N > & values)
inlineexplicit

Set color values directly. Calling setColorValues() has the same effect. This is the most general form that allows type conversion. Basically, all other overloads with value inputs is equivalent to calling setColorValues(), too (unless otherwise noted).

Member Function Documentation

◆ abs()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::abs ( ) const
inline

◆ absLocal()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::absLocal ( )
inline

◆ add() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::add ( const Derived & rhs) const
inline

◆ add() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::add ( T rhs) const
inline

◆ addLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::addLocal ( const Derived & rhs)
inline

◆ addLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::addLocal ( T rhs)
inline

◆ avg()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
T ph::math::TArithmeticArrayBase< Derived, T, N >::avg ( ) const
inline

◆ begin() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::begin ( ) const -> typename std::array<T, N>::const_iterator
inlinenoexcept

◆ begin() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::begin ( ) -> typename std::array<T, N>::iterator
inlinenoexcept

◆ ceil()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::ceil ( ) const
inline

◆ clamp() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::clamp ( const Derived & lowerBound,
const Derived & upperBound ) const
inline

◆ clamp() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::clamp ( T lowerBound,
T upperBound ) const
inline

Clamps current array's elements to specific range. None of value, lowerBound and upperBound can be NaN, or the method's behavior is undefined.

◆ clampLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::clampLocal ( const Derived & lowerBound,
const Derived & upperBound )
inline

◆ clampLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::clampLocal ( T lowerBound,
T upperBound )
inline

◆ complement()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::complement ( ) const
inline

Complements the array's elements. Effectively performing 1 - (*this)[i] for each element.

◆ complementLocal()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::complementLocal ( )
inline

◆ div() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::div ( const Derived & rhs) const
inline

◆ div() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::div ( T rhs) const
inline

◆ divLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::divLocal ( const Derived & rhs)
inline

◆ divLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::divLocal ( T rhs)
inline

◆ end() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::end ( ) const -> typename std::array<T, N>::const_iterator
inlinenoexcept

◆ end() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::end ( ) -> typename std::array<T, N>::iterator
inlinenoexcept

◆ exp() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::exp ( const Derived & exponent) const
inline

Sets the array to \( e^{exponent_i} \).

◆ exp() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<typename U >
Derived ph::math::TArithmeticArrayBase< Derived, T, N >::exp ( U exponent) const

Sets the array to \( e^exponent \).

◆ expLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::expLocal ( const Derived & exponent)
inline

◆ expLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<typename U >
Derived & ph::math::TArithmeticArrayBase< Derived, T, N >::expLocal ( U exponent)

◆ floor()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::floor ( ) const
inline

◆ getColorSpace()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
EColorSpace ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::getColorSpace ( )
inlinestaticconstevalnoexcept

◆ getColorValues()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::getColorValues ( ) const
inline

◆ isEqual()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
bool ph::math::TArithmeticArrayBase< Derived, T, N >::isEqual ( const Derived & other) const
inline

◆ isFinite()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
bool ph::math::TArithmeticArrayBase< Derived, T, N >::isFinite ( ) const
inline

◆ isNear()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
bool ph::math::TArithmeticArrayBase< Derived, T, N >::isNear ( const Derived & other,
T margin ) const
inline

◆ isNonNegative()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
bool ph::math::TArithmeticArrayBase< Derived, T, N >::isNonNegative ( ) const
inline

◆ isZero()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
bool ph::math::TArithmeticArrayBase< Derived, T, N >::isZero ( ) const
inline

◆ lerp()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<typename U >
Derived ph::math::TArithmeticArrayBase< Derived, T, N >::lerp ( const Derived & rhs,
U factor ) const

◆ max() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
T ph::math::TArithmeticArrayBase< Derived, T, N >::max ( ) const
inline

◆ max() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::max ( const Derived & other) const
inline

◆ maxComponent()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
std::size_t ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::maxComponent ( ) const
inline

◆ min() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
T ph::math::TArithmeticArrayBase< Derived, T, N >::min ( ) const
inline
Returns
Minimum of the elements.

◆ min() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::min ( const Derived & other) const
inline
Returns
Element-wise minimum. Effectively performing std::min((*this)[i], other[i]) for each element.

◆ minComponent()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
std::size_t ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::minComponent ( ) const
inline

◆ mul() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::mul ( const Derived & rhs) const
inline

◆ mul() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::mul ( T rhs) const
inline

◆ mulLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::mulLocal ( const Derived & rhs)
inline

◆ mulLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::mulLocal ( T rhs)
inline

◆ negate()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::negate ( ) const
inline

Applies a negative sign to the array's elements. These methods is only defined for signed element types.

◆ negateLocal()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::negateLocal ( )
inline

◆ PH_DEFINE_INLINE_RULE_OF_5_MEMBERS()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::PH_DEFINE_INLINE_RULE_OF_5_MEMBERS ( TSpectrumBase< Derived, COLOR_SPACE, T, N > )
protected

◆ pow() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::pow ( const Derived & exponent) const
inline

◆ pow() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<typename U >
Derived ph::math::TArithmeticArrayBase< Derived, T, N >::pow ( U exponent) const

◆ powLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::powLocal ( const Derived & exponent)
inline

◆ powLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<typename U >
Derived & ph::math::TArithmeticArrayBase< Derived, T, N >::powLocal ( U exponent)

◆ product()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
T ph::math::TArithmeticArrayBase< Derived, T, N >::product ( ) const
inline

◆ putEnergy()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::putEnergy ( T energyLevel)
inline

◆ rcp()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::rcp ( ) const
inline

◆ rcpLocal()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::rcpLocal ( )
inline

◆ relativeLuminance()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
T ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::relativeLuminance ( EColorUsage usage = EColorUsage::EMR) const
inline

◆ safeClamp() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::safeClamp ( const Derived & lowerBound,
const Derived & upperBound ) const
inline

◆ safeClamp() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::safeClamp ( T lowerBound,
T upperBound ) const
inline

Clamps current array's elements to specific range. If a floating-point value is non-finite (e.g., being Inf, NaN), its value is clamped to lowerBound. Neither lowerBound nor upperBound can be NaN, or the method's behavior is undefined.

◆ safeClampLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::safeClampLocal ( const Derived & lowerBound,
const Derived & upperBound )
inline

◆ safeClampLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::safeClampLocal ( T lowerBound,
T upperBound )
inline

◆ setColorValues() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setColorValues ( const TRawColorValues< T, N > & values)
inline

Set and get raw color values directly.

◆ setColorValues() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setColorValues ( T rawColorValue)
inline

◆ setLinearSRGB()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setLinearSRGB ( const TRawColorValues< T, 3 > & linearSRGB,
EColorUsage usage )
inline

Helper for setting linear-sRGB color to this spectrum.

◆ setSpectral() [1/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<CColorValuesInterface ImplType>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setSpectral ( const ImplType & sampleValues,
const EColorUsage usage ) -> Derived&
inline

◆ setSpectral() [2/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<CColorValuesInterface ImplType>
Derived & ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setSpectral ( const ImplType & sampleValues,
EColorUsage usage )

Helper for setting spectral values to this spectrum.

◆ setSpectral() [3/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<EColorSpace SPECTRAL_COLOR_SPACE>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setSpectral ( const TSpectralSampleValues< T > & sampleValues,
const EColorUsage usage ) -> Derived&
inline

◆ setSpectral() [4/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<EColorSpace SPECTRAL_COLOR_SPACE = EColorSpace::Spectral>
Derived & ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setSpectral ( const TSpectralSampleValues< T > & sampleValues,
EColorUsage usage )

Helper for setting spectral values to this spectrum.

◆ setTransformed() [1/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<EColorSpace SRC_COLOR_SPACE>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setTransformed ( const auto & srcColorValues,
const EColorUsage usage ) -> Derived&
inline

◆ setTransformed() [2/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<EColorSpace SRC_COLOR_SPACE>
Derived & ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setTransformed ( const auto & srcColorValues,
EColorUsage usage )

◆ setTransformed() [3/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<CColorValuesInterface ImplType>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setTransformed ( const ImplType & srcColorValues,
const EColorUsage usage ) -> Derived&
inline

◆ setTransformed() [4/4]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<CColorValuesInterface ImplType>
Derived & ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::setTransformed ( const ImplType & srcColorValues,
EColorUsage usage )

◆ sqrt()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::sqrt ( ) const
inline

◆ sqrtLocal()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::sqrtLocal ( )
inline

◆ sub() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::sub ( const Derived & rhs) const
inline

◆ sub() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::sub ( T rhs) const
inline

◆ subLocal() [1/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::subLocal ( const Derived & rhs)
inline

◆ subLocal() [2/2]

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::subLocal ( T rhs)
inline

◆ sum()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
T ph::math::TArithmeticArrayBase< Derived, T, N >::sum ( ) const
inline

◆ toLinearSRGB()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::toLinearSRGB ( EColorUsage usage) const
inline

Helper for converting this spectrum to linear-sRGB color.

◆ toSpectral()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<EColorSpace DST_COLOR_SPACE>
TSpectralSampleValues< T > ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::toSpectral ( EColorUsage usage) const
inline

Helper for getting spectral values from this spectrum.

◆ toString()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::toString ( ) const
inline

◆ toTransformed()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
template<EColorSpace DST_COLOR_SPACE>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::toTransformed ( EColorUsage usage) const
inline

◆ toVector()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TArithmeticArrayBase< Derived, T, N >::toVector ( ) const
inline

◆ transformFrom()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
void ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::transformFrom ( const auto & srcColorValues,
EColorSpace srcColorSpace,
EColorUsage usage )
inline

◆ transformTo()

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
void ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::transformTo ( auto * out_dstColorValues,
EColorSpace dstColorSpace,
EColorUsage usage ) const
inline

Friends And Related Symbol Documentation

◆ operator*

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
Derived operator* ( const T rhs,
const Derived & lhs )
friend

◆ operator+

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
Derived operator+ ( const T rhs,
const Derived & lhs )
friend

Non-member operators for expressions beginning with a single element value.

◆ operator-

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
Derived operator- ( const T rhs,
const Derived & lhs )
friend

◆ operator/

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
Derived operator/ ( const T rhs,
const Derived & lhs )
friend

Member Data Documentation

◆ m

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
std::array<T, N> ph::math::TArithmeticArrayBase< Derived, T, N >::m
protected

◆ NUM_VALUES

template<typename Derived , EColorSpace COLOR_SPACE, typename T , std::size_t N>
auto ph::math::TSpectrumBase< Derived, COLOR_SPACE, T, N >::NUM_VALUES = Base::NUM_ELEMENTS
inlinestaticconstexpr

The documentation for this class was generated from the following files: