g2o
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
g2o::Line3D Class Reference

#include <line3d.h>

Inheritance diagram for g2o::Line3D:
Inheritance graph
[legend]
Collaboration diagram for g2o::Line3D:
Collaboration graph
[legend]

Public Member Functions

 Line3D ()
 
G2O_TYPES_SLAM3D_ADDONS_API Line3D (const Vector6d &v)
 
G2O_TYPES_SLAM3D_ADDONS_API Vector6d toCartesian () const
 
G2O_TYPES_SLAM3D_ADDONS_API Vector3D w () const
 
G2O_TYPES_SLAM3D_ADDONS_API Vector3D d () const
 
G2O_TYPES_SLAM3D_ADDONS_API void setW (const Vector3D &w_)
 
G2O_TYPES_SLAM3D_ADDONS_API void setD (const Vector3D &d_)
 
G2O_TYPES_SLAM3D_ADDONS_API void normalize ()
 
G2O_TYPES_SLAM3D_ADDONS_API Line3D normalized () const
 
G2O_TYPES_SLAM3D_ADDONS_API void oplus (const Vector6d &v)
 
G2O_TYPES_SLAM3D_ADDONS_API Vector6d ominus (const Line3D &line)
 

Static Public Member Functions

static G2O_TYPES_SLAM3D_ADDONS_API Line3D fromCartesian (const Vector6d &cart)
 
static G2O_TYPES_SLAM3D_ADDONS_API void jacobian (Matrix7x6d &Jp, Matrix7x6d &Jl, const Isometry3D &x, const Line3D &l)
 

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Friends

G2O_TYPES_SLAM3D_ADDONS_API friend Line3D operator* (const Isometry3D &t, const Line3D &line)
 

Detailed Description

Definition at line 44 of file line3d.h.

Constructor & Destructor Documentation

g2o::Line3D::Line3D ( )
inline

Definition at line 48 of file line3d.h.

Referenced by normalized().

48  {
49  *this << 0., 0., 0., 1., 0., 0.;
50  }
G2O_TYPES_SLAM3D_ADDONS_API g2o::Line3D::Line3D ( const Vector6d v)
inline

Definition at line 52 of file line3d.h.

References G2O_TYPES_SLAM3D_ADDONS_API, and toCartesian().

52  {
53  (Vector6d&)*this = v;
54  }
Eigen::Matrix< double, 6, 1 > Vector6d

Member Function Documentation

G2O_TYPES_SLAM3D_ADDONS_API Vector3D g2o::Line3D::d ( ) const
inline

Definition at line 62 of file line3d.h.

Referenced by jacobian(), normalize(), and normalized().

62  {
63  return tail<3>();
64  }
static G2O_TYPES_SLAM3D_ADDONS_API Line3D g2o::Line3D::fromCartesian ( const Vector6d cart)
inlinestatic

Definition at line 74 of file line3d.h.

References setD(), and setW().

74  {
75  Line3D l;
76  Vector3D _d= cart.tail<3>() * 1./cart.tail<3>().norm();
77  Vector3D _p= cart.head<3>();
78  _p -= _d*(_d.dot(_p));
79  l.setW(_p.cross(_p+_d));
80  l.setD(_d);
81  return l;
82  }
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Definition: eigen_types.h:46
Line3D()
Definition: line3d.h:48
void g2o::Line3D::jacobian ( Matrix7x6d Jp,
Matrix7x6d Jl,
const Isometry3D x,
const Line3D l 
)
static

Definition at line 61 of file line3d.cpp.

References g2o::_skew(), d(), and w().

Referenced by ominus().

61  {
62  Jp.setZero();
63  Jl.setZero();
64  Matrix6d A=Matrix6d::Zero();
65  A.block<3,3>(0,0)=x.linear();
66  A.block<3,3>(0,3)= _skew(x.translation())*x.linear();
67  A.block<3,3>(3,3)=x.linear();
68  Vector6d v=(Vector6d)l;
69  Line3D lRemapped(v);
70 
71  Matrix6d D = Matrix6d::Zero();
72  D.block<3,3>(0,0) = -_skew(l.d());
73  D.block<3,3>(0,3) = -2*_skew(l.w());
74  D.block<3,3>(3,3) = -2*_skew(l.d());
75  Jp.block<6,6>(0,0) = A*D;
76 
77  Vector3D d = l.d();
78  Vector3D w = l.w();
79  double ln = d.norm();
80  double iln = 1./ln;
81  double iln3 = std::pow(iln,3);
82  Matrix6d Jll;
83  Jll <<
84  iln,0,0,-(w.x()*d.x())*iln3,-(w.x()*d.y())*iln3,-(w.x()*d.z())*iln3,
85  0,iln,0,-(w.y()*d.x())*iln3,-(w.y()*d.y())*iln3,-(w.y()*d.z())*iln3,
86  0,0,iln,-(w.z()*d.x())*iln3,-(w.z()*d.y())*iln3,-(w.z()*d.z())*iln3,
87  0,0,0,-(d.x()*d.x()-ln*ln)*iln3,-(d.x()*d.y())*iln3,-(d.x()*d.z())*iln3,
88  0,0,0,-(d.x()*d.y())*iln3,-(d.y()*d.y()-ln*ln)*iln3,-(d.y()*d.z())*iln3,
89  0,0,0,-(d.x()*d.z())*iln3,-(d.y()*d.z())*iln3,-(d.z()*d.z()-ln*ln)*iln3;
90  Jl.block<6,6>(0,0) = A*Jll;
91  Jl.block<1,6>(6,0) << 2*d.x(),2*d.y(),2*d.z();
92  }
G2O_TYPES_SLAM3D_ADDONS_API Vector3D w() const
Definition: line3d.h:58
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Definition: eigen_types.h:46
G2O_TYPES_SLAM3D_ADDONS_API Vector3D d() const
Definition: line3d.h:62
Eigen::Matrix< double, 6, 6 > Matrix6d
static void _skew(Matrix3D &S, const Vector3D &t)
Definition: line3d.cpp:34
Line3D()
Definition: line3d.h:48
Eigen::Matrix< double, 6, 1 > Vector6d
Matrix< double, 6, 1, Eigen::ColMajor > Vector6d
Definition: types_icp.cpp:75
G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::normalize ( )
inline

