toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN helpers.h so3.h se3.h


From: Gerhard Reitmayr
Subject: [Toon-members] TooN helpers.h so3.h se3.h
Date: Mon, 03 May 2010 17:37:07 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Gerhard Reitmayr <gerhard>      10/05/03 17:37:06

Modified files:
        .              : helpers.h so3.h se3.h 

Log message:
        more fixes for FADBAD++

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.90&r2=1.91
http://cvs.savannah.gnu.org/viewcvs/TooN/so3.h?cvsroot=toon&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/TooN/se3.h?cvsroot=toon&r1=1.29&r2=1.30

Patches:
Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- helpers.h   18 Apr 2010 09:49:18 -0000      1.90
+++ helpers.h   3 May 2010 17:37:06 -0000       1.91
@@ -126,7 +126,7 @@
        template<int Size, class Precision, class Base> inline Vector<Size, 
Precision> unit(const Vector<Size, Precision, Base> & v)
        {
                using std::sqrt;
-               return v * (1/sqrt(v*v));
+               return TooN::operator*(v,(1/sqrt(v*v)));
        }
        
        //Note because of the overload later, this function will ONLY receive 
sliced vectors. Therefore

Index: so3.h
===================================================================
RCS file: /cvsroot/toon/TooN/so3.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- so3.h       28 Apr 2010 22:17:16 -0000      1.46
+++ so3.h       3 May 2010 17:37:06 -0000       1.47
@@ -175,11 +175,12 @@
                return *this * vect; 
        }
        
+       template <typename PA, typename PB>
+       inline SO3(const SO3<PA>& a, const SO3<PB>& b) : 
my_matrix(a.get_matrix()*b.get_matrix()) {}
+       
 private:
        struct Invert {};
        inline SO3(const SO3& so3, const Invert&) : 
my_matrix(so3.my_matrix.T()) {}
-       template <typename PA, typename PB>
-       inline SO3(const SO3<PA>& a, const SO3<PB>& b) : 
my_matrix(a.get_matrix()*b.get_matrix()) {}
        
        Matrix<3,3, Precision> my_matrix;
 };
@@ -294,7 +295,7 @@
                        result *= asin(sin_angle_abs) / sin_angle_abs;
                }
        } else if( cos_angle > -M_SQRT1_2) {    // [Pi/4 - 3Pi/4[ use acos, but 
antisymmetric part
-               double angle = acos(cos_angle);
+               const Precision angle = acos(cos_angle);
                result *= angle / sin_angle_abs;        
        } else {  // rest use symmetric part
                // antisymmetric part vanishes, but still large rotation, need 
information from symmetric part
@@ -302,12 +303,12 @@
                const Precision d0 = my_matrix[0][0] - cos_angle,
                        d1 = my_matrix[1][1] - cos_angle,
                        d2 = my_matrix[2][2] - cos_angle;
-               TooN::Vector<3> r2;
-               if(fabs(d0) > fabs(d1) && fabs(d0) > fabs(d2)){ // first is 
largest, fill with first column
+               TooN::Vector<3, Precision> r2;
+               if(d0*d0 > d1*d1 && d0*d0 > d2*d2){ // first is largest, fill 
with first column
                        r2[0] = d0;
                        r2[1] = (my_matrix[1][0]+my_matrix[0][1])/2;
                        r2[2] = (my_matrix[0][2]+my_matrix[2][0])/2;
-               } else if(fabs(d1) > fabs(d2)) {                            // 
second is largest, fill with second column
+               } else if(d1*d1 > d2*d2) {                          // second 
is largest, fill with second column
                        r2[0] = (my_matrix[1][0]+my_matrix[0][1])/2;
                        r2[1] = d1;
                        r2[2] = (my_matrix[2][1]+my_matrix[1][2])/2;
@@ -320,7 +321,7 @@
                if(r2 * result < 0)
                        r2 *= -1;
                r2 = unit(r2);
-               result = angle * r2;
+               result = TooN::operator*(angle,r2);
        } 
        return result;
 }

Index: se3.h
===================================================================
RCS file: /cvsroot/toon/TooN/se3.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- se3.h       18 Apr 2010 09:49:18 -0000      1.29
+++ se3.h       3 May 2010 17:37:06 -0000       1.30
@@ -437,9 +437,9 @@
        Vector<3, Precision> rottrans = halfrotator * se3.get_translation();
        
        if(theta > 0.001){
-               rottrans -= rot * ((se3.get_translation() * rot) * (1-2*shtot) 
/ (rot*rot));
+               rottrans -= TooN::operator*(rot, ((se3.get_translation() * rot) 
* (1-2*shtot) / (rot*rot)));
        } else {
-               rottrans -= rot * ((se3.get_translation() * rot)/24);
+               rottrans -= TooN::operator*(rot, ((se3.get_translation() * 
rot)/24));
        }
        
        rottrans /= (2 * shtot);




reply via email to

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