mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpimath] Add Pose2d and Pose3d rotateAround() (#7659)
This commit is contained in:
@@ -184,6 +184,19 @@ class WPILIB_DLLEXPORT Pose2d {
|
||||
*/
|
||||
constexpr Pose2d RelativeTo(const Pose2d& other) const;
|
||||
|
||||
/**
|
||||
* Rotates the current pose around a point in 2D space.
|
||||
*
|
||||
* @param point The point in 2D space to rotate around.
|
||||
* @param rot The rotation to rotate the pose by.
|
||||
*
|
||||
* @return The new rotated pose.
|
||||
*/
|
||||
constexpr Pose2d RotateAround(const Translation2d& point,
|
||||
const Rotation2d& rot) const {
|
||||
return {m_translation.RotateAround(point, rot), m_rotation.RotateBy(rot)};
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a new Pose2d from a (constant curvature) velocity.
|
||||
*
|
||||
|
||||
@@ -207,6 +207,19 @@ class WPILIB_DLLEXPORT Pose3d {
|
||||
*/
|
||||
constexpr Pose3d RelativeTo(const Pose3d& other) const;
|
||||
|
||||
/**
|
||||
* Rotates the current pose around a point in 3D space.
|
||||
*
|
||||
* @param point The point in 3D space to rotate around.
|
||||
* @param rot The rotation to rotate the pose by.
|
||||
*
|
||||
* @return The new rotated pose.
|
||||
*/
|
||||
constexpr Pose3d RotateAround(const Translation3d& point,
|
||||
const Rotation3d& rot) const {
|
||||
return {m_translation.RotateAround(point, rot), m_rotation.RotateBy(rot)};
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a new Pose3d from a (constant curvature) velocity.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user