gtsam
Loading...
Searching...
No Matches
Similarity3.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
18
19#pragma once
20
21#include <gtsam/base/Lie.h>
22#include <gtsam/base/Manifold.h>
23#include <gtsam/dllexport.h>
26#include <gtsam/geometry/Rot3.h>
27
28namespace gtsam {
29
30// Forward declarations
31class Pose3;
32
36class GTSAM_EXPORT Similarity3 : public MatrixLieGroup<Similarity3, 7, 4> {
37 public:
40 typedef Rot3 Rotation;
41 typedef Point3 Translation;
43
44 using Vector16 = Eigen::Matrix<double, 16, 1>;
45
46 private:
47 Rot3 R_;
48 Point3 t_;
49 double s_;
50
51 public:
54
57
59 Similarity3(double s);
60
62 Similarity3(const Rot3& R, const Point3& t, double s);
63
65 Similarity3(const Matrix3& R, const Vector3& t, double s);
66
68 Similarity3(const Matrix4& T);
69
70
71
75
77 bool equals(const Similarity3& sim, double tol) const;
78
80 bool operator==(const Similarity3& other) const;
81
83 void print(const std::string& s = "") const;
84
85 GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
86 const Similarity3& p);
87
91
93 static Similarity3 Identity();
94
96 Similarity3 operator*(const Similarity3& S) const;
97
99 Similarity3 inverse() const;
100
104
106 Point3 transformFrom(const Point3& p, //
107 OptionalJacobian<3, 7> H1 = {}, //
108 OptionalJacobian<3, 3> H2 = {}) const;
109
121 Pose3 transformFrom(const Pose3& T,
122 OptionalJacobian<6, 7> H1 = {}, //
123 OptionalJacobian<6, 6> H2 = {}) const;
124
126 Point3 operator*(const Point3& p) const;
127
131 static Similarity3 Align(const Point3Pairs& abPointPairs);
132
143 static Similarity3 Align(const Pose3Pairs& abPosePairs);
144
148
149 using LieAlgebra = Matrix4;
150
154 static Vector7 Logmap(const Similarity3& s);
155
158 static Similarity3 Expmap(const Vector7& v);
159
162 static Similarity3 Retract(const Vector7& v) {
163 return Similarity3::Expmap(v);
164 }
165 static Vector7 Local(const Similarity3& other) {
166 return Similarity3::Logmap(other);
167 }
168 };
169
171
173 Matrix7 AdjointMap() const;
174
176 static Matrix7 adjointMap(const Vector7& xi);
177
183 static Matrix4 Hat(const Vector7& xi);
184
186 static Vector7 Vee(const Matrix4& X);
187
191
193 Matrix4 matrix() const;
194
196 Rot3 rotation(OptionalJacobian<3, 7> Hself = {}) const;
197
199 Point3 translation(OptionalJacobian<3, 7> Hself = {}) const;
200
202 double scale(OptionalJacobian<1, 7> Hself = {}) const;
203
207
208#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
210 static Matrix4 wedge(const Vector7& xi) {
211 return Similarity3::Hat(xi);
212 }
213#endif
214
218
219 private:
220
221 #if GTSAM_ENABLE_BOOST_SERIALIZATION
223 friend class boost::serialization::access;
224 template<class Archive>
225 void serialize(Archive & ar, const unsigned int /*version*/) {
226 ar & BOOST_SERIALIZATION_NVP(R_);
227 ar & BOOST_SERIALIZATION_NVP(t_);
228 ar & BOOST_SERIALIZATION_NVP(s_);
229 }
230 #endif
231
233 static Matrix3 GetV(Vector3 w, double lambda);
234
236};
237
238#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
240template <>
241inline Matrix wedge<Similarity3>(const Vector& xi) {
242 return Similarity3::Hat(xi);
243}
244#endif
245template <>
246struct traits<Similarity3> : public internal::MatrixLieGroup<Similarity3, 4> {};
247
248template <>
249struct traits<const Similarity3> : public internal::MatrixLieGroup<Similarity3, 4> {};
250
251} // namespace gtsam
Base class and basic functions for Manifold types.
Base class and basic functions for Lie types.
3D Point
3D Pose manifold SO(3) x R^3 and group SE(3)
3D rotation represented as a rotation matrix or quaternion
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:38
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A CRTP helper class that implements Lie group methods Prerequisites: methods operator*,...
Definition Lie.h:114
A CRTP helper class that implements matrix Lie group methods.
Definition MatrixLieGroup.h:51
Both LieGroupTraits and Testable.
Definition MatrixLieGroup.h:350
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65
3D similarity transform
Definition Similarity3.h:36
Matrix7 AdjointMap() const
Project from one tangent space to another.
Definition Similarity3.cpp:260
void print(const std::string &s="") const
Print with optional string.
Definition Similarity3.cpp:114
static Similarity3 Identity()
Return an identity transform.
Definition Similarity3.cpp:144
static Similarity3 Expmap(const Vector7 &v)
Exponential map at the identity.
Definition Similarity3.cpp:355
Similarity3 inverse() const
Return the inverse.
Definition Similarity3.cpp:151
static Similarity3 Align(const Point3Pairs &abPointPairs)
Create Similarity3 by aligning at least three point pairs.
Definition Similarity3.cpp:207
Similarity3()
Default constructor.
Definition Similarity3.cpp:85
Rot3 rotation(OptionalJacobian< 3, 7 > Hself={}) const
Return a rotation.
Definition Similarity3.cpp:121
static Matrix4 Hat(const Vector7 &xi)
Hat for Similarity3:
Definition Similarity3.cpp:242
Point3 transformFrom(const Point3 &p, OptionalJacobian< 3, 7 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
Action on a point p is s*(R*p+t).
Definition Similarity3.cpp:157
static Vector7 Vee(const Matrix4 &X)
Vee maps from Lie algebra to tangent vector.
Definition Similarity3.cpp:252
Matrix4 matrix() const
Calculate 4*4 matrix group equivalent.
Definition Similarity3.cpp:375
bool equals(const Similarity3 &sim, double tol) const
Compare with tolerance.
Definition Similarity3.cpp:105
static Matrix7 adjointMap(const Vector7 &xi)
Compute the Lie algebra adjoint map associated with a tangent vector.
Definition Similarity3.cpp:272
Similarity3 operator*(const Similarity3 &S) const
Composition.
Definition Similarity3.cpp:147
static Vector7 Logmap(const Similarity3 &s)
Log map at the identity .
Definition Similarity3.cpp:345
bool operator==(const Similarity3 &other) const
Exact equality.
Definition Similarity3.cpp:110
Chart at the origin.
Definition Similarity3.h:161