Skip to content

Commit e3b6c83

Browse files
updating points name, constexpr
1 parent 47f9f30 commit e3b6c83

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

examples/CreateSFMExampleData.cpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using namespace gtsam;
2626

2727
/* ************************************************************************* */
2828

29-
void createExampleBALFile(const string& filename, const vector<Point3>& P,
29+
void createExampleBALFile(const string& filename, const vector<Point3>& points,
3030
const Pose3& pose1, const Pose3& pose2,
3131
const Cal3Bundler& K = Cal3Bundler()) {
3232
// Class that will gather all data
@@ -35,7 +35,7 @@ void createExampleBALFile(const string& filename, const vector<Point3>& P,
3535
data.cameras.push_back(SfmCamera(pose1, K));
3636
data.cameras.push_back(SfmCamera(pose2, K));
3737

38-
for (const Point3& p : P) {
38+
for (const Point3& p : points) {
3939
// Create the track
4040
SfmTrack track;
4141
track.p = p;
@@ -63,13 +63,12 @@ void create5PointExample1() {
6363
Pose3 pose1, pose2(aRb, aTb);
6464

6565
// Create test data, we need at least 5 points
66-
vector<Point3> P;
67-
P += Point3(0, 0, 1), Point3(-0.1, 0, 1), Point3(0.1, 0, 1), //
68-
Point3(0, 0.5, 0.5), Point3(0, -0.5, 0.5);
66+
vector<Point3> points = {{0, 0, 1}, {-0.1, 0, 1}, {0.1, 0, 1}, //
67+
{0, 0.5, 0.5}, {0, -0.5, 0.5}};
6968

7069
// Assumes example is run in ${GTSAM_TOP}/build/examples
7170
const string filename = "../../examples/Data/5pointExample1.txt";
72-
createExampleBALFile(filename, P, pose1, pose2);
71+
createExampleBALFile(filename, points, pose1, pose2);
7372
}
7473

7574
/* ************************************************************************* */
@@ -81,15 +80,14 @@ void create5PointExample2() {
8180
Pose3 pose1, pose2(aRb, aTb);
8281

8382
// Create test data, we need at least 5 points
84-
vector<Point3> P;
85-
P += Point3(0, 0, 100), Point3(-10, 0, 100), Point3(10, 0, 100), //
86-
Point3(0, 50, 50), Point3(0, -50, 50), Point3(-20, 0, 80),
87-
Point3(20, -50, 80);
83+
vector<Point3> points = {{0, 0, 100}, {-10, 0, 100}, {10, 0, 100}, //
84+
{0, 50, 50}, {0, -50, 50}, {-20, 0, 80},
85+
{20, -50, 80}};
8886

8987
// Assumes example is run in ${GTSAM_TOP}/build/examples
9088
const string filename = "../../examples/Data/5pointExample2.txt";
9189
Cal3Bundler K(500, 0, 0);
92-
createExampleBALFile(filename, P, pose1, pose2, K);
90+
createExampleBALFile(filename, points, pose1, pose2, K);
9391
}
9492

9593
/* ************************************************************************* */
@@ -101,17 +99,16 @@ void create18PointExample1() {
10199
Pose3 pose1, pose2(aRb, aTb);
102100

103101
// Create test data, we need 15 points
104-
vector<Point3> P;
105-
P += Point3(0, 0, 1), Point3(-0.1, 0, 1), Point3(0.1, 0, 1), //
106-
Point3(0, 0.5, 0.5), Point3(0, -0.5, 0.5), Point3(-1, -0.5, 2), //
107-
Point3(-1, 0.5, 2), Point3(0.25, -0.5, 1.5), Point3(0.25, 0.5, 1.5), //
108-
Point3(-0.1, -0.5, 0.5), Point3(0.1, -0.5, 1), Point3(0.1, 0.5, 1), //
109-
Point3(-0.1, 0, 0.5), Point3(-0.1, 0.5, 0.5), Point3(0, 0, 0.5), //
110-
Point3(0.1, -0.5, 0.5), Point3(0.1, 0, 0.5), Point3(0.1, 0.5, 0.5);
102+
vector<Point3> points = {{0, 0, 1}, {-0.1, 0, 1}, {0.1, 0, 1}, //
103+
{0, 0.5, 0.5}, {0, -0.5, 0.5}, {-1, -0.5, 2}, //
104+
{-1, 0.5, 2}, {0.25, -0.5, 1.5}, {0.25, 0.5, 1.5}, //
105+
{-0.1, -0.5, 0.5}, {0.1, -0.5, 1}, {0.1, 0.5, 1}, //
106+
{-0.1, 0, 0.5}, {-0.1, 0.5, 0.5}, {0, 0, 0.5}, //
107+
{0.1, -0.5, 0.5}, {0.1, 0, 0.5}, {0.1, 0.5, 0.5}};
111108

112109
// Assumes example is run in ${GTSAM_TOP}/build/examples
113110
const string filename = "../../examples/Data/18pointExample1.txt";
114-
createExampleBALFile(filename, P, pose1, pose2);
111+
createExampleBALFile(filename, points, pose1, pose2);
115112
}
116113

117114
int main(int argc, char* argv[]) {

gtsam/slam/EssentialMatrixFactor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class EssentialMatrixFactor4
315315
typedef NoiseModelFactor2<EssentialMatrix, CALIBRATION> Base;
316316
typedef EssentialMatrixFactor4 This;
317317

318-
static const int DimK = FixedDimension<CALIBRATION>::value;
318+
static constexpr int DimK = FixedDimension<CALIBRATION>::value;
319319
typedef Eigen::Matrix<double, 2, DimK> JacobianCalibration;
320320

321321
public:

0 commit comments

Comments
 (0)