Definition at line 84 of file line3d.h.

References d().

Referenced by g2o::EdgeSE3Line3D::computeError(), and oplus().

84  {
85  double n = 1./d().norm();
86  (*this)*=n;
87  }
G2O_TYPES_SLAM3D_ADDONS_API Vector3D d() const
Definition: line3d.h:62
G2O_TYPES_SLAM3D_ADDONS_API Line3D g2o::Line3D::normalized ( ) const
inline

Definition at line 89 of file line3d.h.

References d(), and Line3D().

89  {
90  return Line3D((Vector6d)(*this)*(1./d().norm()));
91  }
G2O_TYPES_SLAM3D_ADDONS_API Vector3D d() const
Definition: line3d.h:62
Line3D()
Definition: line3d.h:48
Eigen::Matrix< double, 6, 1 > Vector6d
G2O_TYPES_SLAM3D_ADDONS_API Vector6d g2o::Line3D::ominus ( const Line3D line)
inline

Definition at line 98 of file line3d.h.

References G2O_TYPES_SLAM3D_ADDONS_API, jacobian(), g2o::internal::normalizeCartesianLine(), operator*, and g2o::internal::transformCartesianLine().

98  {
99  return (Vector6d)(*this)-line;
100  }
Eigen::Matrix< double, 6, 1 > Vector6d
G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::oplus ( const Vector6d v)
inline

Definition at line 93 of file line3d.h.

References normalize().

93  {
94  *this+=v;
95  normalize();
96  }
G2O_TYPES_SLAM3D_ADDONS_API void normalize()
Definition: line3d.h:84
G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::setD ( const Vector3D d_)
inline

Definition at line 70 of file line3d.h.

Referenced by fromCartesian().

70  {
71  tail<3>()=d_;
72  }
G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::setW ( const Vector3D w_)
inline

Definition at line 66 of file line3d.h.

Referenced by fromCartesian().

66  {
67  head<3>()=w_;
68  }
Vector6d g2o::Line3D::toCartesian ( ) const

Definition at line 51 of file line3d.cpp.

References g2o::_skew().

Referenced by Line3D(), and main().

51  {
52  Vector6d cartesian;
53  cartesian.tail<3>() = d()/d().norm();
54  Matrix3D W=-_skew(d());
55  double damping = 1e-9;
56  Matrix3D A = W.transpose()*W+(Matrix3D::Identity()*damping);
57  cartesian.head<3>() = A.ldlt().solve(W.transpose()*w());
58  return cartesian;
59  }
G2O_TYPES_SLAM3D_ADDONS_API Vector3D w() const
Definition: line3d.h:58
G2O_TYPES_SLAM3D_ADDONS_API Vector3D d() const
Definition: line3d.h:62
Eigen::Matrix< double, 3, 3, Eigen::ColMajor > Matrix3D
Definition: eigen_types.h:61
static void _skew(Matrix3D &S, const Vector3D &t)
Definition: line3d.cpp:34
Eigen::Matrix< double, 6, 1 > Vector6d
G2O_TYPES_SLAM3D_ADDONS_API Vector3D g2o::Line3D::w ( ) const
inline

Definition at line 58 of file line3d.h.

Referenced by jacobian().

58  {
59  return head<3>();
60  }

Friends And Related Function Documentation

G2O_TYPES_SLAM3D_ADDONS_API friend Line3D operator* ( const Isometry3D t,
const Line3D line 
)
friend

Definition at line 94 of file line3d.cpp.

Referenced by ominus().

94  {
95  Matrix6d A=Matrix6d::Zero();
96  A.block<3,3>(0,0)=t.linear();
97  A.block<3,3>(0,3)= _skew(t.translation())*t.linear();
98  A.block<3,3>(3,3)=t.linear();
99  Vector6d v = (Vector6d)line;
100  // cout << "v" << endl << v << endl;
101  // cout << "A" << endl << A << endl;
102  // cout << "Av" << endl << A*v << endl;
103  return Line3D(A*v);
104  }
Eigen::Matrix< double, 6, 6 > Matrix6d
static void _skew(Matrix3D &S, const Vector3D &t)
Definition: line3d.cpp:34
Line3D()
Definition: line3d.h:48
Eigen::Matrix< double, 6, 1 > Vector6d
Matrix< double, 6, 1, Eigen::ColMajor > Vector6d
Definition: types_icp.cpp:75

Member Data Documentation

g2o::Line3D::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 46 of file line3d.h.


The documentation for this class was generated from the following files: