mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpimath] Add overloads for Transform2d and Transform3d (#5757)
Adds overloads for Transform2d() constructor to accept x, y, and heading and for Transform3d() to accept x, y, z and rotation as a shorthand for the normal constructors.
This commit is contained in:
@@ -33,6 +33,17 @@ class WPILIB_DLLEXPORT Transform2d {
|
||||
*/
|
||||
constexpr Transform2d(Translation2d translation, Rotation2d rotation);
|
||||
|
||||
/**
|
||||
* Constructs a transform with x and y translations instead of a separate
|
||||
* Translation2d.
|
||||
*
|
||||
* @param x The x component of the translational component of the transform.
|
||||
* @param y The y component of the translational component of the transform.
|
||||
* @param rotation The rotational component of the transform.
|
||||
*/
|
||||
constexpr Transform2d(units::meter_t x, units::meter_t y,
|
||||
Rotation2d rotation);
|
||||
|
||||
/**
|
||||
* Constructs the identity transform -- maps an initial pose to itself.
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,10 @@ constexpr Transform2d::Transform2d(Translation2d translation,
|
||||
Rotation2d rotation)
|
||||
: m_translation(std::move(translation)), m_rotation(std::move(rotation)) {}
|
||||
|
||||
constexpr Transform2d::Transform2d(units::meter_t x, units::meter_t y,
|
||||
Rotation2d rotation)
|
||||
: m_translation(x, y), m_rotation(std::move(rotation)) {}
|
||||
|
||||
constexpr Transform2d Transform2d::Inverse() const {
|
||||
// We are rotating the difference between the translations
|
||||
// using a clockwise rotation matrix. This transforms the global
|
||||
|
||||
@@ -33,6 +33,18 @@ class WPILIB_DLLEXPORT Transform3d {
|
||||
*/
|
||||
Transform3d(Translation3d translation, Rotation3d rotation);
|
||||
|
||||
/**
|
||||
* Constructs a transform with x, y, and z translations instead of a separate
|
||||
* Translation3d.
|
||||
*
|
||||
* @param x The x component of the translational component of the transform.
|
||||
* @param y The y component of the translational component of the transform.
|
||||
* @param z The z component of the translational component of the transform.
|
||||
* @param rotation The rotational component of the transform.
|
||||
*/
|
||||
Transform3d(units::meter_t x, units::meter_t y, units::meter_t z,
|
||||
Rotation3d rotation);
|
||||
|
||||
/**
|
||||
* Constructs the identity transform -- maps an initial pose to itself.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user