Class RectBounds

java.lang.Object
com.sun.javafx.geom.BaseBounds
com.sun.javafx.geom.RectBounds

public final class RectBounds extends BaseBounds
A simple object which carries bounds information as floats, and has no Z components.
  • Constructor Details

    • RectBounds

      public RectBounds()
      Create an axis aligned bounding rectangle object, with an empty bounds where maxX invalid input: '<' minX and maxY invalid input: '<' minY.
    • RectBounds

      public RectBounds(float minX, float minY, float maxX, float maxY)
      Creates a RectBounds based on the minX, minY, maxX, and maxY values specified.
    • RectBounds

      public RectBounds(RectBounds other)
      Creates a RectBounds object as a copy of the specified RectBounds object.
  • Method Details

    • copy

      public BaseBounds copy()
      Description copied from class: BaseBounds
      Duplicates this instance. This differs from deriveWithNewBounds(other) where "other" would be this, in that derive methods may return the same instance, whereas copy will always return a new instance.
      Specified by:
      copy in class BaseBounds
    • getBoundsType

      public BaseBounds.BoundsType getBoundsType()
      Creates a RectBounds object as a copy of the specified RECTANGLE.
      Specified by:
      getBoundsType in class BaseBounds
    • is2D

      public boolean is2D()
      Description copied from class: BaseBounds
      Return true if this bounds is of a 2D BoundsType, else false.
      Specified by:
      is2D in class BaseBounds
    • getWidth

      public float getWidth()
      Convenience function for getting the width of this RectBounds. The dimension along the X-Axis.
      Specified by:
      getWidth in class BaseBounds
    • getHeight

      public float getHeight()
      Convenience function for getting the height of this RectBounds The dimension along the Y-Axis.
      Specified by:
      getHeight in class BaseBounds
    • getDepth

      public float getDepth()
      Convenience function for getting the depth of this RectBounds The dimension along the Z-Axis, since this is a 2D bounds the return value is always 0f.
      Specified by:
      getDepth in class BaseBounds
    • getMinX

      public float getMinX()
      Specified by:
      getMinX in class BaseBounds
    • setMinX

      public void setMinX(float minX)
    • getMinY

      public float getMinY()
      Specified by:
      getMinY in class BaseBounds
    • setMinY

      public void setMinY(float minY)
    • getMinZ

      public float getMinZ()
      Specified by:
      getMinZ in class BaseBounds
    • getMaxX

      public float getMaxX()
      Specified by:
      getMaxX in class BaseBounds
    • setMaxX

      public void setMaxX(float maxX)
    • getMaxY

      public float getMaxY()
      Specified by:
      getMaxY in class BaseBounds
    • setMaxY

      public void setMaxY(float maxY)
    • getMaxZ

      public float getMaxZ()
      Specified by:
      getMaxZ in class BaseBounds
    • deriveWithUnion

      public BaseBounds deriveWithUnion(BaseBounds other)
      Specified by:
      deriveWithUnion in class BaseBounds
    • deriveWithNewBounds

      public BaseBounds deriveWithNewBounds(BaseBounds other)
      Specified by:
      deriveWithNewBounds in class BaseBounds
    • deriveWithNewBounds

      public BaseBounds deriveWithNewBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
      Specified by:
      deriveWithNewBounds in class BaseBounds
    • deriveWithNewBoundsAndSort

      public BaseBounds deriveWithNewBoundsAndSort(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
      Specified by:
      deriveWithNewBoundsAndSort in class BaseBounds
    • setBounds

      public final void setBounds(RectBounds other)
      Set the bounds to match that of the RectBounds object specified. The specified bounds object must not be null.
    • setBounds

      public final void setBounds(float minX, float minY, float maxX, float maxY)
      Set the bounds to the given values.
    • setBoundsAndSort

      public void setBoundsAndSort(float minX, float minY, float maxX, float maxY)
      Sets the bounds based on the given coords, and also ensures that after having done so that this RectBounds instance is normalized.
    • setBoundsAndSort

      public void setBoundsAndSort(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
      Specified by:
      setBoundsAndSort in class BaseBounds
    • setBoundsAndSort

      public void setBoundsAndSort(Point2D p1, Point2D p2)
      Description copied from class: BaseBounds
      Sets the bounds based on the given points, and also ensures that after having done so that this bounds instance is sorted (x1invalid input: '<'=x2 and y1invalid input: '<'=y2).
      Specified by:
      setBoundsAndSort in class BaseBounds
    • flattenInto

      public RectBounds flattenInto(RectBounds bounds)
      Description copied from class: BaseBounds
      Sets the given RectBounds (or creates a new instance of bounds is null) to have the minX, minY, maxX, and maxY of this BoxBounds, dropping the Z values.
      Specified by:
      flattenInto in class BaseBounds
      Parameters:
      bounds - The bounds to fill with values, or null. If null, a new RectBounds is returned. If not null, the given bounds will be populated and then returned
      Returns:
      a non-null reference to a RectBounds containing the minX, minY, maxX, and maxY of this BoxBounds.
    • unionWith

      public void unionWith(RectBounds other)
    • unionWith

      public void unionWith(float minX, float minY, float maxX, float maxY)
    • add

      public void add(float x, float y, float z)
      Specified by:
      add in class BaseBounds
    • add

      public void add(float x, float y)
    • add

      public void add(Point2D p)
      Specified by:
      add in class BaseBounds
    • intersectWith

      public void intersectWith(BaseBounds other)
      Specified by:
      intersectWith in class BaseBounds
    • intersectWith

      public void intersectWith(float minX, float minY, float maxX, float maxY)
    • intersectWith

      public void intersectWith(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
      Specified by:
      intersectWith in class BaseBounds
    • contains

      public boolean contains(Point2D p)
      Specified by:
      contains in class BaseBounds
    • contains

      public boolean contains(float x, float y)
      Specified by:
      contains in class BaseBounds
    • contains

      public boolean contains(RectBounds other)
      Determines whether the given other RectBounds is completely contained within this RectBounds. Equivalent RectBounds will return true.
      Parameters:
      other - The other rect bounds to check against.
      Returns:
      Whether the other rect bounds is contained within this one, which also includes equivalence.
    • intersects

      public boolean intersects(float x, float y, float width, float height)
      Specified by:
      intersects in class BaseBounds
    • intersects

      public boolean intersects(BaseBounds other)
    • disjoint

      public boolean disjoint(float x, float y, float width, float height)
      Specified by:
      disjoint in class BaseBounds
    • disjoint

      public boolean disjoint(RectBounds other)
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in class BaseBounds
    • roundOut

      public void roundOut()
      Adjusts the edges of this RectBounds "outward" toward integral boundaries, such that the rounded bounding box will always full enclose the original bounding box.
      Specified by:
      roundOut in class BaseBounds
    • grow

      public void grow(float h, float v)
    • deriveWithPadding

      public BaseBounds deriveWithPadding(float h, float v, float d)
      Specified by:
      deriveWithPadding in class BaseBounds
    • makeEmpty

      public RectBounds makeEmpty()
      Specified by:
      makeEmpty in class BaseBounds
    • sortMinMax

      protected void sortMinMax()
      Specified by:
      sortMinMax in class BaseBounds
    • translate

      public void translate(float x, float y, float z)
      Specified by:
      translate in class BaseBounds
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object