40 : m_translation{
std::move(translation)},
41 m_rotation{
std::move(rotation)} {}
52 constexpr Transform3d(units::meter_t x, units::meter_t y, units::meter_t z,
54 : m_translation{x, y, z}, m_rotation{
std::move(rotation)} {}
63 : m_translation{
Eigen::Vector3d{
64 {matrix(0, 3)}, {matrix(1, 3)}, {matrix(2, 3)}}},
66 Eigen::Matrix3d{{matrix(0, 0), matrix(0, 1), matrix(0, 2)},
67 {matrix(1, 0), matrix(1, 1), matrix(1, 2)},
68 {matrix(2, 0), matrix(2, 1), matrix(2, 2)}}} {
69 if (matrix(3, 0) != 0.0 || matrix(3, 1) != 0.0 || matrix(3, 2) != 0.0 ||
70 matrix(3, 3) != 1.0) {
71 throw std::domain_error(
"Affine transformation matrix is invalid");
103 constexpr units::meter_t
X()
const {
return m_translation.X(); }
110 constexpr units::meter_t
Y()
const {
return m_translation.Y(); }
117 constexpr units::meter_t
Z()
const {
return m_translation.Z(); }
124 auto vec = m_translation.ToVector();
125 auto mat = m_rotation.ToMatrix();
126 return Eigen::Matrix4d{{mat(0, 0), mat(0, 1), mat(0, 2), vec(0)},
127 {mat(1, 0), mat(1, 1), mat(1, 2), vec(1)},
128 {mat(2, 0), mat(2, 1), mat(2, 2), vec(2)},
129 {0.0, 0.0, 0.0, 1.0}};
148 return Transform3d{(-Translation()).RotateBy(-Rotation()), -Rotation()};
158 return Transform3d(m_translation * scalar, m_rotation * scalar);
168 return *
this * (1.0 / scalar);
199 m_translation = (
final.Translation() - initial.
Translation())
#define WPILIB_DLLEXPORT
Definition SymbolExports.h:36
Represents a 3D pose containing translational and rotational elements.
Definition Pose3d.h:31
constexpr Pose3d TransformBy(const Transform3d &other) const
Transforms the pose by the given transformation and returns the new transformed pose.
Definition Pose3d.h:394
constexpr const Translation3d & Translation() const
Returns the underlying translation.
Definition Pose3d.h:123
constexpr const Rotation3d & Rotation() const
Returns the underlying rotation.
Definition Pose3d.h:151
A rotation in a 3D coordinate frame, represented by a quaternion.
Definition Rotation3d.h:72
constexpr Rotation3d RelativeTo(const Rotation3d &other) const
Returns the current rotation relative to the given rotation.
Definition Rotation3d.h:399
Represents a translation in 3D space.
Definition Translation3d.h:31
constexpr Translation3d RotateBy(const Rotation3d &other) const
Applies a rotation to the translation in 3D space.
Definition Translation3d.h:178
Definition variable.hpp:742
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280