g2o
Loading...
Searching...
No Matches
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

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

Static Public Member Functions

static G2O_TYPES_SLAM3D_ADDONS_API Line3D fromCartesian (const Vector6 &cart)
 
static G2O_TYPES_SLAM3D_ADDONS_API Line3D fromOrthonormal (const OrthonormalLine3D &ortho)
 
static G2O_TYPES_SLAM3D_ADDONS_API OrthonormalLine3D toOrthonormal (const Line3D &line)
 

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Friends

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

Detailed Description

Definition at line 53 of file line3d.h.

Constructor & Destructor Documentation

◆ Line3D() [1/2]

G2O_TYPES_SLAM3D_ADDONS_API g2o::Line3D::Line3D ( )
inline

Definition at line 60 of file line3d.h.

60 {
61 *this << 0.0, 0.0, 0.0, 1.0, 0.0, 0.0;
62 }

Referenced by normalized().

◆ Line3D() [2/2]

G2O_TYPES_SLAM3D_ADDONS_API g2o::Line3D::Line3D ( const Vector6 v)
inline

Definition at line 64 of file line3d.h.

64{ (Vector6&)* this = v; }
VectorN< 6 > Vector6
Definition eigen_types.h:53

Member Function Documentation

◆ d()

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

Definition at line 70 of file line3d.h.

70{ return tail<3>(); }

Referenced by fromOrthonormal(), main(), normalize(), normalized(), printPlueckerLine(), toCartesian(), and toOrthonormal().

◆ fromCartesian()

static G2O_TYPES_SLAM3D_ADDONS_API Line3D g2o::Line3D::fromCartesian ( const Vector6 cart)
inlinestatic

Definition at line 80 of file line3d.h.

81 {
82 Line3D l;
83 Vector3 _p = cart.head<3>();
84 Vector3 _d = cart.tail<3>() * 1.0 / cart.tail<3>().norm();
85 _p -= _d * (_d.dot(_p));
86 l.setW(_p.cross(_p + _d));
87 l.setD(_d);
88 return l;
89 }
G2O_TYPES_SLAM3D_ADDONS_API Line3D()
Definition line3d.h:60
VectorN< 3 > Vector3
Definition eigen_types.h:51

References setD(), and setW().

Referenced by main().

◆ fromOrthonormal()

static G2O_TYPES_SLAM3D_ADDONS_API Line3D g2o::Line3D::fromOrthonormal ( const OrthonormalLine3D ortho)
inlinestatic

Definition at line 91 of file line3d.h.

92 {
93 Vector3 w;
94 w.x() = ortho.U(0, 0) * ortho.W(0, 0);
95 w.y() = ortho.U(1, 0) * ortho.W(0, 0);
96 w.z() = ortho.U(2, 0) * ortho.W(0, 0);
97
98 Vector3 d;
99 d.x() = ortho.U(0, 1) * ortho.W(1, 0);
100 d.y() = ortho.U(1, 1) * ortho.W(1, 0);
101 d.z() = ortho.U(2, 1) * ortho.W(1, 0);
102
103 Line3D l;
104 l.setW(w);
105 l.setD(d);
106 l.normalize();
107
108 return l;
109 }
G2O_TYPES_SLAM3D_ADDONS_API Vector3 w() const
Definition line3d.h:68
G2O_TYPES_SLAM3D_ADDONS_API Vector3 d() const
Definition line3d.h:70

References d(), normalize(), setD(), setW(), g2o::OrthonormalLine3D::U, g2o::OrthonormalLine3D::W, and w().

Referenced by oplus().

◆ normalize()

G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::normalize ( )
inline

Definition at line 133 of file line3d.h.

133 {
134 double n = 1.0 / d().norm();
135 (*this) *= n;
136 }

References d().

Referenced by fromOrthonormal(), main(), and oplus().

◆ normalized()

G2O_TYPES_SLAM3D_ADDONS_API Line3D g2o::Line3D::normalized ( ) const
inline

Definition at line 138 of file line3d.h.

138 {
139 return Line3D((Vector6)(*this) * (1.0 / d().norm()));
140 }

References d(), and Line3D().

◆ ominus()

G2O_TYPES_SLAM3D_ADDONS_API Vector4 g2o::Line3D::ominus ( const Line3D line)
inline

Definition at line 158 of file line3d.h.

158 {
159 OrthonormalLine3D ortho_estimate = toOrthonormal(*this);
160 OrthonormalLine3D ortho_line = toOrthonormal(line);
161
162 Matrix2 W_delta = ortho_estimate.W.transpose() * ortho_line.W;
163 Matrix3 U_delta = ortho_estimate.U.transpose() * ortho_line.U;
164
165 Vector4 delta;
166 Quaternion q(U_delta);
167 q.normalize();
168 delta[0] = q.x();
169 delta[1] = q.y();
170 delta[2] = q.z();
171 delta[3] = std::atan2(W_delta(1, 0), W_delta(0, 0));
172
173 return delta;
174 }
static G2O_TYPES_SLAM3D_ADDONS_API OrthonormalLine3D toOrthonormal(const Line3D &line)
Definition line3d.h:111
struct OrthonormalLine3D OrthonormalLine3D
Definition line3d.h:51
MatrixN< 3 > Matrix3
Definition eigen_types.h:72
VectorN< 4 > Vector4
Definition eigen_types.h:52
MatrixN< 2 > Matrix2
Definition eigen_types.h:71
Eigen::Quaternion< double > Quaternion
Definition eigen_types.h:81

