g2o
line3d_test.cpp
Go to the documentation of this file.
1 #include "line3d.h"
4 #include <iostream>
5 
6 using namespace std;
7 using namespace Eigen;
8 using namespace g2o;
9 using namespace g2o::internal;
10 
11 template <typename T>
12 ostream& printVector(ostream& os, const T& t)
13 {
14  for (int i=0; i<t.rows(); i++){
15  os << t(i) << " ";
16  }
17  return os;
18 }
19 
20 int main(int , char** )
21 {
22  Vector6d t;
23  t << -3, -2, -4, .2, .1, .3;
25  cout << "transform" << endl;
26  cout << T.matrix() << endl;
27 
28  Vector6d cl1;
29  cl1 << 20, 50, -70, .1, .2, .3;
30  cl1 =normalizeCartesianLine(cl1);
31  cout << "cartesian line L1: "; printVector(cout, cl1); cout << endl;
32  Line3D pl1 = Line3D::fromCartesian(cl1);
33  cout << "pluecker line L1: "; printVector(cout, pl1); cout << endl;
34  cout << "cartesian line L1, reconstructed from puecker: "; printVector(cout, pl1.toCartesian()); cout << endl;
35 
37  Line3D pl2 = T*pl1;;
38 
39  cout << "transformed line L2: "; printVector(cout, cl2); cout << endl;
40  cout << "transformed pline L2: "; printVector(cout, pl2); cout << endl;
41  cout << "error of cartesian line L2, reconstructed from puecker: "; printVector(cout, cl2 - pl2.toCartesian());
42  cout << endl;
43 
44  return 0;
45 }
Vector6d transformCartesianLine(const Isometry3D &t, const Vector6d &line)
Definition: line3d.cpp:108
ostream & printVector(ostream &os, const T &t)
Definition: line3d_test.cpp:12
int main(int, char **)
Definition: line3d_test.cpp:20
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3D
Definition: eigen_types.h:66
G2O_TYPES_SLAM3D_ADDONS_API Vector6d toCartesian() const
Definition: line3d.cpp:51
Eigen::Matrix< double, 6, 1 > Vector6d
Isometry3D fromVectorMQT(const Vector6d &v)
Vector6d normalizeCartesianLine(const Vector6d &line)
Definition: line3d.cpp:115