X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmoof%2Fcml%2Fquaternion%2Fquaternion_functions.h;fp=src%2Fmoof%2Fcml%2Fquaternion%2Fquaternion_functions.h;h=0000000000000000000000000000000000000000;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hp=95abcb9bdae5a2edf1d163a7859747e75dc0a32d;hpb=85783316365181491a3e3c0c63659972477cebba;p=chaz%2Fyoink diff --git a/src/moof/cml/quaternion/quaternion_functions.h b/src/moof/cml/quaternion/quaternion_functions.h deleted file mode 100644 index 95abcb9..0000000 --- a/src/moof/cml/quaternion/quaternion_functions.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- 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 Functions on quaternions. - * - * @todo The functions that return quaternions and vectors should be changed - * to return quaternion expression nodes, as should the corresponding - * class methods. - */ - -#ifndef quaternion_functions_h -#define quaternion_functions_h - -#include // For CheckQuat() -#include -#include // For acos_safe() - -namespace cml { - -/** Returns the real part of the quaternion. */ -template -inline typename quaternion::value_type -real(const quaternion& q) -{ - return q.real(); -} - -/** Returns the real (scalar) part of the QuaternionXpr. */ -template -inline typename et::QuaternionXpr::value_type -real(const et::QuaternionXpr& e) -{ - return e.real(); -} - -/** Returns the imaginary (vector) part of the quaternion. */ -template -inline typename quaternion::imaginary_type -imaginary(const quaternion& q) -{ - return q.imaginary(); -} - -/** Returns the imaginary (vector) part of the QuaternionXpr. */ -template -//inline typename et::QuaternionXpr::temporary_type -inline typename et::QuaternionXpr::imaginary_type -imaginary(const et::QuaternionXpr& e) -{ - return e.imaginary(); -} - -/** Cayley norm of a quaternion. */ -template -inline typename quaternion::value_type -norm(const quaternion& arg) -{ - return arg.length_squared(); -} - -/** Cayley norm of a QuaternionXpr. */ -template -inline typename XprT::value_type -norm(QUATXPR_ARG_TYPE arg) -{ - return arg.length_squared(); -} - -/** Squared length of a quaternion. */ -template -inline typename quaternion::value_type -length_squared(const quaternion& arg) -{ - return arg.length_squared(); -} - -/** Squared length of a quaternion expr. */ -template -inline typename XprT::value_type -length_squared(QUATXPR_ARG_TYPE arg) -{ - return arg.length_squared(); -} - -/** Length of a quaternion. */ -template -inline typename quaternion::value_type -length(const quaternion& arg) -{ - return arg.length(); -} - -/** Length of a quaternion expr. */ -template -inline typename XprT::value_type -length(QUATXPR_ARG_TYPE arg) -{ - return arg.length(); -} - -/** Normalize a quaternion. - * - * The input quaternion is not changed. - */ -template -inline quaternion -normalize(const quaternion& arg) -{ - typename quaternion::temporary_type result(arg); - result.normalize(); - return result; -} - -/** Normalize a quaternion expr. */ -template -inline typename XprT::temporary_type -normalize(QUATXPR_ARG_TYPE arg) -{ - return arg.normalize(); -} - -/** Set a quaternion to the multiplicative identity. - * - * The input quaternion is not changed. - */ -template -inline quaternion -identity(const quaternion& arg) -{ - typename quaternion::temporary_type result(arg); - result.identity(); - return result; -} - -/** Log of a quaternion or quaternion expression. - */ -template < class QuatT > -typename QuatT::temporary_type log( - const QuatT& q, - typename QuatT::value_type tolerance = - epsilon::placeholder()) -{ - detail::CheckQuat(q); - - return q.log(); -} - -/** Exponential function of a quaternion or quaternion expression. - */ -template < class QuatT > -typename QuatT::temporary_type exp( - const QuatT& q, - typename QuatT::value_type tolerance = - epsilon::placeholder()) -{ - detail::CheckQuat(q); - - return q.exp(); -} - -} // namespace cml - -#endif - -// ------------------------------------------------------------------------- -// vim:ft=cpp