25 #include <gtsam/base/DerivedValue.h>
28 #include <boost/serialization/nvp.hpp>
42 static const size_t dimension = 3;
56 Point3(
double x,
double y,
double z): x_(x), y_(y), z_(z) {}
65 throw std::invalid_argument(
"Point3 constructor from Vector requires that the Vector have dimension 3");
76 void print(
const std::string& s =
"")
const;
98 boost::optional<Matrix&> H1=boost::none,
99 boost::optional<Matrix&> H2=boost::none)
const {
100 if (H1) *H1 =
eye(3);
101 if (H2) *H2 =
eye(3);
110 boost::optional<Matrix&> H1=boost::none,
111 boost::optional<Matrix&> H2=boost::none)
const {
112 if(H1) *H1 = -
eye(3);
125 inline static size_t Dim() {
return dimension; }
128 inline size_t dim()
const {
return dimension; }
144 static inline Vector3
Logmap(
const Point3& dp) {
return Vector3(dp.
x(), dp.
y(), dp.
z()); }
147 static Matrix
dexpL(
const Vector& v) {
164 Point3 operator / (
double s)
const;
168 return (p2 - *
this).norm();
173 return (p2 - *
this).norm();
180 Point3 normalize(boost::optional<Matrix&> H = boost::none)
const;
196 Vector3
vector()
const {
return Vector3(x_,y_,z_); }
199 inline double x()
const {
return x_;}
202 inline double y()
const {
return y_;}
205 inline double z()
const {
return z_;}
209 boost::optional<Matrix&> H1=boost::none, boost::optional<Matrix&> H2=boost::none)
const;
213 boost::optional<Matrix&> H1=boost::none, boost::optional<Matrix&> H2=boost::none)
const;
218 GTSAM_EXPORT
friend std::ostream &operator<<(std::ostream &os,
const Point3& p);
226 friend class boost::serialization::access;
227 template<
class ARCHIVE>
228 void serialize(ARCHIVE & ar,
const unsigned int version)
230 ar & boost::serialization::make_nvp(
"Point3",
231 boost::serialization::base_object<Value>(*
this));
232 ar & BOOST_SERIALIZATION_NVP(x_);
233 ar & BOOST_SERIALIZATION_NVP(y_);
234 ar & BOOST_SERIALIZATION_NVP(z_);
static Matrix dexpInvL(const Vector &v)
Left-trivialized derivative inverse of the exponential map.
Definition: Point3.h:152
static Point3 identity()
identity for group operation
Definition: Point3.h:86
double dot(const V1 &a, const V2 &b)
Dot product.
Definition: Vector.h:259
double dist(const Point3 &p2) const
Definition: Point3.h:172
Base class and basic functions for Lie types.
Point3 between(const Point3 &p2, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
Between using the default implementation.
Definition: Point3.h:109
Matrix eye(size_t m, size_t n)
Creates an identity matrix, with matlab-like syntax.
Definition: Matrix.cpp:50
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:205
double distance(const Point3 &p2) const
distance between two points
Definition: Point3.h:167
Vector3 vector() const
return vectorized form (column-wise)
Definition: Point3.h:196
Point3 compose(const Point3 &p2, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
"Compose" - just adds coordinates of two points
Definition: Point3.h:97
Vector3 localCoordinates(const Point3 &q) const
Returns inverse retraction.
Definition: Point3.h:134
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:249
bool operator==(const Matrix &A, const Matrix &B)
equality is just equal_with_abs_tol 1e-9
Definition: Matrix.h:104
Point3 inverse() const
"Inverse" - negates the coordinates such that compose(p, inverse(p)) = Point3()
Definition: Point3.h:91
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
Point3(double x, double y, double z)
Construct from x, y, and z coordinates.
Definition: Point3.h:56
double z() const
get z
Definition: Point3.h:205
Template to create a binary predicate.
Definition: Testable.h:102
double y() const
get y
Definition: Point3.h:202
static Point3 Expmap(const Vector &v)
Exponential map at identity - just create a Point3 from x,y,z.
Definition: Point3.h:141
static Vector3 Logmap(const Point3 &dp)
Log map at identity - return the x,y,z of this point.
Definition: Point3.h:144
Point3()
Default constructor creates a zero-Point3.
Definition: Point3.h:53
typedef and functions to augment Eigen's MatrixXd
double x() const
get x
Definition: Point3.h:199
static Matrix dexpL(const Vector &v)
Left-trivialized derivative of the exponential map.
Definition: Point3.h:147
Point3 retract(const Vector &v) const
Updates a with tangent space delta.
Definition: Point3.h:131
Definition: DerivedValue.h:44
static size_t Dim()
dimension of the variable - used to autodetect sizes
Definition: Point3.h:125
size_t dim() const
return dimensionality of tangent space, DOF = 3
Definition: Point3.h:128
Point3(const Vector &v)
Construct from 3-element vector.
Definition: Point3.h:63