toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN so3.h


From: Tom Drummond
Subject: [Toon-members] TooN so3.h
Date: Tue, 07 Apr 2009 02:14:33 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Tom Drummond <twd20>    09/04/07 02:14:33

Modified files:
        .              : so3.h 

Log message:
        made coerce a normal member function acting on my_matrix
        rather than a static function acting on an external matrix

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/so3.h?cvsroot=toon&r1=1.26&r2=1.27

Patches:
Index: so3.h
===================================================================
RCS file: /cvsroot/toon/TooN/so3.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- so3.h       3 Apr 2009 14:29:03 -0000       1.26
+++ so3.h       7 Apr 2009 02:14:33 -0000       1.27
@@ -51,20 +51,16 @@
        template <int R, int C, typename P, typename A>
        SO3& operator=(const Matrix<R,C,P,A> & rhs) {
                my_matrix = rhs;
-               coerce(my_matrix);
+               coerce();
                return *this;
        }
        
-       template <int R, int C, typename P, typename A>
-       static void coerce(Matrix<R,C,P,A>& M){
-               SizeMismatch<3,R>::test(3, M.num_rows());
-               SizeMismatch<3,C>::test(3, M.num_cols());
-               M[0] = unit(M[0]);
-               M[1] -= M[0] * (M[0]*M[1]);
-               M[1] = unit(M[1]);
-               M[2] -= M[0] * (M[0]*M[2]);
-               M[2] -= M[1] * (M[1]*M[2]);
-               M[2] = unit(M[2]);
+    void coerce() {
+               my_matrix[1] -= my_matrix[0] * (my_matrix[0]*my_matrix[1]);
+               my_matrix[1] = unit(my_matrix[1]);
+               my_matrix[2] -= my_matrix[0] * (my_matrix[0]*my_matrix[2]);
+               my_matrix[2] -= my_matrix[1] * (my_matrix[1]*my_matrix[2]);
+               my_matrix[2] = unit(my_matrix[2]);
        }
        
        template<int S, typename A> inline static SO3 exp(const 
Vector<S,Precision,A>& vect);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]