Readonly
areaReadonly
hHeight
Readonly
sizeReadonly
topDerived state: topLeft assumes up is -y
Readonly
wWidth
Readonly
xTop left x coordinate
Readonly
yTop left y coordinate
Static
emptyStatic
unitReturns true
if and only if the given point
is contained within this shape.
epsilon
is a small number used to counteract floating point error. Thus, if
point
is within epsilon
of the inside of this shape, containsPoint
may also
return true
.
The default implementation relies on signedDistance
.
Subclasses may override this method to provide a more efficient implementation.
true iff other
is completely within this Rect2
.
the distance from point
to this shape. If point
is within this shape,
this returns the distance from point
to the edge of this shape.
Returns a the subdivision of this into [columns] columns and [rows] rows. For example, Rect2.unitSquare.divideIntoGrid(2, 2) -> [ Rect2(0, 0, 0.5, 0.5), Rect2(0.5, 0, 0.5, 0.5), Rect2(0, 0.5, 0.5, 0.5), Rect2(0.5, 0.5, 0.5, 0.5) ] The rectangles are ordered in row-major order.
true iff this is equal to other ± tolerance
Returns edges in the order [ rightEdge, topEdge, leftEdge, bottomEdge ]
Returns a bounding box that loosely fits the content of this shape.
The result of this call can be larger than the result of getTightBoundingBox,
but should not be smaller. Thus, a call to getLooseBoundingBox
can be significantly
faster than a call to getTightBoundingBox for some shapes.
true iff this and other
overlap
points at which this shape intersects the given lineSegment
.
If this is a closed shape, returns points where the given lineSegment
intersects
the boundary of this.
Returns true
iff all points in this rectangle are within distance
from point
:
If is the set of points in this rectangle, returns true
iff
Computes the signed distance function for this shape.
Static
bboxStatic
fromStatic
ofStatic
union
Represents a rectangle in 2D space, parallel to the XY axes.
Example:
invariant: w ≥ 0, h ≥ 0, immutable