From dae18308c9aecc041cebb5dc45e32fc508842e9b Mon Sep 17 00:00:00 2001 From: shueja-personal <32416547+shueja-personal@users.noreply.github.com> Date: Sun, 27 Feb 2022 16:56:56 -0800 Subject: [PATCH] [wpimath] Minor fixes to Rotation2d docs (NFC) (#4055) Fixed incorrect examples on .plus(), and a missing word. Make example code snippets closer to actual use. --- .../java/edu/wpi/first/math/geometry/Rotation2d.java | 6 ++++-- .../src/main/native/include/frc/geometry/Rotation2d.h | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation2d.java b/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation2d.java index 08e54387dd..8eed76cd18 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation2d.java +++ b/wpimath/src/main/java/edu/wpi/first/math/geometry/Rotation2d.java @@ -70,7 +70,8 @@ public class Rotation2d implements Interpolatable { /** * Adds two rotations together, with the result being bounded between -pi and pi. * - *

For example, Rotation2d.fromDegrees(30) + Rotation2d.fromDegrees(60) = Rotation2d{-pi/2} + *

For example, Rotation2d.fromDegrees(30).plus(Rotation2d.fromDegrees(60)) equals + * Rotation2d.fromRadians(Math.PI/2.0) * * @param other The rotation to add. * @return The sum of the two rotations. @@ -82,7 +83,8 @@ public class Rotation2d implements Interpolatable { /** * Subtracts the new rotation from the current rotation and returns the new rotation. * - *

For example, Rotation2d.fromDegrees(10) - Rotation2d.fromDegrees(100) = Rotation2d{-pi/2} + *

For example, Rotation2d.fromDegrees(10).minus(Rotation2d.fromDegrees(100)) + * equals Rotation2d.fromRadians(-Math.PI/2.0) * * @param other The rotation to subtract. * @return The difference between the two rotations. diff --git a/wpimath/src/main/native/include/frc/geometry/Rotation2d.h b/wpimath/src/main/native/include/frc/geometry/Rotation2d.h index 94a17fc0ca..73f32d4d34 100644 --- a/wpimath/src/main/native/include/frc/geometry/Rotation2d.h +++ b/wpimath/src/main/native/include/frc/geometry/Rotation2d.h @@ -15,7 +15,7 @@ class json; namespace frc { /** - * A rotation in a 2d coordinate frame represented a point on the unit circle + * A rotation in a 2d coordinate frame represented by a point on the unit circle * (cosine and sine). */ class WPILIB_DLLEXPORT Rotation2d { @@ -52,8 +52,8 @@ class WPILIB_DLLEXPORT Rotation2d { * Adds two rotations together, with the result being bounded between -pi and * pi. * - * For example, Rotation2d.FromDegrees(30) + Rotation2d.FromDegrees(60) = - * Rotation2d{-pi/2} + * For example, Rotation2d{30_deg} + Rotation2d{60_deg} equals + * Rotation2d{units::radian_t{wpi::numbers::pi/2.0}} * * @param other The rotation to add. * @@ -65,8 +65,8 @@ class WPILIB_DLLEXPORT Rotation2d { * Subtracts the new rotation from the current rotation and returns the new * rotation. * - * For example, Rotation2d.FromDegrees(10) - Rotation2d.FromDegrees(100) = - * Rotation2d{-pi/2} + * For example, Rotation2d{10_deg} - Rotation2d{100_deg} equals + * Rotation2d{units::radian_t{-wpi::numbers::pi/2.0}} * * @param other The rotation to subtract. *