TSpectrum: added absolute value function
parent
3266aa1cb8
commit
2dd0c78719
|
@ -485,6 +485,14 @@ public:
|
|||
return result * (1.0f / N);
|
||||
}
|
||||
|
||||
/// Component-wise absolute value
|
||||
inline TSpectrum abs() const {
|
||||
TSpectrum value;
|
||||
for (int i=0; i<N; i++)
|
||||
value.s[i] = std::abs(s[i]);
|
||||
return value;
|
||||
}
|
||||
|
||||
/// Component-wise square root
|
||||
inline TSpectrum sqrt() const {
|
||||
TSpectrum value;
|
||||
|
|
|
@ -1649,7 +1649,9 @@ void export_core() {
|
|||
.def("isValid", &Color3::isValid)
|
||||
.def("isNaN", &Color3::isNaN)
|
||||
.def("average", &Color3::average)
|
||||
.def("abs", &Color3::abs)
|
||||
.def("sqrt", &Color3::sqrt)
|
||||
.def("safe_sqrt", &Color3::safe_sqrt)
|
||||
.def("exp", &Color3::exp)
|
||||
.def("log", &Color3::log)
|
||||
.def("pow", &Color3::pow)
|
||||
|
@ -1685,6 +1687,7 @@ void export_core() {
|
|||
.def("isValid", &Spectrum::isValid)
|
||||
.def("isNaN", &Spectrum::isNaN)
|
||||
.def("average", &Spectrum::average)
|
||||
.def("abs", &Spectrum::abs)
|
||||
.def("sqrt", &Spectrum::sqrt)
|
||||
.def("safe_sqrt", &Spectrum::safe_sqrt)
|
||||
.def("exp", &Spectrum::exp)
|
||||
|
|
Loading…
Reference in New Issue