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 56 Point3() { setZero(); }
59 using Vector3::Vector3;
66 void print(
const std::string& s =
"")
const;
69 bool equals(
const Point3& p,
double tol = 1e-9)
const;
76 inline static Point3
identity() {
return Point3(0.0, 0.0, 0.0); }
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(); }
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 std::ostream &operator<<(std::ostream &os,
const gtsam::Point3Pair &p);
163 double distance3(
const Point3& p1,
const Point3& q,
174 Point3
cross(
const Point3& p,
const Point3& q,
179 double dot(
const Point3& p,
const Point3& q,
183 template <
typename A1,
typename A2>
188 typedef double result_type;
189 double operator()(
const Point3& p,
const Point3& q,
Point3 normalize(const Point3 &p, OptionalJacobian< 3, 3 > H)
normalize, with optional Jacobian
Definition: Point3.cpp:108
Definition: BearingRange.h:38
VectorSpace provides both Testable and VectorSpaceTraits.
Definition: VectorSpace.h:207
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:140
double y() const
get y
Definition: Point3.h:111
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
typedef and functions to augment Eigen's VectorXd
const Vector3 & vector() const
return as Vector3
Definition: Point3.h:105
Template to create a binary predicate.
Definition: Testable.h:110
Point3 cross(const Point3 &p, const Point3 &q, OptionalJacobian< 3, 3 > H1, OptionalJacobian< 3, 3 > H2)
cross product
Definition: Point3.cpp:120
double norm3(const Point3 &p, OptionalJacobian< 1, 3 > H)
Distance of the point from the origin, with Jacobian.
Definition: Point3.cpp:97
double distance3(const Point3 &p1, const Point3 &q, OptionalJacobian< 1, 3 > H1, OptionalJacobian< 1, 3 > H2)
distance between two points
Definition: Point3.cpp:83
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
double z() const
get z
Definition: Point3.h:114
double x() const
get x
Definition: Point3.h:108
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
double dot(const V1 &a, const V2 &b)
Dot product.
Definition: Vector.h:162
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
static Point3 identity()
identity for group operation
Definition: Point3.h:76