Class RectangleUtil

java.lang.Object
frc.robot.util.RectangleUtil

public class RectangleUtil extends Object
Utility classes for working with rectangles.
  • Constructor Details

    • RectangleUtil

      public RectangleUtil()
  • Method Details

    • flipRectangleX

      public static Rectangle2d flipRectangleX(Rectangle2d rectangle)
      Flips a rectangle to the other alliance.
      Parameters:
      rectangle - The rectangle to flip.
      Returns:
      The flipped rectangle.
    • flipRectangleY

      public static Rectangle2d flipRectangleY(Rectangle2d rectangle)
      Flips a rectangle top/bottom on the field.
      Parameters:
      rectangle - The rectangle to flip.
      Returns:
      The flipped rectangle.
    • getCornerTopLeft

      public static Pose2d getCornerTopLeft(Rectangle2d rectangle)
      Gets the top left corner of a rectangle.
      Parameters:
      rectangle - The rectangle to use.
      Returns:
      The pose of the top left corner.
    • getCornerTopRight

      public static Pose2d getCornerTopRight(Rectangle2d rectangle)
      Gets the top right corner of a rectangle.
      Parameters:
      rectangle - The rectangle to use.
      Returns:
      The pose of the top right corner.
    • getCornerBottomLeft

      public static Pose2d getCornerBottomLeft(Rectangle2d rectangle)
      Gets the bottom left corner of a rectangle.
      Parameters:
      rectangle - The rectangle to use.
      Returns:
      The pose of the bottom left corner.
    • getCornerBottomRight

      public static Pose2d getCornerBottomRight(Rectangle2d rectangle)
      Gets the bottom right corner of a rectangle.
      Parameters:
      rectangle - The rectangle to use.
      Returns:
      The pose of the bottom right corner.
    • getCornerArray

      public static Pose2d[] getCornerArray(Rectangle2d rectangle)
      Gets an array of the corners of a rectangle.
      Parameters:
      rectangle - The rectangle to use.
      Returns:
      An array of [top left, top right, bottom left, bottom right].