Skip to content

Commit f8099c1

Browse files
committed
Review
1 parent e5bce6c commit f8099c1

File tree

5 files changed

+28
-33
lines changed

5 files changed

+28
-33
lines changed

gtsam/geometry/Similarity2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Matrix2 Similarity2::GetV(double theta, double lambda) {
215215
return V;
216216
}
217217

218-
// general Sim(2) case ---------------------------------------------
218+
// general Sim(2) case
219219
const double d2 = lambda2 + theta2;
220220
if (d2 < 1e-15) // both tiny → identity
221221
return Matrix2::Identity();

gtsam/geometry/Similarity3.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -296,29 +296,29 @@ Matrix4 Similarity3::matrix() const {
296296
}
297297

298298
namespace {
299-
// The 16x7 matrix of vectorized generators for Sim(3).
299+
// The 16x7 matrix of vectorized generators for Sim(3).
300300
// The columns correspond to perturbations in [w_x, w_y, w_z, u_x, u_y, u_z, lambda].
301301
// P_sim3 = [vec(G_wx), vec(G_wy), vec(G_wz), vec(G_ux), vec(G_uy), vec(G_uz), vec(G_lambda)]
302302
static const Eigen::Matrix<double, 16, 7> P_sim3 =
303-
(Eigen::Matrix<double, 16, 7>() <<
304-
// wx, wy, wz, ux, uy, uz, la
305-
0, 0, 0, 0, 0, 0, 0,
306-
0, 0, 1, 0, 0, 0, 0,
307-
0, -1, 0, 0, 0, 0, 0,
308-
0, 0, 0, 0, 0, 0, 0,
309-
0, 0, -1, 0, 0, 0, 0,
310-
0, 0, 0, 0, 0, 0, 0,
311-
1, 0, 0, 0, 0, 0, 0,
312-
0, 0, 0, 0, 0, 0, 0,
313-
0, 1, 0, 0, 0, 0, 0,
314-
-1, 0, 0, 0, 0, 0, 0,
315-
0, 0, 0, 0, 0, 0, 0,
316-
0, 0, 0, 0, 0, 0, 0,
317-
0, 0, 0, 1, 0, 0, 0,
318-
0, 0, 0, 0, 1, 0, 0,
319-
0, 0, 0, 0, 0, 1, 0,
320-
0, 0, 0, 0, 0, 0, -1
321-
).finished();
303+
(Eigen::Matrix<double, 16, 7>() <<
304+
// wx, wy, wz, ux, uy, uz, la
305+
0, 0, 0, 0, 0, 0, 0,
306+
0, 0, 1, 0, 0, 0, 0,
307+
0, -1, 0, 0, 0, 0, 0,
308+
0, 0, 0, 0, 0, 0, 0,
309+
0, 0, -1, 0, 0, 0, 0,
310+
0, 0, 0, 0, 0, 0, 0,
311+
1, 0, 0, 0, 0, 0, 0,
312+
0, 0, 0, 0, 0, 0, 0,
313+
0, 1, 0, 0, 0, 0, 0,
314+
-1, 0, 0, 0, 0, 0, 0,
315+
0, 0, 0, 0, 0, 0, 0,
316+
0, 0, 0, 0, 0, 0, 0,
317+
0, 0, 0, 1, 0, 0, 0,
318+
0, 0, 0, 0, 1, 0, 0,
319+
0, 0, 0, 0, 0, 1, 0,
320+
0, 0, 0, 0, 0, 0, -1
321+
).finished();
322322
} // namespace
323323

324324
Similarity3::Vector16 Similarity3::vec(OptionalJacobian<16, 7> H) const {

gtsam/geometry/tests/testSimilarity2.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
* @author Varun Agrawal
1616
*/
1717

18-
#include <CppUnitLite/TestHarness.h>
18+
#include <gtsam/geometry/Similarity2.h>
19+
1920
#include <gtsam/base/Testable.h>
2021
#include <gtsam/base/numericalDerivative.h>
2122
#include <gtsam/base/testLie.h>
22-
#include <gtsam/geometry/Similarity2.h>
23+
#include <gtsam/base/Vector.h>
24+
25+
#include <CppUnitLite/TestHarness.h>
2326

2427
#include <functional>
28+
#include <vector>
2529

2630
using namespace std::placeholders;
2731
using namespace gtsam;
@@ -205,13 +209,6 @@ TEST(Similarity2, vec) {
205209
EXPECT(assert_equal(H_numerical, H_actual, 1e-7));
206210
}
207211

208-
// In testSimilarity2.cpp
209-
210-
#include <gtsam/base/Vector.h> // For Vector4
211-
#include <vector> // For std::vector
212-
213-
// ... other tests ...
214-
215212
//******************************************************************************
216213
TEST(Similarity2, AdjointMap) {
217214
// Create a non-trivial Similarity2 object
@@ -227,7 +224,6 @@ TEST(Similarity2, AdjointMap) {
227224
// 2. Calculate the Adjoint map using the general, "brute force" definition.
228225
// This is the "expected" ground truth.
229226
// Ad_i = Vee(T * Hat(e_i) * T_inv)
230-
//-------------------------------------------------------------------------
231227

232228
// Get the 4 generators G_i = Hat(e_i) for sim(2)
233229
std::vector<Matrix3> G;

gtsam/geometry/tests/testSimilarity3.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ TEST(Similarity3, AdjointMap) {
116116

117117
// 2. Calculate the Adjoint map using the general, "brute force" definition.
118118
// Ad_i = Vee(T * Hat(e_i) * T_inv)
119-
120119
// Get the 7 generators G_i = Hat(e_i) for sim(3)
121120
std::vector<Matrix4> G;
122121
for (int i = 0; i < 7; ++i) {

gtsam/slam/tests/testFrobeniusFactor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ namespace sim2 {
274274
/* ************************************************************************* */
275275
TEST(FrobeniusFactorSimilarity2, evaluateError) {
276276
using namespace ::sim2;
277-
auto factor = FrobeniusFactor<Similarity2>(1, 2, noiseModel::Unit::Create(12));
277+
auto factor = FrobeniusFactor<Similarity2>(1, 2, noiseModel::Unit::Create(9));
278278
Vector actual = factor.evaluateError(P1, P2);
279279
Vector expected = P2.vec() - P1.vec();
280280
EXPECT(assert_equal(expected, actual, 1e-9));

0 commit comments

Comments
 (0)