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.
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.
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.
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.
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