coord: add to_radians for vector

This commit is contained in:
Danny Robson 2019-12-18 10:52:10 +11:00
parent 599a932dfe
commit 0624a3ad00
2 changed files with 16 additions and 1 deletions

View File

@ -1476,6 +1476,21 @@ namespace cruft {
std::fill_n (std::begin (res) + K::elements - places, places, fill); std::fill_n (std::begin (res) + K::elements - places, places, fill);
return res; return res;
} }
//-------------------------------------------------------------------------
template <
std::size_t S,
typename T
>
vector<S,T>
to_radians (vector<S,T> const &val)
{
return ::cruft::invoke<vector<S,T>> (
::cruft::sin<T>,
val
);
}
}; };

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
* *
* Copyright 2011-2017 Danny Robson <danny@nerdcruft.net> * Copyright 2011-2019 Danny Robson <danny@nerdcruft.net>
*/ */
#ifndef CRUFT_UTIL_VECTOR_HPP #ifndef CRUFT_UTIL_VECTOR_HPP