Create an empty rectangle at the origin.
Create a rectangle from a rect-like object.
Accepts { left, top, width, height }.
Create a rectangle with size only. The rectangle is positioned at the origin.
Create a rectangle from position and size.
Left coordinate
Top coordinate
Rectangle width (must be non-negative)
Rectangle height (must be non-negative)
Rectangle area (width * height).
Bottom edge coordinate.
Geometric center point.
Geometric center x-coordinate.
Geometric center y-coordinate.
Whether this rectangle has zero or negative area. Note: width and height are guaranteed non-negative.
Left edge coordinate.
Right edge coordinate.
Top edge coordinate.
Create a copy with all edges rounded up.
Create a deep copy of this rectangle.
Test whether a point lies inside or on the edges of this rectangle.
Test whether another rectangle is fully contained within this rectangle.
Create a copy with all edges rounded down.
Create an inflated (expanded) copy of this rectangle.
Horizontal expansion
Vertical expansion
Create an inset (shrunken) copy of this rectangle.
Horizontal inset
Vertical inset
Compute the intersection of this rectangle with another rectangle.
Returns an empty rectangle if there is no overlap.
Test whether this rectangle intersects another rectangle.
Edge-touching is considered an intersection.
Test whether this rectangle intersects another rectangle.
Edge-touching is considered an intersection.
Move this rectangle by the given offset. Modifies this instance.
Create a copy with all edges rounded to the nearest integer.
Create a scaled copy of this rectangle. Scaling is performed around the geometric center.
Scale this rectangle around its geometric center. Modifies this instance.
Horizontal scale factor
Vertical scale factor (defaults to scaleX)
Reset this rectangle to the origin with zero size.
Set rectangle size and reset position to the origin.
Rectangle width (must be non-negative)
Rectangle height (must be non-negative)
Set rectangle position and size.
Left coordinate
Top coordinate
Rectangle width (must be non-negative)
Rectangle height (must be non-negative)
Convert this rectangle to an AnchoredRect. The anchor is placed at the geometric center.
Compute the union of this rectangle with another rectangle.
StaticfromCreate a rectangle centered at the given point.
Center x-coordinate
Center y-coordinate
Rectangle width
Rectangle height
StaticfromCreate the smallest rectangle enclosing two points.
Mutable axis-aligned 2D rectangle defined by a top-left corner (
x,y) and non-negative size (width,height).This class represents a basic geometric rectangle without an anchor. All operations assume a coordinate system where:
left = xtop = yright = x + widthbottom = y + heightWidth and height are always non-negative. An error is thrown if violated.