Class Rect2D


  • public class Rect2D
    extends Object
    Represents a 2D axis-aligned immutable rectangle.
    Author:
    Eduardo Ramos
    • Field Detail

      • minX

        public final float minX
      • minY

        public final float minY
      • maxX

        public final float maxX
      • maxY

        public final float maxY
    • Constructor Detail

      • Rect2D

        public Rect2D​(Rect2D source)
        Create a new Rect2D as a copy of the given source .
        Parameters:
        source - the Rect2D to copy from
      • Rect2D

        public Rect2D​(float minX,
                      float minY,
                      float maxX,
                      float maxY)
        Create a new Rect2D with the given minimum and maximum corner coordinates.
        Parameters:
        minX - the x coordinate of the minimum corner
        minY - the y coordinate of the minimum corner
        maxX - the x coordinate of the maximum corner
        maxY - the y coordinate of the maximum corner
    • Method Detail

      • width

        public float width()
      • height

        public float height()
      • center

        public float[] center()
      • radius

        public float radius()
      • contains

        public boolean contains​(Rect2D rect)
      • intersects

        public boolean intersects​(Rect2D rect)
      • contains

        public boolean contains​(float minX,
                                float minY,
                                float maxX,
                                float maxY)
      • intersects

        public boolean intersects​(float minX,
                                  float minY,
                                  float maxX,
                                  float maxY)