mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpimath] Add 2D to 3D geometry constructors (#7380)
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user