// Copyright 2008-2024 Emil Dotchevski and Reverge Studios, Inc. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifdef BOOST_QVM_TEST_SINGLE_HEADER # include BOOST_QVM_TEST_SINGLE_HEADER #else # include # include # include # include # include #endif #include template struct wrap { T t; wrap() { } explicit wrap(T t):t(t) { } }; template wrap operator*(S s, wrap w) { return wrap(s * w.t); } template wrap operator+(wrap a, wrap b) { return wrap(a.t + b.t); } namespace boost { namespace qvm { template struct is_scalar > { static bool const value=true; }; template struct deduce_scalar > { typedef wrap::type> type; }; } } int main() { using namespace boost::qvm; mat m = rotz_mat<3>(3.14159); vec, 3> v; v.a[0] = wrap(1.0); v.a[1] = wrap(0); v.a[2] = wrap(0); vec, 3> r = m * v; BOOST_TEST_LT(fabs(r.a[0].t+1), 0.0001); BOOST_TEST_LT(fabs(r.a[1].t), 0.0001); BOOST_TEST_LT(fabs(r.a[2].t), 0.0001); return boost::report_errors(); }