gtsam 4.2.0
gtsam
Loading...
Searching...
No Matches
Similarity2.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#pragma once
19
20#include <gtsam/base/Lie.h>
21#include <gtsam/base/Manifold.h>
22#include <gtsam/dllexport.h>
25#include <gtsam/geometry/Rot2.h>
26
27namespace gtsam {
28
29// Forward declarations
30class Pose2;
31
35class GTSAM_EXPORT Similarity2 : public LieGroup<Similarity2, 4> {
38 typedef Rot2 Rotation;
39 typedef Point2 Translation;
41
42 private:
43 Rot2 R_;
44 Point2 t_;
45 double s_;
46
47 public:
50
53
55 Similarity2(double s);
56
58 Similarity2(const Rot2& R, const Point2& t, double s);
59
61 Similarity2(const Matrix2& R, const Vector2& t, double s);
62
64 Similarity2(const Matrix3& T);
65
69
71 bool equals(const Similarity2& sim, double tol) const;
72
74 bool operator==(const Similarity2& other) const;
75
77 void print(const std::string& s) const;
78
79 friend std::ostream& operator<<(std::ostream& os, const Similarity2& p);
80
84
86 static Similarity2 Identity();
87
89 Similarity2 operator*(const Similarity2& S) const;
90
92 Similarity2 inverse() const;
93
97
99 Point2 transformFrom(const Point2& p) const;
100
112 Pose2 transformFrom(const Pose2& T) const;
113
114 /* syntactic sugar for transformFrom */
115 Point2 operator*(const Point2& p) const;
116
120 static Similarity2 Align(const Point2Pairs& abPointPairs);
121
135 static Similarity2 Align(const Pose2Pairs& abPosePairs);
136
140
145 static Vector4 Logmap(const Similarity2& S, //
146 OptionalJacobian<4, 4> Hm = boost::none);
147
149 static Similarity2 Expmap(const Vector4& v, //
150 OptionalJacobian<4, 4> Hm = boost::none);
151
154 static Similarity2 Retract(const Vector4& v,
155 ChartJacobian H = boost::none) {
156 return Similarity2::Expmap(v, H);
157 }
158 static Vector4 Local(const Similarity2& other,
159 ChartJacobian H = boost::none) {
160 return Similarity2::Logmap(other, H);
161 }
162 };
163
165 Matrix4 AdjointMap() const;
166
167 using LieGroup<Similarity2, 4>::inverse;
168
172
174 Matrix3 matrix() const;
175
177 Rot2 rotation() const { return R_; }
178
180 Point2 translation() const { return t_; }
181
183 double scale() const { return s_; }
184
186 inline static size_t Dim() { return 4; }
187
189 inline size_t dim() const { return 4; }
190
192};
193
194template <>
195struct traits<Similarity2> : public internal::LieGroup<Similarity2> {};
196
197template <>
198struct traits<const Similarity2> : public internal::LieGroup<Similarity2> {};
199
200} // namespace gtsam
Base class and basic functions for Lie types.
Base class and basic functions for Manifold types.
2D Point
2D rotation
2D Pose
Global functions in a separate testing namespace.
Definition chartTesting.h:28
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:156
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition Point2.h:47
Vector2 Point2
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point2 to Vector2...
Definition Point2.h:27
bool operator==(const Matrix &A, const Matrix &B)
equality is just equal_with_abs_tol 1e-9
Definition Matrix.h:100
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition concepts.h:30
A CRTP helper class that implements Lie group methods Prerequisites: methods operator*,...
Definition Lie.h:37
Both LieGroupTraits and Testable.
Definition Lie.h:229
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:41
Template to create a binary predicate.
Definition Testable.h:111
A 2D pose (Point2,Rot2)
Definition Pose2.h:36
Rotation matrix NOTE: the angle theta is in radians unless explicitly stated.
Definition Rot2.h:36
2D similarity transform
Definition Similarity2.h:35
Point2 translation() const
Return a GTSAM translation.
Definition Similarity2.h:180
double scale() const
Return the scale.
Definition Similarity2.h:183
static size_t Dim()
Dimensionality of tangent space = 4 DOF - used to autodetect sizes.
Definition Similarity2.h:186
Rot2 rotation() const
Return a GTSAM rotation.
Definition Similarity2.h:177
size_t dim() const
Dimensionality of tangent space = 4 DOF.
Definition Similarity2.h:189
Chart at the origin.
Definition Similarity2.h:153