- Aldebaran documentation |
- C++ Libraries |
- index

libalmath 2.8.7.4

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
almathqigeometry.hpp
Go to the documentation of this file.
1
10 #pragma once
11 #ifndef LIBALMATH_SCENEGRAPH_ALMATHQIGEOMETRY_HPP
12 #define LIBALMATH_SCENEGRAPH_ALMATHQIGEOMETRY_HPP
13
14 #include <almath/tools/altransformhelpers.h>
15 #include <almath/scenegraph/qigeometry.h>
16 #include <almath/scenegraph/almatheigen.h>
17
18 namespace AL
19 {
20 namespace Math
21 {
22
23 inline Transform transformFromQiTransform(const qi::geometry::Transform& r)
24 {
25 Quaternion almathQuat(static_cast<float>(r.rotation.w),
26 static_cast<float>(r.rotation.x),
27 static_cast<float>(r.rotation.y),
28 static_cast<float>(r.rotation.z));
29 Transform almathTf = transformFromQuaternion(almathQuat);
30 almathTf.r1_c4 = static_cast<float>(r.translation.x);
31 almathTf.r2_c4 = static_cast<float>(r.translation.y);
32 almathTf.r3_c4 = static_cast<float>(r.translation.z);
33 return almathTf;
34 }
35
36 inline qi::geometry::Transform qiTransformFromALMath(const Transform &tf)
37 {
38 Eigen::Map<const Matrix34frm> atfm (&tf.r1_c1);
39 qi::geometry::Transform result;
40 Eigen::Map<Eigen::Quaterniond>(&result.rotation.x) = atfm.block<3, 3>(0, 0).cast<double>();
41 Eigen::Map<Eigen::Vector3d>(&result.translation.x) = atfm.block<3, 1>(0, 3).cast<double>();
42 return result;
43 };
44
45
46 inline AL::Math::Pose2D pose2DFromQiTransform(
47 const qi::geometry::Transform& r)
48 {
49 return pose2DFromTransform(transformFromQiTransform(r));
50 }
51
52 inline qi::geometry::Transform qiTransformFromPose2D(const Pose2D& pose)
53 {
54 const Quaternion quat = quaternionFromAngleAndAxisRotation(
55 pose.theta, 0.0f, 0.0f, 1.0f);
56 return qi::geometry::makeTransform(
57 qi::geometry::makeQuaternion(quat.x, quat.y, quat.z, quat.w),
58 qi::geometry::makeVector3(pose.x, pose.y, 0.0f));
59 }
60
61 }
62 }
63 #endif
AL::Math::Quaternion::w
float w
Definition: alquaternion.h:26
AL::Math::Pose2D::theta
float theta
Definition: alpose2d.h:32
AL::Math::Pose2D::y
float y
Definition: alpose2d.h:30
qi::geometry::makeQuaternion
Quaternion makeQuaternion(double x, double y, double z, double w)
Definition: qigeometry.h:29
almatheigen.h
qigeometry.h
AL::Math::Pose2D::x
float x
Definition: alpose2d.h:28
AL::Math::Quaternion::y
float y
Definition: alquaternion.h:30
AL::Math::pose2DFromTransform
ALMATH_API Pose2D pose2DFromTransform(const Transform &pT)
Create a Pose2D from a Transform.
AL::Math::transformFromQiTransform
Transform transformFromQiTransform(const qi::geometry::Transform &r)
Definition: almathqigeometry.hpp:23
qi::geometry::makeVector3
Vector3 makeVector3(double x, double y, double z)
Definition: qigeometry.h:19
AL::Math::quaternionFromAngleAndAxisRotation
ALMATH_API Quaternion quaternionFromAngleAndAxisRotation(const float pAngle, const float pAxisX, const float pAxisY, const float pAxisZ)
Create a Quaternion initialized with explicit angle and axis rotation.
AL::Math::qiTransformFromALMath
qi::geometry::Transform qiTransformFromALMath(const Transform &tf)
Definition: almathqigeometry.hpp:36
AL::Math::Quaternion::z
float z
Definition: alquaternion.h:32
AL::Math::qiTransformFromPose2D
qi::geometry::Transform qiTransformFromPose2D(const Pose2D &pose)
Definition: almathqigeometry.hpp:52
AL::Math::pose2DFromQiTransform
AL::Math::Pose2D pose2DFromQiTransform(const qi::geometry::Transform &r)
Definition: almathqigeometry.hpp:46
AL::Math::transformFromQuaternion
ALMATH_API Transform transformFromQuaternion(const Quaternion &pQua)
altransformhelpers.h
AL::Math::Quaternion::x
float x
Definition: alquaternion.h:28
AL::Math::Pose2D
A pose in a 2-dimentional space.
Definition: alpose2d.h:26
AL::Math::Transform
A homogenous transformation matrix.
Definition: altransform.h:23
qi::geometry::makeTransform
Transform makeTransform(const Quaternion &rotation, const Vector3 &translation)
Definition: qigeometry.h:74
AL::Math::Quaternion
Create and play with a Quaternion.
Definition: alquaternion.h:24