toon-members
[Top][All Lists]
Advanced

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

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


From: Ethan Eade
Subject: [Toon-members] TooN so3.h se3.h
Date: Fri, 23 Jun 2006 13:57:51 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Ethan Eade <ethaneade>  06/06/23 13:57:51

Modified files:
        .              : so3.h se3.h 

Log message:
        Added some (private) constructors to SO3 and SE3 that allow the 
compiler to perform
        return value optimization.  These achieve the goal that I had been 
looking
        for with the SE3::Product type, without the hassle and complexity.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/so3.h?cvsroot=toon&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/TooN/se3.h?cvsroot=toon&r1=1.13&r2=1.14

Patches:
Index: so3.h
===================================================================
RCS file: /cvsroot/toon/TooN/so3.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- so3.h       14 Jun 2006 11:46:23 -0000      1.14
+++ so3.h       23 Jun 2006 13:57:51 -0000      1.15
@@ -58,7 +58,7 @@
   }
 
   inline SO3 operator *(const SO3& rhs) const {
-      return SO3(*this)*=rhs;
+      return SO3(*this,rhs);
   }
 
   inline const Matrix<3>& get_matrix()const {return my_matrix;}
@@ -70,6 +70,10 @@
   inline Vector<3> adjoint(Vector<3> vect) const ;
 
  private:
+  struct Invert {};
+  inline SO3(const SO3& so3, const Invert&) : my_matrix(so3.my_matrix.T()) {}
+  inline SO3(const SO3& a, const SO3& b) : my_matrix(a.my_matrix*b.my_matrix) 
{}
+      
   Matrix<3> my_matrix;
 };
 
@@ -279,9 +283,7 @@
 }
 
 inline SO3 SO3::inverse() const{
-  SO3 result;
-  result.my_matrix = my_matrix.T();
-  return result;
+    return SO3(*this, Invert());
 }
 
 

Index: se3.h
===================================================================
RCS file: /cvsroot/toon/TooN/se3.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- se3.h       9 Jun 2006 13:02:19 -0000       1.13
+++ se3.h       23 Jun 2006 13:57:51 -0000      1.14
@@ -299,12 +299,8 @@
 }
 
 inline SE3 SE3::inverse() const {
-  SE3 result;
-  result.my_rotation = my_rotation.inverse();
-  result.my_translation = result.my_rotation * my_translation;
-  result.my_translation *= -1;
-
-  return result;
+    const SO3& rinv = my_rotation.inverse();
+    return SE3(rinv, -(rinv*my_translation));
 }
 
 inline SE3& SE3::left_multiply_by(const SE3& left) {




reply via email to

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