|
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.
|
|
T | 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 () |
|
T | sum () const |
|
T | avg () const |
|
T | min () const |
|
Derived | min (const Derived &other) const |
|
T | max () const |
|
Derived | max (const Derived &other) const |
|
Derived | ceil () const |
|
Derived | floor () const |
|
T | 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 |
|
| 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 |
|
|
| PH_DEFINE_INLINE_RULE_OF_5_MEMBERS (TSpectrumBase) |
|
| 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 () |
|
T | sum () const |
|
T | avg () const |
|
T | product () const |
|
T | min () const |
|
Derived | min (const Derived &other) const |
|
std::size_t | minIndex () const |
|
T | 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 () |
|
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.