[wpimath] Add 2D to 3D geometry constructors (#7380)

This commit is contained in:
Joseph Eng
2024-11-12 15:18:37 -08:00
committed by GitHub
parent 6adad7bad7
commit 425bf83036
8 changed files with 70 additions and 0 deletions

View File

@@ -66,6 +66,16 @@ class WPILIB_DLLEXPORT Translation3d {
m_y{units::meter_t{vector.y()}},
m_z{units::meter_t{vector.z()}} {}
/**
* Constructs a 3D translation from a 2D translation in the X-Y plane.
*
* @param translation The 2D translation.
* @see Pose3d(Pose2d)
* @see Transform3d(Transform2d)
*/
constexpr explicit Translation3d(const Translation2d& translation)
: Translation3d{translation.X(), translation.Y(), 0_m} {}
/**
* Calculates the distance between two translations in 3D space.
*