diff options
Diffstat (limited to 'modules/codec')
| -rw-r--r-- | modules/codec/c++/math.hpp | 4 | ||||
| -rw-r--r-- | modules/codec/tests/math.cpp | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/modules/codec/c++/math.hpp b/modules/codec/c++/math.hpp index 34c64c7..d110b64 100644 --- a/modules/codec/c++/math.hpp +++ b/modules/codec/c++/math.hpp @@ -133,8 +133,8 @@ data<schema::Vector<T,2u>,Encoding> rotate( const data<schema::Scalar<T>, Encoding> rot ){ data<schema::Vector<T,2u>, Encoding> rot_vec; - rot_vec.at({{0u}}) = vec.at({{0u}}) * cos(rot); - rot_vec.at({{1u}}) = vec.at({{1u}}) * sin(rot); + rot_vec.at({{0u}}) = vec.at({{0u}}) * cos(rot).at({}); + rot_vec.at({{1u}}) = vec.at({{1u}}) * sin(rot).at({}); return rot_vec; } diff --git a/modules/codec/tests/math.cpp b/modules/codec/tests/math.cpp index 6817df1..63b6d2b 100644 --- a/modules/codec/tests/math.cpp +++ b/modules/codec/tests/math.cpp @@ -64,6 +64,20 @@ SAW_TEST("Math/Tensor"){ } } +SAW_TEST("Math/Rotate"){ + using namespace saw; + + data<sch::Vector<sch::Float64, 2u>> a; + { + a.at({{0u}}) = 2.0; + a.at({{1u}}) = 1.0; + } + + data<sch::Scalar<sch::Float64>> b; + b.at({}) = 1.4; + auto c = math::rotate(a,b); +} + SAW_TEST("Math/Dot"){ using namespace saw; |
