20 #include <boost/serialization/nvp.hpp>
22 #include <gtsam/base/DerivedValue.h>
38 static const size_t dimension = 2;
51 Point2(
double x,
double y): x_(x), y_(y) {}
60 throw std::invalid_argument(
"Point2 constructor from Vector requires that the Vector have dimension 2");
79 static boost::optional<Point2> CircleCircleIntersection(
double R_d,
double r_d,
88 static std::list<Point2> CircleCircleIntersection(
Point2 c1,
Point2 c2, boost::optional<Point2>);
99 static std::list<Point2> CircleCircleIntersection(
Point2 c1,
double r1,
100 Point2 c2,
double r2,
double tol = 1e-9);
107 void print(
const std::string& s =
"")
const;
129 boost::optional<Matrix&> H1=boost::none,
130 boost::optional<Matrix&> H2=boost::none)
const {
141 boost::optional<Matrix&> H1=boost::none,
142 boost::optional<Matrix&> H2=boost::none)
const {
143 if(H1) *H1 = -
eye(2);
156 inline static size_t Dim() {
return dimension; }
159 inline size_t dim()
const {
return dimension; }
175 static inline Vector
Logmap(
const Point2& dp) {
return (Vector(2) << dp.
x(), dp.
y()); }
185 double norm(boost::optional<Matrix&> H = boost::none)
const;
188 double distance(
const Point2& p2, boost::optional<Matrix&> H1 = boost::none,
189 boost::optional<Matrix&> H2 = boost::none)
const;
193 return (p2 - *
this).norm();
210 double x()
const {
return x_;}
213 double y()
const {
return y_;}
216 Vector2
vector()
const {
return Vector2(x_, y_); }
221 inline void operator += (
const Point2& q) {x_+=q.x_;y_+=q.y_;}
222 inline void operator *= (
double s) {x_*=s;y_*=s;}
226 GTSAM_EXPORT
friend std::ostream &operator<<(std::ostream &os,
const Point2& p);
234 friend class boost::serialization::access;
235 template<
class ARCHIVE>
236 void serialize(ARCHIVE & ar,
const unsigned int version)
238 ar & boost::serialization::make_nvp(
"Point2",
239 boost::serialization::base_object<Value>(*
this));
240 ar & BOOST_SERIALIZATION_NVP(x_);
241 ar & BOOST_SERIALIZATION_NVP(y_);
Point2()
default constructor
Definition: Point2.h:48
Point2(double x, double y)
construct from doubles
Definition: Point2.h:51
Point2 unit() const
creates a unit vector
Definition: Point2.h:182
Base class and basic functions for Lie types.
Matrix eye(size_t m, size_t n)
Creates an identity matrix, with matlab-like syntax.
Definition: Matrix.cpp:50
static Vector Logmap(const Point2 &dp)
Log map around identity - just return the Point2 as a vector.
Definition: Point2.h:175
Point2 retract(const Vector &v) const
Updates a with tangent space delta.
Definition: Point2.h:162
Point2 between(const Point2 &q, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
"Between", subtracts point coordinates. between(p,q) == compose(inverse(p),q)
Definition: Point2.h:140
Vector2 vector() const
return vectorized form (column-wise). TODO: why does this function exist?
Definition: Point2.h:216
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:249
Vector localCoordinates(const Point2 &t2) const
Local coordinates of manifold neighborhood around current value.
Definition: Point2.h:165
bool operator==(const Matrix &A, const Matrix &B)
equality is just equal_with_abs_tol 1e-9
Definition: Matrix.h:104
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
static Point2 Expmap(const Vector &v)
Exponential map around identity - just create a Point2 from a vector.
Definition: Point2.h:172
Template to create a binary predicate.
Definition: Testable.h:102
Point2(const Vector &v)
construct from 2D vector
Definition: Point2.h:58
double y() const
get y
Definition: Point2.h:213
size_t dim() const
Dimensionality of tangent space = 2 DOF.
Definition: Point2.h:159
double dist(const Point2 &p2) const
Definition: Point2.h:192
typedef and functions to augment Eigen's MatrixXd
double x() const
get x
Definition: Point2.h:210
static size_t Dim()
dimension of the variable - used to autodetect sizes
Definition: Point2.h:156
static Point2 identity()
identity
Definition: Point2.h:117
Definition: DerivedValue.h:44
Point2 inverse() const
"Inverse" - negates each coordinate such that compose(p,inverse(p)) == identity() ...
Definition: Point2.h:122
Point2 compose(const Point2 &q, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
"Compose", just adds the coordinates of two points. With optional derivatives
Definition: Point2.h:128