]> Dogcows Code - chaz/yoink/blob - src/cml/vector/vector_functions.h
testing new non-autotools build system
[chaz/yoink] / src / cml / vector / vector_functions.h
1 /* -*- C++ -*- ------------------------------------------------------------
2
3 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
4
5 The Configurable Math Library (CML) is distributed under the terms of the
6 Boost Software License, v1.0 (see cml/LICENSE for details).
7
8 *-----------------------------------------------------------------------*/
9 /** @file
10 * @brief
11 */
12
13 #ifndef vector_functions_h
14 #define vector_functions_h
15
16 namespace cml {
17
18 /** Squared length of a vector. */
19 template<typename E, class AT>
20 inline typename vector<E,AT>::value_type
21 length_squared(const vector<E,AT>& arg)
22 {
23 return arg.length_squared();
24 }
25
26 /** Squared length of a vector expr. */
27 template<typename XprT>
28 inline typename XprT::value_type
29 length_squared(VECXPR_ARG_TYPE arg)
30 {
31 return arg.length_squared();
32 }
33
34 /** Length of a vector. */
35 template<typename E, class AT>
36 inline typename vector<E,AT>::value_type
37 length(const vector<E,AT>& arg)
38 {
39 return arg.length();
40 }
41
42 /** Length of a vector expr. */
43 template<typename XprT>
44 inline typename XprT::value_type
45 length(VECXPR_ARG_TYPE arg)
46 {
47 return arg.length();
48 }
49
50 /** Normalize a vector. */
51 template<typename E, class AT>
52 inline vector<E, AT>
53 normalize(const vector<E,AT>& arg)
54 {
55 vector<E, AT> result(arg);
56 result.normalize();
57 return result;
58 }
59
60 /** Normalize a vector expr. */
61 template<typename XprT>
62 inline typename XprT::result_type
63 normalize(VECXPR_ARG_TYPE arg)
64 {
65 return arg.normalize();
66 }
67
68 } // namespace cml
69
70 #endif
71
72 // -------------------------------------------------------------------------
73 // vim:ft=cpp
This page took 0.038412 seconds and 5 git commands to generate.