X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmoof%2Fcml%2Fmathlib%2Fvector_angle.h;fp=src%2Fmoof%2Fcml%2Fmathlib%2Fvector_angle.h;h=0000000000000000000000000000000000000000;hb=6b0a0d0efafe34d48ab344fca3b479553bd4e62c;hp=910817bb9df582709ebecf8bb82bb2053e2b04ad;hpb=85783316365181491a3e3c0c63659972477cebba;p=chaz%2Fyoink diff --git a/src/moof/cml/mathlib/vector_angle.h b/src/moof/cml/mathlib/vector_angle.h deleted file mode 100644 index 910817b..0000000 --- a/src/moof/cml/mathlib/vector_angle.h +++ /dev/null @@ -1,69 +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 - */ - -#ifndef vector_angle_h -#define vector_angle_h - -#include - -/* Functions for finding the signed and unsigned angles between vectors in - * 3D and 2D. - * - * Note that the input vectors for these functions are not required to be - * unit length. - * - * @todo: Clean up promotions, conversions, and return types. - */ - -namespace cml { - -/** Signed angle between two 3D vectors. */ -template< class VecT_1, class VecT_2, class VecT_3 > -typename detail::DotPromote< - typename detail::CrossPromote::promoted_vector, VecT_3 ->::promoted_scalar -signed_angle(const VecT_1& v1, const VecT_2& v2, const VecT_3& reference) -{ - typedef typename detail::CrossPromote::promoted_vector - vector_type; - typedef typename detail::DotPromote::promoted_scalar - value_type; - - vector_type c = cross(v1,v2); - value_type angle = std::atan2(double(length(c)),double(dot(v1,v2))); - return dot(c,reference) < value_type(0) ? -angle : angle; -} - -/** Unsigned angle between two 3D vectors. */ -template< class VecT_1, class VecT_2 > -typename detail::DotPromote< VecT_1, VecT_2 >::promoted_scalar -unsigned_angle(const VecT_1& v1, const VecT_2& v2) { - return std::atan2(double(length(cross(v1,v2))),double(dot(v1,v2))); -} - -/** Signed angle between two 2D vectors. */ -template< class VecT_1, class VecT_2 > -typename detail::DotPromote< VecT_1, VecT_2 >::promoted_scalar -signed_angle_2D(const VecT_1& v1, const VecT_2& v2) { - return std::atan2(double(perp_dot(v1,v2)),double(dot(v1,v2))); -} - -/** Unsigned angle between two 2D vectors. */ -template< class VecT_1, class VecT_2 > -typename detail::DotPromote< VecT_1, VecT_2 >::promoted_scalar -unsigned_angle_2D(const VecT_1& v1, const VecT_2& v2) { - return std::fabs(signed_angle_2D(v1,v2)); -} - -} // namespace cml - -#endif