20 #include <gtsam/base/VectorSpace.h> 21 #include <boost/serialization/nvp.hpp> 25 #ifdef GTSAM_TYPEDEF_POINTS_TO_VECTORS 29 typedef Vector2 Point2;
40 class GTSAM_EXPORT
Point2 :
public Vector2 {
44 enum { dimension = 2 };
49 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4 56 using Vector2::Vector2;
63 explicit Point2(
const Vector2& v):Vector2(v) {}
69 void print(
const std::string& s =
"")
const;
103 inline double x()
const {
return (*
this)[0];}
106 inline double y()
const {
return (*
this)[1];}
109 const Vector2&
vector()
const {
return *
this; }
114 GTSAM_EXPORT
friend std::ostream &operator<<(std::ostream &os,
const Point2& p);
116 #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4 117 Point2 inverse()
const {
return -(*this); }
120 Point2 compose(
const Point2& q)
const {
return (*
this)+q;}
121 Point2
between(
const Point2& q)
const {
return q-(*this);}
122 Vector2 localCoordinates(
const Point2& q)
const {
return between(q);}
123 Point2 retract(
const Vector2& v)
const {
return compose(Point2(v));}
124 static Vector2 Logmap(
const Point2& p) {
return p;}
125 static Point2 Expmap(
const Vector2& v) {
return Point2(v);}
126 inline double dist(
const Point2& p2)
const {
return distance(p2);}
127 static boost::optional<Point2> CircleCircleIntersection(
double R_d,
double r_d,
double tol = 1e-9);
128 static std::list<Point2> CircleCircleIntersection(Point2 c1, Point2 c2, boost::optional<Point2> fh);
129 static std::list<Point2> CircleCircleIntersection(Point2 c1,
double r1, Point2 c2,
double r2,
double tol = 1e-9);
139 friend class boost::serialization::access;
140 template<
class ARCHIVE>
141 void serialize(ARCHIVE & ar,
const unsigned int )
143 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Vector2);}
152 #endif // GTSAM_TYPEDEF_POINTS_TO_VECTORS 164 GTSAM_EXPORT std::ostream &operator<<(std::ostream &os,
const gtsam::Point2Pair &p);
167 typedef std::vector<Point2, Eigen::aligned_allocator<Point2> > Point2Vector;
188 GTSAM_EXPORT boost::optional<Point2> circleCircleIntersection(
double R_d,
double r_d,
double tol = 1e-9);
196 GTSAM_EXPORT std::list<Point2> circleCircleIntersection(Point2 c1, Point2 c2, boost::optional<Point2> fh);
207 GTSAM_EXPORT std::list<Point2> circleCircleIntersection(Point2 c1,
double r1,
208 Point2 c2,
double r2,
double tol = 1e-9);
const Vector2 & vector() const
return vectorized form (column-wise).
Definition: Point2.h:109
double norm2(const Point2 &p, OptionalJacobian< 1, 2 > H)
Distance of the point from the origin, with Jacobian.
Definition: Point2.cpp:27
static Point2 identity()
identity
Definition: Point2.h:79
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
Point2 unit() const
creates a unit vector
Definition: Point2.h:86
Point2(const Vector2 &v)
construct from 2D vector
Definition: Point2.h:63
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
Point2()
default constructor
Definition: Point2.h:53
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 y() const
get y
Definition: Point2.h:106
double distance2(const Point2 &p, const Point2 &q, OptionalJacobian< 1, 2 > H1, OptionalJacobian< 1, 2 > H2)
distance between two points
Definition: Point2.cpp:39
VectorSpace provides both Testable and VectorSpaceTraits.
Definition: VectorSpace.h:207
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
bool operator==(const Matrix &A, const Matrix &B)
equality is just equal_with_abs_tol 1e-9
Definition: Matrix.h:102
std::pair< Point2, Point2 > Point2Pair
Calculate pose between a vector of 2D point correspondences (p,q) where q = Pose2::transformFrom(p) =...
Definition: Point2.h:163
Point2 operator *(double s, const Point2 &p)
multiply with scalar
Definition: Point2.h:170
double x() const
get x
Definition: Point2.h:103