// (c) Copyright 2010 Terry Golubiewski, all rights reserved. #ifndef CARTESIAN_UNITS_H #define CARTESIAN_UNITS_H #pragma once #include #include #include #include namespace cartesian { template inline boost::units::quantity operator*(const boost::units::quantity >& x, const boost::units::quantity >& y) { typedef boost::units::quantity return_type; return return_type::from_value(x.value() * y.value()); } template inline boost::units::quantity > cross_product(const boost::units::quantity >& x, const boost::units::quantity >& y) { typedef boost::units::quantity > return_type; return return_type::from_value(cross_product(x.value(), y.value())); } template inline boost::units::quantity abs(const boost::units::quantity >& v) { return boost::units::quantity::from_value(abs(v.value())); } template inline boost::units::quantity abs(const boost::units::quantity& v) { return boost::units::quantity::from_value(abs(v.value())); } template inline boost::units::quantity abs(const boost::units::quantity& v) { return boost::units::quantity::from_value(abs(v.value())); } template inline typename boost::units::power_typeof_helper< boost::units::quantity, boost::units::static_rational<2> > ::type abs_squared(const boost::units::quantity >& v) { typedef typename boost::units::power_typeof_helper< quantity, boost::units::static_rational<2> >::type return_type; return return_type::from_value(abs_squared(v.value())); } // abs_squared template inline typename boost::units::power_typeof_helper< boost::units::quantity, boost::units::static_rational<2> > ::type abs_squared(const boost::units::quantity& v) { typedef typename boost::units::power_typeof_helper< quantity, boost::units::static_rational<2> >::type return_type; return return_type::from_value(abs_squared(v.value())); } // abs_squared template inline typename boost::units::power_typeof_helper< boost::units::quantity, boost::units::static_rational<2> > ::type abs_squared(const boost::units::quantity& v) { typedef typename boost::units::power_typeof_helper< quantity, boost::units::static_rational<2> >::type return_type; return return_type::from_value(abs_squared(v.value())); } // abs_squared } // cartesian #endif