Class AxisAlignedBoundingBox

    • Constructor Detail

      • AxisAlignedBoundingBox

        public AxisAlignedBoundingBox​(Translation2d topLeft,
                                      Translation2d bottomRight)
        Create an AxisAlignedBoundingBox from opposing corners
        Parameters:
        topLeft - Top left corner expressed as a percentage of the frame from the center (top left is -1,1)
        bottomRight - Bottom right corner expressed as a percentage of the frame from the center (top left is -1,1)
      • AxisAlignedBoundingBox

        public AxisAlignedBoundingBox​(Translation2d topLeft,
                                      Translation2d bottomRight,
                                      Rotation2d xRot,
                                      Rotation2d yRot)
        Create an AxisAlignedBoundingBox from opposing corners, with angles relative to a camera
        Parameters:
        topLeft - Top left corner expressed as a percentage of the frame from the center (top left is -1,1)
        bottomRight - Bottom right corner expressed as a percentage of the frame from the center (top left is -1,1)
        xRot - X angle from camera
        yRot - Y angle from camera
    • Method Detail

      • getAspectRatio

        public double getAspectRatio()
        Get the aspect ratio of this box as width/height
        Returns:
        Aspect ratio
      • contains

        public boolean contains​(Translation2d point)
        Description copied from class: Contour
        Check if this contour contains a point
        Specified by:
        contains in class Contour
        Parameters:
        point - Point
        Returns:
        Is the point in this contour?
      • overlaps

        public boolean overlaps​(AxisAlignedBoundingBox box)
        Description copied from class: Contour
        Check if this contour overlaps with an AxisAlignedBoundingBox
        Specified by:
        overlaps in class Contour
        Parameters:
        box - AxisAlignedBoundingBox
        Returns:
        Does it overlap?
      • getTopLeftCorner

        public Translation2d getTopLeftCorner()
        Get the top left corner of this box expressed as a percentage of the frame from the center (top left is -1,1)
        Returns:
        top left corner
      • getBottomLeftCorner

        public Translation2d getBottomLeftCorner()
        Get the bottom left corner of this box expressed as a percentage of the frame from the center (top left is -1,1)
        Returns:
        bottom left corner
      • getTopRightCorner

        public Translation2d getTopRightCorner()
        Get the top right corner of this box expressed as a percentage of the frame from the center (top left is -1,1)
        Returns:
        top right corner
      • getBottomRightCorner

        public Translation2d getBottomRightCorner()
        Get the bottom right corner of this box expressed as a percentage of the frame from the center (top left is -1,1)
        Returns:
        bottom right corner
      • getWidth

        public double getWidth()
        Get box width
        Returns:
        Width
      • getHeight

        public double getHeight()
        Get box height
        Returns:
        Height