[wpimath] Implement Translation3d.RotateAround (#7661)

This commit is contained in:
HarryXChen
2025-01-09 23:31:34 -05:00
committed by GitHub
parent 995bc98ccf
commit e37c35746a
5 changed files with 94 additions and 1 deletions

View File

@@ -148,6 +148,18 @@ class WPILIB_DLLEXPORT Translation3d {
units::meter_t{qprime.Z()}};
}
/**
* Rotates this translation around another translation in 3D space.
*
* @param other The other translation to rotate around.
* @param rot The rotation to rotate the translation by.
* @return The new rotated translation.
*/
constexpr Translation3d RotateAround(const Translation3d& other,
const Rotation3d& rot) const {
return (*this - other).RotateBy(rot) + other;
}
/**
* Returns a Translation2d representing this Translation3d projected into the
* X-Y plane.