Add pointwise log & exp for geom::vectors
This commit is contained in:
parent
b9b18b800d
commit
01b8bd3d59
1 changed files with 18 additions and 0 deletions
|
|
@ -361,6 +361,24 @@ namespace psemek::geom
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
vector<T, N> pointwise_log(vector<T, N> const & v)
|
||||||
|
{
|
||||||
|
vector<T, N> result;
|
||||||
|
for (std::size_t i = 0; i < N; ++i)
|
||||||
|
result[i] = std::log(v[i]);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
vector<T, N> pointwise_exp(vector<T, N> const & v)
|
||||||
|
{
|
||||||
|
vector<T, N> result;
|
||||||
|
for (std::size_t i = 0; i < N; ++i)
|
||||||
|
result[i] = std::exp(v[i]);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, std::size_t N>
|
template <typename T, std::size_t N>
|
||||||
vector<T, N> lerp(vector<T, N> const & v0, vector<T, N> const & v1, T const & t)
|
vector<T, N> lerp(vector<T, N> const & v0, vector<T, N> const & v1, T const & t)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue