38 : m_translation{
std::move(translation)},
39 m_rotation{
std::move(rotation)} {}
50 constexpr Transform3d(units::meter_t x, units::meter_t y, units::meter_t z,
52 : m_translation{x, y, z}, m_rotation{
std::move(rotation)} {}
61 : m_translation{
Eigen::Vector3d{
62 {matrix(0, 3)}, {matrix(1, 3)}, {matrix(2, 3)}}},
64 Eigen::Matrix3d{{matrix(0, 0), matrix(0, 1), matrix(0, 2)},
65 {matrix(1, 0), matrix(1, 1), matrix(1, 2)},
66 {matrix(2, 0), matrix(2, 1), matrix(2, 2)}}} {
67 if (matrix(3, 0) != 0.0 || matrix(3, 1) != 0.0 || matrix(3, 2) != 0.0 ||
68 matrix(3, 3) != 1.0) {
69 throw std::domain_error(
"Affine transformation matrix is invalid");
101 constexpr units::meter_t
X()
const {
return m_translation.X(); }
108 constexpr units::meter_t
Y()
const {
return m_translation.Y(); }
115 constexpr units::meter_t
Z()
const {
return m_translation.Z(); }
122 auto vec = m_translation.ToVector();
123 auto mat = m_rotation.ToMatrix();
124 return Eigen::Matrix4d{{mat(0, 0), mat(0, 1), mat(0, 2), vec(0)},
125 {mat(1, 0), mat(1, 1), mat(1, 2), vec(1)},
126 {mat(2, 0), mat(2, 1), mat(2, 2), vec(2)},
127 {0.0, 0.0, 0.0, 1.0}};
146 return Transform3d{(-Translation()).RotateBy(-Rotation()), -Rotation()};
166 return *
this * (1.0 /
scalar);
198 m_translation = (
final.Translation() - initial.
Translation())
201 m_rotation =
final.Rotation() - initial.
Rotation();
#define WPILIB_DLLEXPORT
Definition SymbolExports.h:36
Represents a 3D pose containing translational and rotational elements.
Definition Pose3d.h:28
constexpr Pose3d TransformBy(const Transform3d &other) const
Transforms the pose by the given transformation and returns the new transformed pose.
Definition Pose3d.h:328
constexpr const Translation3d & Translation() const
Returns the underlying translation.
Definition Pose3d.h:120
constexpr const Rotation3d & Rotation() const
Returns the underlying rotation.
Definition Pose3d.h:148
A rotation in a 3D coordinate frame represented by a quaternion.
Definition Rotation3d.h:29
Represents a translation in 3D space.
Definition Translation3d.h:26
constexpr Translation3d RotateBy(const Rotation3d &other) const
Applies a rotation to the translation in 3D space.
Definition Translation3d.h:144
Definition Variable.hpp:739
Implement std::hash so that hash_code can be used in STL containers.
Definition PointerIntPair.h:280
Type representing an arbitrary unit.
Definition base.h:888