24 #include <gtsam/config.h> 25 #include <gtsam/base/VectorSpace.h> 27 #include <gtsam/dllexport.h> 28 #include <boost/serialization/nvp.hpp> 32 #ifdef GTSAM_TYPEDEF_POINTS_TO_VECTORS 36 typedef Vector3 Point3;
45 class GTSAM_EXPORT
Point3 :
public Vector3 {
49 enum { dimension = 3 };
55 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4 59 using Vector3::Vector3;
66 void print(
const std::string& s =
"")
const;
105 const Vector3&
vector()
const {
return *
this; }
108 inline double x()
const {
return (*
this)[0];}
111 inline double y()
const {
return (*
this)[1];}
114 inline double z()
const {
return (*
this)[2];}
119 GTSAM_EXPORT
friend std::ostream &operator<<(std::ostream &os,
const Point3& p);
121 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4 122 Point3 inverse()
const {
return -(*this);}
125 Point3 compose(
const Point3& q)
const {
return (*
this)+q;}
126 Point3
between(
const Point3& q)
const {
return q-(*this);}
127 Vector3 localCoordinates(
const Point3& q)
const {
return between(q);}
128 Point3 retract(
const Vector3& v)
const {
return compose(Point3(v));}
129 static Vector3 Logmap(
const Point3& p) {
return p;}
130 static Point3 Expmap(
const Vector3& v) {
return Point3(v);}
131 inline double dist(
const Point3& q)
const {
return (q - *
this).norm(); }
132 Point3
normalize(OptionalJacobian<3, 3> H = boost::none)
const {
return normalized(H);}
133 Point3 add(
const Point3& q, OptionalJacobian<3, 3> H1 = boost::none,
134 OptionalJacobian<3, 3> H2 = boost::none)
const;
135 Point3
sub(
const Point3& q, OptionalJacobian<3, 3> H1 = boost::none,
136 OptionalJacobian<3, 3> H2 = boost::none)
const;
143 friend class boost::serialization::access;
144 template<
class ARCHIVE>
145 void serialize(ARCHIVE & ar,
const unsigned int ) {
146 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Vector3);
156 #endif // GTSAM_TYPEDEF_POINTS_TO_VECTORS 159 typedef std::pair<Point3, Point3> Point3Pair;
160 GTSAM_EXPORT std::ostream &operator<<(std::ostream &os,
const gtsam::Point3Pair &p);
183 template <
typename A1,
typename A2>
188 typedef double result_type;
double dot(const V1 &a, const V2 &b)
Dot product.
Definition: Vector.h:162
double x() const
get x
Definition: Point3.h:108
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
static Point3 identity()
identity for group operation
Definition: Point3.h:76
Point3 cross(const Point3 &p, const Point3 &q, OptionalJacobian< 3, 3 > H1, OptionalJacobian< 3, 3 > H2)
cross product
Definition: Point3.cpp:121
Point3 normalize(const Point3 &p, OptionalJacobian< 3, 3 > H)
normalize, with optional Jacobian
Definition: Point3.cpp:109
Template to create a binary predicate.
Definition: Testable.h:110
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
const Vector3 & vector() const
return as Vector3
Definition: Point3.h:105
double norm3(const Point3 &p, OptionalJacobian< 1, 3 > H)
Distance of the point from the origin, with Jacobian.
Definition: Point3.cpp:98
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Definition: BearingRange.h:39
VectorSpace provides both Testable and VectorSpaceTraits.
Definition: VectorSpace.h:207
Eigen::Block< const MATRIX > sub(const MATRIX &A, size_t i1, size_t i2, size_t j1, size_t j2)
extract submatrix, slice semantics, i.e.
Definition: Matrix.h:183
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
T between(const T &t1, const T &t2)
binary functions
Definition: lieProxies.h:36
double y() const
get y
Definition: Point3.h:111
typedef and functions to augment Eigen's VectorXd
double z() const
get z
Definition: Point3.h:114
double distance3(const Point3 &p1, const Point3 &q, OptionalJacobian< 1, 3 > H1, OptionalJacobian< 1, 3 > H2)
distance between two points
Definition: Point3.cpp:84