mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpimath] Add Translation2d.getAngle() (#4217)
Co-authored-by: Max Gordon <tonald.drump2.0@gamil.com> Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
@@ -97,6 +97,15 @@ public class Translation2d implements Interpolatable<Translation2d> {
|
||||
return Math.hypot(m_x, m_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the angle this translation forms with the positive X axis.
|
||||
*
|
||||
* @return The angle of the translation
|
||||
*/
|
||||
public Rotation2d getAngle() {
|
||||
return new Rotation2d(m_x, m_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a rotation to the translation in 2D space.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user