[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:
Anit Mangal
2023-10-13 11:51:39 +05:30
committed by GitHub
parent 9a0aafd8ab
commit c0b4c6cce6
6 changed files with 56 additions and 0 deletions

View File

@@ -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