A class for representing two-dimensional rectangles whose properties are immutable.
Properties
- T bottom
-
read-only, inheritedThe y-coordinate of the bottom edge.
- Point<T> bottomLeft
-
read-only, inherited
- Point<T> bottomRight
-
read-only, inherited
- int hashCode
-
read-only, inherited
- T height
-
read-only
- T left
-
read-only
- T right
-
read-only, inheritedThe x-coordinate of the right edge.
- T top
-
read-only
- Point<T> topLeft
-
read-only, inherited
- Point<T> topRight
-
read-only, inherited
- T width
-
read-only
Constructors
- Rectangle(T left, T top, T width, T height)
-
constCreate a rectangle spanned by
(left, top)
and(left+width, top+height)
. - Rectangle.fromPoints(Point<T> a, Point<T> b)
-
Create a rectangle spanned by the points
a
andb
;
Operators
-
operator ==(
other) → bool -
inheritedThe equality operator.
Methods
-
boundingBox(
Rectangle<T> other) → Rectangle<T> -
inheritedReturns a new rectangle which completely contains
this
andother
. -
containsPoint(
Point<num> another) → bool -
inheritedTests whether
another
is inside or along the edges ofthis
. -
containsRectangle(
Rectangle<num> another) → bool -
inheritedTests whether
this
entirely containsanother
. -
intersection(
Rectangle<T> other) → Rectangle<T> -
inheritedComputes the intersection of
this
andother
. -
intersects(
Rectangle<num> other) → bool -
inheritedReturns true if
this
intersectsother
. -
toString(
) → String -
inheritedReturns a string representation of this object.