Interface Rect2ic

All Known Implementing Classes:
Rect2i

public sealed interface Rect2ic permits Rect2i
Interface to a read-only view of a rectangle in integer coordinates. This does not mean that the rectangle is immutable, it only implies that a method should not change the state of the rectangle.

Rect2i const &rect

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Return the rectangle's bottom.
    boolean
    contains(float x, float y)
    Returns true if (x,y) is inside the rectangle.
    boolean
    contains(int x, int y)
    Returns true if (x,y) is inside the rectangle.
    boolean
    Returns true if the specified rectangle r is inside or equal to this rectangle.
    boolean
    Returns true if the specified rectangle r is inside or equal to this rectangle.
    int
     
    boolean
    Returns true if this rectangle intersects the specified rectangle.
    boolean
    Returns true if left is equal to or greater than right, or if top is equal to or greater than bottom.
    boolean
    Returns true if left is equal to or less than right, or if top is equal to or less than bottom.
    int
    Returns the rectangle's left.
    int
    Return the rectangle's right.
    void
    Stores the coordinates from this into dst.
    void
    Stores the coordinates from this into dst.
    int
    top()
    Return the rectangle's top.
    int
     
    int
    x()
    Returns the rectangle's left.
    int
    y()
    Return the rectangle's top.
  • Method Details

    • isEmpty

      boolean isEmpty()
      Returns true if left is equal to or greater than right, or if top is equal to or greater than bottom. Call sort() to reverse rectangles with negative width() or height().
      Returns:
      true if width() or height() are zero or negative
    • isSorted

      boolean isSorted()
      Returns true if left is equal to or less than right, or if top is equal to or less than bottom. Call sort() to reverse rectangles with negative width() or height().
      Returns:
      true if width() or height() are zero or positive
    • x

      int x()
      Returns the rectangle's left.
    • y

      int y()
      Return the rectangle's top.
    • left

      int left()
      Returns the rectangle's left.
    • top

      int top()
      Return the rectangle's top.
    • right

      int right()
      Return the rectangle's right.
    • bottom

      int bottom()
      Return the rectangle's bottom.
    • width

      int width()
      Returns:
      the rectangle's width. This does not check for a valid rectangle (i.e. left invalid input: '<'= right) so the result may be negative.
    • height

      int height()
      Returns:
      the rectangle's height. This does not check for a valid rectangle (i.e. top invalid input: '<'= bottom) so the result may be negative.
    • store

      void store(@Nonnull Rect2i dst)
      Stores the coordinates from this into dst.
      Parameters:
      dst - the rectangle to store
    • store

      void store(@Nonnull Rect2f dst)
      Stores the coordinates from this into dst.
      Parameters:
      dst - the rectangle to store
    • intersects

      boolean intersects(Rect2ic r)
      Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified.
      Parameters:
      r - the rectangle being tested for intersection
      Returns:
      true if the specified rectangle intersects this rectangle. In no event is this rectangle modified.
    • contains

      boolean contains(int x, int y)
      Returns true if (x,y) is inside the rectangle. The left and top are considered to be inside, while the right and bottom are not. This means that for a (x,y) to be contained: left invalid input: '<'= x invalid input: '<' right and top invalid input: '<'= y invalid input: '<' bottom. An empty rectangle never contains any point.
      Parameters:
      x - the X coordinate of the point being tested for containment
      y - the Y coordinate of the point being tested for containment
      Returns:
      true if (x,y) are contained by the rectangle, where containment means left invalid input: '<'= x invalid input: '<' right and top invalid input: '<'= y invalid input: '<' bottom
    • contains

      boolean contains(float x, float y)
      Returns true if (x,y) is inside the rectangle. The left and top are considered to be inside, while the right and bottom are not. This means that for a (x,y) to be contained: left invalid input: '<'= x invalid input: '<' right and top invalid input: '<'= y invalid input: '<' bottom. An empty rectangle never contains any point.
      Parameters:
      x - the X coordinate of the point being tested for containment
      y - the Y coordinate of the point being tested for containment
      Returns:
      true if (x,y) are contained by the rectangle, where containment means left invalid input: '<'= x invalid input: '<' right and top invalid input: '<'= y invalid input: '<' bottom
    • contains

      boolean contains(Rect2ic r)
      Returns true if the specified rectangle r is inside or equal to this rectangle. An empty rectangle never contains another rectangle.
      Parameters:
      r - the rectangle being tested for containment.
      Returns:
      true if the specified rectangle r is inside or equal to this rectangle
    • contains

      boolean contains(Rect2fc r)
      Returns true if the specified rectangle r is inside or equal to this rectangle. An empty rectangle never contains another rectangle.
      Parameters:
      r - the rectangle being tested for containment.
      Returns:
      true if the specified rectangle r is inside or equal to this rectangle