X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2Fcml%2Fvector%2Fvector_functions.h;fp=src%2FMoof%2Fcml%2Fvector%2Fvector_functions.h;h=ce92371b94e8dbbd3498cfee7c78826400d342b7;hp=0000000000000000000000000000000000000000;hb=c2321281bf12a7efaedde930422c7ddbc92080d4;hpb=87bc17e55b0c1dc73ecc66df856d3f08fd7a7724 diff --git a/src/Moof/cml/vector/vector_functions.h b/src/Moof/cml/vector/vector_functions.h new file mode 100644 index 0000000..ce92371 --- /dev/null +++ b/src/Moof/cml/vector/vector_functions.h @@ -0,0 +1,73 @@ +/* -*- C++ -*- ------------------------------------------------------------ + +Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/ + +The Configurable Math Library (CML) is distributed under the terms of the +Boost Software License, v1.0 (see cml/LICENSE for details). + + *-----------------------------------------------------------------------*/ +/** @file + * @brief + */ + +#ifndef vector_functions_h +#define vector_functions_h + +namespace cml { + +/** Squared length of a vector. */ +template +inline typename vector::value_type +length_squared(const vector& arg) +{ + return arg.length_squared(); +} + +/** Squared length of a vector expr. */ +template +inline typename XprT::value_type +length_squared(VECXPR_ARG_TYPE arg) +{ + return arg.length_squared(); +} + +/** Length of a vector. */ +template +inline typename vector::value_type +length(const vector& arg) +{ + return arg.length(); +} + +/** Length of a vector expr. */ +template +inline typename XprT::value_type +length(VECXPR_ARG_TYPE arg) +{ + return arg.length(); +} + +/** Normalize a vector. */ +template +inline vector +normalize(const vector& arg) +{ + vector result(arg); + result.normalize(); + return result; +} + +/** Normalize a vector expr. */ +template +inline typename XprT::result_type +normalize(VECXPR_ARG_TYPE arg) +{ + return arg.normalize(); +} + +} // namespace cml + +#endif + +// ------------------------------------------------------------------------- +// vim:ft=cpp