Skip to content

Commit

Permalink
updating points name, constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay-krishnan committed Jun 21, 2021
1 parent 47f9f30 commit e3b6c83
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
35 changes: 16 additions & 19 deletions examples/CreateSFMExampleData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using namespace gtsam;

/* ************************************************************************* */

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

for (const Point3& p : P) {
for (const Point3& p : points) {
// Create the track
SfmTrack track;
track.p = p;
Expand Down Expand Up @@ -63,13 +63,12 @@ void create5PointExample1() {
Pose3 pose1, pose2(aRb, aTb);

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

// Assumes example is run in ${GTSAM_TOP}/build/examples
const string filename = "../../examples/Data/5pointExample1.txt";
createExampleBALFile(filename, P, pose1, pose2);
createExampleBALFile(filename, points, pose1, pose2);
}

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

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

// Assumes example is run in ${GTSAM_TOP}/build/examples
const string filename = "../../examples/Data/5pointExample2.txt";
Cal3Bundler K(500, 0, 0);
createExampleBALFile(filename, P, pose1, pose2, K);
createExampleBALFile(filename, points, pose1, pose2, K);
}

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

// Create test data, we need 15 points
vector<Point3> P;
P += Point3(0, 0, 1), Point3(-0.1, 0, 1), Point3(0.1, 0, 1), //
Point3(0, 0.5, 0.5), Point3(0, -0.5, 0.5), Point3(-1, -0.5, 2), //
Point3(-1, 0.5, 2), Point3(0.25, -0.5, 1.5), Point3(0.25, 0.5, 1.5), //
Point3(-0.1, -0.5, 0.5), Point3(0.1, -0.5, 1), Point3(0.1, 0.5, 1), //
Point3(-0.1, 0, 0.5), Point3(-0.1, 0.5, 0.5), Point3(0, 0, 0.5), //
Point3(0.1, -0.5, 0.5), Point3(0.1, 0, 0.5), Point3(0.1, 0.5, 0.5);
vector<Point3> points = {{0, 0, 1}, {-0.1, 0, 1}, {0.1, 0, 1}, //
{0, 0.5, 0.5}, {0, -0.5, 0.5}, {-1, -0.5, 2}, //
{-1, 0.5, 2}, {0.25, -0.5, 1.5}, {0.25, 0.5, 1.5}, //
{-0.1, -0.5, 0.5}, {0.1, -0.5, 1}, {0.1, 0.5, 1}, //
{-0.1, 0, 0.5}, {-0.1, 0.5, 0.5}, {0, 0, 0.5}, //
{0.1, -0.5, 0.5}, {0.1, 0, 0.5}, {0.1, 0.5, 0.5}};

// Assumes example is run in ${GTSAM_TOP}/build/examples
const string filename = "../../examples/Data/18pointExample1.txt";
createExampleBALFile(filename, P, pose1, pose2);
createExampleBALFile(filename, points, pose1, pose2);
}

int main(int argc, char* argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion gtsam/slam/EssentialMatrixFactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class EssentialMatrixFactor4
typedef NoiseModelFactor2<EssentialMatrix, CALIBRATION> Base;
typedef EssentialMatrixFactor4 This;

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

public:
Expand Down

0 comments on commit e3b6c83

Please sign in to comment.