References toOrthonormal(), g2o::OrthonormalLine3D::U, and g2o::OrthonormalLine3D::W.

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

◆ oplus()

G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::oplus ( const Vector4 v)
inline

Definition at line 142 of file line3d.h.

142 {
143 OrthonormalLine3D ortho_estimate = toOrthonormal(*this);
144 OrthonormalLine3D ortho_update;
145 ortho_update.W << std::cos(v[3]), -std::sin(v[3]), std::sin(v[3]),
146 std::cos(v[3]);
147 Quaternion quat(std::sqrt(1 - v.head<3>().squaredNorm()), v[0], v[1], v[2]);
148 quat.normalize();
149 ortho_update.U = quat.toRotationMatrix();
150
151 ortho_estimate.U = ortho_estimate.U * ortho_update.U;
152 ortho_estimate.W = ortho_estimate.W * ortho_update.W;
153
154 *this = fromOrthonormal(ortho_estimate);
155 this->normalize();
156 }
G2O_TYPES_SLAM3D_ADDONS_API void normalize()
Definition line3d.h:133
static G2O_TYPES_SLAM3D_ADDONS_API Line3D fromOrthonormal(const OrthonormalLine3D &ortho)
Definition line3d.h:91

References fromOrthonormal(), normalize(), toOrthonormal(), g2o::OrthonormalLine3D::U, and g2o::OrthonormalLine3D::W.

Referenced by main(), and LineSensor::sense().

◆ setD()

G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::setD ( const Vector3 d_)
inline

Definition at line 76 of file line3d.h.

76 {
77 tail<3>() = d_;
78 }

Referenced by fromCartesian(), and fromOrthonormal().

◆ setW()

G2O_TYPES_SLAM3D_ADDONS_API void g2o::Line3D::setW ( const Vector3 w_)
inline

Definition at line 72 of file line3d.h.

72 {
73 head<3>() = w_;
74 }

Referenced by fromCartesian(), and fromOrthonormal().

◆ toCartesian()

Vector6 g2o::Line3D::toCartesian ( ) const

Definition at line 41 of file line3d.cpp.

41 {
42 Vector6 cartesian;
43 cartesian.tail<3>() = d() / d().norm();
44 Matrix3 W = -_skew(d());
45 double damping = cst(1e-9);
46 Matrix3 A = W.transpose() * W + (Matrix3::Identity() * damping);
47 cartesian.head<3>() = A.ldlt().solve(W.transpose() * w());
48 return cartesian;
49}
static Matrix3 _skew(const Vector3 &t)
Definition line3d.cpp:35
constexpr double cst(long double v)
Definition misc.h:60

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

◆ toOrthonormal()

static G2O_TYPES_SLAM3D_ADDONS_API OrthonormalLine3D g2o::Line3D::toOrthonormal ( const Line3D line)
inlinestatic

Definition at line 111 of file line3d.h.

112 {
113 OrthonormalLine3D ortho;
114
115 Vector2 mags;
116 mags << line.d().norm(), line.w().norm();
117
118 double wn = 1.0 / mags.norm();
119 ortho.W << mags.y() * wn, -mags.x() * wn, mags.x() * wn, mags.y() * wn;
120
121 double mn = 1.0 / mags.y();
122 double dn = 1.0 / mags.x();
123 Vector3 mdcross;
124 mdcross = line.w().cross(line.d());
125 double mdcrossn = 1.0 / mdcross.norm();
126 ortho.U << line.w().x() * mn, line.d().x() * dn, mdcross.x() * mdcrossn,
127 line.w().y() * mn, line.d().y() * dn, mdcross.y() * mdcrossn,
128 line.w().z() * mn, line.d().z() * dn, mdcross.z() * mdcrossn;
129
130 return ortho;
131 }
VectorN< 2 > Vector2
Definition eigen_types.h:50

References d(), g2o::OrthonormalLine3D::U, g2o::OrthonormalLine3D::W, and w().

Referenced by ominus(), and oplus().

◆ w()

G2O_TYPES_SLAM3D_ADDONS_API Vector3 g2o::Line3D::w ( ) const
inline

Definition at line 68 of file line3d.h.

68{ return head<3>(); }

Referenced by fromOrthonormal(), main(), printPlueckerLine(), toCartesian(), and toOrthonormal().

Friends And Related Symbol Documentation

◆ operator*

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

Definition at line 51 of file line3d.cpp.

51 {
52 Matrix6 A = Matrix6::Zero();
53 A.block<3, 3>(0, 0) = t.linear();
54 A.block<3, 3>(0, 3) = _skew(t.translation()) * t.linear();
55 A.block<3, 3>(3, 3) = t.linear();
56 Vector6 v = (Vector6)line;
57 return Line3D(A * v);
58}
Eigen::Matrix< double, 6, 6 > Matrix6
Definition line3d.h:38

Member Data Documentation

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

g2o::Line3D::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 55 of file line3d.h.


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