[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN helpers.h
From: |
Edward Rosten |
Subject: |
[Toon-members] TooN helpers.h |
Date: |
Mon, 02 Nov 2009 17:13:44 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Edward Rosten <edrosten> 09/11/02 17:13:44
Modified files:
. : helpers.h
Log message:
Reinstated old, horrible normalize-in-place for vectors since removal
breaks too much old code.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.84&r2=1.85
Patches:
Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -b -r1.84 -r1.85
--- helpers.h 31 Oct 2009 11:32:10 -0000 1.84
+++ helpers.h 2 Nov 2009 17:13:44 -0000 1.85
@@ -89,15 +89,28 @@
return v * (1/sqrt(v*v));
}
+ //Note because of the overload later, this function will ONLY receive
sliced vectors. Therefore
+ //a copy can be made, which is still a slice, so operating on the copy
operates on the original
+ //data.
///Normalize a vector in place
///@param v Vector to normalize
///@ingroup gLinAlg
- template<int Size, class Precision, class Base> inline void
normalize(Vector<Size, Precision, Base>& v)
+ template<int Size, class Precision, class Base> inline void
normalize(Vector<Size, Precision, Base> v)
{
using std::sqrt;
v /= sqrt(v*v);
}
+ //This overload is required to operate on non-slice vectors
+ /**
+ \overload
+ */
+ template<int Size, class Precision> inline void normalize(Vector<Size,
Precision> & v)
+ {
+ normalize(v.as_slice());
+ }
+
+
///For a vector \e v of length \e i, return \f$[v_1, v_2, \cdots,
v_{i-1}] / v_i \f$
///@param v \e v
///@ingroup gLinAlg
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] TooN helpers.h,
Edward Rosten <=