27#include <gtsam/dllexport.h>
29#include <boost/optional.hpp>
30#include <boost/serialization/nvp.hpp>
47 mutable boost::optional<Matrix32> B_;
48 mutable boost::optional<Matrix62> H_B_;
51 mutable std::mutex B_mutex_;
69 explicit Unit3(
const Vector3& p) :
74 Unit3(
double x,
double y,
double z) :
81 explicit Unit3(
const Point2& p,
double f) : p_(p.x(), p.y(), f) {
108 GTSAM_EXPORT
static Unit3 Random(std::mt19937 & rng);
115 friend std::ostream& operator<<(std::ostream& os,
const Unit3& pair);
118 GTSAM_EXPORT
void print(
const std::string& s = std::string())
const;
138 GTSAM_EXPORT Matrix3
skew()
const;
169 return Unit3(p_.cross(q.p_));
183 inline static size_t Dim() {
188 inline size_t dim()
const {
211 template<
class ARCHIVE>
212 void serialize(ARCHIVE & ar,
const unsigned int ) {
213 ar & BOOST_SERIALIZATION_NVP(p_);
#define GTSAM_MAKE_ALIGNED_OPERATOR_NEW
This marks a GTSAM object to require alignment.
Definition: types.h:277
typedef and functions to augment Eigen's MatrixXd
Base class and basic functions for Manifold types.
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Vector2 Point2
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point2 to Vector2...
Definition: Point2.h:27
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition: Point3.h:35
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
equals with a tolerance
Definition: Matrix.h:84
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Both ManifoldTraits and Testable.
Definition: Manifold.h:120
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
Represents a 3D point on a unit sphere.
Definition: Unit3.h:42
GTSAM_EXPORT Vector3 unitVector(OptionalJacobian< 3, 2 > H=boost::none) const
Return unit-norm Vector.
Definition: Unit3.cpp:143
GTSAM_EXPORT Unit3 retract(const Vector2 &v, OptionalJacobian< 2, 2 > H=boost::none) const
The retract function.
Definition: Unit3.cpp:247
GTSAM_EXPORT double dot(const Unit3 &q, OptionalJacobian< 1, 2 > H1=boost::none, OptionalJacobian< 1, 2 > H2=boost::none) const
Return dot product with q.
Definition: Unit3.cpp:166
Unit3(double x, double y, double z)
Construct from x,y,z.
Definition: Unit3.h:74
GTSAM_EXPORT const Matrix32 & basis(OptionalJacobian< 6, 2 > H=boost::none) const
Returns the local coordinate frame to tangent plane It is a 3*2 matrix [b1 b2] composed of two orthog...
Definition: Unit3.cpp:76
Unit3(const Point2 &p, double f)
Construct from 2D point in plane at focal length f Unit3(p,1) can be viewed as normalized homogeneous...
Definition: Unit3.h:81
Unit3(const Unit3 &u)
Copy constructor.
Definition: Unit3.h:86
Unit3()
Default constructor.
Definition: Unit3.h:64
friend Point3 operator*(double s, const Unit3 &d)
Return scaled direction as Point3.
Definition: Unit3.h:147
static size_t Dim()
Dimensionality of tangent space = 2 DOF.
Definition: Unit3.h:183
GTSAM_EXPORT Point3 point3(OptionalJacobian< 3, 2 > H=boost::none) const
Return unit-norm Point3.
Definition: Unit3.cpp:136
GTSAM_EXPORT void print(const std::string &s=std::string()) const
The print fuction.
Definition: Unit3.cpp:156
size_t dim() const
Dimensionality of tangent space = 2 DOF.
Definition: Unit3.h:188
static GTSAM_EXPORT Unit3 FromPoint3(const Point3 &point, OptionalJacobian< 2, 3 > H=boost::none)
Named constructor from Point3 with optional Jacobian.
Definition: Unit3.cpp:36
GTSAM_EXPORT Vector2 error(const Unit3 &q, OptionalJacobian< 2, 2 > H_q=boost::none) const
Signed, vector-valued error between two directions.
Definition: Unit3.cpp:191
Unit3(const Vector3 &p)
Construct from point.
Definition: Unit3.h:69
bool equals(const Unit3 &s, double tol=1e-9) const
The equals function with tolerance.
Definition: Unit3.h:121
CoordinatesMode
Definition: Unit3.h:192
@ EXPMAP
Use the exponential map to retract.
Definition: Unit3.h:193
@ RENORM
Retract with vector addition and renormalize.
Definition: Unit3.h:194
GTSAM_EXPORT Vector2 errorVector(const Unit3 &q, OptionalJacobian< 2, 2 > H_p=boost::none, OptionalJacobian< 2, 2 > H_q=boost::none) const
Signed, vector-valued error between two directions NOTE(hayk): This method has zero derivatives if th...
Definition: Unit3.cpp:201
GTSAM_EXPORT double distance(const Unit3 &q, OptionalJacobian< 1, 2 > H=boost::none) const
Distance between two directions.
Definition: Unit3.cpp:237
Unit3 cross(const Unit3 &q) const
Cross-product between two Unit3s.
Definition: Unit3.h:168
static GTSAM_EXPORT Unit3 Random(std::mt19937 &rng)
Random direction, using boost::uniform_on_sphere Example: std::mt19937 engine(42); Unit3 unit = Unit3...
Definition: Unit3.cpp:47
friend class boost::serialization::access
Serialization function.
Definition: Unit3.h:210
Point3 cross(const Point3 &q) const
Cross-product w Point3.
Definition: Unit3.h:173
GTSAM_EXPORT Vector2 localCoordinates(const Unit3 &s) const
The local coordinates function.
Definition: Unit3.cpp:277
Unit3 & operator=(const Unit3 &u)
Copy assignment.
Definition: Unit3.h:91
GTSAM_EXPORT Matrix3 skew() const
Return skew-symmetric associated with 3D point on unit sphere.
Definition: Unit3.cpp:161