One flag to rule them all: GTSAM_TYPEDEF_POINTS_TO_VECTORS
parent
0799cda9de
commit
be21889e9d
|
@ -66,7 +66,7 @@ option(GTSAM_WITH_EIGEN_MKL_OPENMP "Eigen, when using Intel MKL, will also
|
||||||
option(GTSAM_THROW_CHEIRALITY_EXCEPTION "Throw exception when a triangulated point is behind a camera" ON)
|
option(GTSAM_THROW_CHEIRALITY_EXCEPTION "Throw exception when a triangulated point is behind a camera" ON)
|
||||||
option(GTSAM_BUILD_PYTHON "Enable/Disable building & installation of Python module" OFF)
|
option(GTSAM_BUILD_PYTHON "Enable/Disable building & installation of Python module" OFF)
|
||||||
option(GTSAM_ALLOW_DEPRECATED_SINCE_V4 "Allow use of methods/functions deprecated in GTSAM 4" ON)
|
option(GTSAM_ALLOW_DEPRECATED_SINCE_V4 "Allow use of methods/functions deprecated in GTSAM 4" ON)
|
||||||
option(GTSAM_USE_VECTOR3_POINTS "Simply typdef Point3 to eigen::Vector3d" OFF)
|
option(GTSAM_TYPEDEF_POINTS_TO_VECTORS "Typdef Point2 and Point3 to Eigen::Vector equivalents" OFF)
|
||||||
option(GTSAM_SUPPORT_NESTED_DISSECTION "Support Metis-based nested dissection" ON)
|
option(GTSAM_SUPPORT_NESTED_DISSECTION "Support Metis-based nested dissection" ON)
|
||||||
option(GTSAM_TANGENT_PREINTEGRATION "Use new ImuFactor with integration on tangent space" ON)
|
option(GTSAM_TANGENT_PREINTEGRATION "Use new ImuFactor with integration on tangent space" ON)
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ if(GTSAM_BUILD_PYTHON AND GTSAM_ALLOW_DEPRECATED_SINCE_V4)
|
||||||
message(FATAL_ERROR "GTSAM_BUILD_PYTHON and GTSAM_ALLOW_DEPRECATED_SINCE_V4 are both enabled. The python module cannot be compiled with deprecated functions turned on. Turn one of the two options off.")
|
message(FATAL_ERROR "GTSAM_BUILD_PYTHON and GTSAM_ALLOW_DEPRECATED_SINCE_V4 are both enabled. The python module cannot be compiled with deprecated functions turned on. Turn one of the two options off.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(GTSAM_INSTALL_MATLAB_TOOLBOX AND GTSAM_USE_VECTOR3_POINTS)
|
if(GTSAM_INSTALL_MATLAB_TOOLBOX AND GTSAM_TYPEDEF_POINTS_TO_VECTORS)
|
||||||
message(FATAL_ERROR "GTSAM_INSTALL_MATLAB_TOOLBOX and GTSAM_USE_VECTOR3_POINTS are both enabled. For now, the MATLAB toolbox cannot deal with this yet. Please turn one of the two options off.")
|
message(FATAL_ERROR "GTSAM_INSTALL_MATLAB_TOOLBOX and GTSAM_TYPEDEF_POINTS_TO_VECTORS are both enabled. For now, the MATLAB toolbox cannot deal with this yet. Please turn one of the two options off.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Flags for choosing default packaging tools
|
# Flags for choosing default packaging tools
|
||||||
|
@ -491,7 +491,7 @@ print_config_flag(${GTSAM_ENABLE_CONSISTENCY_CHECKS} "Runtime consistency chec
|
||||||
print_config_flag(${GTSAM_ROT3_EXPMAP} "Rot3 retract is full ExpMap ")
|
print_config_flag(${GTSAM_ROT3_EXPMAP} "Rot3 retract is full ExpMap ")
|
||||||
print_config_flag(${GTSAM_POSE3_EXPMAP} "Pose3 retract is full ExpMap ")
|
print_config_flag(${GTSAM_POSE3_EXPMAP} "Pose3 retract is full ExpMap ")
|
||||||
print_config_flag(${GTSAM_ALLOW_DEPRECATED_SINCE_V4} "Deprecated in GTSAM 4 allowed ")
|
print_config_flag(${GTSAM_ALLOW_DEPRECATED_SINCE_V4} "Deprecated in GTSAM 4 allowed ")
|
||||||
print_config_flag(${GTSAM_USE_VECTOR3_POINTS} "Point3 is typedef to Vector3 ")
|
print_config_flag(${GTSAM_TYPEDEF_POINTS_TO_VECTORS} "Point3 is typedef to Vector3 ")
|
||||||
print_config_flag(${GTSAM_SUPPORT_NESTED_DISSECTION} "Metis-based Nested Dissection ")
|
print_config_flag(${GTSAM_SUPPORT_NESTED_DISSECTION} "Metis-based Nested Dissection ")
|
||||||
print_config_flag(${GTSAM_TANGENT_PREINTEGRATION} "Use tangent-space preintegration")
|
print_config_flag(${GTSAM_TANGENT_PREINTEGRATION} "Use tangent-space preintegration")
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,14 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
#ifdef GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
|
|
||||||
|
/// As of GTSAM 4, in order to make GTSAM more lean,
|
||||||
|
/// it is now possible to just typedef Point2 to Vector2
|
||||||
|
typedef Vector2 Point2;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A 2D point
|
* A 2D point
|
||||||
* Complies with the Testable Concept
|
* Complies with the Testable Concept
|
||||||
|
@ -172,6 +180,12 @@ private:
|
||||||
/// @}
|
/// @}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct traits<Point2> : public internal::VectorSpace<Point2> {
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
|
|
||||||
// Convenience typedef
|
// Convenience typedef
|
||||||
typedef std::pair<Point2, Point2> Point2Pair;
|
typedef std::pair<Point2, Point2> Point2Pair;
|
||||||
std::ostream &operator<<(std::ostream &os, const gtsam::Point2Pair &p);
|
std::ostream &operator<<(std::ostream &os, const gtsam::Point2Pair &p);
|
||||||
|
@ -184,9 +198,5 @@ inline Point2 operator*(double s, const Point2& p) {
|
||||||
return p * s;
|
return p * s;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
struct traits<Point2> : public internal::VectorSpace<Point2> {
|
|
||||||
};
|
|
||||||
|
|
||||||
} // \ namespace gtsam
|
} // \ namespace gtsam
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
#ifndef GTSAM_USE_VECTOR3_POINTS
|
#ifndef GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
bool Point3::equals(const Point3 &q, double tol) const {
|
bool Point3::equals(const Point3 &q, double tol) const {
|
||||||
return (fabs(x() - q.x()) < tol && fabs(y() - q.y()) < tol &&
|
return (fabs(x() - q.x()) < tol && fabs(y() - q.y()) < tol &&
|
||||||
fabs(z() - q.z()) < tol);
|
fabs(z() - q.z()) < tol);
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
#ifdef GTSAM_USE_VECTOR3_POINTS
|
#ifdef GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
|
|
||||||
/// As of GTSAM 4, in order to make GTSAM more lean,
|
/// As of GTSAM 4, in order to make GTSAM more lean,
|
||||||
/// it is now possible to just typedef Point3 to Vector3
|
/// it is now possible to just typedef Point3 to Vector3
|
||||||
|
@ -153,7 +153,7 @@ struct traits<Point3> : public internal::VectorSpace<Point3> {};
|
||||||
template<>
|
template<>
|
||||||
struct traits<const Point3> : public internal::VectorSpace<Point3> {};
|
struct traits<const Point3> : public internal::VectorSpace<Point3> {};
|
||||||
|
|
||||||
#endif
|
#endif // GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
|
|
||||||
// Convenience typedef
|
// Convenience typedef
|
||||||
typedef std::pair<Point3, Point3> Point3Pair;
|
typedef std::pair<Point3, Point3> Point3Pair;
|
||||||
|
|
|
@ -154,7 +154,7 @@ TEST( Point3, cross2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
#ifndef GTSAM_USE_VECTOR3_POINTS
|
#ifndef GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
TEST( Point3, stream) {
|
TEST( Point3, stream) {
|
||||||
Point3 p(1, 2, -3);
|
Point3 p(1, 2, -3);
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
|
|
|
@ -44,7 +44,7 @@ class_<Point3>("Point3")
|
||||||
.def("norm", &Point3::norm, norm_overloads(args("OptionalJacobian<1,3>")))
|
.def("norm", &Point3::norm, norm_overloads(args("OptionalJacobian<1,3>")))
|
||||||
.def("normalized", &Point3::normalized)
|
.def("normalized", &Point3::normalized)
|
||||||
.def("print", &Point3::print, print_overloads(args("s")))
|
.def("print", &Point3::print, print_overloads(args("s")))
|
||||||
#ifndef GTSAM_USE_VECTOR3_POINTS
|
#ifndef GTSAM_TYPEDEF_POINTS_TO_VECTORS
|
||||||
.def("vector", &Point3::vector, return_value_policy<copy_const_reference>())
|
.def("vector", &Point3::vector, return_value_policy<copy_const_reference>())
|
||||||
.def("x", &Point3::x)
|
.def("x", &Point3::x)
|
||||||
.def("y", &Point3::y)
|
.def("y", &Point3::y)
|
||||||
|
|
Loading…
Reference in New Issue