Interface Rect2fc

All Known Implementing Classes:
ClearOp, DrawOp, MeshDrawOp, Op, Rect2f, RectOp, RoundRectOp

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

Rect2f const &rect

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Return the rectangle's bottom.
    float
     
    float
     
    boolean
    contains(float x, float y)
    Returns true if (x,y) is inside the rectangle.
    boolean
    contains(float left, float top, float right, float bottom)
    Returns true if the 4 specified sides of a rectangle are inside or equal to this rectangle.
    boolean
    contains(@NonNull Rect2fc r)
    Returns true if the specified rectangle r is inside or equal to this rectangle.
    boolean
    contains(@NonNull Rect2ic r)
    Returns true if the specified rectangle r is inside or equal to this rectangle.
    float
     
    boolean
    intersects(float left, float top, float right, float bottom)
    Returns true if this rectangle intersects the specified rectangle.
    boolean
    intersects(@NonNull Rect2fc r)
    Returns true if this rectangle intersects the specified rectangle.
    boolean
    intersects(@NonNull Rect2ic r)
    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 all values in the rectangle are finite.
    boolean
    Returns true if left is equal to or less than right, or if top is equal to or less than bottom.
    float
    Returns the rectangle's left.
    float
    Return the rectangle's right.
    void
    round(@NonNull Rect2f dst)
    Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values.
    void
    round(@NonNull Rect2i dst)
    Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.
    void
    roundIn(@NonNull Rect2f dst)
    Set the dst rectangle by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.
    void
    roundIn(@NonNull Rect2i dst)
    Set the dst integer Rect by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.
    void
    roundOut(@NonNull Rect2f dst)
    Set the dst rectangle by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.
    void
    roundOut(@NonNull Rect2i dst)
    Set the dst integer Rect by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.
    void
    store(@NonNull Rect2f dst)
    Stores the coordinates from this into dst.
    void
    store(@NonNull Rect2i dst)
    Stores the coordinates from this into dst.
    float
    top()
    Return the rectangle's top.
    float
     
    float
    x()
    Returns the rectangle's left.
    float
    y()
    Return the rectangle's top.
  • Method Details

    • isEmpty

      @Contract(pure=true) 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

      @Contract(pure=true) 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
    • isFinite

      @Contract(pure=true) boolean isFinite()
      Returns true if all values in the rectangle are finite.
      Returns:
      true if no member is infinite or NaN
    • x

      @Contract(pure=true) float x()
      Returns the rectangle's left.
    • y

      @Contract(pure=true) float y()
      Return the rectangle's top.
    • left

      @Contract(pure=true) float left()
      Returns the rectangle's left.
    • top

      @Contract(pure=true) float top()
      Return the rectangle's top.
    • right

      @Contract(pure=true) float right()
      Return the rectangle's right.
    • bottom

      @Contract(pure=true) float bottom()
      Return the rectangle's bottom.
    • width

      @Contract(pure=true) float 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

      @Contract(pure=true) float 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.
    • centerX

      @Contract(pure=true) float centerX()
      Returns:
      the horizontal center of the rectangle. This does not check for a valid rectangle (i.e. left invalid input: '<'= right)
    • centerY

      @Contract(pure=true) float centerY()
      Returns:
      the vertical center of the rectangle. This does not check for a valid rectangle (i.e. top invalid input: '<'= bottom)
    • store

      @Contract(mutates="param") void store(@NonNull Rect2f dst)
      Stores the coordinates from this into dst.
      Parameters:
      dst - the rectangle to store
    • store

      @Contract(mutates="param") void store(@NonNull Rect2i dst)
      Stores the coordinates from this into dst.
      Parameters:
      dst - the rectangle to store
    • intersects

      @Contract(pure=true) boolean intersects(float left, float top, float right, float bottom)
      Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified. To record the intersection, use intersect().
      Parameters:
      left - the left side of the rectangle being tested for intersection
      top - the top of the rectangle being tested for intersection
      right - the right side of the rectangle being tested for intersection
      bottom - the bottom of the rectangle being tested for intersection
      Returns:
      true if the specified rectangle intersects this rectangle. In no event is this rectangle modified.
    • intersects

      @Contract(pure=true) boolean intersects(@NonNull Rect2fc 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.
    • intersects

      @Contract(pure=true) boolean intersects(@NonNull Rect2ic r)
      Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified. To record the intersection, use intersect().
      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

      @Contract(pure=true) 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

      @Contract(pure=true) boolean contains(float left, float top, float right, float bottom)
      Returns true if the 4 specified sides of a rectangle are inside or equal to this rectangle. i.e. is this rectangle a superset of the specified rectangle. An empty rectangle never contains another rectangle.
      Parameters:
      left - the left side of the rectangle being tested for containment
      top - the top of the rectangle being tested for containment
      right - the right side of the rectangle being tested for containment
      bottom - the bottom of the rectangle being tested for containment
      Returns:
      true if the 4 specified sides of a rectangle are inside or equal to this rectangle
    • contains

      @Contract(pure=true) boolean contains(@NonNull 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
    • contains

      @Contract(pure=true) boolean contains(@NonNull 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
    • round

      @Contract(mutates="param") void round(@NonNull Rect2i dst)
      Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.
    • roundIn

      @Contract(mutates="param") void roundIn(@NonNull Rect2i dst)
      Set the dst integer Rect by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.
    • roundOut

      @Contract(mutates="param") void roundOut(@NonNull Rect2i dst)
      Set the dst integer Rect by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.
    • round

      @Contract(mutates="param") void round(@NonNull Rect2f dst)
      Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values.
    • roundIn

      @Contract(mutates="param") void roundIn(@NonNull Rect2f dst)
      Set the dst rectangle by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.
    • roundOut

      @Contract(mutates="param") void roundOut(@NonNull Rect2f dst)
      Set the dst rectangle by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.