toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN se2.h se3.h internal/operators.hh


From: Edward Rosten
Subject: [Toon-members] TooN se2.h se3.h internal/operators.hh
Date: Mon, 14 Jun 2010 16:48:26 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        10/06/14 16:48:26

Modified files:
        .              : se2.h se3.h 
        internal       : operators.hh 

Log message:
        Patch from Pekka Paalanen <paalanen at lut dot fi> to make formatting
        widths work properly.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/se2.h?cvsroot=toon&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/TooN/se3.h?cvsroot=toon&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/operators.hh?cvsroot=toon&r1=1.48&r2=1.49

Patches:
Index: se2.h
===================================================================
RCS file: /cvsroot/toon/TooN/se2.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- se2.h       18 Apr 2010 09:49:18 -0000      1.9
+++ se2.h       14 Jun 2010 16:48:23 -0000      1.10
@@ -144,8 +144,13 @@
 /// @relates SE2
 template <class Precision>
 inline std::ostream& operator<<(std::ostream& os, const SE2<Precision> & rhs){
-       for(int i=0; i<2; i++)
-               os << rhs.get_rotation().get_matrix()[i] << 
rhs.get_translation()[i] << std::endl;
+       std::streamsize fw = os.width();
+       for(int i=0; i<2; i++){
+               os.width(fw);
+               os << rhs.get_rotation().get_matrix()[i];
+               os.width(fw);
+               os << rhs.get_translation()[i] << '\n';
+       }
        return os;
 }
 

Index: se3.h
===================================================================
RCS file: /cvsroot/toon/TooN/se3.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- se3.h       3 May 2010 17:37:06 -0000       1.30
+++ se3.h       14 Jun 2010 16:48:26 -0000      1.31
@@ -224,8 +224,12 @@
 /// @relates SE3
 template <typename Precision>
 inline std::ostream& operator <<(std::ostream& os, const SE3<Precision>& rhs){
+       std::streamsize fw = os.width();
        for(int i=0; i<3; i++){
-               os << rhs.get_rotation().get_matrix()[i] << 
rhs.get_translation()[i] << std::endl;
+               os.width(fw);
+               os << rhs.get_rotation().get_matrix()[i];
+               os.width(fw);
+               os << rhs.get_translation()[i] << '\n';
        }
        return os;
 }

Index: internal/operators.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/operators.hh,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- internal/operators.hh       5 Feb 2010 02:19:34 -0000       1.48
+++ internal/operators.hh       14 Jun 2010 16:48:26 -0000      1.49
@@ -644,7 +644,9 @@
 // output operator <<
 template <int Size, typename Precision, typename Base>
 inline std::ostream& operator<< (std::ostream& os, const 
Vector<Size,Precision,Base>& v){
+  std::streamsize fw = os.width();
   for(int i=0; i<v.size(); i++){
+    os.width(fw);
     os << v[i] << " ";
   }
   return os;
@@ -661,12 +663,14 @@
 
 template<int Rows, int Cols, typename Precision, class Base>
 inline std::ostream& operator<< (std::ostream& os, const Matrix<Rows, Cols, 
Precision, Base>& m){
+       std::streamsize fw = os.width();
        for(int i=0; i < m.num_rows(); i++)
        {
                for(int j=0; j < m.num_cols(); j++)
                {
                        if(j != 0)
                                os << " ";
+                       os.width(fw);
                        os << m(i,j);
                }
                os << std::endl;



reply via email to

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