Package frc.robot.util
Class RectangleUtil
java.lang.Object
frc.robot.util.RectangleUtil
Utility classes for working with rectangles.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Rectangle2dflipRectangleX(Rectangle2d rectangle) Flips a rectangle to the other alliance.static Rectangle2dflipRectangleY(Rectangle2d rectangle) Flips a rectangle top/bottom on the field.static Pose2d[]getCornerArray(Rectangle2d rectangle) Gets an array of the corners of a rectangle.static Pose2dgetCornerBottomLeft(Rectangle2d rectangle) Gets the bottom left corner of a rectangle.static Pose2dgetCornerBottomRight(Rectangle2d rectangle) Gets the bottom right corner of a rectangle.static Pose2dgetCornerTopLeft(Rectangle2d rectangle) Gets the top left corner of a rectangle.static Pose2dgetCornerTopRight(Rectangle2d rectangle) Gets the top right corner of a rectangle.
-
Constructor Details
-
RectangleUtil
public RectangleUtil()
-
-
Method Details
-
flipRectangleX
Flips a rectangle to the other alliance.- Parameters:
rectangle- The rectangle to flip.- Returns:
- The flipped rectangle.
-
flipRectangleY
Flips a rectangle top/bottom on the field.- Parameters:
rectangle- The rectangle to flip.- Returns:
- The flipped rectangle.
-
getCornerTopLeft
Gets the top left corner of a rectangle.- Parameters:
rectangle- The rectangle to use.- Returns:
- The pose of the top left corner.
-
getCornerTopRight
Gets the top right corner of a rectangle.- Parameters:
rectangle- The rectangle to use.- Returns:
- The pose of the top right corner.
-
getCornerBottomLeft
Gets the bottom left corner of a rectangle.- Parameters:
rectangle- The rectangle to use.- Returns:
- The pose of the bottom left corner.
-
getCornerBottomRight
Gets the bottom right corner of a rectangle.- Parameters:
rectangle- The rectangle to use.- Returns:
- The pose of the bottom right corner.
-
getCornerArray
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].
-