Class Rectangle

java.lang.Object
me.autobot.lib.math.objects.Rectangle

public class Rectangle extends Object
Rectangle object with position, size, and rotation.
  • Constructor Details

    • Rectangle

      public Rectangle(Vector2d position, Vector2d size)
      Creates a new rectangle with the given position and size.
      Parameters:
      position - The position of the rectangle, from the center.
      size - The size of the rectangle.
    • Rectangle

      public Rectangle(Vector2d position, Vector2d size, Rotation2d rotation)
      Creates a new rectangle with the given position, size, and rotation.
      Parameters:
      position - The position of the rectangle, from the center.
      size - The size of the rectangle.
      rotation - The rotation of the rectangle.
  • Method Details

    • getPosition

      public Vector2d getPosition()
      Gets the center position of the rectangle.
      Returns:
      The center position of the rectangle.
    • getSize

      public Vector2d getSize()
      Gets the size of the rectangle.
      Returns:
      The size of the rectangle.
    • getRotation

      public Rotation2d getRotation()
      Gets the rotation of the rectangle.
      Returns:
      The rotation of the rectangle.
    • getVertices

      public Vector2d[] getVertices()
      Returns the vertices of the rectangle.
      Returns:
      The vertices of the rectangle. 0: Top right 1: Bottom right 2: Bottom left 3: Top left