Interface Rect2fc

All Known Implementing Classes:
CircularRRectOp, 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
    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.
    float
     
    boolean
    intersects(float left, float top, float right, float bottom)
    Returns true if this rectangle intersects the specified rectangle.
    boolean
    Returns true if this rectangle intersects the specified rectangle.
    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 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
    Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values.
    void
    Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.
    void
    Set the dst rectangle by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.
    void
    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
    Set the dst rectangle by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.
    void
    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
    Stores the coordinates from this into dst.
    void
    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

      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
    • isFinite

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

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

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

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

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

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

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

      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

      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

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

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

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

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

      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

      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

      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

      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(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

      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

      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

      void round(@Nonnull Rect2i dst)
      Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.
    • roundIn

      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

      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

      void round(@Nonnull Rect2f dst)
      Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values.
    • roundIn

      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

      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.