26 #ifndef INCLUDED_EigenInterop_h_GUID_A07DFDC3_BA71_4894_6593_732B364A2AE7 27 #define INCLUDED_EigenInterop_h_GUID_A07DFDC3_BA71_4894_6593_732B364A2AE7 65 osvrQuatGetY(&q), osvrQuatGetZ(&q));
70 osvrQuatSetW(&q, src.
w());
71 osvrQuatSetX(&q, src.
x());
72 osvrQuatSetY(&q, src.
y());
73 osvrQuatSetZ(&q, src.
z());
85 Eigen::Vector3d::Constant(1));
114 namespace eigen_interop {
125 return const_map(vec);
131 return osvrQuatGetW(&q);
135 return osvrQuatSetW(&q, v);
140 return osvrQuatGetX(&q);
144 return osvrQuatSetX(&q, v);
150 return osvrQuatGetY(&q);
154 return osvrQuatSetY(&q, v);
160 return osvrQuatGetZ(&q);
164 return osvrQuatSetZ(&q, v);
168 template <
char Coefficient,
typename T = OSVR_Quaternion>
172 operator double()
const {
200 double w()
const {
return osvrQuatGetW(m_quat); }
202 double x()
const {
return osvrQuatGetX(m_quat); }
204 double y()
const {
return osvrQuatGetY(m_quat); }
206 double z()
const {
return osvrQuatGetZ(m_quat); }
220 template <
typename T>
223 *m_quat = *other.m_quat;
227 template <
typename Derived>
230 osvrQuatSetW(m_quat, other.
w());
231 osvrQuatSetX(m_quat, other.
x());
232 osvrQuatSetY(m_quat, other.
y());
233 osvrQuatSetZ(m_quat, other.
z());
261 return const_map(quat);
291 return const_map(m_pose->translation);
296 return const_map(m_pose->rotation);
312 template <
typename T>
315 *m_pose = *other.m_pose;
335 return map(m_pose->translation);
349 return const_map(pose);
360 #endif // INCLUDED_EigenInterop_h_GUID_A07DFDC3_BA71_4894_6593_732B364A2AE7 Scalar z() const
Definition: Quaternion.h:64
Definition: RunLoopManager.h:42
QuatCoefficientMap< 'X'> x() const
Read-write accessor for the x component of the quaternion.
Definition: EigenInterop.h:242
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:104
TransformType transform() const
Read-only accessor for the pose as an Eigen transform.
Definition: EigenInterop.h:280
A structure defining a 3D vector, often a position/translation.
Definition: Vec3C.h:48
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
MatrixType matrix() const
Read-only accessor for the pose as an Eigen Matrix.
Definition: EigenInterop.h:286
OSVR_Quaternion rotation
Orientation as a unit quaternion.
Definition: Pose3C.h:58
Definition: EigenInterop.h:269
Scalar y() const
Definition: Quaternion.h:71
Header wrapping include of <Eigen/Core> and <Eigen/Geometry> for warning quieting.
A structure defining a quaternion, often a unit quaternion representing 3D rotation.
Definition: QuaternionC.h:49
void toPose(Eigen::Isometry3d const &xform, OSVR_Pose3 &pose)
Turn an Eigen::Isometry3d (transform) into an OSVR_Pose3.
Definition: EigenInterop.h:93
Eigen::Map< Eigen::Vector3d > vecMap(OSVR_Vec3 &vec)
Wrap an OSVR_Vec3 in an Eigen object that allows it to interoperate with Eigen as though it were an E...
Definition: EigenInterop.h:52
Eigen::Isometry3d fromPose(OSVR_Pose3 const &pose)
Turn an OSVR_Pose3 into an Eigen::Transform.
Definition: EigenInterop.h:81
PoseMap const & operator=(BasePoseMap< T > const &other) const
Assignment operator from another PoseMap (const or not)
Definition: EigenInterop.h:314
double z() const
Read-only accessor for the z component of the quaternion.
Definition: EigenInterop.h:206
Definition: EigenInterop.h:128
Scalar x() const
Definition: Quaternion.h:60
Definition: EigenInterop.h:213
double data[3]
Internal array data.
Definition: Vec3C.h:50
Scalar x() const
Definition: Quaternion.h:69
QuatCoefficientMap< 'W'> w() const
Read-write accessor for the w component of the quaternion.
Definition: EigenInterop.h:238
PoseMap const & operator=(Eigen::Isometry3d const &other) const
Assignment operator from an Eigen isometry.
Definition: EigenInterop.h:320
Definition: newuoa.h:1888
t_< detail::transform_< List, Fun >> transform
Given a list and an alias class, apply the alias class to each element in the list and return the res...
Definition: Transform.h:54
QuatCoefficientMap< 'Y'> y() const
Read-write accessor for the y component of the quaternion.
Definition: EigenInterop.h:246
QuatMap const & operator=(BaseQuatMap< T > const &other) const
Assignment from another QuatMap (whether const or not)
Definition: EigenInterop.h:222
double w() const
Read-only accessor for the w component of the quaternion.
Definition: EigenInterop.h:200
PoseMap const & operator=(Eigen::Matrix4d const &other) const
Assignment operator from an Eigen 4x4 matrix - note that it is assumed to be an isometry! ...
Definition: EigenInterop.h:327
Definition: EigenInterop.h:183
QuatMap rotation() const
Read-write accessor for the rotation portion of the pose as an Eigen quaternion (map) ...
Definition: EigenInterop.h:340
Definition: ForwardDeclarations.h:233
QuatCoefficientMap< 'Z'> z() const
Read-write accessor for the z component of the quaternion.
Definition: EigenInterop.h:250
Scalar w() const
Definition: Quaternion.h:75
Eigen::Map< Eigen::Vector3d > translation() const
Read-write accessor for the translation portion of the pose as an Eigen vector (map) ...
Definition: EigenInterop.h:334
Eigen::Quaterniond fromQuat(OSVR_Quaternion const &q)
Convert an OSVR_Quaternion to an Eigen::Quaterniond.
Definition: EigenInterop.h:63
Definition: Quaternion.h:47
Definition: EigenInterop.h:169
Eigen::Quaterniond quat() const
Read-only accessor for the quaternion as an Eigen quaternion.
Definition: EigenInterop.h:193
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Definition: Pose3C.h:54
Scalar z() const
Definition: Quaternion.h:73
void toQuat(Eigen::Quaterniond const &src, OSVR_Quaternion &q)
Convert an Eigen::Quaterniond to a OSVR_Quaternion.
Definition: EigenInterop.h:69
ConstQuatMap rotation() const
Read-only accessor for the translation as an Eigen quaternion.
Definition: EigenInterop.h:295
Quaternion< double > Quaterniond
double precision quaternion type
Definition: Quaternion.h:211
Eigen::Map< const Eigen::Vector3d > translation() const
Read-only accessor for the translation as an Eigen vector map.
Definition: EigenInterop.h:290
Scalar y() const
Definition: Quaternion.h:62
QuatMap const & operator=(Eigen::QuaternionBase< Derived > const &other) const
Assignment operator from an Eigen quaternion.
Definition: EigenInterop.h:229
double y() const
Read-only accessor for the y component of the quaternion.
Definition: EigenInterop.h:204
OSVR_Vec3 translation
Position vector.
Definition: Pose3C.h:56
Definition: EigenInterop.h:305
Scalar w() const
Definition: Quaternion.h:66
double x() const
Read-only accessor for the x component of the quaternion.
Definition: EigenInterop.h:202