Class Rect2f

java.lang.Object
icyllis.arc3d.core.Rect2f
All Implemented Interfaces:
Rect2fc
Direct Known Subclasses:
Op

public non-sealed class Rect2f extends Object implements Rect2fc
The Rect2f holds four float coordinates describing the upper and lower bounds of a rectangle. (left, top, right, bottom). These fields can be accessed directly. Use width() and height() to retrieve the rectangle's width and height.

Rect may be created from outer bounds or from position, width, and height. Rect describes an area; if its right is less than or equal to its left, or if its bottom is less than or equal to its top, it is considered empty.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    float
     
    float
     
    float
     
    float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new empty rectangle.
    Rect2f(float left, float top, float right, float bottom)
    Create a new rectangle with the specified coordinates.
    Create a new rectangle, initialized with the values in the specified rectangle (which is left unmodified).
    Create a new rectangle, initialized with the values in the specified rectangle (which is left unmodified).
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    adjust(float left, float top, float right, float bottom)
    Adjusts the rectangle on all sides specified by the values.
    final void
    adjust(Rect2fc adjusts)
    Adjusts the rectangle on all sides specified by the values.
    final void
    adjust(Rect2ic adjusts)
    Adjusts the rectangle on all sides specified by the values.
    final float
    Return the rectangle's bottom.
    final float
     
    final float
     
    final boolean
    contains(float x, float y)
    Returns true if (x,y) is inside the rectangle.
    final 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.
    final boolean
    Returns true if the specified rectangle r is inside or equal to this rectangle.
    final boolean
    Returns true if the specified rectangle r is inside or equal to this rectangle.
    static Rect2fc
    Returns a read-only empty rect.
    boolean
    Returns true if all members in a: Left, Top, Right, and Bottom; are equal to the corresponding members in b.
    final float
     
    final float
     
    int
     
    final float
     
    final void
    inset(float dx, float dy)
    Inset the rectangle by (dx,dy).
    final void
    inset(float left, float top, float right, float bottom)
    Insets the rectangle on all sides specified by the insets.
    final void
    inset(Rect2fc insets)
    Insets the rectangle on all sides specified by the dimensions of the insets rectangle.
    final void
    inset(Rect2ic insets)
    Insets the rectangle on all sides specified by the dimensions of the insets rectangle.
    final boolean
    intersect(float left, float top, float right, float bottom)
    If the rectangle specified by left,top,right,bottom intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
    final boolean
    If the specified rectangle intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
    final boolean
    If rectangles a and b intersect, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
    final boolean
    If the specified rectangle intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle.
    final void
    intersectNoCheck(float left, float top, float right, float bottom)
    If the specified rectangle intersects this rectangle, set this rectangle to that intersection, otherwise set this rectangle to the empty rectangle.
    final void
    If the specified rectangle intersects this rectangle, set this rectangle to that intersection, otherwise set this rectangle to the empty rectangle.
    final void
    If the specified rectangle intersects this rectangle, set this rectangle to that intersection, otherwise set this rectangle to the empty rectangle.
    final boolean
    intersects(float left, float top, float right, float bottom)
    Returns true if this rectangle intersects the specified rectangle.
    final boolean
    Returns true if this rectangle intersects the specified rectangle.
    static boolean
    Returns true if the two specified rectangles intersect.
    final boolean
    Returns true if this rectangle intersects the specified rectangle.
    final boolean
    Returns true if left is equal to or greater than right, or if top is equal to or greater than bottom.
    final boolean
    Returns true if all values in the rectangle are finite.
    final boolean
    Returns true if left is equal to or less than right, or if top is equal to or less than bottom.
    final void
    join(float x, float y)
    Update this rectangle to enclose itself and the [x,y] coordinate.
    final void
    join(float left, float top, float right, float bottom)
    Update this rectangle to enclose itself and the specified rectangle.
    final void
    Update this rectangle to enclose itself and the specified rectangle.
    final void
    Update this rectangle to enclose itself and the specified rectangle.
    final void
    joinNoCheck(float left, float top, float right, float bottom)
    Update this rectangle to enclose itself and the specified rectangle.
    final void
    Update this rectangle to enclose itself and the specified rectangle.
    final void
    Update this rectangle to enclose itself and the specified rectangle.
    final float
    Returns the rectangle's left.
    final void
    offset(float dx, float dy)
    Offset the rectangle by adding dx to its left and right coordinates, and adding dy to its top and bottom coordinates.
    final void
    offsetTo(float newLeft, float newTop)
    Offset the rectangle to a specific (left, top) position, keeping its width and height the same.
    final void
    outset(float dx, float dy)
    Outset the rectangle by (dx,dy).
    static boolean
    Returns true if the rectangles have a nonzero area of overlap.
    static boolean
    Returns true if the rectangles overlap or share an edge or corner.
    final float
    Return the rectangle's right.
    final void
    Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values.
    final void
    Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.
    final void
    Set the dst rectangle by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.
    final 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.
    final void
    Set the dst rectangle by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.
    final 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.
    final void
    set(float left, float top, float right, float bottom)
    Set the rectangle's coordinates to the specified values.
    final void
    set(Rect2fc src)
    Copy the coordinates from src into this rectangle.
    final void
    set(Rect2ic src)
    Copy the coordinates from src into this rectangle.
    final boolean
    setBounds(float[] pts, int offset, int count)
    Sets to bounds of pts array with count points.
    final void
    setBoundsNoCheck(float[] pts, int offset, int count)
    Sets to bounds of pts array with count points.
    final void
    Set the rectangle to (0,0,0,0)
    final void
    Swap top/bottom or left/right if there are flipped (i.e.
    void
    Copy the coordinates from this into r.
    void
    Stores the coordinates from this into dst.
    static boolean
     
    final float
    top()
    Return the rectangle's top.
     
    final float
     
    final float
    x()
    Returns the rectangle's left.
    final float
    y()
    Return the rectangle's top.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • mLeft

      public float mLeft
    • mTop

      public float mTop
    • mRight

      public float mRight
    • mBottom

      public float mBottom
  • Constructor Details

    • Rect2f

      public Rect2f()
      Create a new empty rectangle. All coordinates are initialized to 0.
    • Rect2f

      public Rect2f(float left, float top, float right, float bottom)
      Create a new rectangle with the specified coordinates. Note: no range checking is performed, so the caller should ensure that left invalid input: '<'= right and top invalid input: '<'= bottom.
      Parameters:
      left - the X coordinate of the left side of the rectangle
      top - the Y coordinate of the top of the rectangle
      right - the X coordinate of the right side of the rectangle
      bottom - the Y coordinate of the bottom of the rectangle
    • Rect2f

      public Rect2f(@Nonnull Rect2fc r)
      Create a new rectangle, initialized with the values in the specified rectangle (which is left unmodified).
      Parameters:
      r - the rectangle whose coordinates are copied into the new rectangle
    • Rect2f

      public Rect2f(@Nonnull Rect2ic r)
      Create a new rectangle, initialized with the values in the specified rectangle (which is left unmodified).
      Parameters:
      r - the rectangle whose coordinates are copied into the new rectangle
  • Method Details

    • empty

      @Nonnull public static Rect2fc empty()
      Returns a read-only empty rect.
      Returns:
      an empty rect
    • isEmpty

      public final 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().
      Specified by:
      isEmpty in interface Rect2fc
      Returns:
      true if width() or height() are zero or negative
    • isSorted

      public final 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().
      Specified by:
      isSorted in interface Rect2fc
      Returns:
      true if width() or height() are zero or positive
    • isFinite

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

      public final float x()
      Returns the rectangle's left.
      Specified by:
      x in interface Rect2fc
    • y

      public final float y()
      Return the rectangle's top.
      Specified by:
      y in interface Rect2fc
    • left

      public final float left()
      Returns the rectangle's left.
      Specified by:
      left in interface Rect2fc
    • top

      public final float top()
      Return the rectangle's top.
      Specified by:
      top in interface Rect2fc
    • right

      public final float right()
      Return the rectangle's right.
      Specified by:
      right in interface Rect2fc
    • bottom

      public final float bottom()
      Return the rectangle's bottom.
      Specified by:
      bottom in interface Rect2fc
    • width

      public final float width()
      Specified by:
      width in interface Rect2fc
      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

      public final float height()
      Specified by:
      height in interface Rect2fc
      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

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

      public final float centerY()
      Specified by:
      centerY in interface Rect2fc
      Returns:
      the vertical center of the rectangle. This does not check for a valid rectangle (i.e. top invalid input: '<'= bottom)
    • halfWidth

      public final float halfWidth()
      Returns:
      width()/2 without intermediate overflow or underflow.
    • halfHeight

      public final float halfHeight()
      Returns:
      height()/2 without intermediate overflow or underflow.
    • setEmpty

      public final void setEmpty()
      Set the rectangle to (0,0,0,0)
    • store

      public void store(@Nonnull Rect2f dst)
      Copy the coordinates from this into r.
      Specified by:
      store in interface Rect2fc
      Parameters:
      dst - the rectangle to store
    • store

      public void store(@Nonnull Rect2i dst)
      Description copied from interface: Rect2fc
      Stores the coordinates from this into dst.
      Specified by:
      store in interface Rect2fc
      Parameters:
      dst - the rectangle to store
    • set

      public final void set(float left, float top, float right, float bottom)
      Set the rectangle's coordinates to the specified values. Note: no range checking is performed, so it is up to the caller to ensure that left invalid input: '<'= right and top invalid input: '<'= bottom.
      Parameters:
      left - the X coordinate of the left side of the rectangle
      top - the Y coordinate of the top of the rectangle
      right - the X coordinate of the right side of the rectangle
      bottom - the Y coordinate of the bottom of the rectangle
    • set

      public final void set(Rect2fc src)
      Copy the coordinates from src into this rectangle.
      Parameters:
      src - the rectangle whose coordinates are copied into this rectangle.
    • set

      public final void set(Rect2ic src)
      Copy the coordinates from src into this rectangle.
      Parameters:
      src - the rectangle whose coordinates are copied into this rectangle.
    • setBounds

      public final boolean setBounds(float[] pts, int offset, int count)
      Sets to bounds of pts array with count points. Returns false if pts array contains an infinity or NaN; in this case sets rect to (0, 0, 0, 0).
      Parameters:
      pts - pts array
      offset - starting offset
      count - number of points
      Returns:
      true if all values are finite
    • setBoundsNoCheck

      public final void setBoundsNoCheck(float[] pts, int offset, int count)
      Sets to bounds of pts array with count points. If pts array contains an infinity or NaN, all rect values are set to NaN.
      Parameters:
      pts - pts array
      offset - starting offset
      count - number of points
    • offset

      public final void offset(float dx, float dy)
      Offset the rectangle by adding dx to its left and right coordinates, and adding dy to its top and bottom coordinates.
      Parameters:
      dx - the amount to add to the rectangle's left and right coordinates
      dy - the amount to add to the rectangle's top and bottom coordinates
    • offsetTo

      public final void offsetTo(float newLeft, float newTop)
      Offset the rectangle to a specific (left, top) position, keeping its width and height the same.
      Parameters:
      newLeft - the new "left" coordinate for the rectangle
      newTop - the new "top" coordinate for the rectangle
    • inset

      public final void inset(float dx, float dy)
      Inset the rectangle by (dx,dy). If dx is positive, then the sides are moved inwards, making the rectangle narrower. If dx is negative, then the sides are moved outwards, making the rectangle wider. The same holds true for dy and the top and bottom.
      Parameters:
      dx - the amount to add(subtract) from the rectangle's left(right)
      dy - the amount to add(subtract) from the rectangle's top(bottom)
    • outset

      public final void outset(float dx, float dy)
      Outset the rectangle by (dx,dy).
      Parameters:
      dx - the amount to subtract(add) from the rectangle's left(right)
      dy - the amount to subtract(add) from the rectangle's top(bottom)
    • inset

      public final void inset(float left, float top, float right, float bottom)
      Insets the rectangle on all sides specified by the insets.
      Parameters:
      left - the amount to add from the rectangle's left
      top - the amount to add from the rectangle's top
      right - the amount to subtract from the rectangle's right
      bottom - the amount to subtract from the rectangle's bottom
    • inset

      public final void inset(Rect2fc insets)
      Insets the rectangle on all sides specified by the dimensions of the insets rectangle.
      Parameters:
      insets - the rectangle specifying the insets on all side.
    • inset

      public final void inset(Rect2ic insets)
      Insets the rectangle on all sides specified by the dimensions of the insets rectangle.
      Parameters:
      insets - the rectangle specifying the insets on all side.
    • adjust

      public final void adjust(float left, float top, float right, float bottom)
      Adjusts the rectangle on all sides specified by the values.
      Parameters:
      left - the amount to add from the rectangle's left
      top - the amount to add from the rectangle's top
      right - the amount to add from the rectangle's right
      bottom - the amount to add from the rectangle's bottom
    • adjust

      public final void adjust(Rect2fc adjusts)
      Adjusts the rectangle on all sides specified by the values.
      Parameters:
      adjusts - the rectangle specifying the adjusts on all side.
    • adjust

      public final void adjust(Rect2ic adjusts)
      Adjusts the rectangle on all sides specified by the values.
      Parameters:
      adjusts - the rectangle specifying the adjusts on all side.
    • contains

      public final 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.
      Specified by:
      contains in interface Rect2fc
      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

      public final 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.
      Specified by:
      contains in interface Rect2fc
      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

      public final 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.
      Specified by:
      contains in interface Rect2fc
      Parameters:
      r - the rectangle being tested for containment.
      Returns:
      true if the specified rectangle r is inside or equal to this rectangle
    • contains

      public final 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.
      Specified by:
      contains in interface Rect2fc
      Parameters:
      r - the rectangle being tested for containment.
      Returns:
      true if the specified rectangle r is inside or equal to this rectangle
    • subtract

      public static boolean subtract(Rect2fc a, Rect2fc b, Rect2f out)
    • intersect

      public final boolean intersect(float left, float top, float right, float bottom)
      If the rectangle specified by left,top,right,bottom intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. Note: To just test for intersection, use intersects(Rect2fc, Rect2fc).
      Parameters:
      left - the left side of the rectangle being intersected with this rectangle
      top - the top of the rectangle being intersected with this rectangle
      right - the right side of the rectangle being intersected with this rectangle.
      bottom - the bottom of the rectangle being intersected with this rectangle.
      Returns:
      true if the specified rectangle and this rectangle intersect (and this rectangle is then set to that intersection) else return false and do not change this rectangle.
    • intersect

      public final boolean intersect(Rect2fc r)
      If the specified rectangle intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. To just test for intersection, use intersects().
      Parameters:
      r - the rectangle being intersected with this rectangle.
      Returns:
      true if the specified rectangle and this rectangle intersect (and this rectangle is then set to that intersection) else return false and do not change this rectangle.
    • intersect

      public final boolean intersect(Rect2ic r)
      If the specified rectangle intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. To just test for intersection, use intersects().
      Parameters:
      r - the rectangle being intersected with this rectangle.
      Returns:
      true if the specified rectangle and this rectangle intersect (and this rectangle is then set to that intersection) else return false and do not change this rectangle.
    • intersectNoCheck

      public final void intersectNoCheck(float left, float top, float right, float bottom)
      If the specified rectangle intersects this rectangle, set this rectangle to that intersection, otherwise set this rectangle to the empty rectangle.
      See Also:
    • intersectNoCheck

      public final void intersectNoCheck(Rect2fc r)
      If the specified rectangle intersects this rectangle, set this rectangle to that intersection, otherwise set this rectangle to the empty rectangle.
      See Also:
    • intersectNoCheck

      public final void intersectNoCheck(Rect2ic r)
      If the specified rectangle intersects this rectangle, set this rectangle to that intersection, otherwise set this rectangle to the empty rectangle.
      See Also:
    • intersect

      public final boolean intersect(Rect2fc a, Rect2fc b)
      If rectangles a and b intersect, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. To just test for intersection, use intersects().
      Parameters:
      a - the first rectangle being intersected with
      b - the second rectangle being intersected with
      Returns:
      true if the two specified rectangles intersect. If they do, set this rectangle to that intersection. If they do not, return false and do not change this rectangle.
    • intersects

      public final 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().
      Specified by:
      intersects in interface Rect2fc
      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

      public final boolean intersects(@Nonnull Rect2fc r)
      Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified. To record the intersection, use intersect().
      Specified by:
      intersects in interface Rect2fc
      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

      public final 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().
      Specified by:
      intersects in interface Rect2fc
      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

      public static boolean intersects(Rect2fc a, Rect2fc b)
      Returns true if the two specified rectangles intersect. In no event are either of the rectangles modified. To record the intersection, use intersect(Rect2fc) or intersect(Rect2fc, Rect2fc).
      Parameters:
      a - the first rectangle being tested for intersection
      b - the second rectangle being tested for intersection
      Returns:
      true if the two specified rectangles intersect. In no event are either of the rectangles modified.
    • rectsOverlap

      public static boolean rectsOverlap(Rect2fc a, Rect2fc b)
      Returns true if the rectangles have a nonzero area of overlap. It assumed that rects can be infinitely small but not "inverted".
    • rectsTouchOrOverlap

      public static boolean rectsTouchOrOverlap(Rect2fc a, Rect2fc b)
      Returns true if the rectangles overlap or share an edge or corner. It assumed that rects can be infinitely small but not "inverted".
    • round

      public final void round(@Nonnull Rect2i dst)
      Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.
      Specified by:
      round in interface Rect2fc
    • roundIn

      public final 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.
      Specified by:
      roundIn in interface Rect2fc
    • roundOut

      public final 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.
      Specified by:
      roundOut in interface Rect2fc
    • round

      public final void round(@Nonnull Rect2f dst)
      Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values.
      Specified by:
      round in interface Rect2fc
    • roundIn

      public final 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.
      Specified by:
      roundIn in interface Rect2fc
    • roundOut

      public final 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.
      Specified by:
      roundOut in interface Rect2fc
    • join

      public final void join(float left, float top, float right, float bottom)
      Update this rectangle to enclose itself and the specified rectangle. If the specified rectangle is empty, nothing is done. If this rectangle is empty it is set to the specified rectangle.
      Parameters:
      left - the left edge being unioned with this rectangle
      top - the top edge being unioned with this rectangle
      right - the right edge being unioned with this rectangle
      bottom - the bottom edge being unioned with this rectangle
    • join

      public final void join(Rect2fc r)
      Update this rectangle to enclose itself and the specified rectangle. If the specified rectangle is empty, nothing is done. If this rectangle is empty it is set to the specified rectangle.
      Parameters:
      r - the rectangle being unioned with this rectangle
    • join

      public final void join(Rect2ic r)
      Update this rectangle to enclose itself and the specified rectangle. If the specified rectangle is empty, nothing is done. If this rectangle is empty it is set to the specified rectangle.
      Parameters:
      r - the rectangle being unioned with this rectangle
    • joinNoCheck

      public final void joinNoCheck(float left, float top, float right, float bottom)
      Update this rectangle to enclose itself and the specified rectangle. If the specified rectangle is empty, nothing is done. If this rectangle is empty it is set to the specified rectangle. No check is performed to see if either rectangle is empty.
      Parameters:
      left - the left edge being unioned with this rectangle
      top - the top edge being unioned with this rectangle
      right - the right edge being unioned with this rectangle
      bottom - the bottom edge being unioned with this rectangle
    • joinNoCheck

      public final void joinNoCheck(Rect2fc r)
      Update this rectangle to enclose itself and the specified rectangle. If the specified rectangle is empty, nothing is done. If this rectangle is empty it is set to the specified rectangle. No check is performed to see if either rectangle is empty.
      Parameters:
      r - the rectangle being unioned with this rectangle
    • joinNoCheck

      public final void joinNoCheck(Rect2ic r)
      Update this rectangle to enclose itself and the specified rectangle. If the specified rectangle is empty, nothing is done. If this rectangle is empty it is set to the specified rectangle. No check is performed to see if either rectangle is empty.
      Parameters:
      r - the rectangle being unioned with this rectangle
    • join

      public final void join(float x, float y)
      Update this rectangle to enclose itself and the [x,y] coordinate.
      Parameters:
      x - The x coordinate of the point to add to the rectangle
      y - The y coordinate of the point to add to the rectangle
    • sort

      public final void sort()
      Swap top/bottom or left/right if there are flipped (i.e. left > right and/or top > bottom). This can be called if the edges are computed separately, and may have crossed over each other. If the edges are already correct (i.e. left invalid input: '<'= right and top invalid input: '<'= bottom) then nothing is done.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Returns true if all members in a: Left, Top, Right, and Bottom; are equal to the corresponding members in b.

      a and b are not equal if either contain NaN. a and b are equal if members contain zeroes with different signs.

      Overrides:
      equals in class Object
      Parameters:
      o - rect to compare
      Returns:
      true if members are equal
    • toString

      public String toString()
      Overrides:
      toString in class Object