diff --git a/CMakeLists.txt b/CMakeLists.txt index cd8db9a80..26e0c0c5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,12 +83,6 @@ if (NOT GTSAM_BUILD_SHARED_LIBRARY AND NOT GTSAM_BUILD_STATIC_LIBRARY) message(FATAL_ERROR "Both shared and static version of GTSAM library disabled - need to choose at least one!") endif() -# Add the Quaternion Build Flag if requested -if (GTSAM_USE_QUATERNIONS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGTSAM_DEFAULT_QUATERNIONS") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTSAM_DEFAULT_QUATERNIONS") -endif(GTSAM_USE_QUATERNIONS) - # Flags to determine whether tests and examples are build during 'make install' # Note that these remove the targets from the 'all' option(GTSAM_DISABLE_TESTS_ON_INSTALL "Disables building tests during install" ON) @@ -141,6 +135,7 @@ include_directories( gtsam/3rdparty/UFconfig gtsam/3rdparty/CCOLAMD/Include ${CMAKE_SOURCE_DIR} + ${CMAKE_BINARY_DIR} # So we can include generated config header files CppUnitLite ${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) diff --git a/gtsam/3rdparty/CMakeLists.txt b/gtsam/3rdparty/CMakeLists.txt index 8ee371fe8..f152de329 100644 --- a/gtsam/3rdparty/CMakeLists.txt +++ b/gtsam/3rdparty/CMakeLists.txt @@ -2,16 +2,39 @@ install(FILES CCOLAMD/Include/ccolamd.h DESTINATION include/gtsam/3rdparty/CCOLAMD) install(FILES UFconfig/UFconfig.h DESTINATION include/gtsam/3rdparty/UFconfig) -# install Eigen - only the headers -install(DIRECTORY Eigen/Eigen - DESTINATION include/gtsam/3rdparty/Eigen - FILES_MATCHING PATTERN "*.h") -file(GLOB eigen_dir_headers_all "Eigen/Eigen/*") +# Option for using system Eigen or GTSAM-bundled Eigen +option(GTSAM_USE_SYSTEM_EIGEN "Find and use system-installed Eigen. If 'off', use the one bundled with GTSAM" OFF) -# ensure that Eigen folders without extensions get added -foreach(eigen_dir ${eigen_dir_headers_all}) - get_filename_component(filename ${eigen_dir} NAME) - if (NOT ((${filename} MATCHES "CMakeLists.txt") OR (${filename} MATCHES "src") OR (${filename} MATCHES ".svn"))) - install(FILES Eigen/Eigen/${filename} DESTINATION include/gtsam/3rdparty/Eigen/Eigen) - endif() -endforeach(eigen_dir) +# Switch for using system Eigen or GTSAM-bundled Eigen +if(GTSAM_USE_SYSTEM_EIGEN) + # Use generic Eigen include paths e.g. + set(GTSAM_EIGEN_INCLUDE_PREFIX "") + + find_package(Eigen3 REQUIRED) + include_directories(EIGEN3_INCLUDE_DIR) +else() + # Use bundled Eigen include paths e.g. + set(GTSAM_EIGEN_INCLUDE_PREFIX "gtsam/3rdparty/Eigen/") + + # Clear any variables set by FindEigen3 + if(EIGEN3_INCLUDE_DIR) + set(EIGEN3_INCLUDE_DIR NOTFOUND) + endif() + + # install Eigen - only the headers in our 3rdparty directory + install(DIRECTORY Eigen/Eigen + DESTINATION include/gtsam/3rdparty/Eigen + FILES_MATCHING PATTERN "*.h") + file(GLOB eigen_dir_headers_all "Eigen/Eigen/*") + + # ensure that Eigen folders without extensions get added + foreach(eigen_dir ${eigen_dir_headers_all}) + get_filename_component(filename ${eigen_dir} NAME) + if (NOT ((${filename} MATCHES "CMakeLists.txt") OR (${filename} MATCHES "src") OR (${filename} MATCHES ".svn"))) + install(FILES Eigen/Eigen/${filename} DESTINATION include/gtsam/3rdparty/Eigen/Eigen) + endif() + endforeach(eigen_dir) +endif() + +# Write Eigen include file with the paths for either the system Eigen or the GTSAM-bundled Eigen +configure_file(gtsam_eigen_includes.h.in gtsam_eigen_includes.h) diff --git a/gtsam/3rdparty/gtsam_eigen_includes.h.in b/gtsam/3rdparty/gtsam_eigen_includes.h.in new file mode 100644 index 000000000..bd41228b5 --- /dev/null +++ b/gtsam/3rdparty/gtsam_eigen_includes.h.in @@ -0,0 +1,24 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file gtsam_eigen_includes.h + * @brief File to include the Eigen headers that we use - generated by CMake + * @author Richard Roberts + */ + +#pragma once + +#include <@GTSAM_EIGEN_INCLUDE_PREFIX@Eigen/Dense> +#include <@GTSAM_EIGEN_INCLUDE_PREFIX@Eigen/QR> +#include <@GTSAM_EIGEN_INCLUDE_PREFIX@Eigen/LU> +#include <@GTSAM_EIGEN_INCLUDE_PREFIX@Eigen/SVD> +#include <@GTSAM_EIGEN_INCLUDE_PREFIX@Eigen/Geometry> diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index a6a8f0f05..d882f51e9 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -128,6 +128,9 @@ set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/slam/dataset.cpp" APPEND PROPERTY COMPILE_DEFINITIONS "SOURCE_TREE_DATASET_DIR=\"${CMAKE_SOURCE_DIR}/examples/Data\"" "INSTALLED_DATASET_DIR=\"${GTSAM_TOOLBOX_INSTALL_PATH}/gtsam_examples/Data\"") + +# Generate config file +configure_file(config.h.in config.h) # Create the matlab toolbox for the gtsam library if (GTSAM_INSTALL_MATLAB_TOOLBOX) diff --git a/gtsam/base/DSFVector.h b/gtsam/base/DSFVector.h index e1848c79a..dd22d5b83 100644 --- a/gtsam/base/DSFVector.h +++ b/gtsam/base/DSFVector.h @@ -23,7 +23,7 @@ #include #include -#include +#include namespace gtsam { diff --git a/gtsam/base/LieScalar.h b/gtsam/base/LieScalar.h index 5e85c1267..052e5d086 100644 --- a/gtsam/base/LieScalar.h +++ b/gtsam/base/LieScalar.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #include diff --git a/gtsam/base/Matrix.cpp b/gtsam/base/Matrix.cpp index 64df12918..2b72a55e4 100644 --- a/gtsam/base/Matrix.cpp +++ b/gtsam/base/Matrix.cpp @@ -15,15 +15,12 @@ * @author Christian Potthast */ -#include +#include #include #include #include #include -#include -#include - #include #include diff --git a/gtsam/base/Matrix.h b/gtsam/base/Matrix.h index 297e77852..71989db44 100644 --- a/gtsam/base/Matrix.h +++ b/gtsam/base/Matrix.h @@ -23,7 +23,6 @@ #pragma once #include -#include #include #include #include diff --git a/gtsam/base/TestableAssertions.h b/gtsam/base/TestableAssertions.h index 7308b89a7..b62372957 100644 --- a/gtsam/base/TestableAssertions.h +++ b/gtsam/base/TestableAssertions.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include namespace gtsam { diff --git a/gtsam/base/Vector.cpp b/gtsam/base/Vector.cpp index 82d503837..7a71eb125 100644 --- a/gtsam/base/Vector.cpp +++ b/gtsam/base/Vector.cpp @@ -29,7 +29,6 @@ #include #include -#include //#ifdef WIN32 //#include diff --git a/gtsam/base/Vector.h b/gtsam/base/Vector.h index f2c6a2e5c..20699ebcc 100644 --- a/gtsam/base/Vector.h +++ b/gtsam/base/Vector.h @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include namespace gtsam { diff --git a/gtsam/base/cholesky.cpp b/gtsam/base/cholesky.cpp index 15a8a9208..f3c6b2b23 100644 --- a/gtsam/base/cholesky.cpp +++ b/gtsam/base/cholesky.cpp @@ -20,9 +20,6 @@ #include #include -#include -#include - #include #include diff --git a/gtsam/base/debug.h b/gtsam/base/debug.h index c45e3d267..f416bd826 100644 --- a/gtsam/base/debug.h +++ b/gtsam/base/debug.h @@ -17,7 +17,7 @@ */ #include -#include +#include #include diff --git a/gtsam/base/timing.h b/gtsam/base/timing.h index b63f1148c..b1cbe40ef 100644 --- a/gtsam/base/timing.h +++ b/gtsam/base/timing.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include // Automatically use the new Boost timers if version is recent enough. diff --git a/gtsam/base/types.h b/gtsam/base/types.h index d64353d04..94fcb4b27 100644 --- a/gtsam/base/types.h +++ b/gtsam/base/types.h @@ -19,7 +19,7 @@ #pragma once -#include +#include #include diff --git a/gtsam/config.h.in b/gtsam/config.h.in new file mode 100644 index 000000000..e89a31da6 --- /dev/null +++ b/gtsam/config.h.in @@ -0,0 +1,27 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file config.h + * @brief Settings and paths configured with CMake + * @author Richard Roberts + */ + +#pragma once + +// Paths to example datasets distributed with GTSAM +namespace gtsam { + static const char* SourceTreeDatasetDir = "@CMAKE_SOURCE_DIR@/examples/Data"; + static const char* InstalledDatasetDir = "@GTSAM_TOOLBOX_INSTALL_PATH@/gtsam_examples/Data"; +} + +// Whether GTSAM is compiled to use quaternions for Rot3 (otherwise uses rotation matrices) +#cmakedefine GTSAM_USE_QUATERNIONS diff --git a/gtsam/discrete/DiscreteKey.h b/gtsam/discrete/DiscreteKey.h index ba49f1471..6451886c3 100644 --- a/gtsam/discrete/DiscreteKey.h +++ b/gtsam/discrete/DiscreteKey.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include diff --git a/gtsam/discrete/Potentials.h b/gtsam/discrete/Potentials.h index 2dd23ec49..33e266c91 100644 --- a/gtsam/discrete/Potentials.h +++ b/gtsam/discrete/Potentials.h @@ -19,7 +19,6 @@ #include #include -#include #include #include diff --git a/gtsam/base/dllexport.h b/gtsam/dllexport.h similarity index 100% rename from gtsam/base/dllexport.h rename to gtsam/dllexport.h diff --git a/gtsam/geometry/Rot3.h b/gtsam/geometry/Rot3.h index ade3f6ecb..e9c7c6b64 100644 --- a/gtsam/geometry/Rot3.h +++ b/gtsam/geometry/Rot3.h @@ -21,9 +21,11 @@ #pragma once +#include // Get GTSAM_USE_QUATERNIONS macro + // You can override the default coordinate mode using this flag #ifndef ROT3_DEFAULT_COORDINATES_MODE -#ifdef GTSAM_DEFAULT_QUATERNIONS +#ifdef GTSAM_USE_QUATERNIONS // Exponential map is very cheap for quaternions #define ROT3_DEFAULT_COORDINATES_MODE Rot3::EXPMAP #else @@ -35,7 +37,6 @@ #include #include #include -#include namespace gtsam { @@ -46,7 +47,7 @@ namespace gtsam { /** * @brief A 3D rotation represented as a rotation matrix if the preprocessor - * symbol GTSAM_DEFAULT_QUATERNIONS is not defined, or as a quaternion if it + * symbol GTSAM_USE_QUATERNIONS is not defined, or as a quaternion if it * is defined. * @addtogroup geometry * \nosubgrouping @@ -56,7 +57,7 @@ namespace gtsam { static const size_t dimension = 3; private: -#ifdef GTSAM_DEFAULT_QUATERNIONS +#ifdef GTSAM_USE_QUATERNIONS /** Internal Eigen Quaternion */ Quaternion quaternion_; #else @@ -222,18 +223,18 @@ namespace gtsam { * exponential map, but this can be expensive to compute. The following Enum is used * to indicate which method should be used. The default * is determined by ROT3_DEFAULT_COORDINATES_MODE, which may be set at compile time, - * and itself defaults to Rot3::CAYLEY, or if GTSAM_DEFAULT_QUATERNIONS is defined, + * and itself defaults to Rot3::CAYLEY, or if GTSAM_USE_QUATERNIONS is defined, * to Rot3::EXPMAP. */ enum CoordinatesMode { EXPMAP, ///< Use the Lie group exponential map to retract -#ifndef GTSAM_DEFAULT_QUATERNIONS +#ifndef GTSAM_USE_QUATERNIONS CAYLEY, ///< Retract and localCoordinates using the Cayley transform. SLOW_CAYLEY ///< Slow matrix implementation of Cayley transform (for tests only). #endif }; -#ifndef GTSAM_DEFAULT_QUATERNIONS +#ifndef GTSAM_USE_QUATERNIONS /// Retraction from R^3 to Rot3 manifold using the Cayley transform Rot3 retractCayley(const Vector& omega) const; #endif @@ -362,7 +363,7 @@ namespace gtsam { { ar & boost::serialization::make_nvp("Rot3", boost::serialization::base_object(*this)); -#ifndef GTSAM_DEFAULT_QUATERNIONS +#ifndef GTSAM_USE_QUATERNIONS ar & boost::serialization::make_nvp("rot11", rot_(0,0)); ar & boost::serialization::make_nvp("rot12", rot_(0,1)); ar & boost::serialization::make_nvp("rot13", rot_(0,2)); diff --git a/gtsam/geometry/Rot3M.cpp b/gtsam/geometry/Rot3M.cpp index 2e09fd3f9..b63499d6d 100644 --- a/gtsam/geometry/Rot3M.cpp +++ b/gtsam/geometry/Rot3M.cpp @@ -1,385 +1,387 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - -/** - * @file Rot3M.cpp - * @brief Rotation (internal: 3*3 matrix representation*) - * @author Alireza Fathi - * @author Christian Potthast - * @author Frank Dellaert - * @author Richard Roberts - */ - -#ifndef GTSAM_DEFAULT_QUATERNIONS - -#include -#include -#include - -using namespace std; - -namespace gtsam { - -static const Matrix3 I3 = Matrix3::Identity(); - -/* ************************************************************************* */ -Rot3::Rot3() : rot_(Matrix3::Identity()) {} - -/* ************************************************************************* */ -Rot3::Rot3(const Point3& r1, const Point3& r2, const Point3& r3) { - rot_.col(0) = r1.vector(); - rot_.col(1) = r2.vector(); - rot_.col(2) = r3.vector(); -} - -/* ************************************************************************* */ -Rot3::Rot3(double R11, double R12, double R13, - double R21, double R22, double R23, - double R31, double R32, double R33) { - rot_ << R11, R12, R13, - R21, R22, R23, - R31, R32, R33; -} - -/* ************************************************************************* */ -Rot3::Rot3(const Matrix3& R) { - rot_ = R; -} - -/* ************************************************************************* */ -Rot3::Rot3(const Matrix& R) { +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file Rot3M.cpp + * @brief Rotation (internal: 3*3 matrix representation*) + * @author Alireza Fathi + * @author Christian Potthast + * @author Frank Dellaert + * @author Richard Roberts + */ + +#include // Get GTSAM_USE_QUATERNIONS macro + +#ifndef GTSAM_USE_QUATERNIONS + +#include +#include +#include + +using namespace std; + +namespace gtsam { + +static const Matrix3 I3 = Matrix3::Identity(); + +/* ************************************************************************* */ +Rot3::Rot3() : rot_(Matrix3::Identity()) {} + +/* ************************************************************************* */ +Rot3::Rot3(const Point3& r1, const Point3& r2, const Point3& r3) { + rot_.col(0) = r1.vector(); + rot_.col(1) = r2.vector(); + rot_.col(2) = r3.vector(); +} + +/* ************************************************************************* */ +Rot3::Rot3(double R11, double R12, double R13, + double R21, double R22, double R23, + double R31, double R32, double R33) { + rot_ << R11, R12, R13, + R21, R22, R23, + R31, R32, R33; +} + +/* ************************************************************************* */ +Rot3::Rot3(const Matrix3& R) { + rot_ = R; +} + +/* ************************************************************************* */ +Rot3::Rot3(const Matrix& R) { if (R.rows()!=3 || R.cols()!=3) throw invalid_argument("Rot3 constructor expects 3*3 matrix"); - rot_ = R; -} - -///* ************************************************************************* */ -//Rot3::Rot3(const Matrix3& R) : rot_(R) {} - -/* ************************************************************************* */ -Rot3::Rot3(const Quaternion& q) : rot_(q.toRotationMatrix()) {} - -/* ************************************************************************* */ -Rot3 Rot3::Rx(double t) { - double st = sin(t), ct = cos(t); - return Rot3( - 1, 0, 0, - 0, ct,-st, - 0, st, ct); -} - -/* ************************************************************************* */ -Rot3 Rot3::Ry(double t) { - double st = sin(t), ct = cos(t); - return Rot3( - ct, 0, st, - 0, 1, 0, - -st, 0, ct); -} - -/* ************************************************************************* */ -Rot3 Rot3::Rz(double t) { - double st = sin(t), ct = cos(t); - return Rot3( - ct,-st, 0, - st, ct, 0, - 0, 0, 1); -} - -/* ************************************************************************* */ -// Considerably faster than composing matrices above ! -Rot3 Rot3::RzRyRx(double x, double y, double z) { - double cx=cos(x),sx=sin(x); - double cy=cos(y),sy=sin(y); - double cz=cos(z),sz=sin(z); - double ss_ = sx * sy; - double cs_ = cx * sy; - double sc_ = sx * cy; - double cc_ = cx * cy; - double c_s = cx * sz; - double s_s = sx * sz; - double _cs = cy * sz; - double _cc = cy * cz; - double s_c = sx * cz; - double c_c = cx * cz; - double ssc = ss_ * cz, csc = cs_ * cz, sss = ss_ * sz, css = cs_ * sz; - return Rot3( - _cc,- c_s + ssc, s_s + csc, - _cs, c_c + sss, -s_c + css, - -sy, sc_, cc_ - ); -} - -/* ************************************************************************* */ -Rot3 Rot3::rodriguez(const Vector& w, double theta) { - // get components of axis \omega - double wx = w(0), wy=w(1), wz=w(2); - double wwTxx = wx*wx, wwTyy = wy*wy, wwTzz = wz*wz; -#ifndef NDEBUG - double l_n = wwTxx + wwTyy + wwTzz; - if (std::abs(l_n-1.0)>1e-9) throw domain_error("rodriguez: length of n should be 1"); -#endif - - double c = cos(theta), s = sin(theta), c_1 = 1 - c; - - double swx = wx * s, swy = wy * s, swz = wz * s; - double C00 = c_1*wwTxx, C01 = c_1*wx*wy, C02 = c_1*wx*wz; - double C11 = c_1*wwTyy, C12 = c_1*wy*wz; - double C22 = c_1*wwTzz; - - return Rot3( - c + C00, -swz + C01, swy + C02, - swz + C01, c + C11, -swx + C12, - -swy + C02, swx + C12, c + C22); -} - -/* ************************************************************************* */ -Rot3 Rot3::rodriguez(const Vector& w) { - double t = w.norm(); - if (t < 1e-10) return Rot3(); - return rodriguez(w/t, t); -} - -/* ************************************************************************* */ -bool Rot3::equals(const Rot3 & R, double tol) const { - return equal_with_abs_tol(matrix(), R.matrix(), tol); -} - -/* ************************************************************************* */ -Rot3 Rot3::compose (const Rot3& R2, - boost::optional H1, boost::optional H2) const { - if (H1) *H1 = R2.transpose(); - if (H2) *H2 = I3; - return *this * R2; -} - -/* ************************************************************************* */ -Point3 Rot3::operator*(const Point3& p) const { return rotate(p); } - -/* ************************************************************************* */ -Rot3 Rot3::inverse(boost::optional H1) const { - if (H1) *H1 = -rot_; - return Rot3(Matrix3(rot_.transpose())); -} - -/* ************************************************************************* */ -Rot3 Rot3::between (const Rot3& R2, - boost::optional H1, boost::optional H2) const { - if (H1) *H1 = -(R2.transpose()*rot_); - if (H2) *H2 = I3; - return Rot3(Matrix3(rot_.transpose()*R2.rot_)); - //return between_default(*this, R2); -} - -/* ************************************************************************* */ -Rot3 Rot3::operator*(const Rot3& R2) const { - return Rot3(Matrix3(rot_*R2.rot_)); -} - -/* ************************************************************************* */ -Point3 Rot3::rotate(const Point3& p, - boost::optional H1, boost::optional H2) const { - if (H1 || H2) { - if (H1) *H1 = rot_ * skewSymmetric(-p.x(), -p.y(), -p.z()); - if (H2) *H2 = rot_; - } - return Point3(rot_ * p.vector()); -} - -/* ************************************************************************* */ -// see doc/math.lyx, SO(3) section -Point3 Rot3::unrotate(const Point3& p, - boost::optional H1, boost::optional H2) const { - Point3 q(rot_.transpose()*p.vector()); // q = Rt*p - if (H1) *H1 = skewSymmetric(q.x(), q.y(), q.z()); - if (H2) *H2 = transpose(); - return q; -} - -/* ************************************************************************* */ -// Log map at identity - return the canonical coordinates of this rotation -Vector3 Rot3::Logmap(const Rot3& R) { - - static const double PI = boost::math::constants::pi(); - - const Matrix3& rot = R.rot_; - // Get trace(R) - double tr = rot.trace(); - - // when trace == -1, i.e., when theta = +-pi, +-3pi, +-5pi, etc. - // we do something special - if (std::abs(tr+1.0) < 1e-10) { - if(std::abs(rot(2,2)+1.0) > 1e-10) - return (PI / sqrt(2.0+2.0*rot(2,2) )) * - Vector3(rot(0,2), rot(1,2), 1.0+rot(2,2)); - else if(std::abs(rot(1,1)+1.0) > 1e-10) - return (PI / sqrt(2.0+2.0*rot(1,1))) * - Vector3(rot(0,1), 1.0+rot(1,1), rot(2,1)); - else // if(std::abs(R.r1_.x()+1.0) > 1e-10) This is implicit - return (PI / sqrt(2.0+2.0*rot(0,0))) * - Vector3(1.0+rot(0,0), rot(1,0), rot(2,0)); - } else { - double magnitude; - double tr_3 = tr-3.0; // always negative - if (tr_3<-1e-7) { - double theta = acos((tr-1.0)/2.0); - magnitude = theta/(2.0*sin(theta)); - } else { - // when theta near 0, +-2pi, +-4pi, etc. (trace near 3.0) - // use Taylor expansion: magnitude \approx 1/2-(t-3)/12 + O((t-3)^2) - magnitude = 0.5 - tr_3*tr_3/12.0; - } - return magnitude*Vector3( - rot(2,1)-rot(1,2), - rot(0,2)-rot(2,0), - rot(1,0)-rot(0,1)); - } -} - -/* ************************************************************************* */ -Rot3 Rot3::retractCayley(const Vector& omega) const { - const double x = omega(0), y = omega(1), z = omega(2); - const double x2 = x * x, y2 = y * y, z2 = z * z; - const double xy = x * y, xz = x * z, yz = y * z; - const double f = 1.0 / (4.0 + x2 + y2 + z2), _2f = 2.0 * f; - return (*this) - * Rot3((4 + x2 - y2 - z2) * f, (xy - 2 * z) * _2f, (xz + 2 * y) * _2f, - (xy + 2 * z) * _2f, (4 - x2 + y2 - z2) * f, (yz - 2 * x) * _2f, - (xz - 2 * y) * _2f, (yz + 2 * x) * _2f, (4 - x2 - y2 + z2) * f); -} - -/* ************************************************************************* */ -Rot3 Rot3::retract(const Vector& omega, Rot3::CoordinatesMode mode) const { - if(mode == Rot3::EXPMAP) { - return (*this)*Expmap(omega); - } else if(mode == Rot3::CAYLEY) { - return retractCayley(omega); - } else if(mode == Rot3::SLOW_CAYLEY) { - Matrix Omega = skewSymmetric(omega); - return (*this)*Cayley<3>(-Omega/2); - } else { - assert(false); - exit(1); - } -} - -/* ************************************************************************* */ -Vector3 Rot3::localCoordinates(const Rot3& T, Rot3::CoordinatesMode mode) const { - if(mode == Rot3::EXPMAP) { - return Logmap(between(T)); - } else if(mode == Rot3::CAYLEY) { - // Create a fixed-size matrix - Eigen::Matrix3d A(between(T).matrix()); - // Mathematica closed form optimization (procrastination?) gone wild: - const double a=A(0,0),b=A(0,1),c=A(0,2); - const double d=A(1,0),e=A(1,1),f=A(1,2); - const double g=A(2,0),h=A(2,1),i=A(2,2); - const double di = d*i, ce = c*e, cd = c*d, fg=f*g; - const double M = 1 + e - f*h + i + e*i; - const double K = 2.0 / (cd*h + M + a*M -g*(c + ce) - b*(d + di - fg)); - const double x = (a * f - cd + f) * K; - const double y = (b * f - ce - c) * K; - const double z = (fg - di - d) * K; - return -2 * Vector3(x, y, z); - } else if(mode == Rot3::SLOW_CAYLEY) { - // Create a fixed-size matrix - Eigen::Matrix3d A(between(T).matrix()); - // using templated version of Cayley - Eigen::Matrix3d Omega = Cayley<3>(A); - return -2*Vector3(Omega(2,1),Omega(0,2),Omega(1,0)); - } else { - assert(false); - exit(1); - } -} - -/* ************************************************************************* */ -Matrix3 Rot3::matrix() const { - return rot_; -} - -/* ************************************************************************* */ -Matrix3 Rot3::transpose() const { - return rot_.transpose(); -} - -/* ************************************************************************* */ -Point3 Rot3::column(int index) const{ - return Point3(rot_.col(index)); -} - -/* ************************************************************************* */ -Point3 Rot3::r1() const { return Point3(rot_.col(0)); } - -/* ************************************************************************* */ -Point3 Rot3::r2() const { return Point3(rot_.col(1)); } - -/* ************************************************************************* */ -Point3 Rot3::r3() const { return Point3(rot_.col(2)); } - -/* ************************************************************************* */ -Vector3 Rot3::xyz() const { - Matrix3 I;Vector3 q; - boost::tie(I,q)=RQ(rot_); - return q; -} - -/* ************************************************************************* */ -Vector3 Rot3::ypr() const { - Vector3 q = xyz(); - return Vector3(q(2),q(1),q(0)); -} - -/* ************************************************************************* */ -Vector3 Rot3::rpy() const { - return xyz(); -} - -/* ************************************************************************* */ -Quaternion Rot3::toQuaternion() const { - return Quaternion(rot_); -} - -/* ************************************************************************* */ -Vector Rot3::quaternion() const { - Quaternion q = toQuaternion(); - Vector v(4); - v(0) = q.w(); - v(1) = q.x(); - v(2) = q.y(); - v(3) = q.z(); - return v; -} - -/* ************************************************************************* */ -pair RQ(const Matrix3& A) { - - double x = -atan2(-A(2, 1), A(2, 2)); - Rot3 Qx = Rot3::Rx(-x); - Matrix3 B = A * Qx.matrix(); - - double y = -atan2(B(2, 0), B(2, 2)); - Rot3 Qy = Rot3::Ry(-y); - Matrix3 C = B * Qy.matrix(); - - double z = -atan2(-C(1, 0), C(1, 1)); - Rot3 Qz = Rot3::Rz(-z); - Matrix3 R = C * Qz.matrix(); - - Vector xyz = Vector3(x, y, z); - return make_pair(R, xyz); -} - -/* ************************************************************************* */ - -} // namespace gtsam - -#endif + rot_ = R; +} + +///* ************************************************************************* */ +//Rot3::Rot3(const Matrix3& R) : rot_(R) {} + +/* ************************************************************************* */ +Rot3::Rot3(const Quaternion& q) : rot_(q.toRotationMatrix()) {} + +/* ************************************************************************* */ +Rot3 Rot3::Rx(double t) { + double st = sin(t), ct = cos(t); + return Rot3( + 1, 0, 0, + 0, ct,-st, + 0, st, ct); +} + +/* ************************************************************************* */ +Rot3 Rot3::Ry(double t) { + double st = sin(t), ct = cos(t); + return Rot3( + ct, 0, st, + 0, 1, 0, + -st, 0, ct); +} + +/* ************************************************************************* */ +Rot3 Rot3::Rz(double t) { + double st = sin(t), ct = cos(t); + return Rot3( + ct,-st, 0, + st, ct, 0, + 0, 0, 1); +} + +/* ************************************************************************* */ +// Considerably faster than composing matrices above ! +Rot3 Rot3::RzRyRx(double x, double y, double z) { + double cx=cos(x),sx=sin(x); + double cy=cos(y),sy=sin(y); + double cz=cos(z),sz=sin(z); + double ss_ = sx * sy; + double cs_ = cx * sy; + double sc_ = sx * cy; + double cc_ = cx * cy; + double c_s = cx * sz; + double s_s = sx * sz; + double _cs = cy * sz; + double _cc = cy * cz; + double s_c = sx * cz; + double c_c = cx * cz; + double ssc = ss_ * cz, csc = cs_ * cz, sss = ss_ * sz, css = cs_ * sz; + return Rot3( + _cc,- c_s + ssc, s_s + csc, + _cs, c_c + sss, -s_c + css, + -sy, sc_, cc_ + ); +} + +/* ************************************************************************* */ +Rot3 Rot3::rodriguez(const Vector& w, double theta) { + // get components of axis \omega + double wx = w(0), wy=w(1), wz=w(2); + double wwTxx = wx*wx, wwTyy = wy*wy, wwTzz = wz*wz; +#ifndef NDEBUG + double l_n = wwTxx + wwTyy + wwTzz; + if (std::abs(l_n-1.0)>1e-9) throw domain_error("rodriguez: length of n should be 1"); +#endif + + double c = cos(theta), s = sin(theta), c_1 = 1 - c; + + double swx = wx * s, swy = wy * s, swz = wz * s; + double C00 = c_1*wwTxx, C01 = c_1*wx*wy, C02 = c_1*wx*wz; + double C11 = c_1*wwTyy, C12 = c_1*wy*wz; + double C22 = c_1*wwTzz; + + return Rot3( + c + C00, -swz + C01, swy + C02, + swz + C01, c + C11, -swx + C12, + -swy + C02, swx + C12, c + C22); +} + +/* ************************************************************************* */ +Rot3 Rot3::rodriguez(const Vector& w) { + double t = w.norm(); + if (t < 1e-10) return Rot3(); + return rodriguez(w/t, t); +} + +/* ************************************************************************* */ +bool Rot3::equals(const Rot3 & R, double tol) const { + return equal_with_abs_tol(matrix(), R.matrix(), tol); +} + +/* ************************************************************************* */ +Rot3 Rot3::compose (const Rot3& R2, + boost::optional H1, boost::optional H2) const { + if (H1) *H1 = R2.transpose(); + if (H2) *H2 = I3; + return *this * R2; +} + +/* ************************************************************************* */ +Point3 Rot3::operator*(const Point3& p) const { return rotate(p); } + +/* ************************************************************************* */ +Rot3 Rot3::inverse(boost::optional H1) const { + if (H1) *H1 = -rot_; + return Rot3(Matrix3(rot_.transpose())); +} + +/* ************************************************************************* */ +Rot3 Rot3::between (const Rot3& R2, + boost::optional H1, boost::optional H2) const { + if (H1) *H1 = -(R2.transpose()*rot_); + if (H2) *H2 = I3; + return Rot3(Matrix3(rot_.transpose()*R2.rot_)); + //return between_default(*this, R2); +} + +/* ************************************************************************* */ +Rot3 Rot3::operator*(const Rot3& R2) const { + return Rot3(Matrix3(rot_*R2.rot_)); +} + +/* ************************************************************************* */ +Point3 Rot3::rotate(const Point3& p, + boost::optional H1, boost::optional H2) const { + if (H1 || H2) { + if (H1) *H1 = rot_ * skewSymmetric(-p.x(), -p.y(), -p.z()); + if (H2) *H2 = rot_; + } + return Point3(rot_ * p.vector()); +} + +/* ************************************************************************* */ +// see doc/math.lyx, SO(3) section +Point3 Rot3::unrotate(const Point3& p, + boost::optional H1, boost::optional H2) const { + Point3 q(rot_.transpose()*p.vector()); // q = Rt*p + if (H1) *H1 = skewSymmetric(q.x(), q.y(), q.z()); + if (H2) *H2 = transpose(); + return q; +} + +/* ************************************************************************* */ +// Log map at identity - return the canonical coordinates of this rotation +Vector3 Rot3::Logmap(const Rot3& R) { + + static const double PI = boost::math::constants::pi(); + + const Matrix3& rot = R.rot_; + // Get trace(R) + double tr = rot.trace(); + + // when trace == -1, i.e., when theta = +-pi, +-3pi, +-5pi, etc. + // we do something special + if (std::abs(tr+1.0) < 1e-10) { + if(std::abs(rot(2,2)+1.0) > 1e-10) + return (PI / sqrt(2.0+2.0*rot(2,2) )) * + Vector3(rot(0,2), rot(1,2), 1.0+rot(2,2)); + else if(std::abs(rot(1,1)+1.0) > 1e-10) + return (PI / sqrt(2.0+2.0*rot(1,1))) * + Vector3(rot(0,1), 1.0+rot(1,1), rot(2,1)); + else // if(std::abs(R.r1_.x()+1.0) > 1e-10) This is implicit + return (PI / sqrt(2.0+2.0*rot(0,0))) * + Vector3(1.0+rot(0,0), rot(1,0), rot(2,0)); + } else { + double magnitude; + double tr_3 = tr-3.0; // always negative + if (tr_3<-1e-7) { + double theta = acos((tr-1.0)/2.0); + magnitude = theta/(2.0*sin(theta)); + } else { + // when theta near 0, +-2pi, +-4pi, etc. (trace near 3.0) + // use Taylor expansion: magnitude \approx 1/2-(t-3)/12 + O((t-3)^2) + magnitude = 0.5 - tr_3*tr_3/12.0; + } + return magnitude*Vector3( + rot(2,1)-rot(1,2), + rot(0,2)-rot(2,0), + rot(1,0)-rot(0,1)); + } +} + +/* ************************************************************************* */ +Rot3 Rot3::retractCayley(const Vector& omega) const { + const double x = omega(0), y = omega(1), z = omega(2); + const double x2 = x * x, y2 = y * y, z2 = z * z; + const double xy = x * y, xz = x * z, yz = y * z; + const double f = 1.0 / (4.0 + x2 + y2 + z2), _2f = 2.0 * f; + return (*this) + * Rot3((4 + x2 - y2 - z2) * f, (xy - 2 * z) * _2f, (xz + 2 * y) * _2f, + (xy + 2 * z) * _2f, (4 - x2 + y2 - z2) * f, (yz - 2 * x) * _2f, + (xz - 2 * y) * _2f, (yz + 2 * x) * _2f, (4 - x2 - y2 + z2) * f); +} + +/* ************************************************************************* */ +Rot3 Rot3::retract(const Vector& omega, Rot3::CoordinatesMode mode) const { + if(mode == Rot3::EXPMAP) { + return (*this)*Expmap(omega); + } else if(mode == Rot3::CAYLEY) { + return retractCayley(omega); + } else if(mode == Rot3::SLOW_CAYLEY) { + Matrix Omega = skewSymmetric(omega); + return (*this)*Cayley<3>(-Omega/2); + } else { + assert(false); + exit(1); + } +} + +/* ************************************************************************* */ +Vector3 Rot3::localCoordinates(const Rot3& T, Rot3::CoordinatesMode mode) const { + if(mode == Rot3::EXPMAP) { + return Logmap(between(T)); + } else if(mode == Rot3::CAYLEY) { + // Create a fixed-size matrix + Eigen::Matrix3d A(between(T).matrix()); + // Mathematica closed form optimization (procrastination?) gone wild: + const double a=A(0,0),b=A(0,1),c=A(0,2); + const double d=A(1,0),e=A(1,1),f=A(1,2); + const double g=A(2,0),h=A(2,1),i=A(2,2); + const double di = d*i, ce = c*e, cd = c*d, fg=f*g; + const double M = 1 + e - f*h + i + e*i; + const double K = 2.0 / (cd*h + M + a*M -g*(c + ce) - b*(d + di - fg)); + const double x = (a * f - cd + f) * K; + const double y = (b * f - ce - c) * K; + const double z = (fg - di - d) * K; + return -2 * Vector3(x, y, z); + } else if(mode == Rot3::SLOW_CAYLEY) { + // Create a fixed-size matrix + Eigen::Matrix3d A(between(T).matrix()); + // using templated version of Cayley + Eigen::Matrix3d Omega = Cayley<3>(A); + return -2*Vector3(Omega(2,1),Omega(0,2),Omega(1,0)); + } else { + assert(false); + exit(1); + } +} + +/* ************************************************************************* */ +Matrix3 Rot3::matrix() const { + return rot_; +} + +/* ************************************************************************* */ +Matrix3 Rot3::transpose() const { + return rot_.transpose(); +} + +/* ************************************************************************* */ +Point3 Rot3::column(int index) const{ + return Point3(rot_.col(index)); +} + +/* ************************************************************************* */ +Point3 Rot3::r1() const { return Point3(rot_.col(0)); } + +/* ************************************************************************* */ +Point3 Rot3::r2() const { return Point3(rot_.col(1)); } + +/* ************************************************************************* */ +Point3 Rot3::r3() const { return Point3(rot_.col(2)); } + +/* ************************************************************************* */ +Vector3 Rot3::xyz() const { + Matrix3 I;Vector3 q; + boost::tie(I,q)=RQ(rot_); + return q; +} + +/* ************************************************************************* */ +Vector3 Rot3::ypr() const { + Vector3 q = xyz(); + return Vector3(q(2),q(1),q(0)); +} + +/* ************************************************************************* */ +Vector3 Rot3::rpy() const { + return xyz(); +} + +/* ************************************************************************* */ +Quaternion Rot3::toQuaternion() const { + return Quaternion(rot_); +} + +/* ************************************************************************* */ +Vector Rot3::quaternion() const { + Quaternion q = toQuaternion(); + Vector v(4); + v(0) = q.w(); + v(1) = q.x(); + v(2) = q.y(); + v(3) = q.z(); + return v; +} + +/* ************************************************************************* */ +pair RQ(const Matrix3& A) { + + double x = -atan2(-A(2, 1), A(2, 2)); + Rot3 Qx = Rot3::Rx(-x); + Matrix3 B = A * Qx.matrix(); + + double y = -atan2(B(2, 0), B(2, 2)); + Rot3 Qy = Rot3::Ry(-y); + Matrix3 C = B * Qy.matrix(); + + double z = -atan2(-C(1, 0), C(1, 1)); + Rot3 Qz = Rot3::Rz(-z); + Matrix3 R = C * Qz.matrix(); + + Vector xyz = Vector3(x, y, z); + return make_pair(R, xyz); +} + +/* ************************************************************************* */ + +} // namespace gtsam + +#endif diff --git a/gtsam/geometry/Rot3Q.cpp b/gtsam/geometry/Rot3Q.cpp index 4a13bfeee..afab3900c 100644 --- a/gtsam/geometry/Rot3Q.cpp +++ b/gtsam/geometry/Rot3Q.cpp @@ -15,7 +15,9 @@ * @author Richard Roberts */ -#ifdef GTSAM_DEFAULT_QUATERNIONS +#include // Get GTSAM_USE_QUATERNIONS macro + +#ifdef GTSAM_USE_QUATERNIONS #include #include diff --git a/gtsam/geometry/tests/testRot3M.cpp b/gtsam/geometry/tests/testRot3M.cpp index 17aa50fa6..f59455e2f 100644 --- a/gtsam/geometry/tests/testRot3M.cpp +++ b/gtsam/geometry/tests/testRot3M.cpp @@ -26,7 +26,7 @@ #include -#ifndef GTSAM_DEFAULT_QUATERNIONS +#ifndef GTSAM_USE_QUATERNIONS using namespace std; using namespace gtsam; diff --git a/gtsam/geometry/tests/testRot3Q.cpp b/gtsam/geometry/tests/testRot3Q.cpp index 858f9a390..e8733c24d 100644 --- a/gtsam/geometry/tests/testRot3Q.cpp +++ b/gtsam/geometry/tests/testRot3Q.cpp @@ -23,7 +23,7 @@ #include #include -#ifdef GTSAM_DEFAULT_QUATERNIONS +#ifdef GTSAM_USE_QUATERNIONS using namespace gtsam; diff --git a/gtsam/global_includes.h b/gtsam/global_includes.h new file mode 100644 index 000000000..9eba7c7fc --- /dev/null +++ b/gtsam/global_includes.h @@ -0,0 +1,23 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file global_includes.h + * @brief Included from all GTSAM files + * @author Richard Roberts + * @addtogroup base + */ + +#pragma once + +#include // Configuration from CMake +#include // Basic types, constants, and compatibility functions +// types.h includes dllexport.h, which contains macros for dllspec tags for Windows DLLs diff --git a/gtsam/inference/BayesNet.h b/gtsam/inference/BayesNet.h index d3998656a..7aa54b216 100644 --- a/gtsam/inference/BayesNet.h +++ b/gtsam/inference/BayesNet.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/gtsam/inference/BayesTree.h b/gtsam/inference/BayesTree.h index 5e35b3f09..8f57531ae 100644 --- a/gtsam/inference/BayesTree.h +++ b/gtsam/inference/BayesTree.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/gtsam/inference/BayesTreeCliqueBase.h b/gtsam/inference/BayesTreeCliqueBase.h index 4841f6669..5e06aea1c 100644 --- a/gtsam/inference/BayesTreeCliqueBase.h +++ b/gtsam/inference/BayesTreeCliqueBase.h @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include diff --git a/gtsam/inference/ClusterTree.h b/gtsam/inference/ClusterTree.h index c1d3cfa76..b88929878 100644 --- a/gtsam/inference/ClusterTree.h +++ b/gtsam/inference/ClusterTree.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace gtsam { diff --git a/gtsam/inference/Factor.h b/gtsam/inference/Factor.h index abadb3a5a..b8ff34788 100644 --- a/gtsam/inference/Factor.h +++ b/gtsam/inference/Factor.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include namespace gtsam { diff --git a/gtsam/inference/GenericSequentialSolver.h b/gtsam/inference/GenericSequentialSolver.h index fffcb209f..250ff0d73 100644 --- a/gtsam/inference/GenericSequentialSolver.h +++ b/gtsam/inference/GenericSequentialSolver.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include diff --git a/gtsam/inference/IndexConditional.h b/gtsam/inference/IndexConditional.h index c83730e29..a4068f6c4 100644 --- a/gtsam/inference/IndexConditional.h +++ b/gtsam/inference/IndexConditional.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #include #include diff --git a/gtsam/inference/Permutation.h b/gtsam/inference/Permutation.h index 9f120d35f..213055781 100644 --- a/gtsam/inference/Permutation.h +++ b/gtsam/inference/Permutation.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include namespace gtsam { diff --git a/gtsam/inference/SymbolicFactorGraph.h b/gtsam/inference/SymbolicFactorGraph.h index 6f8fbcfc0..31e2b2b88 100644 --- a/gtsam/inference/SymbolicFactorGraph.h +++ b/gtsam/inference/SymbolicFactorGraph.h @@ -17,7 +17,7 @@ #pragma once -#include +#include #include #include diff --git a/gtsam/inference/VariableIndex.h b/gtsam/inference/VariableIndex.h index 501b84277..f503516a4 100644 --- a/gtsam/inference/VariableIndex.h +++ b/gtsam/inference/VariableIndex.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include namespace gtsam { diff --git a/gtsam/inference/VariableSlots.h b/gtsam/inference/VariableSlots.h index 7bebdea41..28367a647 100644 --- a/gtsam/inference/VariableSlots.h +++ b/gtsam/inference/VariableSlots.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include #include diff --git a/gtsam/linear/GaussianBayesNet.h b/gtsam/linear/GaussianBayesNet.h index 6de008bb1..3052e3926 100644 --- a/gtsam/linear/GaussianBayesNet.h +++ b/gtsam/linear/GaussianBayesNet.h @@ -20,7 +20,7 @@ #pragma once -#include +#include #include #include diff --git a/gtsam/linear/GaussianConditional.h b/gtsam/linear/GaussianConditional.h index 7ec2fabb1..b8d064efe 100644 --- a/gtsam/linear/GaussianConditional.h +++ b/gtsam/linear/GaussianConditional.h @@ -21,7 +21,7 @@ #include -#include +#include #include #include #include diff --git a/gtsam/linear/GaussianISAM.cpp b/gtsam/linear/GaussianISAM.cpp index 17371ffc1..a358e5cab 100644 --- a/gtsam/linear/GaussianISAM.cpp +++ b/gtsam/linear/GaussianISAM.cpp @@ -15,7 +15,6 @@ * @author Michael Kaess */ -#include #include #include diff --git a/gtsam/linear/GaussianMultifrontalSolver.cpp b/gtsam/linear/GaussianMultifrontalSolver.cpp index 84eadec86..af4fe90ec 100644 --- a/gtsam/linear/GaussianMultifrontalSolver.cpp +++ b/gtsam/linear/GaussianMultifrontalSolver.cpp @@ -15,7 +15,6 @@ * @date Oct 21, 2010 */ -#include #include namespace gtsam { diff --git a/gtsam/linear/GaussianSequentialSolver.cpp b/gtsam/linear/GaussianSequentialSolver.cpp index ab6984cd6..75a8c3871 100644 --- a/gtsam/linear/GaussianSequentialSolver.cpp +++ b/gtsam/linear/GaussianSequentialSolver.cpp @@ -15,7 +15,6 @@ * @date Oct 19, 2010 */ -#include #include #include diff --git a/gtsam/linear/JacobianFactor.h b/gtsam/linear/JacobianFactor.h index bce3396f7..f474123e4 100644 --- a/gtsam/linear/JacobianFactor.h +++ b/gtsam/linear/JacobianFactor.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include diff --git a/gtsam/linear/VectorValues.h b/gtsam/linear/VectorValues.h index af02f62d4..bcd106a0e 100644 --- a/gtsam/linear/VectorValues.h +++ b/gtsam/linear/VectorValues.h @@ -18,7 +18,7 @@ #pragma once #include -#include +#include #include #include diff --git a/gtsam/linear/linearExceptions.h b/gtsam/linear/linearExceptions.h index 6db549ee0..8b036df0a 100644 --- a/gtsam/linear/linearExceptions.h +++ b/gtsam/linear/linearExceptions.h @@ -17,7 +17,7 @@ */ #pragma once -#include +#include #include #include diff --git a/gtsam/nonlinear/Key.h b/gtsam/nonlinear/Key.h index 452af11ae..477febce9 100644 --- a/gtsam/nonlinear/Key.h +++ b/gtsam/nonlinear/Key.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/gtsam/nonlinear/Marginals.cpp b/gtsam/nonlinear/Marginals.cpp index ba13e23c1..466a20a84 100644 --- a/gtsam/nonlinear/Marginals.cpp +++ b/gtsam/nonlinear/Marginals.cpp @@ -16,7 +16,6 @@ * @date May 14, 2012 */ -#include #include #include #include diff --git a/gtsam/slam/dataset.cpp b/gtsam/slam/dataset.cpp index c5d72359f..25cce20d7 100644 --- a/gtsam/slam/dataset.cpp +++ b/gtsam/slam/dataset.cpp @@ -40,8 +40,8 @@ namespace gtsam { string findExampleDataFile(const string& name) { // Search source tree and installed location vector rootsToSearch; - rootsToSearch.push_back(SOURCE_TREE_DATASET_DIR); // Defined by CMake, see gtsam/gtsam/CMakeLists.txt - rootsToSearch.push_back(INSTALLED_DATASET_DIR); // Defined by CMake, see gtsam/gtsam/CMakeLists.txt + rootsToSearch.push_back(SourceTreeDatasetDir); // Defined by CMake, see gtsam/gtsam/CMakeLists.txt + rootsToSearch.push_back(InstalledDatasetDir); // Defined by CMake, see gtsam/gtsam/CMakeLists.txt // Search for filename as given, and with .graph and .txt extensions vector namesToSearch; diff --git a/gtsam_unstable/base/Dummy.h b/gtsam_unstable/base/Dummy.h index 48efb0ac7..ff9f3a8a6 100644 --- a/gtsam_unstable/base/Dummy.h +++ b/gtsam_unstable/base/Dummy.h @@ -17,7 +17,7 @@ * @date June 14, 2012 */ -#include +#include #include #include diff --git a/gtsam_unstable/dynamics/PoseRTV.cpp b/gtsam_unstable/dynamics/PoseRTV.cpp index bf10e38b8..5a442560e 100644 --- a/gtsam_unstable/dynamics/PoseRTV.cpp +++ b/gtsam_unstable/dynamics/PoseRTV.cpp @@ -3,8 +3,6 @@ * @author Alex Cunningham */ -#include - #include #include #include